Export ceniku do JSONu
authorThomas Mudrunka <tomas@mudrunka.cz>
Wed, 23 Nov 2011 14:57:37 +0000 (15:57 +0100)
committerThomas Mudrunka <tomas@mudrunka.cz>
Wed, 23 Nov 2011 14:57:37 +0000 (15:57 +0100)
apis/go.inc.php [moved from assistants/go.inc.php with 100% similarity]
apis/price-list.inc.php [moved from assistants/price-list.inc.php with 75% similarity]
index.php
sklad.conf.php.example

similarity index 100%
rename from assistants/go.inc.php
rename to apis/go.inc.php
similarity index 75%
rename from assistants/price-list.inc.php
rename to apis/price-list.inc.php
index 3d549c6c9315529f0bf1c26d1fe977a18e3d1572..67e0c4c38e933c7f396eb10c4ce9f7aa6171ef69 100644 (file)
@@ -1,5 +1,5 @@
-<pre><?php
+<?php
 $sql = 'SELECT model_name,model_price_out FROM model';
 $result = $this->db->safe_query_fetch($sql);
 foreach($result as $item) $items[$item['model_name']]=$item['model_price_out'];
-die(print_r(json_decode(json_encode($items))));
+die(json_encode($items));
index 02aa5252b21644ec018d8950ece2b365574d7289..7994b33153117f2a4a817d319c21bf57dac5458c 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -245,7 +245,7 @@ EOF;
 
        $html .= '<div style="float: right;">';
 
-       $html .= $this->form("$script/assistant/go", 'GET', array(
+       $html .= $this->form("$script/api/go", 'GET', array(
                array('q','','text','smart id...', 'autofocus'),
                array(false,'go','submit')
        ), 'style="float: left;"');
@@ -915,19 +915,23 @@ class Sklad_UI {
                $PATH_CHUNKS = preg_split('/\//', $PATH_INFO);
                //Sephirot:
                if(!isset($PATH_CHUNKS[1])) $PATH_CHUNKS[1]='';
-               if($_SERVER['REQUEST_METHOD'] != 'POST' && $PATH_CHUNKS[1]!='barcode') //TODO: tyhle podminky naznacujou, ze je v navrhu nejaka drobna nedomyslenost...
+               if($_SERVER['REQUEST_METHOD'] != 'POST' && $PATH_CHUNKS[1]!='barcode' && $PATH_CHUNKS[1]!='api') //TODO: tyhle podminky naznacujou, ze je v navrhu nejaka drobna nedomyslenost...
                        echo $this->html->header($PATH_INFO,$this->db->auth->get_user());
                switch($PATH_CHUNKS[1]) { //TODO: Move some branches to plugins if possible
                        case 'test':    //test
                                die('Tell me why you cry');
                                break;
-                       case 'assistant': //assistant
+                       case 'assistant': case 'api': //assistant|api
+                               $incdirs = array(
+                                       'assistant'     => DIR_ASSISTANTS,
+                                       'api'   => DIR_APIS
+                               );
                                $PATH_CHUNKS[3] = isset($PATH_CHUNKS[3]) ? trim($PATH_CHUNKS[3]) : false;
                                $assistant_vars['SUBPATH'] = array_slice($PATH_CHUNKS, 3);
                                $assistant_vars['URL_INTERNAL'] = 'assistant/'.$PATH_CHUNKS[2];
                                $assistant_vars['URL'] = $_SERVER['SCRIPT_NAME'].'/'.$assistant_vars['URL_INTERNAL'];
                                $assistant_vars['ASSISTANT'] = $PATH_CHUNKS[2];
-                               echo $this->safe_include(DIR_ASSISTANTS,$PATH_CHUNKS[2],$assistant_vars);
+                               echo $this->safe_include($incdirs[$PATH_CHUNKS[1]],$PATH_CHUNKS[2],$assistant_vars);
                                break;
                        case 'barcode': //barcode
                                Barcode::download_barcode(implode('/',array_slice($PATH_CHUNKS, 2)));
index 52ae347dd21d8b77ea6722073aeeda73499d44b6..c33ecc03743e31d90cfbdedf56e0347e8c5a6ca6 100755 (executable)
@@ -11,6 +11,7 @@ define('DIR_IMAGES',          DIR_HOME.'/images');
 define('DIR_LOCALE',           DIR_HOME.'/locale');
 define('DIR_BARCODES',         DIR_HOME.'/barcodes');
 define('DIR_TEMPLATES',                DIR_HOME.'/templates');
+define('DIR_APIS',             DIR_HOME.'/apis');
 define('DIR_ASSISTANTS',       DIR_HOME.'/assistants');
 
 define('URL_HOME',             dirname($_SERVER['SCRIPT_NAME']));
This page took 0.149831 seconds and 4 git commands to generate.