public static function doSelectByAccalFromPrereq() { $accal_id = sfContext::getInstance()->getRequest()->getParameter('accal_id'); if (!$accal_id) { return array(); } $c = new Criteria(); $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal_id); $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID); $c->addAscendingOrderByColumn(SubjectPeer::NAME); return SubjectAccalPeer::doSelect($c); }
public function executeShowStudent() { $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'); } $subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($subject_accal); $this->subtitle = $subject_accal->toString() . ' - id:' . $subject_accal->getId(); $actions = array(); $this->subject_accal = $subject_accal; $this->actions = $actions; }
public function executeEditScore() { $subject_accal_id = $this->getRequestParameter('subject_accal_id'); $this->forward404Unless($subject_accal_id); $class_group_id = $this->getRequestParameter('class_group_id'); $this->forward404Unless($class_group_id); $emp = EmployeePeer::retrieveByPK($this->getContext()->getUser()->getAttribute('user_id', null, 'bo')); $this->forward404Unless($emp); $subject_accal = SubjectAccalPeer::retrieveByPK($subject_accal_id); $this->class_group_id = $class_group_id; $this->subject_accal_id = $subject_accal_id; $this->subject_accal = SubjectAccalPeer::retrieveByPK($subject_accal_id); $c = new Criteria(); $c->add(VSubjectAccalLectorStudentDetailPeer::SUBJECT_ACCAL_ID, $subject_accal_id); $c->add(VSubjectAccalLectorStudentDetailPeer::CLASS_GROUP_ID, $class_group_id); $data = VSubjectAccalLectorStudentDetailPeer::doSelect($c); $this->data = $data; $c = new Criteria(); $c->add(SubjectGradingPeer::SUBJECT_ACCAL_ID, $subject_accal_id); $subject_gradings = array(); foreach (SubjectGradingPeer::doSelect($c) as $sg) { $subject_gradings[$sg->getId()] = $sg->getGradeComponent()->getName(); } $this->subject_gradings = $subject_gradings; }
public function executeDeleteSubject() { $subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($subject_accal); $subject_accal->delete(); return $this->redirect('academic_calendar/list'); }
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'); }
public function getSubjectAccalsJoinAcademicCalendar($criteria = null, $con = null) { include_once 'lib/model/om/BaseSubjectAccalPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collSubjectAccals === null) { if ($this->isNew()) { $this->collSubjectAccals = array(); } else { $criteria->add(SubjectAccalPeer::EMPLOYEE_ID, $this->getId()); $this->collSubjectAccals = SubjectAccalPeer::doSelectJoinAcademicCalendar($criteria, $con); } } else { $criteria->add(SubjectAccalPeer::EMPLOYEE_ID, $this->getId()); if (!isset($this->lastSubjectAccalCriteria) || !$this->lastSubjectAccalCriteria->equals($criteria)) { $this->collSubjectAccals = SubjectAccalPeer::doSelectJoinAcademicCalendar($criteria, $con); } } $this->lastSubjectAccalCriteria = $criteria; return $this->collSubjectAccals; }
public function filterSchedule($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'ACADEMIC_CALENDAR_ID') { $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(CourseSchedulePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $column = SubjectAccalPeer::getTableMap()->getColumn($key); } elseif ($key == 'SUBJECT_ID') { $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID); $c->addJoin(SubjectAccalPeer::ID, CourseSchedulePeer::SUBJECT_ACCAL_ID); $column = SubjectAccalPeer::getTableMap()->getColumn($key); } 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); } } } } }
public function executeUpdatePackaged() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $this->student = $student; $academic_calendar_id = $this->getRequestParameter('academic_calendar_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); $status = $this->getRequestParameter('status'); $this->forward404Unless($status); $subject_accals = $academic_calendar->getSubjectAccals(); $sas = array(); foreach ($subject_accals as $sa) { if ($sa->getSubject()) { $sas[] = $sa->getId(); } } $saved_sas = array(); $saved_student_courses = $student->getStudentCourses(); foreach ($saved_student_courses as $ssc) { $saved_sas[] = $ssc->getSubjectAccalId(); } $disabled_sa = array_intersect($sas, $saved_sas); // calculate sc rules $objs = SubjectAccalPeer::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); foreach ($selected_sa as $sa_id) { $student_course = new StudentCourse(); $student_course->setStudentId($student_id); $student_course->setSubjectAccalId($sa_id); $student_course->setStatus($status); $student_course->setClassGroupId($class_group_id); $student_course->save(); } return $this->redirect('student_course_s/list?student_id=' . $student->getId()); }
echo $subject->getSubjectGroup() ? link_to_remote($subject->getSubjectGroup()->toString(), array('url' => 'subject_group/showFromSubject?id=' . $subject->getSubjectGroupId(), 'update' => 'content', 'script' => 'true', 'before' => "this.blur();showIndicator('content', 'snakebig_black');", 'complete' => "hideIndicator()"), array('class' => 'white')) : '-'; ?> </td> <td> <?php echo $subject->getDepartment() ? $subject->getDepartment()->toString() : '-'; ?> <?php #echo $subject->getDepartment()? link_to_remote($subject->getDepartment()->toString(), array('url'=>'department/show?id='.$subject->getDepartmentId(), 'update'=>'content', 'script'=>'true', 'before'=>"this.blur();showIndicator('content', 'snakebig_black');",'complete'=>"hideIndicator()"), array('class'=>'white')) : '-' ?> </td> <?php $c = new Criteria(); $c->add(SubjectAccalPeer::SUBJECT_ID, $subject->getId()); $subject_curr = SubjectAccalPeer::doSelectOne($c); $subject_count = SubjectAccalPeer::doCount($c); ?> <td> <?php if ($subject_count > 0) { echo $subject_curr->getAcademicCalendar() ? $subject_curr->getAcademicCalendar()->getYear() : '-'; } else { echo '-'; } ?> </td> <td> <?php if ($subject_count > 0) { echo $subject_curr->getEmployeeId() ? $subject_curr->getEmployee()->getName() : '-'; } else {
public function executeSave() { $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(); $subject_accal = SubjectAccalPeer::retrieveByPk($this->getRequestParameter('subject_accal_id')); $this->forward404Unless($subject_accal); #$c = new Criteria() #$c->add(SubjectAccalPeer::SUBJECT_ID, $this->getRequestParameter('id')); #$subject_accal = SubjectAccalPeer::doSelectOne($c); #$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(); return $this->redirect('subject/list'); }
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(SubjectAccalPeer::ID, $pks, Criteria::IN); $objs = SubjectAccalPeer::doSelect($criteria, $con); } return $objs; }
public static function doSelectByDepartment(Criteria $criteria, $con = null) { $sa_id = sfContext::getInstance()->getRequest()->getParameter('subject_accal_id'); $sa = SubjectAccalPeer::retrieveByPK($sa_id); if ($sa == null) { return array(); } $dept_id = $sa->getDepartmentId(); $criteria->add(VAcademicCalendarPeer::ID, $dept_id, Criteria::IN); $tmp_depts = VAcademicCalendarPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setName($prefix . $val->getName()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
public static function doSelectJoinAllExceptEmployee(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } SubjectAccalLectorPeer::addSelectColumns($c); $startcol2 = SubjectAccalLectorPeer::NUM_COLUMNS - SubjectAccalLectorPeer::NUM_LAZY_LOAD_COLUMNS + 1; SubjectAccalPeer::addSelectColumns($c); $startcol3 = $startcol2 + SubjectAccalPeer::NUM_COLUMNS; $c->addJoin(SubjectAccalLectorPeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = SubjectAccalLectorPeer::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->addSubjectAccalLector($obj1); break; } } if ($newObject) { $obj2->initSubjectAccalLectors(); $obj2->addSubjectAccalLector($obj1); } $results[] = $obj1; } return $results; }
public function executeGetSchedules() { $class_group_id = $this->getRequestParameter('class_group_id'); $subject_accal_id = $this->getRequestParameter('subject_accal_id'); $subject_accal = SubjectAccalPeer::retrieveByPK($subject_accal_id); $this->forward404Unless($subject_accal); $c = new Criteria(); $c->add(CourseSchedulePeer::SUBJECT_ACCAL_ID, $subject_accal_id); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_group_id); $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(); $objs = CourseSchedulePeer::doSelect($c); $rows = array(); foreach ($objs as $o) { $rows[$o->getId()] = $o->toStringWithoutSubjectClass(); } $this->content = $rows; $this->setTemplate('buildOptions'); }
public static function doSelectJoinAllExceptCourseSchedule(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VCourseSessionPeer::addSelectColumns($c); $startcol2 = VCourseSessionPeer::NUM_COLUMNS - VCourseSessionPeer::NUM_LAZY_LOAD_COLUMNS + 1; SubjectAccalPeer::addSelectColumns($c); $startcol3 = $startcol2 + SubjectAccalPeer::NUM_COLUMNS; SubjectCurrPeer::addSelectColumns($c); $startcol4 = $startcol3 + SubjectCurrPeer::NUM_COLUMNS; EmployeePeer::addSelectColumns($c); $startcol5 = $startcol4 + EmployeePeer::NUM_COLUMNS; ClassGroupPeer::addSelectColumns($c); $startcol6 = $startcol5 + ClassGroupPeer::NUM_COLUMNS; LocationPeer::addSelectColumns($c); $startcol7 = $startcol6 + LocationPeer::NUM_COLUMNS; ClassSessionPeer::addSelectColumns($c); $startcol8 = $startcol7 + ClassSessionPeer::NUM_COLUMNS; AcademicCalendarPeer::addSelectColumns($c); $startcol9 = $startcol8 + AcademicCalendarPeer::NUM_COLUMNS; $c->addJoin(VCourseSessionPeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $c->addJoin(VCourseSessionPeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID); $c->addJoin(VCourseSessionPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addJoin(VCourseSessionPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VCourseSessionPeer::LOCATION_ID, LocationPeer::ID); $c->addJoin(VCourseSessionPeer::CLASS_SESSION_ID, ClassSessionPeer::ID); $c->addJoin(VCourseSessionPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VCourseSessionPeer::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->addVCourseSession($obj1); break; } } if ($newObject) { $obj2->initVCourseSessions(); $obj2->addVCourseSession($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->addVCourseSession($obj1); break; } } if ($newObject) { $obj3->initVCourseSessions(); $obj3->addVCourseSession($obj1); } $omClass = EmployeePeer::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->getEmployee(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVCourseSession($obj1); break; } } if ($newObject) { $obj4->initVCourseSessions(); $obj4->addVCourseSession($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->addVCourseSession($obj1); break; } } if ($newObject) { $obj5->initVCourseSessions(); $obj5->addVCourseSession($obj1); } $omClass = LocationPeer::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->getLocation(); if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) { $newObject = false; $temp_obj6->addVCourseSession($obj1); break; } } if ($newObject) { $obj6->initVCourseSessions(); $obj6->addVCourseSession($obj1); } $omClass = ClassSessionPeer::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->getClassSession(); if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) { $newObject = false; $temp_obj7->addVCourseSession($obj1); break; } } if ($newObject) { $obj7->initVCourseSessions(); $obj7->addVCourseSession($obj1); } $omClass = AcademicCalendarPeer::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->getAcademicCalendar(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addVCourseSession($obj1); break; } } if ($newObject) { $obj8->initVCourseSessions(); $obj8->addVCourseSession($obj1); } $results[] = $obj1; } return $results; }
public function executeShow() { $subject_accal_id = $this->getRequestParameter('subject_accal_id'); $subject_accal = SubjectAccalPeer::retrieveByPK($subject_accal_id); $this->forward404Unless($subject_accal); $this->subject_accal = $subject_accal; $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'); } $subject_grading = SubjectGradingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($subject_grading); $this->subtitle = $subject_grading->toString() . ' - id:' . $subject_grading->getId(); $actions = array(array('name' => 'back', 'url' => 'subject_grading/list?subject_curr_id=' . $subject_curr->getId(), 'color' => 'white')); if ($acl->getEditPriv()) { array_push($actions, array('name' => 'edit', 'url' => 'subject_grading/edit?subject_curr_id=' . $subject_curr->getId() . '&id=' . $subject_grading->getId(), 'color' => 'blue')); } if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'subject_grading/delete?subject_accal_id=' . $subject_curr->getId() . '&id=' . $subject_grading->getId(), 'color' => 'red')); } $this->actions = $actions; $this->subject_grading = $subject_grading; }
public function executeSelectBySubjectAccal() { $this->selected = $this->getRequestParameter('class_group_id'); $sa_id = $this->getRequestParameter('subject_accal_id'); $sa = SubjectAccalPeer::retrieveByPK($sa_id); $content = array(); $cg_ids = array(); if ($sa) { $c = new Criteria(); $c->add(CourseSchedulePeer::SUBJECT_ACCAL_ID, $sa->getId()); $c->addJoin(ClassGroupPeer::ID, CourseSchedulePeer::CLASS_GROUP_ID); $c->setDistinct(); $cgs = ClassGroupPeer::doSelect($c); foreach ($cgs as $cg) { $cg_ids[] = $cg->getId(); } $accal = $sa->getAcademicCalendar(); if ($accal) { $objs = $accal->getClassGroup()->getChildRecurs(); $c = new Criteria(); $c->add(ClassGroupPeer::ID, $objs, Criteria::IN); $objs = ClassGroupPeer::doSelectOrdered($c); foreach ($objs as $o) { $content[$o->getId()] = $o->toString(); } } } $this->cg_ids = $cg_ids; $this->content = $content; $this->setTemplate('buildOptions'); }
public static function doSelectByDepartmentFromAccal() { $accal_id = sfContext::getInstance()->getRequest()->getParameter('accal_id'); $sa_id = sfContext::getInstance()->getRequest()->getParameter('id'); $action_type = sfContext::getInstance()->getRequest()->getParameter('action'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); if ($accal == null) { return array(); } $sa = SubjectAccalPeer::retrieveByPK($sa_id); $subject_accals = $accal->getSubjectAccals(); $subject_ids = array(); foreach ($subject_accals as $subject_accal) { if ($action_type == 'edit' && $subject_accal->getSubjectId() == $sa->getSubjectId()) { } else { $subject_ids[] = $subject_accal->getSubjectId(); } } $depts = $accal->getDepartment()->getIdRecurs(); $depts = explode(',', $depts); $c = new Criteria(); $c->add(SubjectPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->add(SubjectPeer::ID, $subject_ids, Criteria::NOT_IN); $c->addJoin(SubjectAccalPeer::SUBJECT_ID, SubjectPeer::ID); $c->addJoin(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addAscendingOrderByColumn(SubjectPeer::NAME); return SubjectPeer::doSelect($c); }
public function executeGetLectors() { $subject_id = $this->getRequestParameter('subject_id'); $accal_id = $this->getRequestParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $subject = SubjectPeer::retrieveByPK($subject_id); $subject_academic = null; if (!$subject) { $subject_academic_id = $this->getRequestParameter('subject_academic_id'); $subject_academic = SubjectAccalPeer::retrieveByPK($subject_academic_id); $subject = $subject_academic->getSubject(); } $this->forward404Unless($subject); $subject_id = $subject->getId(); if ($subject_academic == null) { $c = new Criteria(); $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal_id); $c->add(SubjectAccalPeer::SUBJECT_ID, $subject_id); $subject_academic = SubjectAccalPeer::doSelectOne($c); } $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addAscendingOrderByColumn(EmployeePeer::EMP_NO); $objs = EmployeePeer::doSelect($c); $lectors = array(); $disabled = array(); $cs_counts = array(); foreach ($objs as $o) { $lectors[$o->getId()] = $o->toString(); if ($subject_academic) { $c = new Criteria(); $c->add(CourseSchedulePeer::EMPLOYEE_ID, $o->getId()); $c->add(CourseSchedulePeer::SUBJECT_ACCAL_ID, $subject_academic->getId()); $cs_count = CourseSchedulePeer::doCount($c); $cs_counts[$o->getId()] = $cs_count; } } $this->selected_lectors = array(); if ($subject_academic) { $sals = $subject_academic->getSubjectAccalLectors(); foreach ($sals as $sal) { $this->selected_lectors[$sal->getEmployeeId()] = 1; } } $this->cs_counts = $cs_counts; $this->lectors = $lectors; $this->forward404Unless($subject); $this->setTemplate('buildCheckBoxes'); $this->disabled = $disabled; $this->accal = $accal; $this->subject_academic = $subject_academic; }
public function getSubjectAccal($con = null) { include_once 'lib/model/om/BaseSubjectAccalPeer.php'; if ($this->aSubjectAccal === null && $this->subject_accal_id !== null) { $this->aSubjectAccal = SubjectAccalPeer::retrieveByPK($this->subject_accal_id, $con); } return $this->aSubjectAccal; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = SubjectAccalPeer::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->setAcademicCalendarId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEmployeeId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setSemester($arr[$keys[4]]); } }
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; }
public static function doSelectJoinAllExceptStudentCourse(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VSubjectAccalLectorStudentDetailPeer::addSelectColumns($c); $startcol2 = VSubjectAccalLectorStudentDetailPeer::NUM_COLUMNS - VSubjectAccalLectorStudentDetailPeer::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; DepartmentPeer::addSelectColumns($c); $startcol9 = $startcol8 + DepartmentPeer::NUM_COLUMNS; StudentPeer::addSelectColumns($c); $startcol10 = $startcol9 + StudentPeer::NUM_COLUMNS; $c->addJoin(VSubjectAccalLectorStudentDetailPeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::SUBJECT_ID, SubjectPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(VSubjectAccalLectorStudentDetailPeer::STUDENT_ID, StudentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VSubjectAccalLectorStudentDetailPeer::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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj2->initVSubjectAccalLectorStudentDetails(); $obj2->addVSubjectAccalLectorStudentDetail($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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj3->initVSubjectAccalLectorStudentDetails(); $obj3->addVSubjectAccalLectorStudentDetail($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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj4->initVSubjectAccalLectorStudentDetails(); $obj4->addVSubjectAccalLectorStudentDetail($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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj5->initVSubjectAccalLectorStudentDetails(); $obj5->addVSubjectAccalLectorStudentDetail($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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj6->initVSubjectAccalLectorStudentDetails(); $obj6->addVSubjectAccalLectorStudentDetail($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->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj7->initVSubjectAccalLectorStudentDetails(); $obj7->addVSubjectAccalLectorStudentDetail($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj8->getPrimaryKey() === $obj8->getPrimaryKey()) { $newObject = false; $temp_obj8->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj8->initVSubjectAccalLectorStudentDetails(); $obj8->addVSubjectAccalLectorStudentDetail($obj1); } $omClass = StudentPeer::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->getStudent(); if ($temp_obj9->getPrimaryKey() === $obj9->getPrimaryKey()) { $newObject = false; $temp_obj9->addVSubjectAccalLectorStudentDetail($obj1); break; } } if ($newObject) { $obj9->initVSubjectAccalLectorStudentDetails(); $obj9->addVSubjectAccalLectorStudentDetail($obj1); } $results[] = $obj1; } return $results; }