Exemplo n.º 1
0
 public function getRegistrationPeriod($departmentId)
 {
     $ci = new Criteria();
     $ci->add(AcademicCalendarPeer::DEPARTMENT_ID, $departmentId);
     $ci->addJoin(RegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $ci->add(RegPeriodPeer::CURRICULUM_ID, 1);
     return RegPeriodPeer::doSelectOne($ci);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RegSchedulePeer::addSelectColumns($c);
     $startcol2 = RegSchedulePeer::NUM_COLUMNS - RegSchedulePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     RegPeriodPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + RegPeriodPeer::NUM_COLUMNS;
     $c->addJoin(RegSchedulePeer::REG_PERIOD_ID, RegPeriodPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = RegSchedulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = RegPeriodPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getRegPeriod();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addRegSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initRegSchedules();
             $obj2->addRegSchedule($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Exemplo n.º 4
0
 public function getRegPeriod($con = null)
 {
     include_once 'lib/model/om/BaseRegPeriodPeer.php';
     if ($this->aRegPeriod === null && $this->reg_period_id !== null) {
         $this->aRegPeriod = RegPeriodPeer::retrieveByPK($this->reg_period_id, $con);
     }
     return $this->aRegPeriod;
 }
Exemplo n.º 5
0
 public function getRegPeriodsJoinCurriculum($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseRegPeriodPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collRegPeriods === null) {
         if ($this->isNew()) {
             $this->collRegPeriods = array();
         } else {
             $criteria->add(RegPeriodPeer::ACADEMIC_CALENDAR_ID, $this->getId());
             $this->collRegPeriods = RegPeriodPeer::doSelectJoinCurriculum($criteria, $con);
         }
     } else {
         $criteria->add(RegPeriodPeer::ACADEMIC_CALENDAR_ID, $this->getId());
         if (!isset($this->lastRegPeriodCriteria) || !$this->lastRegPeriodCriteria->equals($criteria)) {
             $this->collRegPeriods = RegPeriodPeer::doSelectJoinCurriculum($criteria, $con);
         }
     }
     $this->lastRegPeriodCriteria = $criteria;
     return $this->collRegPeriods;
 }
Exemplo n.º 6
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(RegPeriodPeer::ID, $pks, Criteria::IN);
         $objs = RegPeriodPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 7
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(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
             $c->addJoin(RegPeriodPeer::ID, RegTestPeriodPeer::REG_PERIOD_ID);
             $c->addJoin(AcademicCalendarPeer::ID, RegPeriodPeer::ACADEMIC_CALENDAR_ID);
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'REG_PERIOD_ID') {
             $c->addJoin(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
             $c->addJoin(RegPeriodPeer::ID, RegTestPeriodPeer::REG_PERIOD_ID);
             $column = RegPeriodPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'YEAR') {
             $c->addJoin(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
             $c->addJoin(RegPeriodPeer::ID, RegTestPeriodPeer::REG_PERIOD_ID);
             $c->addJoin(AcademicCalendarPeer::ID, RegPeriodPeer::ACADEMIC_CALENDAR_ID);
             $column = AcademicCalendarPeer::getTableMap()->getColumn('YEAR');
         } elseif ($key == 'NAME') {
             $c->addJoin(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
             $column = RegTestPeriodPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'CODE') {
             $c->addJoin(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
             $column = RegTestPeriodPeer::getTableMap()->getColumn('CODE');
         } else {
             $column = TestSchedulePeer::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 );
             $c->add($name, $value, Criteria::EQUAL);
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
 public function countRegPeriods($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseRegPeriodPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(RegPeriodPeer::CURRICULUM_ID, $this->getId());
     return RegPeriodPeer::doCount($criteria, $distinct, $con);
 }
Exemplo n.º 9
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = RegPeriodPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCode($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCurriculumId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStart($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setEnd($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setName($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setNo($arr[$keys[7]]);
     }
 }
Exemplo n.º 10
0
 public function executeListTest()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, 'reg_test_period');
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $this->can_add = $acl->getAddPriv() == 1;
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $reg_period = RegPeriodPeer::retrieveByPk($this->getRequestParameter('reg_period_id'));
     $this->forward404Unless($reg_period);
     $reg_test_period = RegTestPeriodPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($reg_test_period);
     $c = new Criteria();
     $c->add(TestSchedulePeer::REG_TEST_PERIOD_ID, $reg_test_period->getId());
     $c->addAscendingOrderByColumn(TestSchedulePeer::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(), 'test'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'test');
     $pager = new sfPropelPager('TestSchedule', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'test'));
     $this->getUser()->setAttribute('page', $page, 'test');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'back', 'url' => 'reg_period/listTest?id=' . $reg_period->getId(), 'color' => 'black'));
     array_unshift($actions, array('name' => 'add', 'url' => 'locate_test/create?test_id=' . $reg_test_period->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $this->reg_test_period = $reg_test_period;
     $this->reg_period = $reg_period;
     $this->subtitle = $reg_test_period->toString();
     $actions2 = array(array('name' => '<span>Jadwal Test</span>', 'url' => 'reg_period/listTest?id=' . $reg_test_period->getRegPeriodId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Detail Jadwal</span>', 'url' => 'reg_schedule_test/list?id=' . $reg_test_period->getId() . '&reg_period_id=' . $reg_test_period->getRegPeriodId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Daftar Ruangan Test</span>', 'url' => 'locate_test/list?id=' . $reg_test_period->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }