Exemplo n.º 1
0
 /**
  * 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 [];
 }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 /**
  * Find active kriteria record by child id
  *
  * @param int $id            
  * @param Phalcon\Mvc\Model\Query\Builder $qBuilder            
  * @return Phalcon\Mvc\Model\Resultset\Simple
  */
 public static function getKriteriaAndSubKriteriaById($id, $qBuilder)
 {
     return $qBuilder->columns(array("c.id_kriteria", "p.deskripsi AS kriteria", "c.deskripsi AS sub_kriteria"))->addFrom("Kriteria", "c")->leftJoin("Kriteria", "c.parent_id = p.id_kriteria", "p")->where("c.id_kriteria = :id: AND c.active = true", array("id" => $id))->getQuery()->getSingleResult();
 }