コード例 #1
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeShow()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
     if ($group == 'lector') {
         $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
         $employee = EmployeePeer::retrieveByPK($employee_id);
         if ($employee->getStaffTypeId() == 13 || $employee->getStaffTypeId() == 14) {
             $this->can_add == 0;
             $this->can_edit == 0;
             $this->can_remove == 0;
         }
         $this->employee = $employee;
     } else {
         $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');
         }
     }
     $counseling = VCounselingPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($counseling);
     $this->subtitle = $counseling->toString() . ' - id:' . $counseling->getId();
     $actions = array(array('name' => 'back', 'url' => 'student_finance/list', 'color' => 'black'));
     $this->actions = $actions;
     $this->counseling = $counseling;
     $c = new Criteria();
     $c->add(StudentPeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN);
     $c->add(StudentPeer::STATUS, Student::STATUS_GRADUATE, Criteria::NOT_EQUAL);
     $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'));
     $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;
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeShowByEmployee()
 {
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $counseling = VCounselingPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($counseling);
     $this->subtitle = $counseling->toString() . ' - id:' . $counseling->getId();
     $actions = array(array('name' => 'back', 'url' => 'counseling_menu/listAbsence?employee_id=' . $employee_id, 'color' => 'black'));
     $this->actions = $actions;
     $this->counseling = $counseling;
     $c = new Criteria();
     $c->add(VStudentActivePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN);
     $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'));
     $this->actions2 = $actions2;
 }