コード例 #1
0
 public function indexAction()
 {
     // Page
     if (isset($_GET['search'])) {
         $like = $this->inc->pageWhere();
         $where = '';
         foreach ($like['data'] as $key => $val) {
             $where .= $key . " LIKE '%" . $val . "%' AND ";
         }
         $where = rtrim($where, 'AND ');
         $data = MenuAction::find(array($where, 'order' => 'id'));
         $getUrl = $like['getUrl'];
     } else {
         $getUrl = '';
         $data = MenuAction::find(array('order' => 'id'));
     }
     $page = $this->inc->getPage(array('data' => $data, 'getUrl' => $getUrl));
     $this->view->setVar('Page', $page);
     // Data
     $this->view->setVar('MenusLang', $this->inc->getLang('menus'));
     $this->view->setVar('Lang', $this->inc->getLang('system/sys_menu_action'));
     $this->view->setVar('LoadJS', array('system/sys_menus_action.js'));
     // Menus
     $this->view->setVar('Menus', $this->inc->getMenus());
     $this->tag->prependTitle($this->inc->Ctitle);
     // View
     if ($this->session->get('IsMobile')) {
         $this->view->setTemplateAfter(APP_THEMES . '/main_m');
         $this->view->pick("system/menus/action/index_m");
     } else {
         $this->view->setTemplateAfter(APP_THEMES . '/main');
         $this->view->pick("system/menus/action/index");
     }
 }
コード例 #2
0
 public function editAction()
 {
     $id = $this->request->getPost('id');
     $this->view->setVar('Edit', Menus::findFirst(array('id=' . $id)));
     $this->view->setVar('MLang', $this->inc->getLang('menus'));
     $this->view->setVar('Action', MenuAction::find());
     $this->view->setVar('Lang', $this->inc->getLang('system/sys_menu'));
     $this->view->pick("system/menus/edit");
 }
コード例 #3
0
 public function permAction()
 {
     $Lang = $this->inc->getLang('menus');
     $html = '';
     $permArr = $this->splitPerm($this->request->getPost('perm'));
     $actionM = MenuAction::find();
     $menu1 = Menus::find('fid=0');
     foreach ($menu1 as $m1) {
         $ck = isset($permArr[$m1->id]) ? 'checked' : '';
         $title1 = $Lang->_($m1->title);
         $html .= '<div id="oneMenuPerm" class="perm">';
         $html .= '    <span class="text1"><input type="checkbox" value="' . $m1->id . '" ' . $ck . ' /></span>';
         $html .= '    <span>[<a href="#">-</a>] ' . $title1 . '</span>';
         $html .= '</div>';
         $menu2 = Menus::find('fid=' . $m1->id);
         foreach ($menu2 as $m2) {
             $ck = isset($permArr[$m2->id]) ? 'checked' : '';
             $title2 = $Lang->_($m2->title);
             $html .= '<div id="twoMenuPerm" class="perm">';
             $html .= '    <span class="text2"><input type="checkbox" value="' . $m2->id . '" ' . $ck . ' /></span>';
             $html .= '    <span>[<a href="#">-</a>] ' . $title2 . '</span>';
             $html .= '</div>';
             $menu3 = Menus::find('fid=' . $m2->id);
             foreach ($menu3 as $m3) {
                 $ck = isset($permArr[$m3->id]) ? 'checked' : '';
                 $title3 = $Lang->_($m3->title);
                 $html .= '<div id="threeMenuPerm" class="perm perm_action">';
                 $html .= '      <span class="text3"><input type="checkbox" name="threeMenuPerm" value="' . $m3->id . '" ' . $ck . ' /></span>';
                 $html .= '      <span>[<a href="#">-</a>] ' . $title3 . '</span>';
                 $html .= '  <span id="actionPerm_' . $m3->id . '"> ( ';
                 foreach ($actionM as $val) {
                     if (intval($m3->perm) & intval($val->perm)) {
                         $ck = @$permArr[$m3->id] & intval($val->perm) ? 'checked' : '';
                         $name = $Lang->_($val->name);
                         $html .= '<span><input type="checkbox" value="' . $val->perm . '" ' . $ck . ' /></span><span class="text">' . $name . '</span>';
                     }
                 }
                 $html .= ')</span>';
                 $html .= '</div>';
             }
         }
     }
     $this->view->setVar('menusHtml', $html);
     $this->view->pick("system/admin/perm");
 }
コード例 #4
0
ファイル: Inc.php プロジェクト: hcxiong/phalcon-webmis
 private function actionMenus($perm = '', $Cname = '', $Lang = '')
 {
     $Action = MenuAction::find(array('order' => 'id'));
     $data = '';
     foreach ($Action as $val) {
         if (intval($perm) & intval($val->perm)) {
             $data[] = array('name' => $Lang->_($val->name), 'ico' => $val->ico);
         }
     }
     return $data;
 }