/**
  * Shows the dashboard view
  */
 public function indexAction()
 {
     $this->view->menu = Menus::findFirst(array('conditions' => 'id = ?1', 'order' => 'name', 'bind' => array(1 => 1)));
     $this->view->devices = Devices::find(array('order' => 'name ASC'));
     $this->view->movies = KodiMovies::getLatestMovies();
     $this->view->albums = KodiMusic::getLatestAlbums();
     $this->view->episodes = KodiTVShowEpisodes::getLatestEpisodes();
     $this->executionTime = -microtime(true);
     $this->view->phpsysinfoData = PHPSysInfo::getData($this->config);
     $this->view->PHPSysinfoExecutionTime = round($this->executionTime + microtime(true), 2) . 's';
 }
Example #2
0
 private function _registerSession(Admins $admin)
 {
     // User Perm
     $arr = explode(' ', $admin->perm);
     foreach ($arr as $val) {
         $num = explode(':', $val);
         $menu = Menus::findFirst(array("id = :id:", 'bind' => array('id' => $num[0])));
         $data[$menu->url] = $num[1];
     }
     // Save
     $this->session->set('Admin', array('id' => $admin->id, 'uname' => $admin->uname, 'name' => $admin->name, 'department' => $admin->department, 'position' => $admin->position, 'perm' => $admin->perm, 'ltime' => time() + 1800, 'logged_in' => TRUE, 'perm_s' => $data));
 }
 public function testAction()
 {
     //$this->view->disable();
     //$admin = $this->session->get('Admin');
     //print_r($_SESSION);
     $C = $this->dispatcher->getControllerName();
     $menu = Menus::findFirst(array("url = :url:", 'bind' => array('url' => $C)));
     if ($menu->fid) {
         $this->_getMenuPositive($menu->id);
     } else {
         $this->_getMenuPositive($menu->id);
     }
     //$this->flash->success('Goodbye!');
     //echo 1232;
     //echo $c = $this->dispatcher->getControllerName();
     //print_r($_SESSION);
     //$this->response->setStatusCode(404, "Not Found");
     //$this->forward('users/login');
     //$this->view->partial('welcome/index');
     //$this->view->partial('welcome/index');
 }
Example #4
0
 private function getFID($Cname)
 {
     $FID1 = '';
     $FID2 = '';
     $FID3 = '';
     $G1 = Menus::findFirst(array("url = :url:", 'bind' => array('url' => $Cname)));
     $Title = $G1->title;
     if ($G1->fid == 0) {
         $FID1 = $G1->id;
     } else {
         $G2 = Menus::findFirst(array("id = :fid:", 'bind' => array('fid' => $G1->fid)));
         if ($G2->fid == 0) {
             $FID1 = $G1->fid;
             $FID2 = $G1->id;
         } else {
             $FID1 = $G2->fid;
             $FID2 = $G1->fid;
             $FID3 = $G1->id;
         }
     }
     return array('Ctitle' => $Title, 'FID1' => $FID1, 'FID2' => $FID2, 'FID3' => $FID3);
 }
 public function DataAction($type = '')
 {
     if ($this->request->isPost()) {
         // Add
         if ($type == 'add') {
             $post = $this->request->getPost();
             $post['ctime'] = date('Y-m-d H:i:s');
             $data = new Menus();
             if ($data->save($post)) {
                 $this->response->redirect('Result/suc/SysMenus');
             } else {
                 $this->response->redirect('Result/err');
             }
             // Edit
         } elseif ($type == 'edit') {
             $id = $this->request->getPost('id');
             $data = Menus::findFirst('id=' . $id);
             $data->fid = $this->request->getPost('fid');
             $data->title = $this->request->getPost('title');
             $data->url = $this->request->getPost('url');
             $data->ico = $this->request->getPost('ico');
             $data->perm = $this->request->getPost('perm');
             $data->remark = $this->request->getPost('remark');
             $data->sort = $this->request->getPost('sort');
             if ($data->save()) {
                 $this->response->redirect('Result/suc/SysMenus');
             } else {
                 $this->response->redirect('Result/err');
             }
             // Delete
         } elseif ($type == 'delete') {
             $id = $this->request->getPost('id');
             $arr = json_decode($id);
             foreach ($arr as $val) {
                 $data = Menus::findFirst('id=' . $val);
                 if ($data->delete() == FALSE) {
                     $this->response->redirect('Result/err');
                 }
             }
             $this->response->redirect('Result/suc/SysMenus');
         }
     } else {
         return FALSE;
     }
 }