Example #1
0
 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;
     $c = new Criteria();
     $time = $this->getRequestParameter('time_in');
     $this->daily_visit = VVisitDeptDailyPeer::retrieveByTime($time);
     $c->add(VisitorPeer::CODE, $time, Criteria::IN);
     #$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     #$c->add(VisitorPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $this->sortDetail($c);
     if ($this->getRequest()->hasParameter('filters')) {
         $filters = $this->getRequestParameter('filters');
         if ($this->hasRequestParameter('member_name') && $this->getRequestParameter('member_name') == '') {
             $filters['MEMBER_ID'] = null;
         }
         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->filterDetail($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'visitor'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'visitor');
     $pager = new sfPropelPager('Visitor', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'visitor'));
     $this->getUser()->setAttribute('page', $page, 'visitor');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     array_unshift($actions, array('name' => 'back', 'url' => 'rpt_borang/summary', 'color' => 'green'));
     $this->actions = $actions;
     $this->subtitle = '';
 }