コード例 #1
0
 /**
  * Index action method
  *
  * @param  int $tid
  * @return void
  */
 public function index($tid = null)
 {
     if (null === $tid) {
         $this->prepareView('entities/types.phtml');
         $type = new Model\EntityType();
         if ($type->hasPages($this->config->pagination)) {
             $limit = $this->config->pagination;
             $pages = new Paginator($type->getCount(), $limit);
             $pages->useInput(true);
         } else {
             $limit = null;
             $pages = null;
         }
         $this->view->title = 'Entities';
         $this->view->pages = $pages;
         $this->view->types = $type->getAll($limit, $this->request->getQuery('page'), $this->request->getQuery('sort'));
     } else {
         $this->prepareView('entities/index.phtml');
         $entities = new Model\Entity();
         $type = new Model\EntityType();
         $type->getById($tid);
         if (!isset($type->id)) {
             $this->redirect(BASE_PATH . APP_URI . '/entities');
         }
         if ($this->services['acl']->isAllowed($this->sess->user->role, 'entity-type-' . $type->id, 'index')) {
             if ($entities->hasPages($this->config->pagination, $tid)) {
                 $limit = $this->config->pagination;
                 $pages = new Paginator($entities->getCount($tid), $limit);
                 $pages->useInput(true);
             } else {
                 $limit = null;
                 $pages = null;
             }
             $ents = $entities->getAll($tid, $limit, $this->request->getQuery('page'), $this->request->getQuery('sort'));
             $this->view->title = 'Entities : ' . $type->name;
             $this->view->pages = $pages;
             $this->view->tid = $tid;
             $this->view->fieldNum = $type->field_num;
             $this->view->entities = $ents;
             $this->view->fields = $entities->getAllFields($ents);
         } else {
             $this->redirect(BASE_PATH . APP_URI . '/entities');
         }
     }
     $this->send();
 }
コード例 #2
0
 /**
  * Index action method
  *
  * @return void
  */
 public function index()
 {
     $this->prepareView('entities/types/index.phtml');
     $types = new Model\EntityType();
     if ($types->hasPages($this->config->pagination)) {
         $limit = $this->config->pagination;
         $pages = new Paginator($types->getCount(), $limit);
         $pages->useInput(true);
     } else {
         $limit = null;
         $pages = null;
     }
     $this->view->title = 'Entity Types';
     $this->view->pages = $pages;
     $this->view->types = $types->getAll($limit, $this->request->getQuery('page'), $this->request->getQuery('sort'), $this->application->modules());
     $this->send();
 }