Beispiel #1
0
 public function view_my_expenses()
 {
     $flash = Flash::Instance();
     $employee_id = $this->get_employee_id();
     if (!empty($employee_id)) {
         $this->_templateName = $this->getTemplateName('index');
         $errors = array();
         $s_data = array();
         // Set context from calling module
         $this->setSearch('expenseSearch', 'myExpenses', $s_data);
         unset($this->_templateobject->defaultDisplayFields['person']);
         $he = new ExpenseCollection($this->_templateobject);
         $sh = new SearchHandler($he, false);
         $sh->extract();
         $sh->addConstraint(new Constraint('employee_id', '=', $employee_id));
         parent::index($he, $sh);
         $sidebarlist = array();
         $sidebarlist['new'] = array('tag' => 'New', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'employee_id' => $employee_id));
         $sidebar = new SidebarController($this->view);
         $sidebar->addList('actions', $sidebarlist);
         $this->view->register('sidebar', $sidebar);
         $this->view->set('sidebar', $sidebar);
         $this->view->set('clickaction', 'view');
     } else {
         $flash->addError('You have not been set up as an employee');
         sendBack();
     }
 }
 public function view_my_holiday_requests()
 {
     $flash = Flash::Instance();
     $employee_id = $this->get_employee_id();
     if (!empty($employee_id)) {
         $this->_templateName = $this->getTemplateName('index');
         $hr = new HolidayrequestCollection($this->_templateobject);
         $sh = $this->setSearchHandler($hr);
         $sh->addConstraint(new Constraint('employee_id', '=', $employee_id));
         parent::index($hr, $sh);
         $this->view->set('clickaction', 'view');
     } else {
         $flash->addError('You have not been set up as an employee');
         sendBack();
     }
 }