コード例 #1
0
ファイル: actions.class.php プロジェクト: taryono/school
 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');
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeGetClassByAccal()
 {
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($accal);
     $cg_ids = $accal->getClassGroup()->getChildRecurs();
     $c = new Criteria();
     $c->add(ClassGroupPeer::ID, $cg_ids, Criteria::IN);
     $cgs = ClassGroupPeer::doSelectOrdered($c);
     $classes = array();
     foreach ($cgs as $cg) {
         $classes[$cg->getId()] = $cg->toString();
     }
     $this->content = $classes;
     $this->setTemplate('buildOptions');
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: taryono/school
 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;
     $counseling = CounselingPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($counseling);
     $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' => 'counselor/delete?id=' . $counseling->getId(), 'color' => 'red'));
     }
     array_push($actions, array('name' => 'cancel', 'url' => 'counselor/list', 'color' => 'black'));
     $this->subtitle = $counseling->toString() . ' - id:' . $counseling->getId();
     $this->type = 'edit';
     $this->counseling = $counseling;
     $this->actions = $actions;
     $cr = new Criteria();
     $cr->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId(), Criteria::IN);
     $objs = ClassGroupPeer::doSelectOrdered($cr);
     $class_groups = array();
     foreach ($objs as $o) {
         $class_groups[$o->getId()] = $o->toString();
     }
     $this->class_groups = $class_groups;
     $c = new Criteria();
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $c->addJoin(VStudentActivePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(StudentPeer::ID, VStudentActivePeer::ID);
     $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;
     $actions2 = 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);
     }
     $this->actions2 = $actions2;
 }