public static function doSelectFiltered(Criteria $criteria, $con = null) { $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $criteria->add(VClassPeer::DEPARTMENT_ID, $depts, Criteria::IN); $criteria->addAscendingOrderByColumn(VClassPeer::NAME); return VClassPeer::doSelect($criteria); }
public function executeCreate() { $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; $this->payment_student = new PaymentJournal(); $class_options = array(); $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(VClassPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addAscendingOrderByColumn(VClassPeer::NAME); $accals = VClassPeer::doSelect($c); foreach ($accals as $accal) { $class_options[$accal->getId()] = $accal->toString(); } $this->class_options = $class_options; $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'payment_student/list', 'color' => 'black')); $this->subtitle = ''; $this->type = 'add'; $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $this->academic_costs = array(); $c = new Criteria(); $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addJoin(AcademicCalendarPeer::ID, VAcademicCostPeer::ACADEMIC_CALENDAR_ID); $costs = VAcademicCostPeer::doSelect($c); foreach ($costs as $cost) { $academic_costs[$cost->getId()] = $cost->toStringCap(); } $this->academic_costs = $academic_costs; $this->students = array(); $this->selected_student = ''; $cr = new Criteria(); $cr->addAscendingOrderByColumn(MonthPeer::ID); $this->months = MonthPeer::doSelect($cr); $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
public function executeEditCounseling() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $class_options = array(); $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(VClassPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addAscendingOrderByColumn(VClassPeer::NAME); $classes = VClassPeer::doSelect($c); foreach ($classes as $clas) { $class_options[$clas->getId()] = $clas->getName(); } $this->class_options = $class_options; $class_counseling = ClassCounselingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($class_counseling); if ($class_counseling->getCourseSchedule()->getAcademicCalendar()->getCourseModel() == 'A') { $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'course_counseling/listByEmployee', 'color' => 'black')); } else { $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'course_counseling/listByEmployee2', 'color' => 'black')); } $dept = $this->getContext()->getUser()->getAttribute('department_id', null, 'bo'); $cr = new Criteria(); $cr->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept); $cr->add(AcademicCalendarPeer::COURSE_MODEL, 'C'); $cr->add(AcademicCalendarPeer::CURR_SYSTEM_ID, 1); $parent = AcademicCalendarPeer::doSelectOne($cr); $cw = new Criteria(); $cw->add(AcademicCalendarPeer::PARENT, $parent->getId()); $cw->add(AcademicCalendarPeer::COURSE_MODEL, 'A'); $cw->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept); $child = AcademicCalendarPeer::doSelectOne($cw); if ($class_counseling->getCourseSchedule()->getAcademicCalendar()->getCourseModel() == 'A') { $actions2 = array(array('name' => '<span>Semester 1, ' . $parent->getName() . '</span>', 'url' => 'course_counseling/listByEmployee', 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Semester 2, ' . $parent->getName() . '</span>', 'url' => 'course_counseling/listByEmployee2', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Riwayat Konseling</span>', 'url' => 'course_counseling/listHistoryClass', 'color' => 'volcadot')); } else { $actions2 = array(array('name' => '<span>Semester 1, ' . $parent->getName() . '</span>', 'url' => 'course_counseling/listByEmployee', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Semester 2, ' . $parent->getName() . '</span>', 'url' => 'course_counseling/listByEmployee2', 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Riwayat Konseling</span>', 'url' => 'course_counseling/listHistoryClass', 'color' => 'volcadot')); } $this->accal = $class_counseling->getCourseSchedule()->getAcademicCalendarId(); $this->actions2 = $actions2; $this->employee = $employee; $students = array(); $c = new Criteria(); $c->add(VStudentActivePeer::CLASS_GROUP_ID, $class_counseling->getClassGroupId(), Criteria::IN); $c->addAscendingOrderByColumn(VStudentActivePeer::NAME); $studes = VStudentActivePeer::doSelect($c); foreach ($studes as $stu) { $students[$stu->getId()] = $stu->getName(); } $this->students = $students; $courses = array(); $ct = new Criteria(); $ct->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_counseling->getClassGroupId(), Criteria::IN); $ct->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $this->accal, Criteria::IN); $ct->addAscendingOrderByColumn(CourseSchedulePeer::ID); $objs = CourseSchedulePeer::doSelect($ct); foreach ($objs as $o) { $c = new Criteria(); $c->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $o->getId()); $cst = CourseScheduleTutorPeer::doSelect($c); $tutors = array(); foreach ($cst as $cr) { $tutors[] = $cr->getEmployee() ? $cr->getEmployee()->getName() : '-'; } $courses[$o->getId()] = $o->getSubjectCurr()->getSubject()->getName() . ' # ' . join("‚", $tutors); } $this->courses = $courses; $this->subtitle = $class_counseling->getStudent()->toString() . ' - ' . $class_counseling->getId(); $this->class_counseling = $class_counseling; }
public function getVClasssRelatedByParent($criteria = null, $con = null) { include_once 'lib/model/om/BaseVClassPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collVClasssRelatedByParent === null) { if ($this->isNew()) { $this->collVClasssRelatedByParent = array(); } else { $criteria->add(VClassPeer::PARENT, $this->getId()); VClassPeer::addSelectColumns($criteria); $this->collVClasssRelatedByParent = VClassPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(VClassPeer::PARENT, $this->getId()); VClassPeer::addSelectColumns($criteria); if (!isset($this->lastVClassRelatedByParentCriteria) || !$this->lastVClassRelatedByParentCriteria->equals($criteria)) { $this->collVClasssRelatedByParent = VClassPeer::doSelect($criteria, $con); } } } $this->lastVClassRelatedByParentCriteria = $criteria; return $this->collVClasssRelatedByParent; }
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(VClassPeer::ID, $pks, Criteria::IN); $objs = VClassPeer::doSelect($criteria, $con); } return $objs; }
public function executeEditByEmployee() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, 'absence/listByEmployee'); $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; $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $student_absence = StudentAbsencePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_absence); $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' => 'absence/deleteByEmployee?id=' . $student_absence->getId() . '&employee_id=' . $employee_id, 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'absence/listByEmployee?employee_id=' . $employee_id, 'color' => 'white')); $this->subtitle = $student_absence->toString() . ' - id:' . $student_absence->getId(); $this->type = 'edit'; $this->student_absence = $student_absence; $this->actions = $actions; $class_options = array(); $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(VClassPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addAscendingOrderByColumn(VClassPeer::NAME); $accals = VClassPeer::doSelect($c); foreach ($accals as $accal) { $class_options[$accal->getId()] = $accal->toString(); } $this->class_options = $class_options; $c = new Criteria(); $c->add(StudentPeer::CLASS_GROUP_ID, $student_absence->getClassGroupId()); $objs = StudentPeer::doSelect($c); $students = array(); foreach ($objs as $o) { $students[$o->getId()] = $o->toString(); } $this->students = $students; }