From 88c38b26e8ac27d3e7de78a0a7bc904994f0bed4 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Wed, 23 Nov 2011 15:57:37 +0100 Subject: [PATCH] Export ceniku do JSONu --- {assistants => apis}/go.inc.php | 0 {assistants => apis}/price-list.inc.php | 4 ++-- index.php | 12 ++++++++---- sklad.conf.php.example | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) rename {assistants => apis}/go.inc.php (100%) rename {assistants => apis}/price-list.inc.php (75%) diff --git a/assistants/go.inc.php b/apis/go.inc.php similarity index 100% rename from assistants/go.inc.php rename to apis/go.inc.php diff --git a/assistants/price-list.inc.php b/apis/price-list.inc.php similarity index 75% rename from assistants/price-list.inc.php rename to apis/price-list.inc.php index 3d549c6..67e0c4c 100644 --- a/assistants/price-list.inc.php +++ b/apis/price-list.inc.php @@ -1,5 +1,5 @@ -
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));
diff --git a/index.php b/index.php
index 02aa525..7994b33 100755
--- a/index.php
+++ b/index.php
@@ -245,7 +245,7 @@ EOF;
 
 	$html .= '
'; - $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))); diff --git a/sklad.conf.php.example b/sklad.conf.php.example index 52ae347..c33ecc0 100755 --- a/sklad.conf.php.example +++ b/sklad.conf.php.example @@ -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'])); -- 2.30.2