public function execute($request) { if (!isset($request->limit)) { $request->limit = sfConfig::get('app_hits_per_page'); } $criteria = new Criteria(); switch ($request->sort) { case 'nameDown': $criteria->addDescendingOrderByColumn('authorized_form_of_name'); break; case 'nameUp': $criteria->addAscendingOrderByColumn('authorized_form_of_name'); break; case 'updatedDown': $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); break; case 'updatedUp': $criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT); break; default: if (!$this->getUser()->isAuthenticated()) { $criteria->addAscendingOrderByColumn('authorized_form_of_name'); } else { $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); } } // Do source culture fallback $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitFunction'); // Page results $this->pager = new QubitPager('QubitFunction'); $this->pager->setCriteria($criteria); $this->pager->setMaxPerPage($request->limit); $this->pager->setPage($request->page); }
public function execute($request) { if (!$this->context->user->hasCredential(array('contributor', 'editor', 'administrator'), false)) { QubitAcl::forwardUnauthorized(); } if (!isset($request->limit)) { $request->limit = sfConfig::get('app_hits_per_page'); } $criteria = new Criteria(); switch ($request->sort) { case 'nameDown': $criteria->addDescendingOrderByColumn('identifier'); break; case 'nameUp': $criteria->addAscendingOrderByColumn('identifier'); break; case 'updatedDown': $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); break; case 'updatedUp': $criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT); break; default: if (!$this->getUser()->isAuthenticated()) { $criteria->addAscendingOrderByColumn('authorized_form_of_name'); } else { $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); } } // Page results $this->pager = new QubitPager('QubitAccession'); $this->pager->setCriteria($criteria); $this->pager->setMaxPerPage($request->limit); $this->pager->setPage($request->page); }
public function getOrderedStudentExaminationRepprovedSubjects() { $c = new Criteria(); $c->addAscendingOrderByColumn(StudentExaminationRepprovedSubjectPeer::MARK); $c->addAscendingOrderByColumn(StudentExaminationRepprovedSubjectPeer::DATE); return $this->getStudentExaminationRepprovedSubjects($c); }
public function execute($request) { $this->resource = $request->getAttribute('sf_route')->resource; $criteria = new Criteria(); $criteria->add(QubitEvent::ACTOR_ID, $this->resource->id); $criteria->addJoin(QubitEvent::INFORMATION_OBJECT_ID, QubitInformationObject::ID); $criteria->addAscendingOrderByColumn(QubitEvent::TYPE_ID); // Sort info objects alphabetically (w/ fallback) $criteria->addAscendingOrderByColumn('title'); $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitInformationObject'); // Filter draft descriptions $criteria = QubitAcl::addFilterDraftsCriteria($criteria); $this->relatedInfoObjects = array(); foreach (QubitEvent::get($criteria) as $item) { $this->relatedInfoObjects[$item->type->getRole()][] = $item->informationObject; } // Get "subject of" information objects (name access point) $criteria = new Criteria(); $criteria->add(QubitRelation::OBJECT_ID, $this->resource->id); $criteria->add(QubitRelation::TYPE_ID, QubitTerm::NAME_ACCESS_POINT_ID); $this->subjectInfoObjects = array(); foreach (QubitRelation::get($criteria) as $item) { $this->subjectInfoObjects[] = $item->subject; } }
public function execute($request) { parent::execute($request); $this->permissions = array(); if (null != $this->resource->id) { // Get term permissions for this group $criteria = new Criteria(); $criteria->addJoin(QubitAclPermission::OBJECT_ID, QubitObject::ID, Criteria::LEFT_JOIN); $criteria->add(QubitAclPermission::GROUP_ID, $this->resource->id); $c1 = $criteria->getNewCriterion(QubitAclPermission::OBJECT_ID, null, Criteria::ISNULL); $c2 = $criteria->getNewCriterion(QubitObject::CLASS_NAME, 'QubitTerm'); $c1->addOr($c2); $criteria->add($c1); $criteria->addAscendingOrderByColumn(QubitAclPermission::CONSTANTS); $criteria->addAscendingOrderByColumn(QubitAclPermission::OBJECT_ID); if (0 < count($permissions = QubitAclPermission::get($criteria))) { $this->permissions = $permissions; } } // List of actions without create or translate $this->basicActions = QubitAcl::$ACTIONS; unset($this->basicActions['read']); unset($this->basicActions['translate']); if ($request->isMethod('post')) { $this->form->bind($request->getPostParameters()); if ($this->form->isValid()) { $this->processForm(); $this->redirect(array($this->resource, 'module' => 'aclGroup', 'action' => 'indexTermAcl')); } } }
public static function doSelectOrdered() { $criteria = new Criteria(); $criteria->addAscendingOrderByColumn(EmployeePeer::EMP_NO); $criteria->addAscendingOrderByColumn(EmployeePeer::NAME); return EmployeePeer::doSelect($criteria); }
public function execute($request) { if (!isset($request->limit)) { $request->limit = sfConfig::get('app_hits_per_page'); } $criteria = new Criteria(); if (isset($this->getRoute()->resource)) { $this->resource = $this->getRoute()->resource; $criteria->add(QubitInformationObject::PARENT_ID, $this->resource->id); } else { $criteria->add(QubitInformationObject::PARENT_ID, QubitInformationObject::ROOT_ID); } if (isset($request->repositoryId)) { $criteria->add(QubitInformationObject::REPOSITORY_ID, $request->repositoryId); } if (isset($request->collectionType)) { $criteria->add(QubitInformationObject::COLLECTION_TYPE_ID, $request->collectionType); } $fallbackTable = 'QubitInformationObject'; switch ($request->sort) { case 'repositoryDown': $fallbackTable = 'QubitActor'; $criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN); $criteria->addDescendingOrderByColumn('authorized_form_of_name'); break; case 'repositoryUp': $fallbackTable = 'QubitActor'; $criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN); $criteria->addAscendingOrderByColumn('authorized_form_of_name'); break; case 'titleDown': $criteria->addDescendingOrderByColumn('title'); break; case 'titleUp': $criteria->addAscendingOrderByColumn('title'); break; case 'updatedDown': $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); break; case 'updatedUp': $criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT); break; default: if (!$this->getUser()->isAuthenticated()) { $criteria->addAscendingOrderByColumn('title'); } else { $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT); } } // Do source culture fallback $criteria = QubitCultureFallback::addFallbackCriteria($criteria, $fallbackTable); // Filter drafts $criteria = QubitAcl::addFilterDraftsCriteria($criteria); // Page results $this->pager = new QubitPager('QubitInformationObject'); $this->pager->setCriteria($criteria); $this->pager->setMaxPerPage($request->limit); $this->pager->setPage($request->page); }
public static function getAllOrderedByCategory() { $c = new Criteria(); $c->addJoin(self::CATEGORY_ID, sfSimpleForumCategoryPeer::ID); $c->addAscendingOrderByColumn(sfSimpleForumCategoryPeer::RANK); $c->addAscendingOrderByColumn(self::RANK); return self::doSelectJoinCategoryLeftJoinPost($c); }
public function getMatriculats() { $C = new Criteria(); $C->addAscendingOrderByColumn(MatriculesPeer::ESTAT); $C->addAscendingOrderByColumn(MatriculesPeer::DATAINSCRIPCIO); //$C->add(MatriculesPeer::CURSOS_IDCURSOS, $this->getIdcursos()); return $this->getMatriculess($C); }
public function executeList() { $c = new Criteria(); $c->addAscendingOrderByColumn(PodcastPeer::TITLE); $c->addAscendingOrderByColumn(PodcastPeer::UPDATED_AT); $c->addAscendingOrderByColumn(PodcastPeer::CREATED_AT); $this->podcasts = PodcastPeer::doSelect($c); }
public static function doSelectJoinAnioByOrden(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { // $c->addAscendingOrderByColumn(AnioPeer::ORDEN); $c->addAscendingOrderByColumn(AnioPeer::DESCRIPCION); $c->addAscendingOrderByColumn(DivisionPeer::ORDEN); $c->addAscendingOrderByColumn(DivisionPeer::DESCRIPCION); return DivisionPeer::doSelectJoinAnio($c); }
public function execute($request) { $this->resource = $this->getRoute()->resource; // Except for administrators, only allow users to see their own profile if (!$this->context->user->hasCredential('administrator')) { if ($this->resource->id != $this->context->user->getAttribute('user_id')) { $this->redirect('admin/secure'); } } // Get user's groups $this->userGroups = array(); if (0 < count($aclUserGroups = $this->resource->aclUserGroups)) { foreach ($aclUserGroups as $aclUserGroup) { $this->userGroups[] = $aclUserGroup->groupId; } } else { // User is *always* part of authenticated group $this->userGroups = array(QubitAclGroup::AUTHENTICATED_ID); } // Table width $this->tableCols = count($this->userGroups) + 3; // Get access control permissions $criteria = new Criteria(); $criteria->addJoin(QubitAclPermission::OBJECT_ID, QubitObject::ID, Criteria::LEFT_JOIN); $c1 = $criteria->getNewCriterion(QubitAclPermission::USER_ID, $this->resource->id); // Add group criteria if (1 == count($this->userGroups)) { $c2 = $criteria->getNewCriterion(QubitAclPermission::GROUP_ID, $this->userGroups[0]); } else { $c2 = $criteria->getNewCriterion(QubitAclPermission::GROUP_ID, $this->userGroups, Criteria::IN); } $c1->addOr($c2); // Add info object criteria $c3 = $criteria->getNewCriterion(QubitObject::CLASS_NAME, 'QubitInformationObject'); $c4 = $criteria->getNewCriterion(QubitAclPermission::OBJECT_ID, null, Criteria::ISNULL); $c3->addOr($c4); $c1->addAnd($c3); $criteria->add($c1); // Sort $criteria->addAscendingOrderByColumn(QubitAclPermission::CONSTANTS); $criteria->addAscendingOrderByColumn(QubitAclPermission::OBJECT_ID); $criteria->addAscendingOrderByColumn(QubitAclPermission::USER_ID); $criteria->addAscendingOrderByColumn(QubitAclPermission::GROUP_ID); // Add user as final "group" $this->userGroups[] = $this->resource->username; // Build ACL $this->acl = array(); if (0 < count($permissions = QubitAclPermission::get($criteria))) { foreach ($permissions as $item) { // In this context permissions for all objects (null) and root actor // object are equivalent $objectId = QubitInformationObject::ROOT_ID != $item->objectId ? $item->objectId : null; // Use username as "group" for permissions specific to user $groupKey = null !== $item->groupId ? $item->groupId : $this->resource->username; $this->acl[$item->getConstants(array('name' => 'repositoryId'))][$objectId][$item->action][$groupKey] = $item; } } }
public function executeList() { $c = new Criteria(); //$c->add(DesignationPeer::TITLE, 'None', Criteria::NOT_EQUAL); $c->add(DesignationPeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL); $c->addAscendingOrderByColumn(DesignationPeer::DEPARTMENT_ID); $c->addAscendingOrderByColumn(DesignationPeer::TITLE); $this->designations = DesignationPeer::doSelect($c); }
public static function retrieveSorted(Criteria $criteria = null, PropelPDO $con = null) { if (null === $criteria) { $criteria = new Criteria(); } $criteria->addAscendingOrderByColumn(self::LAST_NAME); $criteria->addAscendingOrderByColumn(self::FIRST_NAME); return self::doSelect($criteria, $con); }
public function executeList() { $c = new Criteria(); //$c->add(WardBedPeer::TITLE, 'None', Criteria::NOT_EQUAL); $c->add(WardBedPeer::STATUS, Constant::BED_DELETE, Criteria::NOT_EQUAL); $c->addAscendingOrderByColumn(WardBedPeer::WARD_ID); $c->addAscendingOrderByColumn(WardBedPeer::BED); $this->beds = WardBedPeer::doSelect($c); }
public function getJournalComments($oCriteria = null, PropelPDO $oConnection = null) { if ($oCriteria === null) { $oCriteria = new Criteria(); } $oCriteria->addAscendingOrderByColumn(JournalCommentPeer::CREATED_AT); $oCriteria->addAscendingOrderByColumn(JournalCommentPeer::ID); return parent::getJournalComments($oCriteria, $oConnection); }
/** * Función que devuelve una lista con los estados de las tareas que son eventos. * @return array, lista de objetos de tipo parametro * @version 10-02-09 * @author Ana Martín */ public static function getAllEstadosEventos() { $c = new Criteria(); $c->add(ParametroPeer::TIPOPARAMETRO, '_ESTADO_TAREA_'); $c->add(ParametroPeer::SI_NO, 1); $c->addAscendingOrderByColumn(ParametroPeer::NUMERO); $c->addAscendingOrderByColumn(ParametroPeer::NOMBRE); $lista = ParametroPeer::doSelect($c); return $lista; }
public static function getSectionsForTerm($term, PropelPDO $propelConnection = null) { $c = new Criteria(); $crit1 = $c->getNewCriterion(self::TERM, $term); $c->addAnd($crit1); $c->addAscendingOrderByColumn(self::COURSE_ID); $c->addAscendingOrderByColumn(self::SECTION_TYPE); $c->addAscendingOrderByColumn(self::SECTION_NUM); return self::doSelect($c, $propelConnection); }
public static function getByNamePhone($name = null, $phone = null) { $c = new Criteria(); $c->addAscendingOrderByColumn(self::ID); $c->addAscendingOrderByColumn(self::NAME); $c->add(self::NAME, $name); if ($phone) { $c->add(self::PHONE, $phone); } return self::doSelectOne($c); }
public static function sortedBySubject(Criteria $c = null) { if (is_null($c)) { $c = new Criteria(); } $c->addJoin(self::CAREER_SUBJECT_ID, CareerSubjectPeer::ID); $c->addAscendingOrderByColumn(CareerSubjectPeer::YEAR); $c->addJoin(CareerSubjectPeer::SUBJECT_ID, SubjectPeer::ID); $c->addAscendingOrderByColumn(SubjectPeer::NAME); return $c; }
public static function getExamsForYearAndCourseId($courseId, $year, PropelPDO $propelConnection) { $c = new Criteria(); $crit1 = $c->getNewCriterion(ExamPeer::COURSE_ID, $courseId); $crit2 = $c->getNewCriterion(ExamPeer::YEAR, $year); $c->addAnd($crit1); $c->addAnd($crit2); $c->addAscendingOrderByColumn(ExamPeer::TYPE); $c->addAscendingOrderByColumn(ExamPeer::DESCR); return ExamPeer::doSelect($c, $propelConnection); }
public static function sorted(Criteria $criteria) { if (is_null($criteria)) { $criteria = new Criteria(); } $criteria->addJoin(CareerSubjectPeer::ID, self::CAREER_SUBJECT_ID); $criteria->addJoin(CareerSubjectPeer::SUBJECT_ID, SubjectPeer::ID); $criteria->addAscendingOrderByColumn(CareerSubjectPeer::YEAR); $criteria->addAscendingOrderByColumn(self::INDEX_SORT); $criteria->addAscendingOrderByColumn(SubjectPeer::NAME); }
public static function getCriteriaForPathwayStudents(Criteria $criteria = null) { if ($criteria === null) { $criteria = new Criteria(); } $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID); //$criteria->addAscendingOrderByColumn(PathwayStudentPeer::YEAR); $criteria->addAscendingOrderByColumn(PersonPeer::LASTNAME); $criteria->addAscendingOrderByColumn(PersonPeer::FIRSTNAME); return $criteria; }
protected function doSort() { if ($this->sortColumn) { $this->criteria->clearOrderByColumns(); if ($this->sortDir === 'DESC') { $this->criteria->addDescendingOrderByColumn($this->sortColumn); } else { $this->criteria->addAscendingOrderByColumn($this->sortColumn); } } }
public static function getEnOrden($criteria = NULL) { if (!$criteria instanceof Criteria or is_null($criteria)) { $criteria = new Criteria(); } // $criteria->add(ProvinciaPeer::ESTA_BORRADO, false); Pensado para borrado logico $criteria->addAscendingOrderByColumn(ProvinciaPeer::ORDEN); $criteria->addAscendingOrderByColumn(ProvinciaPeer::NOMBRE_CORTO); $criteria->addAscendingOrderByColumn(ProvinciaPeer::NOMBRE_LARGO); $provincias = ProvinciaPeer::doSelect($criteria); return $provincias; }
public function executeIndex(sfWebRequest $request) { $this->buildSubmenu($request); $id = $request->getParameter("id"); $conn = Propel::getConnection(); $this->courseObj = CoursePeer::retrieveByPK($id, $conn); if (!is_object($this->courseObj)) { $this->forward404(); } // courseDetail $detList = $this->courseObj->getCourseDetails(null, $conn); if (count($detList) > 0) { $this->courseDetail = $detList[0]; } // instructor $detList = CourseInstructorAssociationPeer::getLatestInstructorsForCourseId($this->courseObj->getId(), $conn); $newList = CourseInstructorAssociationPeer::getHistoricalInstructorsForCourseId($this->courseObj->getId(), $conn); if (count($detList) > 0) { $this->currentInstructorList = $detList; $this->pastInstructorList = $newList; } // program $detList = CourseDisciplineAssociationPeer::getRelatedDisciplinesForCourse($this->courseObj, $conn); if (count($detList) > 0) { $this->programList = $detList; } // full exam data $conn = Propel::getConnection(); $c = new Criteria(); $courseCrit = $c->getNewCriterion(ExamPeer::COURSE_ID, $this->courseObj->getId()); $c->addAnd($courseCrit); $c->addAscendingOrderByColumn(ExamPeer::YEAR); $c->addAscendingOrderByColumn(ExamPeer::TYPE); $c->addAscendingOrderByColumn(ExamPeer::DESCR); $examData = ExamPeer::doSelect($c, $conn); // now splice the data up and send it to the frontend $this->examData = array(); $year = ""; $type = ""; foreach ($examData as $exam) { if ($year != $exam->getYear()) { $year = $exam->getYear(); $this->examData[$year] = array(); $type = ""; } if ($type != $exam->getType()) { $type = $exam->getType(); $this->examData[$year][$type] = array(); } $this->examData[$year][$type][] = $exam; } }
public static function getForSelectParent() { $c = new Criteria(); $c->addAscendingOrderByColumn(self::ID); $c->addAscendingOrderByColumn(self::SOURCE_NAME); $sources = self::doSelect($c); $arr = array(); $arr[0] = '-- select --'; foreach ($sources as $source) { $arr[$source->getId()] = $source->getSourceName(); } return $arr; }
public static function getForSelectParent() { $c = new Criteria(); $c->addAscendingOrderByColumn(self::ID); $c->addAscendingOrderByColumn(self::CONTACT_TYPE_DESC); $types = self::doSelect($c); $arr = array(); $arr[0] = '-- select --'; foreach ($types as $type) { $arr[$type->getId()] = $type->getContactTypeDesc(); } return $arr; }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); // add your code here $c = new Criteria(); $c->addAscendingOrderByColumn(AbsenceTypePeer::VALUE); $c->addAscendingOrderByColumn(AbsenceTypePeer::ID); foreach (AbsenceTypePeer::doSelect($c) as $key => $absence_type) { $absence_type->setOrder($key); $absence_type->save(); } }
protected function getPager($feed_id) { $pager = new sfPropelPager('Torrent', 20); $pager->setPeerMethod('doSelectJoinAll'); $c = new Criteria(); $c->addAscendingOrderByColumn(TorrentPeer::UPDATED_AT); $c->addAscendingOrderByColumn(TorrentPeer::CREATED_AT); // todo exclude future if ($feed_id) { $c->add(TorrentPeer::FEED_ID, $feed_id); } $pager->setCriteria($c); $pager->setPage(1); return $pager; }