function common__show($Item = array()) { $out = ""; if (isset($_GET["form"]) && $_GET["form"] > "") { $Item = aikiReadItem($_GET["form"], $_GET["id"]); if ($_SESSION["error"] == "noitem") { header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found"); if (is_file($_SESSION["app_path"] . "/tpl/404.php")) { $out = aikiGetTpl("404.php"); } else { $out = ki::fromString("[Ошибка 404] Страница отсутствует"); } } else { if (isset($Item["template"]) && $Item["template"] > "") { $out = aikiGetTpl($Item["template"]); } else { $out = aikiGetForm(); } if ($out == "") { $out = ki::fromString("<html><div><h2>{{header}}</h2>{{text}}</div></html>"); } } if (isset($Item["form"])) { formCurrentInclude($Item["form"]); $call = "_{$Item["form"]}BeforeShowItem"; if (is_callable($call)) { $Item = @$call($Item); } $call = "{$Item["form"]}BeforeShowItem"; if (is_callable($call)) { $Item = @$call($Item); } } } if (!is_object($out)) { $out = ki::fromString($out); } $out->contentSetData($Item); return $out->outerHtml(); }
} if (isset($_GET["item"]) && $_GET["item"] > "") { $item = $_GET["item"]; } else { $_GET["item"] = $item; } if (isset($_GET["id"]) && $_GET["id"] > "") { $item = $_GET["id"]; } else { $_GET["id"] = $item; } if ($_SERVER["REQUEST_URI"] == "/" && $mode == "show" && $form == "page") { $item = "home"; } if (isset($form) && isset($item)) { formCurrentInclude($form); include_once "{$_SESSION["engine_path"]}/forms/common/common.php"; $Item = $_SESSION["Item"] = aikiReadItem($form, $item); if ($_SESSION["error"] == "noitem") { $error = "noitem"; } else { if (isset($Item["template"])) { $tpl = $Item["template"]; } } } if ($_SESSION["error"] == "noitem") { $empty = 1; } else { $empty = 0; }
function tagFormData($Item = array()) { $srcItem = $Item; $call = $this->attr("call"); $vars = $this->attr("vars"); if ($vars > "") { $Item = attrAddData($vars, $Item); } $from = $this->attr("from"); if ($from > "") { $Item = $Item[$from]; } $json = $this->attr("json"); if ($json > "") { $Item = json_decode($json, true); } $item = $this->attr("item"); $mode = $this->attr("data-mode"); if ($mode == "") { $mode = "show"; } $form = $this->attr("form"); if ($form > "") { formCurrentInclude($form); $datatype = "file"; $func = $form . "DataType"; if (is_callable($func)) { $datatype = $func(); } $ReadItem = $datatype . "ReadItem"; if ($item > "") { $Item = $ReadItem($form, $item); } if ($vars > "") { $Item = attrAddData($vars, $Item); } } $field = $this->attr("field"); if ($field > "") { $tmparr = json_decode($Item[$field], true); if (is_array($tmparr)) { $Item = $tmparr; unset($tmparr); } else { $Item = $Item[$field]; } } if (is_callable($call)) { $Item = $call($Item); } if (is_array($srcItem)) { foreach ($srcItem as $k => $v) { $Item["%{$k}"] = $v; } unset($v); } $Item = aikiCallFormFunc("BeforeShowItem", $Item, $form, $mode); $this->contentSetData($Item); //$this->html(clearValueTags($this->html())); }
function fileListItems($form, $where = NULL, $engine = FALSE) { $result = ""; if ($engine == TRUE) { $dir = $_SERVER['DOCUMENT_ROOT'] . "/engine/contents/{$form}/"; } else { $dir = $_SESSION["app_path"] . "/contents/{$form}/"; } formCurrentInclude($form); // обрабатываем переменную сессии с типом данных // engine - читать из данных движка // app - читать из данных коренвого проекта // prj (не обязательно) - по-умолчанию данные проекта if (isset($_SESSION[$form]["data-type-tmp"])) { $type = $_SESSION[$form]["data-type-tmp"]; if ($type == "engine") { $вшп = $_SESSION["engine_path"] . "/contents/" . $form . "/"; } if ($type == "app") { $dir = $_SESSION["app_path"] . "/contents/" . $form . "/"; $dir = str_replace($_SESSION["prj_path"], "/", $dir); } } if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (is_file($dir . $file)) { $data = fileReadItem($form, $file); $result[$file] = $data; } } unset($file, $data); closedir($dh); } } if ($where != NULL) { $result = aikiWhere($result, $where); } $after = "_" . $form . "AfterGetListItems"; if (is_callable($after)) { $array = $after($result); } $after = $form . "AfterGetListItems"; if (is_callable($after)) { $array = $after($result); } if (!is_array($result)) { $result = array(); } $out['result'] = $result; // $out=json_encode($out); return $out; }