mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-25 09:23:08 +03:00
Events get rendered based on the current user timezone.
This commit is contained in:
parent
1e5a1e59ea
commit
26442a1e17
2 changed files with 18 additions and 4 deletions
|
@ -282,7 +282,13 @@ class Appointments_Model extends CI_Model {
|
|||
. $appointment_id);
|
||||
}
|
||||
|
||||
return $this->db->get_where('ea_appointments', ['id' => $appointment_id])->row_array();
|
||||
$appointment = $this->db->get_where('ea_appointments', ['id' => $appointment_id])->row_array();
|
||||
|
||||
$this->load->model('timezones_model');
|
||||
|
||||
$appointment = $this->timezones_model->convert_event_timezone($appointment);
|
||||
|
||||
return $appointment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,6 +330,10 @@ class Appointments_Model extends CI_Model {
|
|||
throw new Exception('The given field name does not exist in the database: ' . $field_name);
|
||||
}
|
||||
|
||||
$this->load->model('timezones_model');
|
||||
|
||||
$row_data = $this->timezones_model->convert_event_timezone($row_data);
|
||||
|
||||
return $row_data[$field_name];
|
||||
}
|
||||
|
||||
|
@ -348,9 +358,13 @@ class Appointments_Model extends CI_Model {
|
|||
|
||||
$appointments = $this->db->get('ea_appointments')->result_array();
|
||||
|
||||
if ($aggregates)
|
||||
$this->load->model('timezones_model');
|
||||
|
||||
foreach ($appointments as &$appointment)
|
||||
{
|
||||
foreach ($appointments as &$appointment)
|
||||
$appointment = $this->timezones_model->convert_event_timezone($appointment);
|
||||
|
||||
if ($aggregates)
|
||||
{
|
||||
$appointment = $this->get_aggregates($appointment);
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ class Timezones_Model extends CI_Model {
|
|||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function convert_event_datetime($event)
|
||||
public function convert_event_timezone($event)
|
||||
{
|
||||
if ( ! isset($event['start_datetime'], $event['end_datetime'], $event['id_users_provider']))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue