예제 #1
0
파일: Page.php 프로젝트: kaibosh/nZEDb
 public function __construct()
 {
     parent::__construct();
     $role = Users::ROLE_GUEST;
     if ($this->userdata != null) {
         $role = $this->userdata["role"];
     }
     $content = new Contents(['Settings' => $this->settings]);
     $menu = new Menu($this->settings);
     $this->smarty->assign('menulist', $menu->get($role, $this->serverurl));
     $this->smarty->assign('usefulcontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEUSEFUL, $role));
     $this->smarty->assign('articlecontentlist', $content->getForMenuByTypeAndRole(Contents::TYPEARTICLE, $role));
     $this->smarty->assign('main_menu', $this->smarty->fetch('mainmenu.tpl'));
     $this->smarty->assign('useful_menu', $this->smarty->fetch('usefullinksmenu.tpl'));
     $this->smarty->assign('article_menu', $this->smarty->fetch('articlesmenu.tpl'));
     $category = new Category(['Settings' => $content->pdo]);
     if ($this->userdata != null) {
         $parentcatlist = $category->getForMenu($this->userdata["categoryexclusions"]);
     } else {
         $parentcatlist = $category->getForMenu();
     }
     // Add in system types to console categories to make the boot strap drop down list less long.
     $consoleCatList = [];
     foreach ($parentcatlist as $parent) {
         if ($parent['title'] === 'Console') {
             foreach ($parent['subcatlist'] as $consoleCat) {
                 if (preg_match('/^XBOX/i', $consoleCat['title'])) {
                     $consoleCatList['Microsoft'][] = $consoleCat;
                 } else {
                     if (preg_match('/^([3N]DS|N?GC)$|^WII/i', $consoleCat['title'])) {
                         $consoleCatList['Nintendo'][] = $consoleCat;
                     } else {
                         if (preg_match('/PS[\\dXP ]/i', $consoleCat['title'])) {
                             $consoleCatList['Sony'][] = $consoleCat;
                         } else {
                             $consoleCatList['Other'][] = $consoleCat;
                         }
                     }
                 }
             }
             break;
         }
     }
     $this->smarty->assign('consolecatlist', $consoleCatList);
     $this->smarty->assign('parentcatlist', $parentcatlist);
     $searchStr = '';
     if ($this->page == 'search' && isset($_REQUEST["id"])) {
         $searchStr = (string) $_REQUEST["id"];
     }
     $this->smarty->assign('header_menu_search', $searchStr);
     if (isset($_REQUEST["t"])) {
         $this->smarty->assign('header_menu_cat', $_REQUEST["t"]);
     } else {
         $this->smarty->assign('header_menu_cat', '');
     }
     $header_menu = $this->smarty->fetch('headermenu.tpl');
     $this->smarty->assign('header_menu', $header_menu);
 }
예제 #2
0
<?php

require_once './config.php';
use nzedb\Menu;
$page = new AdminPage();
if (isset($_GET['id'])) {
    $menu = new Menu($page->settings);
    $menu->delete($_GET['id']);
}
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);
예제 #3
0
파일: menu-list.php 프로젝트: kaibosh/nZEDb
<?php

require_once './config.php';
use nzedb\Menu;
$page = new AdminPage();
$menu = new Menu($page->settings);
$page->title = "Menu List";
$menulist = $menu->getAll();
$page->smarty->assign('menulist', $menulist);
$page->content = $page->smarty->fetch('menu-list.tpl');
$page->render();
예제 #4
0
파일: menu-edit.php 프로젝트: kaibosh/nZEDb
<?php

require_once './config.php';
use nzedb\Menu;
$page = new AdminPage();
$menu = new Menu($page->settings);
$id = 0;
// Get the user roles.
$userroles = $page->users->getRoles();
$roles = [];
foreach ($userroles as $r) {
    $roles[$r['id']] = $r['name'];
}
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        if ($_POST["id"] == "") {
            $menu->add($_POST);
        } else {
            $ret = $menu->update($_POST);
        }
        header("Location:" . WWW_TOP . "/menu-list.php");
        break;
    case 'view':
    default:
        $menuRow = ['id' => '', 'title' => '', 'href' => '', 'tooltip' => '', 'menueval' => '', 'role' => 0, 'ordinal' => 0, 'newwindow' => 0];
        if (isset($_GET["id"])) {
            $id = $_GET["id"];
            $menuRow = $menu->getByID($id);
        }