示例#1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new M_Menu();
     }
     return self::$instance;
 }
示例#2
0
 protected function getMenu($menu_id)
 {
     //
     $menu = M_Menu::Instance()->getMenuWithChildren($menu_id);
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_menu.php');
     $pageUrl = $this->getPageUrl();
     $_menu = $this->Template($templateName, array('menu' => $menu[0], 'pageUrl' => $pageUrl));
     //var_dump($_menu);
     return $_menu;
 }
示例#3
0
 public function action_edit()
 {
     $this->title .= '->Редактирование страницы';
     $this->scripts[] = 'ckeditor/ckeditor';
     $this->scripts[] = 'custom/init_posts_add_edit';
     $mPosts = M_Posts::Instance();
     $this->messages = array();
     if ($this->isPost()) {
         if ($mPosts->edit($_POST['post_id'], $_POST)) {
             $_SESSION['saved_post'] = true;
             $this->redirect(M_Link::ToAdminPosts('edit', (int) $_POST['post_id']));
         }
         $this->fields = $_POST;
         $this->messages = M_Posts::Instance()->errors();
     } else {
         $post_id = isset($_GET['param']) ? $_GET['param'] : 0;
         $this->fields = $mPosts->get($post_id);
         if (empty($this->fields)) {
             $this->p404();
         }
         $this->fields['parent'] = $this->fields['menu_id'] . ':' . $this->fields['plid'];
     }
     if (isset($_SESSION['saved_post'])) {
         unset($_SESSION['saved_post']);
         $this->messageSuccess = 'Изменения сохранены';
     }
     $this->map = M_Menu::Instance()->getMenuWithChildren();
     // Переписываем URL загрузки картинок CKEditor
     $this->EnableParamsUrlCKEditor();
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/posts/v_edit.php');
     $this->content = $this->Template($templateName, $this);
 }
示例#4
0
 public function action_itemslist()
 {
     $mMenu = M_Menu::Instance();
     $menu_id = isset($_GET['param']) ? (int) $_GET['param'] : 0;
     if ($this->isPost()) {
         M_MenuLink::Instance()->editItemList($_POST);
         $this->redirect(M_Link::ToAdminMenu('itemslist', $menu_id));
     }
     $menu = $mMenu->getMenuWithChildren($menu_id);
     if (empty($menu)) {
         $this->p404();
     }
     $this->fields = $menu[0];
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/menu/v_itemslist.php');
     $this->content = $this->Template($templateName, $this);
 }