public function __construct($request) { parent::__construct($request); $this->templateDirectory = realpath(dirname(__FILE__) . "/../template") . "/"; $this->template = "itemEdit.html.php"; $UserModel = new User_Model(); $this->component = "menu"; $itemId = $request->get("itemId"); if (empty($itemId)) { $this->action = "insert"; } else { $this->action = "update"; } $this->aItemSelect = DKY_Item::getItems(null, true); if (empty($itemId) && !empty($_SESSION["aBlock"][$this->block_id]["itemId"])) { $itemId = $_SESSION["aBlock"][$this->block_id]["itemId"]; } if (empty($itemId) || $this->action == "insert") { $this->action = "insert"; $this->aItem = null; unset($_SESSION["aBlock"][$this->block_id]["itemId"]); } else { $_SESSION["aBlock"][$this->block_id]["itemId"] = $itemId; $this->aItem = DKY_Item::getItemById($itemId); $this->action = "update"; unset($this->aItemSelect[$itemId]); // Can't select itself as a parent. } $this->aGroups = $UserModel->getGroups(true); $this->getItemsURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "get_items"); $this->cancelURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "list_items"); }
public function action_get_items($request) { $aItems = DKY_Item::getItems(array("parent_id" => $request->get("parentId")), true); $strOptions = DKY_Output::getSelectOptions($aItems); echo trim($strOptions); die; // hexdump($strOptions); }