Пример #1
0
 public static function doSelectFilter()
 {
     $depts = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
     $c = new Criteria();
     $c->add(DepartmentDetailPeer::DEPARTMENT_ID, $depts->getId());
     $dept_detail = DepartmentDetailPeer::doSelectOne($c);
     $criteria = new Criteria();
     #$criteria->add(SubjectPeer::DEPARTMENT_ID, $depts->getChildRecurs(), Criteria::IN);
     #$criteria->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID);
     $criteria->add(CurriculumPeer::DEPARTMENT_ID, $dept_detail->getAccreditation(), Criteria::IN);
     $criteria->addJoin(SubjectCurrPeer::CURRICULUM_ID, CurriculumPeer::ID);
     $criteria->addAscendingOrderByColumn(SubjectPeer::NAME);
     return SubjectCurrPeer::doSelect($criteria);
 }
Пример #2
0
 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);
 }
Пример #3
0
 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;
 }
Пример #4
0
 public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VStudentCoursePeer::addSelectColumns($c);
     $startcol2 = VStudentCoursePeer::NUM_COLUMNS - VStudentCoursePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS;
     SubjectAccalPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SubjectAccalPeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + SubjectCurrPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + ClassGroupPeer::NUM_COLUMNS;
     $c->addJoin(VStudentCoursePeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(VStudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
     $c->addJoin(VStudentCoursePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $c->addJoin(VStudentCoursePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VStudentCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentPeer::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->getStudent();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVStudentCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVStudentCourses();
             $obj2->addVStudentCourse($obj1);
         }
         $omClass = SubjectAccalPeer::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->getSubjectAccal();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVStudentCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVStudentCourses();
             $obj3->addVStudentCourse($obj1);
         }
         $omClass = SubjectCurrPeer::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->getSubjectCurr();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVStudentCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVStudentCourses();
             $obj4->addVStudentCourse($obj1);
         }
         $omClass = ClassGroupPeer::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->getClassGroup();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVStudentCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVStudentCourses();
             $obj5->addVStudentCourse($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #5
0
 public function executeShowSubjectSched2()
 {
     $subject_curriculum = SubjectCurrPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($subject_curriculum);
     $this->subtitle = $subject_curriculum->getCurriculum()->toString() . ' - id:' . $subject_curriculum->getId();
     $actions = array(array('name' => 'back', 'url' => 'student_schedule/listSched2', 'color' => 'black'));
     $this->setTemplate('showSubject');
     $this->actions = $actions;
     $this->subject_curriculum = $subject_curriculum;
 }
Пример #6
0
 public static function doSelectJoinAllExceptGradeComponent(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     SchedulePeer::addSelectColumns($c);
     $startcol2 = SchedulePeer::NUM_COLUMNS - SchedulePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + SubjectCurrPeer::NUM_COLUMNS;
     EmployeePeer::addSelectColumns($c);
     $startcol4 = $startcol3 + EmployeePeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS;
     LocationPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + LocationPeer::NUM_COLUMNS;
     ClassSessionPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + ClassSessionPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + AcademicCalendarPeer::NUM_COLUMNS;
     GradeSpecPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + GradeSpecPeer::NUM_COLUMNS;
     $c->addJoin(SchedulePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $c->addJoin(SchedulePeer::EMPLOYEE_ID, EmployeePeer::ID);
     $c->addJoin(SchedulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(SchedulePeer::LOCATION_ID, LocationPeer::ID);
     $c->addJoin(SchedulePeer::CLASS_SESSION_ID, ClassSessionPeer::ID);
     $c->addJoin(SchedulePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(SchedulePeer::GRADE_SPEC_ID, GradeSpecPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = SchedulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = SubjectCurrPeer::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->getSubjectCurr();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initSchedules();
             $obj2->addSchedule($obj1);
         }
         $omClass = EmployeePeer::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->getEmployee();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initSchedules();
             $obj3->addSchedule($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->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initSchedules();
             $obj4->addSchedule($obj1);
         }
         $omClass = LocationPeer::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->getLocation();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initSchedules();
             $obj5->addSchedule($obj1);
         }
         $omClass = ClassSessionPeer::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->getClassSession();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initSchedules();
             $obj6->addSchedule($obj1);
         }
         $omClass = AcademicCalendarPeer::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->getAcademicCalendar();
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initSchedules();
             $obj7->addSchedule($obj1);
         }
         $omClass = GradeSpecPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj8 = new $cls();
         $obj8->hydrate($rs, $startcol8);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj8 = $temp_obj1->getGradeSpec();
             if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj8->addSchedule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj8->initSchedules();
             $obj8->addSchedule($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #7
0
 public function getSubjectCurr($con = null)
 {
     include_once 'lib/model/om/BaseSubjectCurrPeer.php';
     if ($this->aSubjectCurr === null && $this->subject_curr_id !== null) {
         $this->aSubjectCurr = SubjectCurrPeer::retrieveByPK($this->subject_curr_id, $con);
     }
     return $this->aSubjectCurr;
 }
Пример #8
0
 public function executeUpdate()
 {
     $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');
     $subject_curr_id = $this->getRequestParameter('subject_curr_id');
     $subject_curr = SubjectCurrPeer::retrieveByPK($subject_curr_id);
     $this->forward404Unless($subject_curr);
     $academic_calendar_id = $this->getRequestParameter('accal_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $class_group_id = $this->getRequestParameter('class_group_id');
     $class_group = ClassGroupPeer::retrieveByPK($class_group_id);
     $this->forward404Unless($class_group);
     $course_sched = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id'));
     $this->forward404Unless($course_sched);
     $cur13_term = Cur13TermPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($cur13_term);
     $cur13_term->setCourseScheduleId($course_sched->getId());
     $cur13_term->setCode($this->getRequestParameter('code'));
     $cur13_term->setName($this->getRequestParameter('name'));
     $cur13_term->setDescription($this->getRequestParameter('description'));
     #$cur13_term->setCur13KiId($this->getRequestParameter('cur13_ki_id'));
     $cur13_term->save();
     $spkis = $this->getRequestParameter('spki');
     $bobot = $this->getRequestParameter('bobot');
     foreach ($spkis as $l => $spki) {
         $ct = new Criteria();
         $ct->add(Cur13TermSpecPeer::CUR13_TERM_ID, $cur13_term->getId());
         $ct->add(Cur13TermSpecPeer::GRADE_SPEC_ID, $l);
         $cur13_ts = Cur13TermSpecPeer::doSelectOne($ct);
         if ($cur13_ts == null) {
             $cur13_ts = new Cur13TermSpec();
         }
         $cur13_ts->setCur13TermId($cur13_term->getId());
         $cur13_ts->setGradeSpecId($l);
         $cur13_ts->setBobot($bobot[$l]);
         $cur13_ts->save();
     }
     $delspkis = $this->getRequestParameter('delspki');
     foreach ($delspkis as $l => $delspki) {
         $ct = new Criteria();
         $ct->add(Cur13TermSpecPeer::CUR13_TERM_ID, $cur13_term->getId());
         $ct->add(Cur13TermSpecPeer::GRADE_SPEC_ID, $l);
         $cur13_ts = Cur13TermSpecPeer::doSelectOne($ct);
         if ($cur13_ts != null) {
             $cur13_ts->delete();
         }
     }
     return $this->redirect('cur13_term/getSubject?subject_curr_id=' . $subject_curr->getId() . '&accal_id=' . $academic_calendar->getId() . '&class_group_id=' . $class_group->getId());
 }
Пример #9
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 == 'SUBJECT_GROUP_ID') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $column = SubjectPeer::getTableMap()->getColumn($key);
         } elseif ($key == 'CREDIT') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $column = SubjectPeer::getTableMap()->getColumn($key);
         } else {
             $column = SubjectCurrPeer::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);
                 }
             }
         }
     }
 }
Пример #10
0
 public function executeGetLectors()
 {
     $subject_curr_id = $this->getRequestParameter('subject_curr_id');
     $subject_curr = SubjectCurrPeer::retrieveByPk($subject_curr_id);
     $c = new Criteria();
     $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_curr->getSubjectId());
     $objs = TeachingCompetencyPeer::doSelect($c);
     $lectors = array();
     foreach ($objs as $o) {
         $lectors[$o->getEmployeeId()] = $o->getEmployee()->getName();
     }
     $this->content = $lectors;
     $this->setTemplate('buildOptions');
 }
Пример #11
0
 public static function doSelectJoinAllExceptGradeConversion(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     SubjectPrereqPeer::addSelectColumns($c);
     $startcol2 = SubjectPrereqPeer::NUM_COLUMNS - SubjectPrereqPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + SubjectCurrPeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SubjectCurrPeer::NUM_COLUMNS;
     $c->addJoin(SubjectPrereqPeer::SUBCURR_PREREQ, SubjectCurrPeer::ID);
     $c->addJoin(SubjectPrereqPeer::SUBCURR, SubjectCurrPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = SubjectPrereqPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = SubjectCurrPeer::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->getSubjectCurrRelatedBySubcurrPrereq();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addSubjectPrereqRelatedBySubcurrPrereq($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initSubjectPrereqsRelatedBySubcurrPrereq();
             $obj2->addSubjectPrereqRelatedBySubcurrPrereq($obj1);
         }
         $omClass = SubjectCurrPeer::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->getSubjectCurrRelatedBySubcurr();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addSubjectPrereqRelatedBySubcurr($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initSubjectPrereqsRelatedBySubcurr();
             $obj3->addSubjectPrereqRelatedBySubcurr($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #12
0
 public function executeUpdate()
 {
     $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id'));
     $this->forward404Unless($course_schedule);
     $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id'));
     $this->forward404Unless($accal);
     $c = new Criteria();
     $c->add(SubjectCurrPeer::CURRICULUM_ID, $accal->getCurriculumId());
     $c->add(SubjectCurrPeer::SUBJECT_ID, $this->getRequestParameter('subject_curr_id'));
     $subject_curr = SubjectCurrPeer::doSelectOne($c);
     $course_schedule->setSubjectCurrId($subject_curr->getId());
     $course_schedule->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $course_schedule->setClassGroupId($this->getRequestParameter('class_group_id'));
     $course_schedule->setKkm($this->getRequestParameter('kkm'));
     $course_schedule->save();
     $lectors = $this->getRequestParameter('lectors');
     foreach ($lectors as $lector) {
         $cs_tutor = new CourseScheduleTutor();
         $cs_tutor->setEmployeeId($lector);
         $cs_tutor->setCourseScheduleId($this->getRequestParameter('course_id'));
         $cs_tutor->save();
     }
     return $this->redirect('course_schedule/list');
 }
Пример #13
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $subject = new Subject();
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         $subject_curr = new SubjectCurr();
         $subject_curr->setSubject($subject);
         $subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
         $subject_curr->save();
         if ($this->hasRequestParameter('academic_calendar_id') && $this->getRequestParameter('academic_calendar_id') != null && $this->getRequestParameter('academic_calendar_id') != '') {
             $subject_accal = new SubjectAccal();
             $subject_accal->setSubject($subject);
             $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
             $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
             $subject_accal->save();
             $subject_accal_lector = new SubjectAccalLector();
             $subject_accal_lector->setSubjectAccal($subject_accal);
             $subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
             $subject_accal_lector->save();
         } else {
             $c = new Criteria();
             $c->add(AcademicCalendarPeer::CURRICULUM_ID, $this->getRequestParameter('curriculum_id'));
             $currs = AcademicCalendarPeer::doSelect($c);
             foreach ($currs as $curr) {
                 $subject_accal = new SubjectAccal();
                 $subject_accal->setSubject($subject);
                 $subject_accal->setAcademicCalendarId($curr->getId());
                 $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
                 $subject_accal->save();
                 $subject_accal_lector = new SubjectAccalLector();
                 $subject_accal_lector->setSubjectAccal($subject_accal);
                 $subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
                 $subject_accal_lector->save();
             }
         }
     } else {
         $subject = SubjectPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($subject);
         $subject->setId($this->getRequestParameter('id'));
         $subject->setCode($this->getRequestParameter('code'));
         $subject->setName($this->getRequestParameter('name'));
         $subject->setCredit($this->getRequestParameter('credit'));
         $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
         $subject->setDepartmentId($this->getRequestParameter('department_id'));
         $subject->save();
         if ($this->hasRequestParameter('subject_curr_id') && $this->getRequestParameter('subject_curr_id') != null && $this->getRequestParameter('subject_curr_id') != '') {
             $subject_curr = SubjectCurrPeer::retrieveByPk($this->getRequestParameter('subject_curr_id'));
             $this->forward404Unless($subject_curr);
             $subject_curr->setId($this->getRequestParameter('subject_curr_id'));
             $subject_curr->setSubject($subject);
             $subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
             $subject_curr->save();
         } else {
             $subject_curr = new SubjectCurr();
             $subject_curr->setSubject($subject);
             $subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
             $subject_curr->save();
         }
         if ($this->hasRequestParameter('subject_accal_id') && $this->getRequestParameter('subject_accal_id') != null && $this->getRequestParameter('subject_accal_id') != '') {
             $subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('subject_accal_id'));
             $this->forward404Unless($subject_accal);
             $subject_accal->setId('subject_accal_id');
             $subject_accal->setSubject($subject);
             $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
             $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
             $subject_accal->save();
         } else {
             $c = new Criteria();
             $c->add(AcademicCalendarPeer::CURRICULUM_ID, $this->getRequestParameter('curriculum_id'));
             $currs = AcademicCalendarPeer::doSelect($c);
             foreach ($currs as $curr) {
                 $subject_accal = new SubjectAccal();
                 $subject_accal->setSubject($subject);
                 $subject_accal->setAcademicCalendarId($curr->getId());
                 $subject_accal->setEmployeeId($this->getRequestParameter('employee_id'));
                 $subject_accal->save();
                 $subject_accal_lector = new SubjectAccalLector();
                 $subject_accal_lector->setSubjectAccal($subject_accal);
                 $subject_accal_lector->setEmployeeId($this->getRequestParameter('employee_id'));
                 $subject_accal_lector->save();
             }
         }
     }
     return $this->redirect('subject/list');
 }
Пример #14
0
 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());
     $this->can_add = $acl->getAddPriv() == 1;
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $course_regulation = CourseRegulationPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($course_regulation);
     $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_regulation/delete?id=' . $course_regulation->getId(), 'color' => 'red'));
     }
     array_push($actions, array('name' => 'cancel', 'url' => 'course_regulation/list', 'color' => 'black'));
     $this->subtitle = $course_regulation->toString() . ' - id:' . $course_regulation->getId();
     $this->type = 'edit';
     $this->course_regulation = $course_regulation;
     $this->actions = $actions;
     $c = new Criteria();
     $c->add(SubjectGradingPeer::SUBJECT_CURR_ID, $course_regulation->getSubjectCurrId());
     $objs = SubjectGradingPeer::doSelect($c);
     $subject_grades = array();
     foreach ($objs as $o) {
         $subject_grades[$o->getId()] = $o->getGradeComponent()->getName();
     }
     $this->subject_grades = $subject_grades;
     $this->selected_subject_grade = $course_regulation->getSubjectGradingId();
     $subject_currs_options = array();
     $c = new Criteria();
     $c->add(SubjectCurrPeer::CURRICULUM_ID, $course_regulation->getSubjectCurr()->getCurriculumId());
     $subject_currs = SubjectCurrPeer::doSelect($c);
     foreach ($subject_currs as $sa) {
         $subject_currs_options[$sa->getId()] = $sa->getSubject()->getName();
     }
     $this->subject_currs = $subject_currs_options;
     $this->selected_subject_curr = $course_regulation->getSubjectCurrId();
 }
 public static function doSelectJoinAllExceptCur13Ki(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     Cur13SubjectDescriptionPeer::addSelectColumns($c);
     $startcol2 = Cur13SubjectDescriptionPeer::NUM_COLUMNS - Cur13SubjectDescriptionPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     ClassLevelPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + ClassLevelPeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SubjectCurrPeer::NUM_COLUMNS;
     $c->addJoin(Cur13SubjectDescriptionPeer::CLASS_LEVEL_ID, ClassLevelPeer::ID);
     $c->addJoin(Cur13SubjectDescriptionPeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = Cur13SubjectDescriptionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = ClassLevelPeer::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->getClassLevel();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addCur13SubjectDescription($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initCur13SubjectDescriptions();
             $obj2->addCur13SubjectDescription($obj1);
         }
         $omClass = SubjectCurrPeer::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->getSubjectCurr();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addCur13SubjectDescription($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initCur13SubjectDescriptions();
             $obj3->addCur13SubjectDescription($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #16
0
 public function executeCreatePackaged()
 {
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $this->student = $student;
     $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;
     $accal_options = array();
     $accals = $student->getAcademicCalendar()->getCurriculum()->getAcademicCalendars();
     foreach ($accals as $accal) {
         if ($accal->getParent() != null) {
             $accal_options[$accal->getId()] = '&nbsp;&nbsp;.&nbsp;&nbsp;&nbsp;' . $accal->toString();
         } else {
             $accal_options[$accal->getId()] = $accal->toString();
         }
     }
     $this->accal_options = $accal_options;
     $c = new Criteria();
     $c->add(AcademicCalendarPeer::ID, $student->getAcademicCalendarId());
     $c->addJoin(CurriculumPeer::ID, AcademicCalendarPeer::CURRICULUM_ID);
     $c->addJoin(SubjectCurrPeer::CURRICULUM_ID, CurriculumPeer::ID);
     $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID);
     $c->addAscendingOrderByColumn(CurriculumPeer::CODE);
     $c->addAscendingOrderByColumn(SubjectPeer::CODE);
     $c->addAscendingOrderByColumn(SubjectPeer::NAME);
     $c->setDistinct();
     $subject_currs = SubjectCurrPeer::doSelect($c);
     $sas = array();
     $all_sa = array();
     foreach ($subject_currs as $sa) {
         $sas[] = $sa->getId();
         if ($sa->getSubject()) {
             $all_sa[$sa->getId()] = $sa->toString();
         }
     }
     $saved_sas = array();
     $saved_student_courses = $student->getStudentCourses();
     foreach ($saved_student_courses as $ssc) {
         $saved_sas[] = $ssc->getSubjectCurrId();
     }
     $disabled_sa = array_intersect($sas, $saved_sas);
     // calculate sc rules
     $objs = SubjectCurrPeer::doSelectByAccal();
     foreach ($objs as $o) {
         $content[$o->getId()] = $o->toStringWithLector();
         $c = new Criteria();
         $c->add(SubjectAccalPeer::ID, $o->getId());
         $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId());
         $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID);
         $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID);
         $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR);
         $sps = SubjectPrereqPeer::doSelect($c);
         foreach ($sps as $sp) {
             $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject();
             // prereq subject must be in closed state
             $c = new Criteria();
             $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId());
             $c->add(StudentCoursePeer::STUDENT_ID, $student_id);
             $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED);
             $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
             $scs = StudentCoursePeer::doSelect($c);
             $isPassGrade = false;
             $isPassCredit = true;
             $isPassIndex = true;
             foreach ($scs as $sc) {
                 $grade = $sc->getFinalGrade();
                 $gc = GradeConversionPeer::retrieveByName($grade[0]);
                 // check prereq subject grade
                 if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) {
                     $isPassGrade = true;
                 } else {
                     $isPassGrade = false;
                 }
                 // check credit requirement
                 if ($sp->getTotalCredit() > 0) {
                     if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) {
                         $isPassCredit = true;
                     } else {
                         $isPassCredit = false;
                     }
                 }
                 // check index requirement
                 if ($sp->getPerformanceIndex() > 0) {
                     if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) {
                         $isPassIndex = true;
                     } else {
                         $isPassIndex = false;
                     }
                 }
             }
             $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString();
             $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString();
             if (!$isPassGrade || !$isPassCredit || !$isPassIndex) {
                 $disabled_sa[] = $o->getId();
             }
         }
     }
     $selected_sa = array_diff($sas, $disabled_sa);
     $this->disabled_sa = $disabled_sa;
     $this->selected_sa = $selected_sa;
     $this->all_sa = $all_sa;
     $this->subject_accals = $subject_accals;
     $c = new Criteria();
     $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $student->getClassGroupId());
     $c->add(CourseSchedulePeer::SUBJECT_ACCAL_ID, $selected_sa, Criteria::IN);
     $c->addJoin(CourseSchedulePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID);
     $c->addJoin(SubjectAccalPeer::SUBJECT_ID, SubjectPeer::ID);
     $c->addJoin(CourseSchedulePeer::CLASS_SESSION_ID, ClassSessionPeer::ID);
     $c->addAscendingOrderByColumn(SubjectPeer::CODE);
     $c->addAscendingOrderByColumn(CourseSchedulePeer::EMPLOYEE_ID);
     $c->addAscendingOrderByColumn(CourseSchedulePeer::LOCATION_ID);
     $c->addAscendingOrderByColumn(CourseSchedulePeer::DAY);
     $c->addAscendingOrderByColumn(ClassSessionPeer::CODE);
     $c->setDistinct();
     $css = CourseSchedulePeer::doSelect($c);
     $this->student_course = new StudentCourse();
     $this->setTemplate('editPackaged');
     $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'student_course/list?student_id=' . $student->getId(), 'color' => 'white'));
     if ($student->getAcademicCalendar()->getCourseModelRecurs() == AcademicCalendar::CM_PACKAGED_CUSTOM) {
         array_unshift($this->actions, array('name' => 'add custom course', 'url' => 'student_course/create?student_id=' . $student->getId() . '&custom=1', 'color' => 'green'));
     }
     $this->subtitle = $student->toString();
     $this->type = 'add';
     $this->schedules = $css;
 }
Пример #17
0
 public static function doSelectJoinAllExceptEmployee(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VAbsenceCoursePeer::addSelectColumns($c);
     $startcol2 = VAbsenceCoursePeer::NUM_COLUMNS - VAbsenceCoursePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     CourseSchedulePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + CourseSchedulePeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + SubjectCurrPeer::NUM_COLUMNS;
     $c->addJoin(VAbsenceCoursePeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID);
     $c->addJoin(VAbsenceCoursePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VAbsenceCoursePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = CourseSchedulePeer::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->getCourseSchedule();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVAbsenceCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVAbsenceCourses();
             $obj2->addVAbsenceCourse($obj1);
         }
         $omClass = SubjectCurrPeer::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->getSubjectCurr();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVAbsenceCourse($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVAbsenceCourses();
             $obj3->addVAbsenceCourse($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #18
0
 public function executeDelete()
 {
     $subject_curriculum = SubjectCurrPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($subject_curriculum);
     $ref_error = 0;
     foreach ($subject_curriculum->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $subject_curriculum->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('subject_curriculum/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('subject_curriculum/delete', '_ERR_DELETE_ (' . $subject_curriculum->toString() . ' - id:' . $subject_curriculum->getId() . ')');
     } else {
         $subject_curriculum->delete();
     }
     return $this->forward('subject_curriculum', 'list');
 }
Пример #19
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = SubjectCurrPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setSubjectId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCurriculumId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCode($arr[$keys[3]]);
     }
 }
Пример #20
0
 public static function doSelectJoinAllExceptScheduleDetail(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     StudentRaportPeer::addSelectColumns($c);
     $startcol2 = StudentRaportPeer::NUM_COLUMNS - StudentRaportPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS;
     StudentCoursePeer::addSelectColumns($c);
     $startcol4 = $startcol3 + StudentCoursePeer::NUM_COLUMNS;
     GradeComponentPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + GradeComponentPeer::NUM_COLUMNS;
     GradeSpecPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + GradeSpecPeer::NUM_COLUMNS;
     CitationPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + CitationPeer::NUM_COLUMNS;
     SubjectCurrPeer::addSelectColumns($c);
     $startcol8 = $startcol7 + SubjectCurrPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol9 = $startcol8 + ClassGroupPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol10 = $startcol9 + AcademicCalendarPeer::NUM_COLUMNS;
     SchedulePeer::addSelectColumns($c);
     $startcol11 = $startcol10 + SchedulePeer::NUM_COLUMNS;
     $c->addJoin(StudentRaportPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(StudentRaportPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $c->addJoin(StudentRaportPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
     $c->addJoin(StudentRaportPeer::GRADE_SPEC_ID, GradeSpecPeer::ID);
     $c->addJoin(StudentRaportPeer::CITATION_ID, CitationPeer::ID);
     $c->addJoin(StudentRaportPeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID);
     $c->addJoin(StudentRaportPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(StudentRaportPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(StudentRaportPeer::SCHEDULE_ID, SchedulePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = StudentRaportPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentPeer::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->getStudent();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initStudentRaports();
             $obj2->addStudentRaport($obj1);
         }
         $omClass = StudentCoursePeer::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->getStudentCourse();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initStudentRaports();
             $obj3->addStudentRaport($obj1);
         }
         $omClass = GradeComponentPeer::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->getGradeComponent();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initStudentRaports();
             $obj4->addStudentRaport($obj1);
         }
         $omClass = GradeSpecPeer::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->getGradeSpec();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initStudentRaports();
             $obj5->addStudentRaport($obj1);
         }
         $omClass = CitationPeer::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->getCitation();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initStudentRaports();
             $obj6->addStudentRaport($obj1);
         }
         $omClass = SubjectCurrPeer::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->getSubjectCurr();
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initStudentRaports();
             $obj7->addStudentRaport($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj8 = new $cls();
         $obj8->hydrate($rs, $startcol8);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj8 = $temp_obj1->getClassGroup();
             if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj8->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj8->initStudentRaports();
             $obj8->addStudentRaport($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj9 = new $cls();
         $obj9->hydrate($rs, $startcol9);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj9 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj9->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj9->initStudentRaports();
             $obj9->addStudentRaport($obj1);
         }
         $omClass = SchedulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj10 = new $cls();
         $obj10->hydrate($rs, $startcol10);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj10 = $temp_obj1->getSchedule();
             if ($temp_obj10->getPrimaryKey() === $obj10->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj10->addStudentRaport($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj10->initStudentRaports();
             $obj10->addStudentRaport($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #21
0
 public function executeUpdateAll()
 {
     $curr_id = $this->getRequestParameter('curr_id');
     $curr = CurriculumPeer::retrieveByPK($curr_id);
     $this->forward404Unless($curr);
     // get subjects list
     $subject_ids = array();
     foreach ($curr->getSubjectCurrs() as $sc) {
         $subject_ids[] = $sc->getSubjectId();
     }
     $add = array_diff($this->getRequestParameter('subject_id'), $subject_ids);
     $remove = array_diff($subject_ids, $this->getRequestParameter('subject_id'));
     foreach ($remove as $id) {
         $c = new Criteria();
         $c->add(SubjectCurrPeer::SUBJECT_ID, $id);
         $c->add(SubjectCurrPeer::CURRICULUM_ID, $curr_id);
         $subject_curr = SubjectCurrPeer::doSelectOne($c);
         $subject_curr->delete();
     }
     foreach ($add as $id) {
         $subject_curr = new SubjectCurr();
         $subject_curr->setSubjectId($id);
         $subject_curr->setCurriculumId($curr_id);
         $subject_curr->save();
     }
     return $this->redirect('subject_curr/list?curr_id=' . $curr_id);
 }
Пример #22
0
 public function executeDelete()
 {
     $subject_curr_id = $this->getRequestParameter('subject_curr_id');
     $subject_curr = SubjectCurrPeer::retrieveByPK($subject_curr_id);
     $this->forward404Unless($subject_curr);
     $this->subject_curr = $subject_curr;
     $subject_grading = SubjectGradingPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($subject_grading);
     $ref_error = 0;
     foreach ($subject_grading->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $subject_grading->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('subject_grading/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     $c = new Criteria();
     $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $subject_grading->getSubjectCurrId());
     $c->add(StudentCoursePeer::GRADE_COMPONENT_ID, $subject_grading->getGradeComponentId());
     $c->addJoin(StudentRaportPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID);
     $score_count = StudentRaportPeer::doCount($c);
     if ($ref_error > 0) {
         $this->getRequest()->setError('subject_grading/delete', '_ERR_DELETE_ (' . $subject_grading->toString() . ' - id:' . $subject_grading->getId() . ')');
     } elseif ($score_count > 0) {
         $this->getRequest()->setError('subject_grading/delete/StudentScore', $score_count);
         $this->getRequest()->setError('subject_grading/delete', '_ERR_DELETE_ (' . $subject_grading->toString() . ' - id:' . $subject_grading->getId() . ')');
     } else {
         $subject_grading->delete();
     }
     $this->getRequest()->setParameter('subject_curr_id', $subject_curr_id);
     return $this->forward('subject_grading', 'list');
 }
Пример #23
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 == 'CODE_CLASS') {
             $c->addJoin(CourseSchedulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'EMPLOYEE_NAME') {
             $c->addJoin(CourseSchedulePeer::ID, CourseScheduleTutorPeer::COURSE_SCHEDULE_ID);
             $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'SUBJECT_ID') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $c->addJoin(SubjectCurrPeer::ID, CourseSchedulePeer::SUBJECT_CURR_ID);
             $column = SubjectCurrPeer::getTableMap()->getColumn($key);
         } elseif ($key == 'SUBJECT_NAME') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $c->addJoin(SubjectCurrPeer::ID, CourseSchedulePeer::SUBJECT_CURR_ID);
             $column = SubjectPeer::getTableMap()->getColumn('NAME');
         } else {
             $column = CourseSchedulePeer::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);
                 }
             }
         }
     }
 }
Пример #24
0
 public function getSubjectCurrsJoinCurriculum($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseSubjectCurrPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collSubjectCurrs === null) {
         if ($this->isNew()) {
             $this->collSubjectCurrs = array();
         } else {
             $criteria->add(SubjectCurrPeer::SUBJECT_ID, $this->getId());
             $this->collSubjectCurrs = SubjectCurrPeer::doSelectJoinCurriculum($criteria, $con);
         }
     } else {
         $criteria->add(SubjectCurrPeer::SUBJECT_ID, $this->getId());
         if (!isset($this->lastSubjectCurrCriteria) || !$this->lastSubjectCurrCriteria->equals($criteria)) {
             $this->collSubjectCurrs = SubjectCurrPeer::doSelectJoinCurriculum($criteria, $con);
         }
     }
     $this->lastSubjectCurrCriteria = $criteria;
     return $this->collSubjectCurrs;
 }
Пример #25
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(SubjectCurrPeer::ID, $pks, Criteria::IN);
         $objs = SubjectCurrPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #26
0
 public function executeListShow()
 {
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $this->employee_id = $employee_id;
     $c = new Criteria();
     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $this->getRequestParameter('accal_id'));
     $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $this->getRequestParameter('subject_id'));
     $c->add(StudentCoursePeer::CLASS_GROUP_ID, $this->getRequestParameter('class_id'));
     $c->addJoin(VStudentActivePeer::ID, StudentCoursePeer::STUDENT_ID);
     $c->addAscendingOrderByColumn(VStudentActivePeer::NAME);
     $this->students = VStudentActivePeer::doSelect($c);
     $this->student_count = VStudentActivePeer::doCount($c);
     $subject_curr = SubjectCurrPeer::retrieveByPk($this->getRequestParameter('subject_id'));
     $this->forward404Unless($subject_curr);
     $class_group = ClassGroupPeer::retrieveByPk($this->getRequestParameter('class_id'));
     $this->forward404Unless($class_group);
     $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $cw = new Criteria();
     $cw->add(CourseSchedulePeer::SUBJECT_CURR_ID, $subject_curr->getId());
     $cw->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_group->getId());
     $cw->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $course_schedule = CourseSchedulePeer::doSelectOne($cw);
     $cr = new Criteria();
     $cr->add(GradeSpecPeer::PARENT, 1);
     $this->grade1 = GradeSpecPeer::doSelect($cr);
     $this->count1 = GradeSpecPeer::doCount($cr);
     $cr = new Criteria();
     $cr->add(GradeSpecPeer::PARENT, 7);
     $this->grade2 = GradeSpecPeer::doSelect($cr);
     $this->count2 = GradeSpecPeer::doCount($cr);
     $cr = new Criteria();
     $cr->add(GradeSpecPeer::PARENT, 30);
     $this->grade3 = GradeSpecPeer::doSelect($cr);
     $this->count3 = GradeSpecPeer::doCount($cr);
     $this->subject_curr = $subject_curr;
     $this->academic_calendar = $academic_calendar;
     $this->class_group = $class_group;
     $rpp = $this->getRequestParameter('max_per_page', 999);
     $pager = new sfPropelPager('Student', $rpp);
     $pager->setCriteria($c);
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->init();
     $this->pager = $pager;
     $actions2 = array(array('name' => '<span>Daftar Guru Kelas</span>', 'url' => 'employee_agenda/list', 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Agenda Kelas</span>', 'url' => 'employee_agenda/listAgenda?course_id=' . $course_schedule->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Absensi</span>', 'url' => 'employee_agenda/listAbsence?course_id=' . $course_schedule->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Jadwal Tugas/Ulangan/PR</span>', 'url' => 'employee_agenda/listTest?course_id=' . $course_schedule->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Penilaian</span>', 'url' => 'course_detail/listShow?subject_id=' . $course_schedule->getSubjectCurrId() . '&class_id=' . $course_schedule->getClassGroupId() . '&accal_id=' . $course_schedule->getAcademicCalendarId(), 'color' => 'sun', 'type' => 'direct'));
     if ($course_schedule->getClassGroup()->getParent() == 70 || $course_schedule->getClassGroup()->getParent() == 85 || $course_schedule->getClassGroup()->getParent() == 117) {
         array_push($actions2, array('name' => '<span>Penilaian Tryout</span>', 'url' => 'course_detail/listTryout?subject_id=' . $course_schedule->getSubjectCurrId() . '&class_id=' . $course_schedule->getClassGroupId() . '&accal_id=' . $course_schedule->getAcademicCalendarId(), 'color' => 'sun'));
     }
     $this->actions2 = $actions2;
 }