public function executeGetAcademicCalendars() { $budget_id = $this->getRequestParameter('budget'); $budget = BankAccountPeer::retrieveByPK($budget_id); $this->forward404Unless($budget); $c = new Criteria(); $c->addJoin(AcademicCalenderPeer::ID, ExpenditureJournalPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(CurriculumPeer::DEPARTMENT_ID, BankAccountPeer::DEPARTMENT_ID); $c->add(BankAccountPeer::ID, $bank_account->getId()); if ($bank_account->getDepartmentId()) { $c->add(CurriculumPeer::DEPARTMENT_ID, $bank_account->getDepartment()->getParentRecurs(), Criteria::IN); } $objs = AcademicCalendarPeer::doSelect($c); $ac_calendars = array(); foreach ($objs as $o) { $ac_calendars[$o->getId()] = $o->toString(); } $this->content = $ac_calendars; $this->forward404Unless($ac_calendars); $this->setTemplate('buildOptions'); }
public function executeEdit() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($class_agenda); $this->subtitle = ''; if (sfContext::getInstance()->getUser()->getAttribute('usertype', null, 'bo') == 'lector') { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $this->subtitle = $employee->toString(); $this->employee_id = $employee_id; } $accal_options = array(); $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addDescendingOrderByColumn(AcademicCalendarPeer::CODE); $accals = AcademicCalendarPeer::doSelect($c); foreach ($accals as $accal) { if ($accal->getParent() != null) { $accal_options[$accal->getId()] = '· ' . $accal->toString(); } else { $accal_options[$accal->getId()] = $accal->toString(); } } $this->accal_options = $accal_options; $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'agenda/list', 'color' => 'black')); $this->subtitle = ''; $this->type = 'add'; $this->class_agenda = $class_agenda; $c = new Criteria(); $c->add(SubjectGradingPeer::SUBJECT_CURR_ID, $class_agenda->getCourseSchedule()->getSubjectCurrId(), Criteria::IN); $c->addAscendingOrderByColumn(SubjectGradingPeer::ID); $objs = SubjectGradingPeer::doSelect($c); $grades = array(); foreach ($objs as $o) { $grades[$o->getId()] = $o->getGradeComponent()->toString(); } $this->grades = $grades; $this->selected_grade = $class_agenda->getSubjectGradingId(); $scheds_options = array(); $c = new Criteria(); $c->add(CourseScheduleTutorPeer::EMPLOYEE_ID, $employee_id, Criteria::IN); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $class_agenda->getCourseSchedule()->getAcademicCalendarId(), Criteria::IN); $c->addJoin(CourseSchedulePeer::ID, CourseScheduleTutorPeer::COURSE_SCHEDULE_ID); $c->addJoin(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID); $c->addAscendingOrderByColumn(CourseScheduleDetailPeer::CLASS_SESSION_ID); $csds = CourseScheduleDetailPeer::doSelect($c); foreach ($csds as $csd) { $scheds_options[$csd->getCourseScheduleId()] = $csd->getCourseSchedule()->getSubjectCurr()->getSubject()->getName() . ' # ' . $csd->getCourseSchedule()->getClassGroup()->getName(); } $this->scheds = $scheds_options; $this->selected_sched = $class_agenda->getCourseScheduleId(); $c = new Criteria(); $cton4 = $c->getNewCriterion(StudentAbsencePeer::END, $class_agenda->getDate(), Criteria::IN); $cton3 = $c->getNewCriterion(StudentAbsencePeer::START, $class_agenda->getDate(), Criteria::IN); $cton2 = $c->getNewCriterion(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $class_agenda->getCourseSchedule()->getAcademicCalendarId(), Criteria::IN); $cton1 = $c->getNewCriterion(StudentAbsencePeer::CLASS_GROUP_ID, $class_agenda->getClassGroupId(), Criteria::IN); $cton3->addOr($cton4); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $c->add($cton1); $this->student_absences = StudentAbsencePeer::doSelect($c); $this->stu_count = StudentAbsencePeer::doCount($c); }
public function executeListLedgerAll() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); $course_ids[$subject->getSubjectCurrId()] = $subject->getId(); } $this->subjects = $subjects; $this->course_ids = $course_ids; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); #$cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; $cblek = new Criteria(); $cblek->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $s_accal = StudentAccalPeer::doSelect($cblek); $this->s_accal = $s_accal; $cmiw = new Criteria(); $cmiw->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accals = AcademicCalendarPeer::doSelect($cmiw); $this->accals = $accals; $cq = new Criteria(); $cq->add(AcademicCalendarPeer::COURSE_MODEL, 'A'); $cq->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accal1 = AcademicCalendarPeer::doSelectOne($cq); $this->accal1 = $accal1; $cb = new Criteria(); $cb->add(AcademicCalendarPeer::COURSE_MODEL, 'B'); $cb->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accal2 = AcademicCalendarPeer::doSelectOne($cb); $this->accal2 = $accal2; $cmi = new Criteria(); $cmi->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmi->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $student_habits = StudentHabitPeer::doSelect($cmi); $this->student_habits = $student_habits; $cwi = new Criteria(); $cwi->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cwi->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cwi); $this->c_regulations = $c_regulations; # Menentukan Aturan Penilaian $cd = new Criteria(); #$cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 4); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; #Khusus SMP 9 if ($counseling->getAcademicCalendar()->getDepartmentId() == 11) { ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); #$cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cton1 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, 1, Criteria::IN); $cton2 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, 3, Criteria::IN); $cton1->addOr($cton2); $cm->add($cton1); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); } else { ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); } $this->list_subs = $list_subs; $this->subject_count = $subject_count; $cwe = new Criteria(); $cwe->add(GradeComponentPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId(), Criteria::IN); $cton1 = $cwe->getNewCriterion(GradeComponentPeer::GRADE_SPEC_ID, 20, Criteria::IN); $cton2 = $cwe->getNewCriterion(GradeComponentPeer::PUBLISHED, 1, Criteria::IN); $cton1->addAnd($cton2); $cwe->add($cton1); $this->grade_components = GradeComponentPeer::doSelect($cwe); $this->grade_count = GradeComponentPeer::doCount($cwe); $cmot = new Criteria(); $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID); $cmot->add(StudentPeer::STATUS, 2, Criteria::NOT_EQUAL); $cmot->add(StudentPeer::STATUS, 3, Criteria::NOT_EQUAL); $this->student_count = StudentPeer::doCount($cmot); $c = new Criteria(); $c->addJoin(StudentAccalPeer::STUDENT_ID, StudentPeer::ID); $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $this->sortStudentAccal($c); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student_accal')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student_accal'); $pager = new sfPropelPager('StudentAccal', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_accal')); $this->getUser()->setAttribute('page', $page, 'student_accal'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(); array_unshift($actions, array('name' => 'Print PDF', 'url' => "counseling/listLedgerAllAsPDF?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => 'Print Excel', 'url' => "counseling/listLedgerAllAsCSV?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $actions2 = array(array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'counseling/listByEmployee', 'color' => 'volcadot')); array_push($actions2, array('name' => '<span>Ledger Nilai Raport</span>', 'url' => 'counseling/listLedger?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Ledger Pembiasaan</span>', 'url' => 'counseling/listLedgerHabit?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Ledger Gabungan</span>', 'url' => 'counseling/listLedgerAll?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sky', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Ranking Paralel</span>', 'url' => 'counseling/listParalel?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); $this->actions2 = $actions2; $this->counseling = $counseling; $this->subtitle = $academic_calendar->getName() . ' # Kelas : ' . $counseling->getClassGroup()->toString(); $this->academic_calendar = $academic_calendar; }
public function executeListDetail() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $c = new Criteria(); $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c->addJoin(VStudentActivePeer::ID, StudentAccalPeer::STUDENT_ID); $c->addJoin(StudentPeer::ID, VStudentActivePeer::ID); $c->addAscendingOrderByColumn(StudentPeer::CLASS_NAME); $this->sortStudent($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterStudent($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student'); $pager = new sfPropelPager('Student', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student')); $this->getUser()->setAttribute('page', $page, 'student'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } array_unshift($actions, array('name' => 'back', 'url' => "counseling_hist/list", 'color' => 'black')); $this->actions = $actions; $co = new Criteria(); $co->add(AcademicCalendarPeer::PARENT, $counseling->getAcademicCalendarId()); $co->addAscendingOrderByColumn(AcademicCalendarPeer::ID); $accal_counselings = AcademicCalendarPeer::doSelect($co); $actions2 = array(array('name' => '<span>Laporan Rekap Perwalian</span>', 'url' => 'counseling_hist/list', 'color' => 'sun')); if ($accal_counselings) { foreach ($accal_counselings as $accal_counsel) { if ($accal_counsel->getId() == $academic_calendar->getId()) { array_push($actions2, array('name' => '<span>' . $accal_counsel->toString() . '</span>', 'url' => 'counseling_hist/listDetail?accal_id=' . $accal_counsel->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun', 'type' => 'direct')); } else { array_push($actions2, array('name' => '<span>' . $accal_counsel->toString() . '</span>', 'url' => 'counseling_hist/listDetail?accal_id=' . $accal_counsel->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); } } } else { array_push($actions2, array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'counseling_hist/listDetail?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun', 'type' => 'direct')); } $this->actions2 = $actions2; $this->counseling = $counseling; $this->subtitle = $academic_calendar->toString() . ' # ' . $counseling->getClassGroup()->toString(); $this->academic_calendar = $academic_calendar; }
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(AcademicCalendarPeer::ID, $pks, Criteria::IN); $objs = AcademicCalendarPeer::doSelect($criteria, $con); } return $objs; }
public function getAcademicCalendarsRelatedByParent($criteria = null, $con = null) { include_once 'lib/model/om/BaseAcademicCalendarPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collAcademicCalendarsRelatedByParent === null) { if ($this->isNew()) { $this->collAcademicCalendarsRelatedByParent = array(); } else { $criteria->add(AcademicCalendarPeer::PARENT, $this->getId()); AcademicCalendarPeer::addSelectColumns($criteria); $this->collAcademicCalendarsRelatedByParent = AcademicCalendarPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(AcademicCalendarPeer::PARENT, $this->getId()); AcademicCalendarPeer::addSelectColumns($criteria); if (!isset($this->lastAcademicCalendarRelatedByParentCriteria) || !$this->lastAcademicCalendarRelatedByParentCriteria->equals($criteria)) { $this->collAcademicCalendarsRelatedByParent = AcademicCalendarPeer::doSelect($criteria, $con); } } } $this->lastAcademicCalendarRelatedByParentCriteria = $criteria; return $this->collAcademicCalendarsRelatedByParent; }
public function executeSelectByAccal() { $accal_id = $this->getRequestParameter('academic_calendar_id'); $this->forward404Unless($accal_id); $content = array(); $disabled = array(); $c = new Criteria(); $cton1 = $c->getNewCriterion(AcademicCalendarPeer::ID, $accal_id, Criteria::IN); $cton2 = $c->getNewCriterion(AcademicCalendarPeer::PARENT, $accal_id, Criteria::IN); $cton1->addOr($cton2); $c->add($cton1); $c->addDescendingOrderByColumn(AcademicCalendarPeer::CODE); $objs = AcademicCalendarPeer::doSelect($c); foreach ($objs as $obj) { if ($obj->getParent() != null) { $content[$obj->getId()] = ' . ' . $obj->toString(); } else { $content[$obj->getId()] = $obj->toString(); } } $this->content = $content; $this->disabled = $disabled; }
public function executePreview() { $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; $class_id = $this->getRequestParameter('class_group_id'); $accal_id = $this->getRequestParameter('accal_id'); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $accal_id); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_id); $c->addDescendingOrderByColumn(CourseSchedulePeer::ID); $course_schedules = CourseSchedulePeer::doSelect($c); $counts = CourseSchedulePeer::doCount($c); $actions = array(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); if ($dept->getCourseModel() == Department::CM_TK) { array_push($actions, array('name' => 'selesai', 'url' => 'course_sched/listTK', 'color' => 'black')); } else { array_push($actions, array('name' => 'selesai', 'url' => 'course_sched/list', 'color' => 'black')); } $this->subtitle = ''; $this->type = 'edit'; $this->course_schedules = $course_schedules; $this->counts = $counts; $this->actions = $actions; $this->class_id = $class_id; $this->accal_id = $accal_id; $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $accal_options = array(); $c = new Criteria(); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addDescendingOrderByColumn(AcademicCalendarPeer::CODE); $accals = AcademicCalendarPeer::doSelect($c); foreach ($accals as $accal) { if ($accal->getParent() != null) { $accal_options[$accal->getId()] = ' . ' . $accal->toString(); } else { $accal_options[$accal->getId()] = $accal->toString(); } } $this->accal_options = $accal_options; $class_options = array(); $c = new Criteria(); $c->add(ClassGroupPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addDescendingOrderByColumn(ClassGroupPeer::CODE); $class = ClassGroupPeer::doSelect($c); foreach ($class as $clas) { if ($clas->getParent() != null) { $class_options[$clas->getId()] = ' . ' . $clas->toString(); } else { $class_options[$clas->getId()] = $clas->toString(); } } $this->class_options = $class_options; }
public function executePreview() { $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; $class_id = $this->getRequestParameter('class_group_id'); $accal_id = $this->getRequestParameter('accal_id'); $semester = $this->getRequestParameter('semester'); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $accal_id); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_id); $course_schedules = CourseSchedulePeer::doSelect($c); $counts = CourseSchedulePeer::doCount($c); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); $this->subtitle = ''; $this->type = 'edit'; $this->course_schedules = $course_schedules; $this->counts = $counts; $this->actions = $actions; $this->class_id = $class_id; $this->accal_id = $accal_id; $this->semester = $semester; $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $accal_options = array(); $c = new Criteria(); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addDescendingOrderByColumn(AcademicCalendarPeer::CODE); $accals = AcademicCalendarPeer::doSelect($c); foreach ($accals as $accal) { if ($accal->getParent() != null) { $accal_options[$accal->getId()] = ' . ' . $accal->toString(); } else { $accal_options[$accal->getId()] = $accal->toString(); } } $this->accal_options = $accal_options; $class_options = array(); $c = new Criteria(); $c->add(ClassGroupPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addDescendingOrderByColumn(ClassGroupPeer::CODE); $class = ClassGroupPeer::doSelect($c); foreach ($class as $clas) { if ($clas->getParent() != null) { $class_options[$clas->getId()] = ' . ' . $clas->toString(); } else { $class_options[$clas->getId()] = $clas->toString(); } } $this->class_options = $class_options; $rpp = $this->getRequestParameter('max_per_page', 999); $pager = new sfPropelPager('CourseSchedule', $rpp); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; }
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 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'); $counseling = CounselingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($counseling); $counseling->setId($this->getRequestParameter('id')); $counseling->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $counseling->setClassGroupId($this->getRequestParameter('class_group_id')); $counseling->setEmployeeId($this->getRequestParameter('employee_id')); $counseling->setClassTypeId($this->getRequestParameter('class_type_id')); $counseling->save(); $c = new Criteria(); $c->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId()); CounselingTutorPeer::doDelete($c); $tutors = $this->getRequestParameter('isSelected'); if ($tutors) { foreach ($tutors as $id) { $cr = new CounselingTutor(); $cr->setCounseling($counseling); $cr->setEmployeeId($id); $cr->save(); } } $params = array(); foreach (explode('&', $this->getRequestParameter('student_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('academic_calendar_id')); if (array_key_exists('students', $params)) { foreach ($params['students'] as $stu_id) { $stu = StudentPeer::retrieveByPk($stu_id); $stu->setAcademicCalendarId($counseling->getAcademicCalendarId()); $stu->setClassGroupId($counseling->getClassGroupId()); $stu->save(); $ct = new Criteria(); $ct->add(AcademicCalendarPeer::PARENT, $counseling->getAcademicCalendarId()); $academics = AcademicCalendarPeer::doSelect($ct); if ($academics) { foreach ($academics as $academic) { $cr = new Criteria(); $cr->add(StudentAccalPeer::STUDENT_ID, $stu_id); $cr->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic->getId()); $stu_accal = StudentAccalPeer::doSelectOne($cr); if ($stu_accal == null) { $stu_accal = new StudentAccal(); } $stu_accal->setStudentId($stu_id); $stu_accal->setAcademicCalendarId($academic->getId()); $stu_accal->setClassGroupId($counseling->getClassGroupId()); $stu_accal->setClassName($stu->getClassName()); $stu_accal->setStatus($stu->getStatus()); $stu_accal->save(); } } } } return $this->redirect('counselor/showPreview?id=' . $counseling->getId()); }