コード例 #1
0
ファイル: MenuBootstrap.php プロジェクト: kimthangatm/zcms
 /**
  * Get menu
  *
  * @param int $menuTypeId
  * @param bool $isLogin
  * @return array
  */
 private function _getMenu($menuTypeId, $isLogin)
 {
     $builder = new Phalcon\Mvc\Model\Query\Builder();
     $builder->columns('mi.menu_item_id AS id, mi.name, mi.full_link AS link, mi.thumbnail, md.parent_id, require_login')->addFrom('ZCMS\\Core\\Models\\MenuItems', 'mi')->innerJoin('ZCMS\\Core\\Models\\MenuDetails', 'mi.menu_item_id = md.menu_item_id', 'md')->innerJoin('ZCMS\\Core\\Models\\MenuTypes', 'md.menu_type_id = mt.menu_type_id', 'mt')->where('md.menu_type_id = ?0', [$menuTypeId])->orderBy('ordering ASC');
     $menu_items = $builder->getQuery()->execute()->toArray();
     if (count($menu_items)) {
         return $this->_repaidMenuItems($menu_items, $isLogin);
     }
     return [];
 }
コード例 #2
0
 public function canSeeProject($project)
 {
     $ret = $this->isAdmin() || $project->visibility == 'public' ? true : false;
     if (!$ret && ($this->isEditor() || $this->isGuest())) {
         // check if the user has the right to see the project
         $queryBuilder = new Phalcon\Mvc\Model\Query\Builder();
         $queryBuilder->from('UsersProjects');
         $queryBuilder->columns('id');
         $queryBuilder->where('user_id = :userId: AND project_id = :projectId:', array('userId' => $this->id, 'projectId' => $projectId));
         if (count($queryBuilder->getQuery()->execute()) > 0) {
             $ret = true;
         }
     }
     return $ret;
 }