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 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 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 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 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 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 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 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'); }