Example #1
0
 public function __construct()
 {
     $employee = new Employee();
     if (!$employee->isLoggedIn()) {
         Redirect::to('employee/login');
     }
 }
Example #2
0
 public function sendMailToAllAction()
 {
     $context = [];
     $employee = new Employee();
     if (!$employee->hasPermission('admin')) {
         Redirect::to('home');
     }
     if (Input::exists()) {
         if (!Token::check(Input::get('token'))) {
             Redirect::to();
         }
         $data = ['subject' => Input::get('subject'), 'body' => Input::get('body')];
         $success = $this->model()->sendMailToAll($data);
         if ($success) {
             Redirect::to('employee');
         } else {
             $context['errors'] = $this->model()->getErrors();
             $context['values'] = $data;
         }
     }
     $context['flash'] = Session::flash('home');
     $context['token'] = Token::generate();
     echo $this->view('employee/sendmailtoall', $context);
 }
 public function deleteAction($id = null, $parent = null)
 {
     if (isset($id) && !empty($id)) {
         if (!Token::check(Input::get('token'))) {
             Redirect::to();
         }
         if (isset($parent) && !empty($parent)) {
             $this->model()->deleteAppointment($id, $parent);
         } else {
             $this->model()->deleteAppointment($id);
         }
         Redirect::to('reservation/confirmation');
     } else {
         http_response_code(404);
         exit("Dude, I think you're lost");
     }
 }