diff --git a/src/application/controllers/backend.php b/src/application/controllers/backend.php index 8994b34f..6cc1ca3f 100644 --- a/src/application/controllers/backend.php +++ b/src/application/controllers/backend.php @@ -27,8 +27,12 @@ class Backend extends CI_Controller { $this->load->model('customers_model'); $this->load->model('settings_model'); $this->load->model('roles_model'); + $this->load->model('user_model'); + $this->load->model('secretaries_model'); $view['base_url'] = $this->config->item('base_url'); + $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['active_menu'] = PRIV_APPOINTMENTS; $view['book_advance_timeout'] = $this->settings_model->get_setting('book_advance_timeout'); $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['available_providers'] = $this->providers_model->get_available_providers(); @@ -36,6 +40,13 @@ class Backend extends CI_Controller { $view['customers'] = $this->customers_model->get_batch(); $this->setUserData($view); + if ($this->session->userdata('role_slug') == DB_SLUG_SECRETARY) { + $secretary = $this->secretaries_model->get_row($this->session->userdata('user_id')); + $view['secretary_providers'] = $secretary['providers']; + } else { + $view['secretary_providers'] = array(); + } + if ($appointment_hash != '') { $results = $this->appointments_model->get_batch(array('hash' => $appointment_hash)); $appointment = $results[0]; @@ -63,8 +74,11 @@ class Backend extends CI_Controller { $this->load->model('customers_model'); $this->load->model('services_model'); $this->load->model('settings_model'); + $this->load->model('user_model'); $view['base_url'] = $this->config->item('base_url'); + $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['active_menu'] = PRIV_CUSTOMERS; $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['customers'] = $this->customers_model->get_batch(); $view['available_providers'] = $this->providers_model->get_available_providers(); @@ -92,8 +106,11 @@ class Backend extends CI_Controller { $this->load->model('customers_model'); $this->load->model('services_model'); $this->load->model('settings_model'); + $this->load->model('user_model'); $view['base_url'] = $this->config->item('base_url'); + $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['active_menu'] = PRIV_SERVICES; $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['services'] = $this->services_model->get_batch(); $view['categories'] = $this->services_model->get_all_categories(); @@ -120,8 +137,11 @@ class Backend extends CI_Controller { $this->load->model('admins_model'); $this->load->model('services_model'); $this->load->model('settings_model'); + $this->load->model('user_model'); $view['base_url'] = $this->config->item('base_url'); + $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['active_menu'] = PRIV_USERS; $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['admins'] = $this->admins_model->get_batch(); $view['providers'] = $this->providers_model->get_batch(); @@ -154,6 +174,8 @@ class Backend extends CI_Controller { $user_id = $this->session->userdata('user_id'); $view['base_url'] = $this->config->item('base_url'); + $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['active_menu'] = PRIV_SYSTEM_SETTINGS; $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['role_slug'] = $this->session->userdata('role_slug'); $view['system_settings'] = $this->settings_model->get_settings(); diff --git a/src/application/models/roles_model.php b/src/application/models/roles_model.php index 955522ef..6555145c 100644 --- a/src/application/models/roles_model.php +++ b/src/application/models/roles_model.php @@ -39,10 +39,10 @@ class Roles_Model extends CI_Model { $privileges_number = $value; $value = array( - 'view' => false, - 'add' => false, - 'edit' => false, - 'delete' => false + 'view' => FALSE, + 'add' => FALSE, + 'edit' => FALSE, + 'delete' => FALSE ); if ($privileges_number > 0) { diff --git a/src/application/models/user_model.php b/src/application/models/user_model.php index 53a2173e..ed85d31d 100644 --- a/src/application/models/user_model.php +++ b/src/application/models/user_model.php @@ -89,6 +89,19 @@ class User_Model extends CI_Model { return ($user_data) ? $user_data : NULL; } + + /** + * Get the given user's display name (first + last name). + * + * @param numeric $user_id The given user record id. + * @return string Returns the user display name. + */ + public function get_user_display_name($user_id) { + if (!is_numeric($user_id)) + throw new Exception ('Invalid argument given ($user_id = "' . $user_id . '").'); + $user = $this->db->get_where('ea_users', array('id' => $user_id))->row_array(); + return $user['first_name'] . ' ' . $user['last_name']; + } } /* End of file user_model.php */ diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 2b94fde3..8ef2ea61 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -272,8 +272,8 @@