Пример #1
0
 /**
  * Главная страница - Список материалов
  * 
  * @return void
  */
 public function indexAction()
 {
     $this->view->assign('Header', $this->_translate->_('Список ' . (empty($this->ModuleInfo) ? 'материалов сайта' : $this->ModuleInfo['genetivename'])));
     $section = isset($this->_params['section']) ? $this->_params['section'] : 'index';
     $options = $this->Resource->getGridOptions($section);
     if ($this->_request->isXmlHttpRequest()) {
         $rows = $this->Resource->getResourcesList($this->_params);
         $paginator = $this->Resource->getPaginator();
         $this->_helper->json(Phorm_JQuery_DataGrid::data($rows, $paginator, $options + $this->_params));
         // В параметрах есть id модуля по которому можно подрезать список разделов в Phorm_JQuery_DataGrid::data
     } else {
         $this->view->assign('ResourceDataTable', $this->view->DataGrid('ResourceDataTable', $options));
     }
 }
Пример #2
0
 /**
  * Информация о разделе
  * 
  * @return void
  */
 public function viewAction()
 {
     if (isset($this->_params['categoryid']) && ($CategoryInfo = $this->Categories->getCategoryInfo($this->_params['categoryid']))) {
         $CategoryInfo['acl'] = array('mvc' => $this->_usersession->UserData['acl']['mvc']['control']['categories'], 'category' => $this->_usersession->UserData['acl']['categories'][$CategoryInfo['categoryid']]);
         $this->view->assign("CategoryInfo", $CategoryInfo);
         $this->view->assign("Header", $CategoryInfo['categoryname']);
         $MoveForm = new Phorm_Form('forms/control/categories.xml', 'move');
         $MoveForm->setAction($this->view->siteUrl() . '/control/categories/move/categoryid/' . $CategoryInfo['categoryid']);
         $this->view->assign('MoveForm', $MoveForm);
         if (!empty($CategoryInfo['moduleid'])) {
             $Resource = new Phorm_Resource($CategoryInfo['moduleid']);
             $options = $Resource->getGridOptions('category');
             $options['url'] = '/control/resource/index/moduleid/' . $CategoryInfo['moduleid'] . '/categoryid/' . $CategoryInfo['categoryid'] . '/section/category/';
             $this->view->assign('ResourceDataTable', $this->view->DataGrid('ResourceDataTable', $options));
         }
         /**
          * Обновление дерева разделов
          */
         if (isset($this->_params['tree']) && $this->_params['tree'] == 'reload') {
             $js = 'window.parent.trees.categories.reload(\'' . $this->view->siteUrl() . '/control/?categoryid=' . $CategoryInfo['categoryid'] . '\');';
             $this->_boot->jquery->addOnload($js);
         }
     } else {
         // Ошибка 404... надо что-то придумать
     }
 }