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");
 }
Beispiel #2
0
 public function action_logout($request)
 {
     DKY_SessionHandler::destroySession();
     DKY_SessionHandler::startSession();
     DKY_Output::raiseMessage("You are now logged out.", DKY_MSG_SUCCESS);
     DKY_HTTP::redirect("/");
 }
Beispiel #3
0
 public function action_delete_item($request)
 {
     $itemId = $request->get("itemId");
     $result = DKY_Item::deleteitem($itemId);
     if (!empty($result)) {
         DKY_Output::raiseMessage("Item deleted successfully.", DKY_MSG_SUCCESS);
     } else {
         DKY_Output::raiseMessage("Item NOT deleted.", DKY_MSG_ERROR);
     }
     DKY_HTTP::redirect(DKY_HTTP::makeURL($request->aURL["path"], "menu", "list_items"));
 }
 public static function process()
 {
     $request = DKY_RequestHandler::getRequest();
     $component = DKY_ComponentHandler::getComponent($request->componentName);
     if (!empty($component)) {
         $component->run($request->actionName, $request);
     } else {
         header("HTTP/1.0 404 Not Found");
         DKY_HTTP::redirect("/" . DKY_Config::get("404_path"));
     }
 }
 public static function run()
 {
     // TODO: Filters.. exceptions..?
     if ($_SERVER["REQUEST_URI"] == "/favicon.ico") {
         DKY_HTTP::redirect("/www/favicon.ico");
     }
     DKY_Config::initialize();
     DKY_DB::initialize(array("host" => DKY_Config::get("db_host"), "database" => DKY_Config::get("db_database"), "username" => DKY_Config::get("db_username"), "password" => DKY_Config::get("db_password")));
     DKY_Log::initialize(array("path" => DKY_Config::get("log_path")));
     DKY_Log::i("REQUEST: " . $_SERVER["REQUEST_URI"]);
     DKY_SessionHandler::startSession();
     DKY_SessionHandler::cachePermissions();
     //$strLogTail = "<div style='font:10px sans-serif;height:100px;overflow:auto;'>" . implode("<br />", DKY_Log::tail(20)) . "</div>";
     //DKY_Output::raiseMessage($strLogTail, DKY_MSG_INFO);
     DKY_RequestHandler::process();
 }
 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");
 }