public function executeIndex(sfWebRequest $request) { //get request parameters $this->selectedBrand = $this->getRequestParameter('brand'); $this->selectedSeries = $this->getRequestParameter('series'); $this->selectedModel = $this->getRequestParameter('model'); $cConfig = new Criteria(); $cConfig->addJoin(ConfigPeer::MODEL_ID, ModelPeer::ID); $cConfig->addJoin(ModelPeer::SERIES_ID, SeriesPeer::ID); $cConfig->addJoin(SeriesPeer::BRAND_ID, BrandPeer::ID); if ($this->selectedBrand) { $cConfig->add(BrandPeer::ID, $this->selectedBrand); } if ($this->selectedSeries) { $cConfig->add(SeriesPeer::SERIES_NAME, $this->selectedSeries, Criteria::LIKE); } if ($this->selectedModel) { $cConfig->add(ModelPeer::MODEL_NAME, $this->selectedModel, Criteria::LIKE); } //$this->Configs = ConfigPeer::doSelect($cConfig); //paginatiom $pager = new sfPropelPager('Config', 15); $pager->setCriteria($cConfig); $pager->setPage($this->getRequestParameter('page')); $pager->init(); $this->pager = $pager; //get config columns $c = new Criteria(); $c->addDescendingOrderByColumn(ConfigFieldCategoryPeer::WEIGHT); $this->configFieldCategories = ConfigFieldCategoryPeer::doSelect($c); //get brands $cBrand = new Criteria(); $this->brands = BrandPeer::doSelect($cBrand); }
public static function doSelectByStudent(Criteria $criteria, $con = null) { $usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo'); $student = null; $student_id = null; if ($usertype == 'student') { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); } if ($student == null) { $student_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); } $criteria->add(StudentPeer::CURRICULUM_ID, $student->getCurriculumId()); $criteria->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $criteria->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $tmp_depts = DepartmentPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setdescription($prefix . $val->getDescription()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
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(); $this->createContextInstance(); $c1 = new Criteria(); $career_school_year = CareerSchoolYearPeer::retrieveBySchoolYear(); $c1->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year[0]->getId()); $c1->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED); $students_career_school_year = StudentCareerSchoolYearPeer::doSelectJoinCareerSchoolYear($c1); foreach ($students_career_school_year as $student_career_school_year) { $this->logSection('STUDENT CAREER SCHOOL YEAR ID', $student_career_school_year->getId()); $previous_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear()); if (is_null($previous_school_year)) { $this->logSection('action', 'continue'); continue; } $c = new Criteria(); $c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student_career_school_year->getStudent()->getId()); $c->addJoin(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID, Criteria::INNER_JOIN); $c->addJoin(CareerSchoolYearPeer::CAREER_ID, CareerPeer::ID, Criteria::INNER_JOIN); $c->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $previous_school_year->getId()); $c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED); if (StudentCareerSchoolYearPeer::doCount($c)) { $this->logSection('action', 'fix'); $student_career_school_year->setStatus(StudentCareerSchoolYearStatus::IN_COURSE); $student_career_school_year->save(); } } }
public static function getPager($max = 10, $page = 1, $camp_name = null, $agency_name = null, $agency_city = null, $agency_state = null, $agency_country = null, $airport_ident = null, $airport_city = null, $airport_state = null) { $c = new Criteria(); $c->addJoin(self::AGENCY_ID, AgencyPeer::ID, Criteria::LEFT_JOIN); $c->addJoin(self::AIRPORT_ID, AirportPeer::ID, Criteria::LEFT_JOIN); if ($camp_name) { $c->add(self::CAMP_NAME, $camp_name . '%', Criteria::LIKE); } if ($agency_name) { $c->add(AgencyPeer::NAME, $agency_name . '%', Criteria::LIKE); } if ($agency_city) { $c->add(AgencyPeer::CITY, $agency_city . '%', Criteria::LIKE); } if ($agency_state) { $c->add(AgencyPeer::STATE, $agency_state . '%', Criteria::LIKE); } if ($airport_ident) { $c->add(AirportPeer::IDENT, $airport_ident . '%', Criteria::LIKE); } if ($airport_city) { $c->add(AirportPeer::CITY, $airport_city . '%', Criteria::LIKE); } if ($airport_state) { $c->add(AirportPeer::STATE, $airport_state . '%', Criteria::LIKE); } $c->addAscendingOrderByColumn(self::CAMP_NAME); $pager = new sfPropelPager('Camp', $max); $pager->setCriteria($c); $pager->setPage($page); $pager->init(); return $pager; }
public static function doSelectByRegPeriod(Criteria $c = null, $rpi = null) { $tsi = null; if ($rpi == null) { $tsi = sfContext::getInstance()->getRequest()->getParameter('id'); } if ($rpi == null && $tsi == null) { return array(); } $ids = ''; if ($rpi != null) { $c = new Criteria(); $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->add(RegPeriodPeer::ID, $rpi); $dept = DepartmentPeer::doSelectOne($c); $ids = $dept->getIdRecurs(); } if ($tsi != null) { $c = new Criteria(); $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID); $c->add(TestSchedulePeer::ID, $tsi); $dept = DepartmentPeer::doSelectOne($c); $ids = $dept->getIdRecurs(); } $sql = "select * from test_subject where department_id in ({$ids})"; $connection = Propel::getConnection(); $statement = $connection->createStatement(); $result = $statement->executeQuery($sql, ResultSet::FETCHMODE_NUM); $objs = TestSubjectPeer::populateObjects($result); return $objs; }
/** * returns the groups in the given ramo (and for the given legislatura) and include the zero value, if given * * @param string $ramo * @param int $legislatura * @param string $include_zero * @return an associative array, with id and name as key => value * @author Guglielmo Celata */ public static function getAllGroups($ramo, $legislatura, $include_zero = false) { $c = new Criteria(); if ($ramo == 'camera') { $c->add(OppCaricaPeer::TIPO_CARICA_ID, 1); } else { $c->add(OppCaricaPeer::TIPO_CARICA_ID, array(4, 5), Criteria::IN); } $c->addJoin(OppGruppoPeer::ID, OppCaricaHasGruppoPeer::GRUPPO_ID); $c->addJoin(OppCaricaPeer::ID, OppCaricaHasGruppoPeer::CARICA_ID); $c_or_leg = $c->getNewCriterion(OppCaricaPeer::LEGISLATURA, $legislatura); $c_or_leg->addOr($c->getNewCriterion(OppCaricaPeer::LEGISLATURA, null, Criteria::ISNULL)); $c->add($c_or_leg); $c->clearSelectColumns(); $c->addSelectColumn(OppGruppoPeer::ID); $c->addSelectColumn(OppGruppoPeer::NOME); $c->setDistinct(); $rs = OppGruppoPeer::doSelectRS($c); if ($include_zero) { $all_groups = array('0' => $include_zero); } else { $all_groups = array(); } while ($rs->next()) { $all_groups[$rs->getInt(1)] = $rs->getString(2); } return $all_groups; }
public static function getEquipmentMileage($userId, $bikeId) { $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn('SUM(' . UserStatsPeer::MILEAGE . ')'); $c->addSelectColumn(UserEquipementPeer::EQUIPMENT_ID); //$c->addGroupByColumn(UserRidesPeer::MILEAGE); $c->add(UserEquipementPeer::USER_ID, $userId); $c->add(UserEquipementPeer::BIKE_ID, $bikeId); $c->addJoin(UserEquipementPeer::EQUIPMENT_ID, UserStatEquipPeer::USER_EQUIP_ID, Criteria::INNER_JOIN); $c->addJoin(UserStatEquipPeer::USER_STAT_ID, UserStatsPeer::STAT_NO, Criteria::INNER_JOIN); //$c->addJoin(UserStatsPeer::RIDE_KEY,UserRidesPeer::USER_RIDE_ID, Criteria::INNER_JOIN); $c->addGroupByColumn(UserEquipementPeer::EQUIPMENT_ID); $stmt = UserStatsPeer::doSelectStmt($c); $hashmap = array(); if ($stmt) { while ($row = $stmt->fetch(PDO::FETCH_NUM)) { if ($row) { $sum = $row[0]; $eqId = $row[1]; //echo 'Mil '.$sum.' '.$eqId; $hashmap[$eqId] = $sum; // array_push($hashmap, $eqId=>$sum); } } } return $hashmap; }
public function addStudentColumnCriteria(Criteria $criteria, $field, $value) { $criteria->add(PersonPeer::ID, $value); $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID); $criteria->addJoin(DivisionStudentPeer::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(DivisionPeer::ID, DivisionStudentPeer::DIVISION_ID); }
public function execute($request) { if (!isset($request->limit)) { $request->limit = sfConfig::get('app_hits_per_page'); } $criteria = new Criteria(); $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID); $criteria->add(QubitActorI18n::CULTURE, $this->context->user->getCulture()); $criteria->addJoin(QubitActor::ID, QubitObject::ID); // Filter out non-authority Actors $criteria->add(QubitObject::CLASS_NAME, 'QubitUser', Criteria::NOT_EQUAL); $criteria->add(QubitObject::CLASS_NAME, 'QubitDonor', Criteria::NOT_EQUAL); // Sort alphabetically by name $criteria->addAscendingOrderByColumn('authorized_form_of_name'); if (isset($request->showOnlyActors) && 'true' == $request->showOnlyActors) { $criteria->add(QubitObject::CLASS_NAME, 'QubitActor'); } if (isset($request->query)) { $criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, "{$request->query}%", Criteria::LIKE); } // Exclude the calling actor from the list $params = $this->context->routing->parse(Qubit::pathInfo($request->getReferer())); $resource = $params['_sf_route']->resource; if (isset($resource->id)) { $criteria->add(QubitActor::ID, $resource->id, Criteria::NOT_EQUAL); } $this->pager = new QubitPager('QubitActor'); $this->pager->setCriteria($criteria); $this->pager->setMaxPerPage($request->limit); $this->pager->setPage($request->page); $this->actors = $this->pager->getResults(); $this->setTemplate('list'); }
public static function getPager($max = 10, $page = 1, $date_req = null, $pass_name = null, $req_name = null, $pass_lname = null, $req_lname = null) { $c = new Criteria(); $c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN); $c->addJoin(self::REQUESTER_ID, RequesterPeer::ID, Criteria::LEFT_JOIN); $c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('c1', PersonPeer::ID), Criteria::LEFT_JOIN); $c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::alias('c2', PersonPeer::ID), Criteria::LEFT_JOIN); $c->addAlias('c1', PersonPeer::TABLE_NAME); $c->addAlias('c2', PersonPeer::TABLE_NAME); if ($date_req) { $c->add(self::DATE_REQUESTED, '%' . date('Y-m-d', strtotime($date_req)) . '%', Criteria::LIKE); } if ($pass_name) { $c->add(PersonPeer::alias("c1", PersonPeer::FIRST_NAME), $pass_name . '%', Criteria::LIKE); } if ($req_name) { $c->add(PersonPeer::alias("c2", PersonPeer::FIRST_NAME), $req_name . '%', Criteria::LIKE); } if ($pass_lname) { $c->add(PersonPeer::alias("c1", PersonPeer::LAST_NAME), $pass_lname . '%', Criteria::LIKE); } if ($req_lname) { $c->add(PersonPeer::alias("c2", PersonPeer::LAST_NAME), $req_lname . '%', Criteria::LIKE); } $c->addAscendingOrderByColumn(self::DATE_REQUESTED); $pager = new sfPropelPager('Itinerary', $max); $pager->setCriteria($c); $pager->setPage($page); $pager->init(); return $pager; }
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 getLlistes($email) { $C = new Criteria(); $C->add(self::EMAIL, $email); $C->addJoin(self::IDEMAIL, LlistesLlistesEmailsPeer::IDEMAIL); $C->addJoin(LlistesLlistesEmailsPeer::IDLLISTA, LlistesLlistesPeer::IDLLISTA); return LlistesLlistesPeer::doSelect($C); }
public static function getFiles($entry_id, $idS) { $C = new Criteria(); $C->addJoin(self::ID, AppBlogMultimediaEntriesPeer::ENTRIES_ID); $C->addJoin(AppBlogMultimediaEntriesPeer::MULTIMEDIA_ID, AppBlogsMultimediaPeer::ID); $C->add(self::ID, $entry_id); return AppBlogsMultimediaPeer::doSelect($C); }
public static function getUsedCategories() { $c = new Criteria(); $c->addJoin(self::ID, PcBlogCategoriesPostsPeer::CATEGORY_ID, Criteria::INNER_JOIN); $c->addJoin(PcBlogCategoriesPostsPeer::POST_ID, PcBlogPostPeer::ID, Criteria::INNER_JOIN); $c->setDistinct(); return self::doSelect($c); }
public function addStudentColumnCriteria(Criteria $criteria, $field, $value) { $criteria->addJoin(CourseSubjectStudentExaminationPeer::EXAMINATION_SUBJECT_ID, ExaminationSubjectPeer::ID); $criteria->addJoin(CourseSubjectStudentExaminationPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID); $criteria->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID); $criteria->add(PersonPeer::ID, $value); }
public function countExaminationSubjectsForYear($year) { $c = new Criteria(); $c->addJoin(ExaminationSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID); $c->addJoin(CareerSubjectPeer::ID, CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID); $c->add(CareerSubjectPeer::YEAR, $year); return $this->countExaminationSubjects($c); }
public function executeList() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(CurriculumPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(ComprehensiveExamPeer::STUDENT_ID, StudentPeer::ID); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'comprehensive_exam')); $this->getUser()->setAttribute('max_per_page', $rpp, 'comprehensive_exam'); $pager = new sfPropelPager('ComprehensiveExam', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'comprehensive_exam')); $this->getUser()->setAttribute('page', $page, 'comprehensive_exam'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); if ($acl->getAddPriv()) { array_unshift($actions, array('name' => 'add', 'url' => 'comprehensive_exam/create', 'color' => 'green')); } $this->actions = $actions; }
public function controllerChangeAction(sfEvent $event) { $controller = $event->getSubject(); if ('sfInstallPlugin' != $event->module) { return; } $credential = $controller->getActionStack()->getLastEntry()->getActionInstance()->getCredential(); if (sfContext::getInstance()->user->hasCredential($credential)) { return; } $criteria = new Criteria(); $criteria->add(QubitAclGroupI18n::NAME, $credential); $criteria->addJoin(QubitAclGroupI18n::ID, QubitAclGroup::ID); $criteria->addJoin(QubitAclGroup::ID, QubitAclUserGroup::GROUP_ID); $criteria->addJoin(QubitAclUserGroup::USER_ID, QubitUser::ID); // If for any reason the database can't be accessed, e.g. // * config.php doesn't exist // * config.php is misconfigured // * the database is empty // // - or if no user exists with the necessary credential, then grant access // to install actions // // This could only present a vulnerability if the database can't be // accessed, or if no user exists with the necessary credential. If the // database can't be accessed, then it isn't vulneralbe. The filesystem is // vulnerable, so we must be careful not to read or write anything // sensitive. We erase the database, but it isn't vulnerable // // Previously we granted sessions access to install actions if config.php // was missing, because this suggests that someone can access to the // filesystem - but we didn't link a specific session with access to the // filesystem, like Gallery login.txt // // One vulnerability is that anyone who gains the necessary credential on // one site, and knows the database username and password of another site, // can erase that database. To fix this, sessions should be bound to a key // stored in the database. This is superior to, // http://trac.symfony-project.org/ticket/5683 // // If one database can't be accessed, then anyone can reconfigure the // database username and password, but other databases are safe as long as // a user exists with the necessary credential // // Another vulnerability is that databases with incompatible schemas can be // erased. To fix this, we must know the database username and password to // reconfigure it. The currently configured database can be erased if it's // schema is incombatible, but this isn't a vulnerability try { if (1 > count(QubitUser::get($criteria))) { return; } } catch (PropelException $e) { return; } $event->getSubject()->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); throw new sfStopException(); }
public function build($runData) { $site = $runData->getTemp("site"); $c = new Criteria(); $c->addJoin("page_id", "page.page_id"); $c->addJoin("user_id", "ozone_user.user_id"); $c->add("page.site_id", $site->getSiteId()); $c->addOrderDescending("page_revision.revision_id"); $c->setLimit(30); $revisions = DB_PageRevisionPeer::instance()->select($c); $channel['title'] = _('Recent page changes from site') . ' "' . htmlspecialchars($site->getName()) . '" (a Wikidot site)'; $channel['link'] = "http://" . $site->getDomain(); $items = array(); foreach ($revisions as $rev) { $page = $rev->getPage(); $item = array(); $item['link'] = 'http://' . $site->getDomain() . '/' . $page->getUnixName(); $desc = ''; $flags = array(); if ($rev->getFlagText()) { $flags[] = _("source change"); } if ($rev->getFlagTitle()) { $flags[] = _("title change"); } if ($rev->getFlagFile()) { $flags[] = _("file action"); } if ($rev->getFlagRename()) { $flags[] = _("page move/rename"); } if ($rev->getFlagMeta()) { $flags[] = _("metadata changed"); } if ($rev->getFlagNew()) { $flags[] = _("new page"); } $item['title'] = '"' . $page->getTitleOrUnixName() . '" - ' . implode(', ', $flags); $desc = ''; $desc .= _('Page') . ': <a href="http://' . $site->getDomain() . '/' . $page->getUnixName() . '">' . htmlspecialchars($page->getTitle()) . '</a> (' . $page->getUnixName() . ')<br/>'; $desc .= _('Current revision number') . ': ' . $rev->getRevisionNumber() . '<br/>'; $desc .= _('Date changed') . ': ' . date('r', $rev->getDateLastEdited()->getTimestamp()) . '<br/>'; $desc .= _('Change type') . ': ' . implode(', ', $flags) . '<br/>'; if ($rev->getComments()) { $desc .= _('Change comments') . ': ' . htmlspecialchars($rev->getComments()) . '<br/>'; } $desc .= _('By') . ': ' . WDRenderUtils::renderUser($rev->getUserOrString()) . '<br/>'; $desc .= '<br/>' . _('Page content preview') . ': <br/>' . $page->getPreview(); $item['description'] = $desc; $item['content'] = $desc; $item['guid'] = $item['link'] . "#revision-" . $rev->getRevisionId(); $item['date'] = date('r', $rev->getDateLastEdited()->getTimestamp()); $content = ''; $items[] = $item; } $runData->contextAdd("channel", $channel); $runData->contextAdd("items", $items); }
public function addCareerColumnCriteria(Criteria $criteria, $field, $values) { if ($values) { $criteria->add(CareerStudentPeer::CAREER_ID, $values); $criteria->addJoin(CareerStudentPeer::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(CareerStudentPeer::CAREER_ID, CareerSchoolYearPeer::CAREER_ID); //$criteria->addJoin(CareerSchoolYearPeer::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveCurrent()->getId()); } }
public static function doSelectFilteredByEmployee(Criteria $criteria, $con = null) { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $criteria->add(CounselingTutorPeer::EMPLOYEE_ID, $employee_id, Criteria::IN); $criteria->addJoin(CounselingPeer::ID, CounselingTutorPeer::COUNSELING_ID); $criteria->addJoin(VStudentActivePeer::CLASS_GROUP_ID, CounselingPeer::CLASS_GROUP_ID); $criteria->addAscendingOrderByColumn(VStudentActivePeer::CODE); return VStudentActivePeer::doSelect($criteria); }
public static function doSelectFiltered() { $criteria = new Criteria(); $depts = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $criteria->add(DepartmentPeer::ID, $depts->getChildRecurs(), Criteria::IN); $criteria->addJoin(AcademicCalendarPeer::DEPARTMENT_ID, DepartmentPeer::ID); $criteria->addJoin(RegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); return RegPeriodPeer::doSelect($criteria); }
public static function getAll() { //FIXME doSelectJoinAll throws error while addJoin doesn't hydrate the objects $c = new Criteria(); $c->addAscendingOrderByColumn(self::COLUMN); $c->addJoin(self::MAPPING, EnumItemPeer::ID); $c->addJoin(self::RATING_FIELD_ID, RatingFieldPeer::ID); return self::doSelect($c); }
public function addStudentColumnCriteria(Criteria $criteria, $field, $value) { if ($value !== null) { $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID); $criteria->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(CourseSubjectPeer::ID, CourseSubjectStudentPeer::COURSE_SUBJECT_ID); $criteria->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID); $criteria->add(PersonPeer::ID, $value); } }
/** * Admin email finder * * @return string the administrator email */ public static function getAdminEmail() { $criteria = new Criteria(); $criteria->addJoin(QubitUser::ID, QubitUserRoleRelation::USER_ID); $criteria->addJoin(QubitUserRoleRelation::ROLE_ID, QubitRole::ID); $criteria->add(QubitRole::NAME, 'administrator'); $criteria->addAscendingOrderByColumn(QubitUser::ID); $users = QubitUser::get($criteria); return trim($users[0]->getEmail()); }
/** * This method joins to the divisions of the teacher * @param Criteria $c * @param <type> $user_id */ public static function joinWithDivisions(Criteria $criteria, $user_id) { $criteria->setDistinct(DivisionPeer::ID); $criteria->addJoin(DivisionPeer::ID, CoursePeer::DIVISION_ID); $criteria->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID); $criteria->addJoin(CourseSubjectPeer::ID, CourseSubjectTeacherPeer::COURSE_SUBJECT_ID); $criteria->addJoin(CourseSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID); $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID); $criteria->add(PersonPeer::USER_ID, $user_id); }
/** * This static method retrieves all the subjects for a course. * * @param Course $course * @return Criteria */ public static function retrieveForCourseCriteria(Course $course) { $c = new Criteria(); $c->add(CourseSubjectPeer::COURSE_ID, $course->getId()); $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID, Criteria::INNER_JOIN); $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID, Criteria::INNER_JOIN); $c->addJoin(CareerSubjectPeer::SUBJECT_ID, self::ID, Criteria::INNER_JOIN); $c->setDistinct(); return $c; }
public function addDivisionIdColumnCriteria(Criteria $criteria, $field, $value) { if ($value) { $criteria->add(DivisionPeer::ID, $value); $criteria->addJoin(DivisionPeer::ID, DivisionStudentPeer::DIVISION_ID); $criteria->addJoin(StudentPeer::ID, DivisionStudentPeer::STUDENT_ID); $criteria->addJoin(StudentPeer::ID, StudentTutorPeer::STUDENT_ID); $criteria->addJoin(StudentTutorPeer::TUTOR_ID, TutorPeer::ID); } }
public static function retrieveCriteriaForCurrentYear($criteria) { if (is_null($criteria)) { $criteria = new Criteria(); } $criteria->addJoin(self::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID); $criteria->addJoin(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID); $criteria->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveCurrent()->getId()); return $criteria; }
public static function retrieveCriteriaForCourseSubjectAndExaminationNumber(CourseSubject $course_subject, $examination_number) { $c = new Criteria(); $c->add(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, $course_subject->getId()); $c->addJoin(CourseSubjectStudentPeer::ID, self::COURSE_SUBJECT_STUDENT_ID); $c->add(self::EXAMINATION_NUMBER, $examination_number); $c->addJoin(self::EXAMINATION_SUBJECT_ID, ExaminationSubjectPeer::ID); $c->addJoin(ExaminationSubjectPeer::EXAMINATION_ID, ExaminationPeer::ID); return $c; }