1: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2:
3: class Backend extends CI_Controller {
4: 5: 6: 7: 8: 9: 10: 11:
12: public function index() {
13:
14:
15: $this->load->model('Providers_Model');
16: $this->load->model('Services_Model');
17: $this->load->model('Settings_Model');
18:
19:
20: $view_data['base_url'] = $this->config->item('base_url');
21: $view_data['company_name'] = $this->Settings_Model->get_setting('company_name');
22: $view_data['available_providers'] = $this->Providers_Model->get_available_providers();
23: $view_data['available_services'] = $this->Services_Model->get_available_services();
24:
25: $this->load->view('backend/header', $view_data);
26: $this->load->view('backend/calendar', $view_data);
27: $this->load->view('backend/footer', $view_data);
28: }
29:
30: public function customers() {
31:
32: }
33:
34: public function services() {
35:
36: }
37:
38: public function providers() {
39:
40: }
41:
42: public function settings() {
43:
44: }
45:
46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57:
58: public function ajax_get_calendar_appointments() {
59: $this->load->model('Appointments_Model');
60: $this->load->model('Providers_Model');
61: $this->load->model('Services_Model');
62: $this->load->model('Customers_Model');
63:
64: if ($_POST['filter_type'] == FILTER_TYPE_PROVIDER) {
65: $where_id = 'id_users_provider';
66: } else {
67: $where_id = 'id_services';
68: }
69:
70: $where_clause = array(
71: $where_id => $_POST['record_id'],
72: 'start_datetime >=' => $_POST['start_date'],
73: 'end_datetime <=' => $_POST['end_date']
74: );
75:
76: $appointments = $this->Appointments_Model->get_batch($where_clause);
77:
78: foreach($appointments as &$appointment) {
79: $appointment['provider'] = $this->Providers_Model
80: ->get_row($appointment['id_users_provider']);
81: $appointment['service'] = $this->Services_Model
82: ->get_row($appointment['id_services']);
83: $appointment['customer'] = $this->Customers_Model
84: ->get_row($appointment['id_users_customer']);
85: }
86:
87: echo json_encode($appointments);
88: }
89: }
90:
91:
92: