public static function doSelectFiltered() { $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $dw = new Criteria(); $dw->add(DepartmentDetailPeer::DEPARTMENT_ID, $dept->getId()); $dept_detail = DepartmentDetailPeer::doSelectOne($dw); if ($dept_detail->getAccreditation() != 60) { $c = new Criteria(); $c->add(CurriculumPeer::DEPARTMENT_ID, $dept_detail->getAccreditation(), Criteria::IN); $c->addAscendingOrderByColumn(CurriculumPeer::ID); } else { $c = new Criteria(); $c->addAscendingOrderByColumn(CurriculumPeer::ID); } return CurriculumPeer::doSelect($c); }
public static function doSelectJoinAllExceptDepartment(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VAcademicCalendarPeer::addSelectColumns($c); $startcol2 = VAcademicCalendarPeer::NUM_COLUMNS - VAcademicCalendarPeer::NUM_LAZY_LOAD_COLUMNS + 1; AcademicCalendarPeer::addSelectColumns($c); $startcol3 = $startcol2 + AcademicCalendarPeer::NUM_COLUMNS; CurriculumPeer::addSelectColumns($c); $startcol4 = $startcol3 + CurriculumPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS; CurrSystemPeer::addSelectColumns($c); $startcol6 = $startcol5 + CurrSystemPeer::NUM_COLUMNS; $c->addJoin(VAcademicCalendarPeer::PARENT, AcademicCalendarPeer::ID); $c->addJoin(VAcademicCalendarPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(VAcademicCalendarPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VAcademicCalendarPeer::CURR_SYSTEM_ID, CurrSystemPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VAcademicCalendarPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = AcademicCalendarPeer::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->getAcademicCalendar(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVAcademicCalendar($obj1); break; } } if ($newObject) { $obj2->initVAcademicCalendars(); $obj2->addVAcademicCalendar($obj1); } $omClass = CurriculumPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getCurriculum(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVAcademicCalendar($obj1); break; } } if ($newObject) { $obj3->initVAcademicCalendars(); $obj3->addVAcademicCalendar($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getClassGroup(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVAcademicCalendar($obj1); break; } } if ($newObject) { $obj4->initVAcademicCalendars(); $obj4->addVAcademicCalendar($obj1); } $omClass = CurrSystemPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getCurrSystem(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVAcademicCalendar($obj1); break; } } if ($newObject) { $obj5->initVAcademicCalendars(); $obj5->addVAcademicCalendar($obj1); } $results[] = $obj1; } return $results; }
public function executeSave() { $curr_id = $this->getRequestParameter('curr_id'); $curr = CurriculumPeer::retrieveByPK($curr_id); $this->forward404Unless($curr); $this->curr = $curr; $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); $params = array(); foreach (explode('&', $this->getRequestParameter('subject_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } if (array_key_exists('subjects', $params)) { foreach ($params['subjects'] as $su_id) { $subject_curr = new SubjectCurr(); $subject_curr->setSubjectId($su_id); $subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id')); $subject_curr->save(); } } return $this->redirect('subject_curr/list?curr_id=' . $curr->getId()); }
public function filterHistory($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'ACADEMIC_COST_COMPONENT_ID') { $c->addJoin(AcademicCostPeer::ACADEMIC_COST_COMPONENT_ID, AcademicCostComponentPeer::ID); $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID); $column = AcademicCostPeer::getTableMap()->getColumn($key); } elseif ($key == 'DEPARTMENT_ID') { $c->addJoin(DepartmentPeer::ID, CurriculumPeer::DEPARTMENT_ID); $c->addJoin(CurriculumPeer::ID, AcademicCalendarPeer::CURRICULUM_ID); $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID); $column = CurriculumPeer::getTableMap()->getColumn($key); } elseif ($key == 'PAYER') { $c->addJoin(StudentPeer::ID, PaymentJournalPeer::PAYER); $c->addJoin(StudentPeer::CURRICULUM_ID, AcademicCalendarPeer::CURRICULUM_ID); $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(PaymentJournalPeer::ACADEMIC_COST_ID, AcademicCostPeer::ID); $column = StudentPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'ACADEMIC_PROCESS_ID') { $c->addJoin(PaymentJournalPeer::ID, PaymentHistoryPeer::PAYMENT_JOURNAL_ID); $column = PaymentJournalPeer::getTableMap()->getColumn($key); } else { $column = PaymentHistoryPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; $c2 = null; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); $c2 = $c->getCriterion($name); } if ($from != '' && $from != null && $to != '' && $to != null) { $c3 = new Criterion($c, $name, $to, Criteria::LESS_EQUAL); $c2->addAnd($c3); } if (($from == '' || $from == null) && $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 || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }
public function countCurriculums($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseCurriculumPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(CurriculumPeer::DEPARTMENT_ID, $this->getId()); return CurriculumPeer::doCount($criteria, $distinct, $con); }
public static function doSelectByCurriculumFromAccal($accal_id) { $accal = AcademicCalendarPeer::retrieveByPK($accal_id); if ($accal == null) { return array(); } $curr = CurriculumPeer::retrieveByPK($accal->getCurriculumId()); #$subject_curriculums = $curr->getSubjectCurrs(); #$subject_ids = array(); #foreach ($subject_curriculums as $subject_curriculum) { # $subject_ids[] = $subject_curriculum->getSubjectId(); #} #$depts = $curr->getDepartment()->getIdRecurs(); #$depts = explode(',', $depts); #$c = new Criteria(); #$c->add(SubjectPeer::DEPARTMENT_ID, $depts, Criteria::IN); #$c->add(SubjectPeer::ID, $subject_ids, Criteria::IN); #$c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); #$c->addJoin(SubjectCurrPeer::CURRICULUM_ID, CurriculumPeer::ID); #$c->addAscendingOrderByColumn(SubjectPeer::NAME); #return SubjectPeer::doSelect($c); $c = new Criteria(); $c->add(SubjectCurrPeer::CURRICULUM_ID, $curr->getId(), Criteria::IN); #$c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $c->addAscendingOrderByColumn(SubjectCurrPeer::ID); return SubjectCurrPeer::doSelect($c); }
public function executeEdit() { $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_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $c = new Criteria(); $c->add(VCoursePeer::ID, $this->getRequestParameter('id')); $c_schedule = VCoursePeer::doSelectOne($c); $this->forward404Unless($c_schedule); $cw = new Criteria(); $cw->add(CourseScheduleDetailPeer::ID, $c_schedule->getId()); $csd = CourseScheduleDetailPeer::doSelectOne($c); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $c_schedule->getAcademicCalendarId()); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $c_schedule->getClassGroupId()); $c->add(CourseSchedulePeer::SUBJECT_CURR_ID, $c_schedule->getSubjectCurrId()); $course_schedule = CourseSchedulePeer::doSelectOne($c); #$course_schedule = CourseSchedulePeer::retrieveByPK($csd->getCourseScheduleId()); #$this->forward404Unless($course_schedule); $this->subtitle = $c_schedule->getClassGroup()->getName() . ' - ' . $c_schedule->getSubjectCurr()->getSubject()->getName() . ' (id:' . $c_schedule->getId() . ')'; $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'course_schedule/delete?id=' . $c_schedule->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'course_schedule/list', 'color' => 'black')); $this->type = 'edit'; $this->course_schedule = $course_schedule; $this->c_schedule = $c_schedule; $this->actions = $actions; $curr = CurriculumPeer::retrieveByPK($c_schedule->getSubjectCurr()->getCurriculumId()); $this->curr = $curr; $subject_curriculums = $curr->getSubjectCurrs(); $subject_ids = array(); foreach ($subject_curriculums as $subject_curriculum) { $subject_ids[$subject_curriculum->getSubjectId()] = $subject_curriculum->getSubject()->getName(); } $this->subject_ids = $subject_ids; $this->subject_currs = $subject_ids; $this->selected_subject_curr = $c_schedule->getSubjectCurr()->getSubjectId(); $subject_id = $c_schedule->getSubjectCurr()->getSubjectId(); $c = new Criteria(); $c->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, TeachingCompetencyPeer::EMPLOYEE_ID); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $employee_ids = array(); foreach ($objs as $o) { $employee_ids[] = $o->getId(); } $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id, Criteria::IN); $c->add(TeachingCompetencyPeer::EMPLOYEE_ID, $employee_ids, Criteria::NOT_IN); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $lectors = EmployeePeer::doSelect($c); $this->lectors = $lectors; $c = new Criteria(); $c->add(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $c->addDescendingOrderByColumn(CourseScheduleDetailPeer::ID); $this->sortDetail($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->filterDetail($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course_schedule_detail')); $this->getUser()->setAttribute('max_per_page', $rpp, 'course_schedule_detail'); $pager = new sfPropelPager('CourseScheduleDetail', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course_schedule_detail')); $this->getUser()->setAttribute('page', $page, 'course_schedule_detail'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions3 = array(array('name' => 'filter', 'color' => 'white')); array_unshift($actions3, array('name' => 'add', 'url' => 'course_schedule/createSchedule2?course_id=' . $course_schedule->getId() . '&vcourse_id=' . $c_schedule->getId(), 'color' => 'black')); $this->actions3 = $actions3; }
public static function doSelectJoinAllExceptSubject(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } SubjectCurrPeer::addSelectColumns($c); $startcol2 = SubjectCurrPeer::NUM_COLUMNS - SubjectCurrPeer::NUM_LAZY_LOAD_COLUMNS + 1; CurriculumPeer::addSelectColumns($c); $startcol3 = $startcol2 + CurriculumPeer::NUM_COLUMNS; $c->addJoin(SubjectCurrPeer::CURRICULUM_ID, CurriculumPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = SubjectCurrPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CurriculumPeer::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->getCurriculum(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addSubjectCurr($obj1); break; } } if ($newObject) { $obj2->initSubjectCurrs(); $obj2->addSubjectCurr($obj1); } $results[] = $obj1; } return $results; }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'CURRICULUM_ID') { $c->addJoin(ComprehensiveExamPeer::STUDENT_ID, StudentPeer::ID); $column = StudentPeer::getTableMap()->getColumn($key); } elseif ($key == 'EMPLOYEE_ID') { $c->addJoin(ComprehensiveReviewerPeer::COMPREHENSIVE_EXAM_ID, ComprehensiveExamPeer::ID); $column = ComprehensiveReviewerPeer::getTableMap()->getColumn($key); } elseif ($key == 'DEPARTMENT_ID') { $c->addJoin(ComprehensiveExamPeer::STUDENT_ID, StudentPeer::ID); $c->addJoin(CurriculumPeer::ID, StudentPeer::CURRICULUM_ID); $c->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $column = CurriculumPeer::getTableMap()->getColumn($key); } else { $column = ComprehensiveExamPeer::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 || $creoleType == CreoleTypes::CHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }
public function executeGetByCurriculum() { $curr_id = $this->getRequestParameter('curriculum_id'); $curr = CurriculumPeer::retrieveByPK($curr_id); $this->forward404Unless($curr); $c = new Criteria(); $c->add(AcademicCalendarPeer::CURRICULUM_ID, $curr_id); $objs = AcademicCalendarPeer::doSelectFiltered($c); $array = array(); if ($this->getRequestParameter('include_blank') == 'true') { $array[] = ''; } foreach ($objs as $obj) { $array[$obj->getId()] = $obj->toString(); } $this->content = $array; $this->setTemplate('buildOptions'); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CurriculumPeer::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->setDepartmentId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setYear($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTotalCredit($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setAcademicTitle($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setCourseModel($arr[$keys[6]]); } }
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; $student__id = $this->getContext()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student__id); $this->forward404Unless($student); $curr_id = $student->getCurriculumId(); $this->getContext()->getRequest()->setParameter('curr_id', $curr_id); $c = new Criteria(); $c->add(SubjectCurrPeer::CURRICULUM_ID, $curr_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 ($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(), 'subject_curr_s')); $this->getUser()->setAttribute('max_per_page', $rpp, 'subject_curr_s'); $pager = new sfPropelPager('SubjectCurr', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'subject_curr_s')); $this->getUser()->setAttribute('page', $page, 'subject_curr_s'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); if ($acl->getAddPriv() && $acl->getEditPriv()) { array_unshift($actions, array('name' => 'edit', 'url' => 'subject_curr_s/editAll?curr_id=' . $curr_id, 'color' => 'blue')); } if ($acl->getAddPriv()) { array_unshift($actions, array('name' => 'add', 'url' => 'subject_curr_s/create?curr_id=' . $curr_id, 'color' => 'green')); } $this->curr = CurriculumPeer::retrieveByPK($curr_id); $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' => '_AS_CSV_', 'url' => "subject_curr_s/listAsCSV?curr_id={$curr_id}&{$filter_string}", 'color' => 'white', 'type' => 'direct')); array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "subject_curr_s/listAsPDF?curr_id={$curr_id}&{$filter_string}", 'color' => 'white', 'type' => 'direct')); $this->actions = $actions; $this->student = $student; }
public function executeDelete() { $curr_id = $this->getRequestParameter('curr_id'); $this->forward404Unless($curr_id); $this->curr = CurriculumPeer::retrieveByPK($curr_id); $subject_prereq = SubjectPrereqPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($subject_prereq); $ref_error = 0; foreach ($subject_prereq->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $subject_prereq->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('subject_prereq/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('subject_prereq/delete', '_ERR_DELETE_ (' . $subject_prereq->toString() . ' - id:' . $subject_prereq->getId() . ')'); } else { $subject_prereq->delete(); } $this->getRequest()->setParameter('curr_id', $this->curr->getId()); return $this->forward('subject_prereq', 'list'); }
public static function doSelectJoinAllExceptMember(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VStudentActivePeer::addSelectColumns($c); $startcol2 = VStudentActivePeer::NUM_COLUMNS - VStudentActivePeer::NUM_LAZY_LOAD_COLUMNS + 1; CurriculumPeer::addSelectColumns($c); $startcol3 = $startcol2 + CurriculumPeer::NUM_COLUMNS; AcademicCalendarPeer::addSelectColumns($c); $startcol4 = $startcol3 + AcademicCalendarPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS; TestApplicantPeer::addSelectColumns($c); $startcol6 = $startcol5 + TestApplicantPeer::NUM_COLUMNS; StudentDetailPeer::addSelectColumns($c); $startcol7 = $startcol6 + StudentDetailPeer::NUM_COLUMNS; $c->addJoin(VStudentActivePeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(VStudentActivePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(VStudentActivePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VStudentActivePeer::TEST_APPLICANT_ID, TestApplicantPeer::ID); $c->addJoin(VStudentActivePeer::STUDENT_DETAIL_ID, StudentDetailPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VStudentActivePeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CurriculumPeer::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->getCurriculum(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVStudentActive($obj1); break; } } if ($newObject) { $obj2->initVStudentActives(); $obj2->addVStudentActive($obj1); } $omClass = AcademicCalendarPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getAcademicCalendar(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVStudentActive($obj1); break; } } if ($newObject) { $obj3->initVStudentActives(); $obj3->addVStudentActive($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getClassGroup(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVStudentActive($obj1); break; } } if ($newObject) { $obj4->initVStudentActives(); $obj4->addVStudentActive($obj1); } $omClass = TestApplicantPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getTestApplicant(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVStudentActive($obj1); break; } } if ($newObject) { $obj5->initVStudentActives(); $obj5->addVStudentActive($obj1); } $omClass = StudentDetailPeer::getOMClass(); $cls = Propel::import($omClass); $obj6 = new $cls(); $obj6->hydrate($rs, $startcol6); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj6 = $temp_obj1->getStudentDetail(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addVStudentActive($obj1); break; } } if ($newObject) { $obj6->initVStudentActives(); $obj6->addVStudentActive($obj1); } $results[] = $obj1; } return $results; }
public function executeEdit() { $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_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $course_schedule = CourseSchedulePeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($course_schedule); $this->subtitle = $course_schedule->getClassGroup()->getName() . ' - ' . $course_schedule->getSubjectCurr()->getSubject()->getName() . ' (id:' . $course_schedule->getId() . ')'; $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'course_sched/delete?id=' . $course_schedule->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'course_sched/list', 'color' => 'black')); $this->type = 'edit'; $this->course_schedule = $course_schedule; $this->actions = $actions; $curr = CurriculumPeer::retrieveByPK($course_schedule->getSubjectCurr()->getCurriculumId()); $this->curr = $curr; $subject_curriculums = $curr->getSubjectCurrs(); $subject_ids = array(); foreach ($subject_curriculums as $subject_curriculum) { $subject_ids[$subject_curriculum->getId()] = $subject_curriculum->getSubject()->getName(); } $this->subject_ids = $subject_ids; $this->subject_currs = $subject_ids; $this->selected_subject_curr = $course_schedule->getSubjectCurr()->getSubjectId(); $subject_id = $course_schedule->getSubjectCurr()->getSubjectId(); $c = new Criteria(); $c->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, TeachingCompetencyPeer::EMPLOYEE_ID); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $employee_ids = array(); foreach ($objs as $o) { $employee_ids[] = $o->getId(); } $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id, Criteria::IN); $c->add(TeachingCompetencyPeer::EMPLOYEE_ID, $employee_ids, Criteria::NOT_IN); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $lectors = EmployeePeer::doSelect($c); $this->lectors = $lectors; $cw = new Criteria(); $cw->add(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $cw->addAscendingOrderByColumn(CourseScheduleDetailPeer::DAY); $rows = CourseScheduleDetailPeer::doSelect($cw); $row_count = CourseScheduleDetailPeer::doCount($cw); $actions3 = array(); array_unshift($actions3, array('name' => 'add', 'url' => 'course_sched/createSchedule?id=' . $course_schedule->getId(), 'color' => 'black')); $this->actions3 = $actions3; $this->rows = $rows; $this->row_count = $row_count; }
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(CurriculumPeer::ID, $pks, Criteria::IN); $objs = CurriculumPeer::doSelect($criteria, $con); } return $objs; }
public function executeGetListForCourse() { $accal_id = $this->getRequestParameter('academic_calendar_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $this->accal = $accal; $curr = CurriculumPeer::retrieveByPK($accal->getCurriculumId()); $this->curr = $curr; $subject_curriculums = $curr->getSubjectCurrs(); $subject_ids = array(); foreach ($subject_curriculums as $subject_curriculum) { $subject_ids[] = $subject_curriculum->getSubjectId(); } $c = new Criteria(); $c->add(SubjectPeer::DEPARTMENT_ID, $curr->getDepartmentId(), Criteria::IN); $c->add(SubjectPeer::ID, $subject_ids, Criteria::IN); $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $c->addAscendingOrderByColumn(SubjectCurrPeer::SUBJECT_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(), 'subject_curriculum')); $this->getUser()->setAttribute('max_per_page', $rpp, 'subject_curriculum'); $pager = new sfPropelPager('SubjectCurr', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'subject_curriculum')); $this->getUser()->setAttribute('page', $page, 'subject_curriculum'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
public function executeEditSubject() { $rule_id = $this->getRequestParameter('rule_id'); $score_rule = ScoreRulePeer::retrieveByPK($rule_id); $this->forward404Unless($score_rule); $curr = CurriculumPeer::retrieveByPK($score_rule->getAcademicCalendar()->getCurriculumId()); $this->curr = $curr; $subject_curriculums = $curr->getSubjectCurrs(); $subject_ids = array(); foreach ($subject_curriculums as $subject_curriculum) { $subject_ids[] = $subject_curriculum->getSubjectId(); } $c = new Criteria(); $c->add(SubjectPeer::DEPARTMENT_ID, $curr->getDepartmentId(), Criteria::IN); $c->add(SubjectPeer::ID, $subject_ids, Criteria::IN); $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $c->addAscendingOrderByColumn(SubjectCurrPeer::SUBJECT_ID); $subject_currs = SubjectCurrPeer::doSelect($c); $subj_ids = array(); foreach ($subject_currs as $subject_curr) { $subj_ids[$subject_curr->getId()] = $subject_curr->getSubject()->getName(); } $this->subj_ids = $subj_ids; /* foreach ($subject_currs as $sc) { $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $sc->getId()); $sc->rule = ScoreRuleSubjectPeer::doSelectOne($cm); } */ $sub_ids = array(); foreach ($subject_currs as $sub_curr) { $sub_ids = $sub_curr->getId(); } $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); array_push($actions, array('name' => 'cancel', 'url' => 'score_rule_new/listSubject?rule_id=' . $score_rule->getId(), 'color' => 'white')); $subtitle = $score_rule->toName(); $this->subtitle = $subtitle; $this->actions = $actions; $this->subject_currs = $subject_currs; $this->type = 'add'; $this->sub_ids = $sub_ids; $this->score_rule = $score_rule; $actions2 = array(array('name' => '<span>Aturan Penilaian</span>', 'url' => 'score_rule_new/list', 'color' => 'sun')); array_push($actions2, array('name' => '<span>Daftar Mata Pelajaran</span>', 'url' => 'score_rule_new/listSubject?rule_id=' . $score_rule->getId(), 'color' => 'sky', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Daftar Kategori Penilaian</span>', 'url' => 'score_rule_new/listObject?rule_id=' . $score_rule->getId(), 'color' => 'sun')); $this->actions2 = $actions2; }
public function getCurriculum($con = null) { include_once 'lib/model/om/BaseCurriculumPeer.php'; if ($this->aCurriculum === null && $this->curriculum_id !== null) { $this->aCurriculum = CurriculumPeer::retrieveByPK($this->curriculum_id, $con); } return $this->aCurriculum; }
public static function doSelectJoinAllExceptDepartment(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VSubjectAccalLectorStudentPeer::addSelectColumns($c); $startcol2 = VSubjectAccalLectorStudentPeer::NUM_COLUMNS - VSubjectAccalLectorStudentPeer::NUM_LAZY_LOAD_COLUMNS + 1; SubjectAccalPeer::addSelectColumns($c); $startcol3 = $startcol2 + SubjectAccalPeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol4 = $startcol3 + ClassGroupPeer::NUM_COLUMNS; AcademicCalendarPeer::addSelectColumns($c); $startcol5 = $startcol4 + AcademicCalendarPeer::NUM_COLUMNS; SubjectPeer::addSelectColumns($c); $startcol6 = $startcol5 + SubjectPeer::NUM_COLUMNS; EmployeePeer::addSelectColumns($c); $startcol7 = $startcol6 + EmployeePeer::NUM_COLUMNS; CurriculumPeer::addSelectColumns($c); $startcol8 = $startcol7 + CurriculumPeer::NUM_COLUMNS; $c->addJoin(VSubjectAccalLectorStudentPeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $c->addJoin(VSubjectAccalLectorStudentPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VSubjectAccalLectorStudentPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(VSubjectAccalLectorStudentPeer::SUBJECT_ID, SubjectPeer::ID); $c->addJoin(VSubjectAccalLectorStudentPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addJoin(VSubjectAccalLectorStudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VSubjectAccalLectorStudentPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = SubjectAccalPeer::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->getSubjectAccal(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj2->initVSubjectAccalLectorStudents(); $obj2->addVSubjectAccalLectorStudent($obj1); } $omClass = ClassGroupPeer::getOMClass(); $cls = Propel::import($omClass); $obj3 = new $cls(); $obj3->hydrate($rs, $startcol3); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj3 = $temp_obj1->getClassGroup(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj3->initVSubjectAccalLectorStudents(); $obj3->addVSubjectAccalLectorStudent($obj1); } $omClass = AcademicCalendarPeer::getOMClass(); $cls = Propel::import($omClass); $obj4 = new $cls(); $obj4->hydrate($rs, $startcol4); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj4 = $temp_obj1->getAcademicCalendar(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj4->initVSubjectAccalLectorStudents(); $obj4->addVSubjectAccalLectorStudent($obj1); } $omClass = SubjectPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getSubject(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj5->initVSubjectAccalLectorStudents(); $obj5->addVSubjectAccalLectorStudent($obj1); } $omClass = EmployeePeer::getOMClass(); $cls = Propel::import($omClass); $obj6 = new $cls(); $obj6->hydrate($rs, $startcol6); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj6 = $temp_obj1->getEmployee(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj6->initVSubjectAccalLectorStudents(); $obj6->addVSubjectAccalLectorStudent($obj1); } $omClass = CurriculumPeer::getOMClass(); $cls = Propel::import($omClass); $obj7 = new $cls(); $obj7->hydrate($rs, $startcol7); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj7 = $temp_obj1->getCurriculum(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addVSubjectAccalLectorStudent($obj1); break; } } if ($newObject) { $obj7->initVSubjectAccalLectorStudents(); $obj7->addVSubjectAccalLectorStudent($obj1); } $results[] = $obj1; } return $results; }