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 getAction($id = null) { if (isset($id) && !empty($id)) { $appointment = $this->model()->getAppointment($id); if (!$appointment) { http_response_code(404); exit("No appointment was found by specified id"); } $context = []; $creator = new Employee($appointment->employee_id); $context['creator'] = $creator->data(); if ($appointment->employee_id == $this->employee->data()->id || $this->employee->hasPermission('admin')) { $context['rightToModify'] = true; $context['urlBase'] = URL_BASE; } $context['token'] = Token::generate(); $context['values'] = $appointment; $context['clock'] = Config::get('calendar/clock'); echo $this->view('reservation/get', $context); } else { http_response_code(404); exit("Dude, I think you're lost"); } }