mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Refactored the get_available_providers method.
This commit is contained in:
parent
7dbe929218
commit
0dc88a85a9
3 changed files with 600 additions and 588 deletions
|
@ -62,6 +62,17 @@ class Appointments extends CI_Controller {
|
|||
$company_name = $this->settings_model->get_setting('company_name');
|
||||
$date_format = $this->settings_model->get_setting('date_format');
|
||||
|
||||
// Remove the data that are not needed inside the $available_providers array.
|
||||
foreach ($available_providers as $index=>$provider) {
|
||||
$stripped_data = array(
|
||||
'id' => $provider['id'],
|
||||
'first_name' => $provider['first_name'],
|
||||
'last_name' => $provider['last_name'],
|
||||
'services' => $provider['services']
|
||||
);
|
||||
$available_providers[$index] = $stripped_data;
|
||||
}
|
||||
|
||||
// If an appointment hash is provided then it means that the customer
|
||||
// is trying to edit a registered appointment record.
|
||||
if ($appointment_hash !== ''){
|
||||
|
|
|
@ -259,21 +259,6 @@ class Backend extends CI_Controller {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user data in order to be available at the view and js code.
|
||||
*
|
||||
* @param array $view Contains the view data.
|
||||
*/
|
||||
public function set_user_data(&$view) {
|
||||
$this->load->model('roles_model');
|
||||
|
||||
// Get privileges
|
||||
$view['user_id'] = $this->session->userdata('user_id');
|
||||
$view['user_email'] = $this->session->userdata('user_email');
|
||||
$view['role_slug'] = $this->session->userdata('role_slug');
|
||||
$view['privileges'] = $this->roles_model->get_privileges($this->session->userdata('role_slug'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will update the installation to the latest available
|
||||
* version in the server. IMPORTANT: The code files must exist in the
|
||||
|
@ -301,6 +286,21 @@ class Backend extends CI_Controller {
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user data in order to be available at the view and js code.
|
||||
*
|
||||
* @param array $view Contains the view data.
|
||||
*/
|
||||
private function set_user_data(&$view) {
|
||||
$this->load->model('roles_model');
|
||||
|
||||
// Get privileges
|
||||
$view['user_id'] = $this->session->userdata('user_id');
|
||||
$view['user_email'] = $this->session->userdata('user_email');
|
||||
$view['role_slug'] = $this->session->userdata('role_slug');
|
||||
$view['privileges'] = $this->roles_model->get_privileges($this->session->userdata('role_slug'));
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file backend.php */
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue