Exemplo n.º 1
0
 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");
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $this->aParams = array_merge($_GET, $_POST);
     $this->aFile = $_FILES;
     $this->aURL = parse_url($_SERVER["REQUEST_URI"]);
     // Strip slashes from path.
     $this->aURL["path"] = trim($this->aURL["path"], "/");
     // Use default path if not specified.
     if (empty($this->aURL["path"])) {
         $this->aURL["path"] = DKY_Config::get("default_path");
     }
     // Get item from request path.
     $this->item = DKY_Item::getItemByPath($this->aURL["path"]);
     // TODO: Handle no item..?
     // Get component from POST/GET.
     $this->componentName = $this->get("component");
     $this->actionName = $this->get("action");
     // Use item component/action if not specified in request.
     if (empty($this->componentName)) {
         $this->componentName = $this->item["component"];
     }
     if (empty($this->actionName)) {
         $this->actionName = $this->item["action"];
     }
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 public function __construct($request)
 {
     parent::__construct($request);
     $this->templateDirectory = realpath(dirname(__FILE__) . "/../template") . "/";
     $this->template = "itemList.html.php";
     $pageNum = $request->get("page");
     if (empty($pageNum)) {
         if (!empty($_SESSION["aBlock"][$this->block_id]["page"])) {
             $pageNum = $_SESSION["aBlock"][$this->block_id]["page"];
         } else {
             $pageNum = 1;
         }
     }
     $_SESSION["aBlock"][$this->block_id]["page"] = $pageNum;
     $sth = DKY_Item::buildItemQuery();
     $this->aPagedData = DKY_Pager::getPagedData($sth, $pageNum, 10, 3);
     $this->editURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "edit_item");
     $this->deleteURL = DKY_HTTP::makeURL($request->aURL["path"], "menu", "delete_item");
 }
Exemplo n.º 5
0
 public static function deleteItem($itemId)
 {
     $itemSet = new DKY_NestedSet("item", "item_id");
     $success = $itemSet->deleteNode($itemId);
     if (!empty($success)) {
         DKY_Item::deleteItemGroups($itemId);
     }
     return $success;
 }