public function getVAcademicCalendars($criteria = null, $con = null) { include_once 'lib/model/om/BaseVAcademicCalendarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collVAcademicCalendars === null) { if ($this->isNew()) { $this->collVAcademicCalendars = array(); } else { $criteria->add(VAcademicCalendarPeer::PARENT, $this->getId()); VAcademicCalendarPeer::addSelectColumns($criteria); $this->collVAcademicCalendars = VAcademicCalendarPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(VAcademicCalendarPeer::PARENT, $this->getId()); VAcademicCalendarPeer::addSelectColumns($criteria); if (!isset($this->lastVAcademicCalendarCriteria) || !$this->lastVAcademicCalendarCriteria->equals($criteria)) { $this->collVAcademicCalendars = VAcademicCalendarPeer::doSelect($criteria, $con); } } } $this->lastVAcademicCalendarCriteria = $criteria; return $this->collVAcademicCalendars; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(VAcademicCalendarPeer::ID, $pks, Criteria::IN); $objs = VAcademicCalendarPeer::doSelect($criteria, $con); } return $objs; }
public static function doSelectByDepartment(Criteria $criteria, $con = null) { $sa_id = sfContext::getInstance()->getRequest()->getParameter('subject_accal_id'); $sa = SubjectAccalPeer::retrieveByPK($sa_id); if ($sa == null) { return array(); } $dept_id = $sa->getDepartmentId(); $criteria->add(VAcademicCalendarPeer::ID, $dept_id, Criteria::IN); $tmp_depts = VAcademicCalendarPeer::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->setName($prefix . $val->getName()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }