Exemplo n.º 1
0
         }
     }
     $values['params'] = $p;
     $res = $this->update($values, $this->registry->core . 'pages', array('where' => 'page_id=' . $this->registry->params['id']));
     $menuBar['back'] = '/' . $this->registry->component . '/overview';
     if ($res) {
         $ed_message['TYPE'] = 'pass';
         $ed_message['MESSAGE'] = '<h2>Page was successfully edited.</h2>';
     } else {
         $ed_message['TYPE'] = 'error';
         $ed_message['MESSAGE'] = '<h2>Page could not be edited.</h2>';
     }
 } else {
     $row = $this->getResult('page, content, params', $this->registry->core . 'pages', null, array('where' => 'page_id=' . $this->registry->params['id']), false);
     $row->params = parse_ini_string($row->params, true);
     $form->setDefaults(Uthando::objectToArray($row));
     $renderer = new UthandoForm(TEMPLATES . $this->get('admin_config.site.template'));
     $renderer->setFormTemplate('form');
     $renderer->setHeaderTemplate('header');
     $renderer->setElementTemplate('element');
     $form->accept($renderer);
     // output the form
     $menuBar = array('html' => '', 'edit' => '', 'params' => '', 'cancel' => '/' . $this->registry->component . '/overview', 'save' => '');
     $this->content .= $this->makeToolbar($menuBar, 24);
     $this->content .= $renderer->toHtml();
     $this->loadJavaScript(array('/editors/tiny_mce/tiny_mce_gzip.js', '/uthando-js/uthando/admin/tinyMCEGz.js', '/editors/CodeMirror/js/codemirror.js'));
     $this->addComponentJS(array('article', 'editor', 'editorConfig'));
     $this->addComponentCSS(array('FileManager', 'Additions'));
     $session = Utility::encodeString(session_id());
     $this->addScriptDeclaration("UthandoAdmin.sid = ['" . $session[0] . "','" . $session[1] . "'];");
 }
Exemplo n.º 2
0
 protected function queryMenu($menu_id)
 {
     $menu = array();
     if ($this->status == "LI") {
         $status = "LO";
     } else {
         $status = "LI";
     }
     $tree = new NestedTree($this->db_table . 'menu_items', $menu_id, 'item');
     $decendants = $tree->getDecendants(true);
     $search_categories = null;
     if ($decendants) {
         foreach ($decendants as $key => $value) {
             $search_categories .= $decendants[$key]['item_id'] . ',';
         }
         $search_categories = substr($search_categories, 0, -1);
         $fields = 'item_id, item, status, url, enssl, page_id';
         $join = array($this->registry->core . 'menu_link_status', $this->db_table . 'menu_urls');
         $result = $this->registry->db->getResult($fields, 'menu_items', $join, array('WHERE' => "status != '" . $status . "'", 'AND' => 'item_id IN (' . $search_categories . ')', 'ORDER BY' => 'lft ASC'));
     } else {
         $result = false;
     }
     if ($result) {
         foreach ($result as $row) {
             $menu[] = Uthando::objectToArray($row);
         }
         foreach ($menu as $key => $value) {
             $return_menu[$key] = $value;
             if (is_numeric($value['page_id'])) {
                 $page = $this->registry->db->getResult('page', $this->db_table . 'pages', null, array('WHERE' => 'page_id=' . $value['page_id']), false);
                 $return_menu[$key]['page'] = $page->page;
             }
             $return_menu[$key]['lft'] = $decendants[$key]['lft'];
             $return_menu[$key]['rgt'] = $decendants[$key]['rgt'];
             $return_menu[$key]['depth'] = $decendants[$key]['depth'] - 1;
         }
         if ($return_menu) {
             foreach ($return_menu as $key => $value) {
                 $category[$key] = $value['lft'];
             }
             array_multisort($category, SORT_ASC, $return_menu);
         }
         return $return_menu;
     } else {
         return false;
     }
 }