Example #1
0
 public function getParentName()
 {
     if ($this->getParent() != null && $this->getParent() != 0) {
         return VClassParentPeer::retrieveByPk($this->getParent())->getName();
     }
     return '-';
 }
Example #2
0
 public function filter($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'DEPARTMENT_ID') {
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $c->addJoin(CounselingPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'CODE_CLASS') {
             $c->addJoin(CounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'CLASS_GROUP_ID') {
             $c->addJoin(CounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $c->addJoin(VClassParentPeer::ID, ClassGroupPeer::PARENT);
             $column = VClassParentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'EMPLOYEE_NAME') {
             $c->addJoin(EmployeePeer::ID, CounselingTutorPeer::EMPLOYEE_ID);
             $c->addJoin(CounselingPeer::ID, CounselingTutorPeer::COUNSELING_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } else {
             $column = CounselingPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Example #3
0
 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(VClassParentPeer::ID, $pks, Criteria::IN);
         $objs = VClassParentPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #4
0
 public function getVClassParentsRelatedByParentJoinDepartment($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseVClassParentPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collVClassParentsRelatedByParent === null) {
         if ($this->isNew()) {
             $this->collVClassParentsRelatedByParent = array();
         } else {
             $criteria->add(VClassParentPeer::PARENT, $this->getId());
             $this->collVClassParentsRelatedByParent = VClassParentPeer::doSelectJoinDepartment($criteria, $con);
         }
     } else {
         $criteria->add(VClassParentPeer::PARENT, $this->getId());
         if (!isset($this->lastVClassParentRelatedByParentCriteria) || !$this->lastVClassParentRelatedByParentCriteria->equals($criteria)) {
             $this->collVClassParentsRelatedByParent = VClassParentPeer::doSelectJoinDepartment($criteria, $con);
         }
     }
     $this->lastVClassParentRelatedByParentCriteria = $criteria;
     return $this->collVClassParentsRelatedByParent;
 }
Example #5
0
 public static function doSelectFiltered(Criteria $criteria, $con = null)
 {
     $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
     $depts = $dept->getChildRecurs(array());
     $criteria->add(VClassParentPeer::DEPARTMENT_ID, $depts, Criteria::IN);
     $tmp_depts = VClassParentPeer::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;
 }