Пример #1
0
 /**
  * Index Page for this controller.
  *
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     if ($this->input->is_ajax_request()) {
         $contacts = $this->Member->all(false, 'id, CONCAT(firstname, " ", lastname) AS name, msisdn');
         $c = [];
         foreach ($contacts as $contact) {
             $c[$contact->msisdn][] = $contact;
         }
         $d = [];
         $i = 0;
         foreach ($c as $msisdn => $cc) {
             $d[$i]['id'] = $msisdn;
             $fullname = [];
             foreach ($cc as $ccc) {
                 $fullname[] = "{$ccc->firstname} {$ccc->lastname}";
             }
             $d[$i]['name'] = implode(",", $fullname);
             $d[$i]['msisdn'] = $msisdn;
             $i++;
         }
         echo json_encode($d);
         exit;
     }
     // $this->Data['contacts'] = $this->Contact->all();
     $this->Data['form']['contacts_list'] = dropdown_list($this->Member->dropdown_list('id, CONCAT(firstname, " ", lastname) AS fullname, msisdn')->result_array(), ['id', 'fullname'], 'No Contacts');
     $this->Data['form']['contacts_json'] = json_encode($this->Member->dropdown_list('id, CONCAT(firstname, " ", lastname) AS fullname, msisdn')->result_array());
     $this->Data['form']['groups_json'] = json_encode($this->Group->dropdown_list('groups_id, groups_name')->result_array());
     $this->Data['form']['templates'] = $this->db->query('SELECT * FROM message_templates')->result();
     $this->load->view('layouts/main', $this->Data);
 }
Пример #2
0
 /**
  * Index Page for this controller.
  *
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->Data['users'] = $this->User->all();
     $this->Data['form']['privileges_list'] = dropdown_list($this->Privilege->dropdown_list('id, name')->result_array(), ['id', 'name'], 'Select One');
     $this->Data['form']['privileges_levels_list'] = dropdown_list($this->PrivilegesLevel->dropdown_list('id, name')->result_array(), ['id', 'name'], 'Select One');
     $this->Data['trash']['count'] = $this->Privilege->get_all(0, 0, null, true)->num_rows();
     $this->load->view('layouts/main', $this->Data);
 }
 /**
  * Index Page for this controller.
  *
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     # Override the default layout, which was `users/privileges` based on the route
     $this->Data['privilegesLevels'] = $this->PrivilegesLevel->all();
     $this->Data['form']['privileges_list'] = dropdown_list($this->PrivilegesLevel->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     $this->Data['form']['modules_list'] = dropdown_list($this->Module->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     $this->Data['form']['modules_list'] = dropdown_list($this->Module->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     $this->Data['trash']['count'] = $this->PrivilegesLevel->get_all(0, 0, null, true)->num_rows();
     $this->load->view('layouts/main', $this->Data);
 }
Пример #4
0
 /**
  * Index Page for this controller.
  *
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->Data['privileges'] = $this->Privilege->all();
     // $this->Data['form']['groups_list'] = dropdown_list($this->Group->dropdown_list('groups_id, groups_name')->result_array(), ['groups_id', 'groups_name'], '', false);
     $this->Data['form']['privileges_list'] = dropdown_list($this->Privilege->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     $this->Data['form']['privileges_levels_list'] = dropdown_list($this->PrivilegesLevel->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     // $this->Data['form']['types_list']  = dropdown_list($this->Type->dropdown_list('types_id, types_name')->result_array(), ['types_id', 'types_name'], '', false);
     $this->Data['trash']['count'] = $this->Privilege->get_all(0, 0, null, true)->num_rows();
     $this->load->view('layouts/main', $this->Data);
 }
Пример #5
0
 public function index()
 {
     $this->Data['trash']['count'] = $this->Schedule->get_all(0, 0, null, true)->num_rows();
     $this->Data['form']['preset_message'] = dropdown_list($this->db->query('SELECT id, name FROM preset_messages WHERE active = 1')->result_array(), ['id', 'name'], '', false);
     // $this->Data['form']['message_template_normal_out'] = dropdown_list($this->MessageTemplate->dropdown_list('id, name, code', 'type', 'NORMAL_OUT')->result_array(), ['id', 'code'], '', false);
     // $this->Data['form']['message_template_early_in'] = dropdown_list($this->MessageTemplate->dropdown_list('id, name, code', 'type', 'EARLY_IN')->result_array(), ['id', 'code'], '', false);
     // $this->Data['form']['message_template_early_out'] = dropdown_list($this->MessageTemplate->dropdown_list('id, name, code', 'type', 'EARLY_OUT')->result_array(), ['id', 'code'], '', false);
     // $this->Data['form']['message_template_late_in'] = dropdown_list($this->MessageTemplate->dropdown_list('id, name, code', 'type', 'LATE_IN')->result_array(), ['id', 'code'], '', false);
     // $this->Data['form']['message_template_late_out'] = dropdown_list($this->MessageTemplate->dropdown_list('id, name, code', 'type', 'LATE_OUT')->result_array(), ['id', 'code'], '', false);
     $this->load->view('layouts/main', $this->Data);
 }
Пример #6
0
 /**
  * Index Page for this controller.
  *
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     if (!$this->Auth->can(['modules', 'modules/', 'modules/listing'])) {
         $this->Data['Headers']->Page = 'errors/403';
         $this->load->view('layouts/errors', $this->Data);
         return false;
     }
     # Override the default layout, which was `users/modules` based on the route
     $this->Data['modules'] = $this->Module->all();
     // $this->Data['form']['groups_list'] = dropdown_list($this->Group->dropdown_list('groups_id, groups_name')->result_array(), ['groups_id', 'groups_name'], '', false);
     $this->Data['form']['modules_list'] = dropdown_list($this->Module->dropdown_list('id, name')->result_array(), ['id', 'name'], '', false);
     // $this->Data['form']['types_list']  = dropdown_list($this->Type->dropdown_list('types_id, types_name')->result_array(), ['types_id', 'types_name'], '', false);
     $this->Data['trash']['count'] = $this->Module->get_all(0, 0, null, true)->num_rows();
     $this->load->view('layouts/main', $this->Data);
 }
Пример #7
0
 /**
  * Export Page for this controller
  * @return [type] [description]
  */
 public function export()
 {
     if (null != $this->input->post('export_start')) {
         $export = $this->Contact->export(false, date('Y-m-d', strtotime($this->input->post('export_start'))), date('Y-m-d', strtotime($this->input->post('export_end') . ' +1 day')), $this->input->post('export_level'));
         /*
         | ---------------------------------------------
         | # Validation
         | ---------------------------------------------
         */
         $result = $this->Contact->export(false, date('Y-m-d', strtotime($this->input->post('export_start'))), date('Y-m-d', strtotime($this->input->post('export_end') . ' +1 day')), $this->input->post('export_level'))->result();
         if (empty($result)) {
             $this->Data['messages']['error'] = 'No Record was found in the Dates or Level specified';
         } else {
             # Export
             #// Load the DB Utility
             $this->load->dbutil();
             switch ($this->input->post('export_format')) {
                 case 'CSV':
                     $CSV = $this->dbutil->csv_from_result($export);
                     $csv_name = 'Contacts_' . date('Y-m-d-H-i') . '.export.csv';
                     force_download($csv_name, $CSV);
                     // $data = array('message' => 'Export was successful', 'type'=>'success');
                     break;
                 case 'SQL':
                     $SQL = $this->dbutil->backup(['tables' => '{PRE}contacts']);
                     $sql_name = 'Contacts_' . date('Y-m-d-H-i') . '.export.zip';
                     force_download($sql_name, $SQL);
                     break;
                 case 'PDF':
                     die('PDF is not available on your user level');
                     break;
                 default:
                     break;
             }
             # Response
             # -- No response yet --
         }
     }
     $this->Data['Headers']->JS .= '<script src="' . base_url('assets/js/specifics/contactsExport.js') . '"></script>';
     $this->Data['form']['levels_list'] = dropdown_list($this->Level->dropdown_list('levels_id, levels_name')->result_array(), ['levels_id', 'levels_name'], 'No Level');
     $this->load->view('layouts/main', $this->Data);
 }