public function download($id) { if (!$this->user->is_group('admin')) { set_message_note($this->lang->line('error_invalid_access'), MESSAGE_NOTE_FAILURE); redirect('admin/home'); } $this->load->library('database_manager'); $files = $this->database_manager->get_backup_file_list(); foreach ($files as $file) { if ($file->id == $id) { $fp = fopen($file->get_filename(), 'r'); if ($fp) { $fileSize = filesize($file->get_filename()); header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Length: ' . $fileSize); header('Content-Type: application/gz'); header('Content-disposition: attachment; filename=' . $file->name); header("Content-Transfer-Encoding: binary"); while (!feof($fp)) { print fread($fp, 2048); } fclose($fp); } } } }
public function toolbar_save() { if ($this->form_validation->run()) { if ($this->_row->id == 0) { $id = $this->park_model->add_row($this->_row); $this->park_model->load_by_id($id); set_message_note($this->lang->line('success_add'), MESSAGE_NOTE_SUCCESS); } else { $this->park_model->update_row($this->_row); $point_ids = $this->input->post('point_id'); foreach ($point_ids as $point_id) { $this->park_point_model->load_by_id($point_id); $row = array('type' => $this->input->post('point_type')[$point_id], 'title' => $this->input->post('point_title')[$point_id], 'pos_x' => $this->input->post('point_pos_x')[$point_id], 'pos_y' => $this->input->post('point_pos_y')[$point_id]); if ($row['type'] == '0') { $row['type'] = ''; } $this->park_point_model->update_row($row, $point_id); } set_message_note($this->lang->line('success_save'), MESSAGE_NOTE_SUCCESS); } return TRUE; } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } return FALSE; }
protected function _save_user($input_row) { if ($this->form_validation->run()) { $rows = $this->register_model->get_rows(array('username' => $this->db->escape($input_row->username))); if (count($rows) == 0) { } print_r($rows); } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } }
protected function _save() { if ($this->form_validation->run()) { $this->reply_status_model->update_row($this->_row, $this->staff_model->id); set_message_note($this->lang->line('success_save'), MESSAGE_NOTE_SUCCESS); return true; } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } return false; }
function bday_save() { $this->load->model('sysconf_model'); $mytextarea = $_POST['mytextarea']; $data = array('bday_template' => $mytextarea); $bday_temp = $this->sysconf_model->get_bday(); if ($bday_temp != false) { $this->sysconf_model->update_bday($data); } else { $this->sysconf_model->insert_bday($data); } set_message_note('Birthday greeting set successfully', MESSAGE_NOTE_SUCCESS); redirect('admin/home/bday_template'); }
public function index() { $this->set_output_mode(self::OUTPUT_NORMAL); $this->load->helper(array('form')); $this->load->library(array('form_validation')); $this->load->language('admin/login'); $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); $data = array('error_message' => ''); if ($this->form_validation->run() == true) { $this->load->model('user_model'); $username = $this->form_validation->set_value('username'); $password = $this->form_validation->set_value('password'); if ($this->login_session->login($username, $password, 'Admin')) { redirect('admin/home'); } else { $data = array(); set_message_note($this->lang->line('error_invalid_access'), MESSAGE_NOTE_FAILURE); } } $this->load->view('admin/login', $data); }
public function toolbar_upgrade() { $result = ''; $checkid = form_checkids_id_value(); if ($checkid) { $files = $this->database_manager->get_upgrade_file_list(); foreach ($files as $file) { if ($file->name == $checkid) { $result = $this->database_manager->execute($file); if ($result) { set_message_note($this->lang->line('success_upgarde'), MESSAGE_NOTE_SUCCESS); } else { set_message_note($this->database_manager->get_error()->message, MESSAGE_NOTE_WARNING); } break; } } } else { set_message_note($this->lang->line('error_no_check_id', 'upgrade'), MESSAGE_NOTE_WARNING); } // redirect(uri_string()); }
protected function _save() { //var_dump($_POST); exit; if ($this->form_validation->run()) { $autocall_confirm = isset($_POST['autocall_confirm']) ? $_POST['autocall_confirm'] : 'False'; $autocall_time = isset($_POST['autocall_time']) ? $_POST['autocall_time'] : '0'; $check_in_alert = isset($_POST['check_in_alert']) ? $_POST['check_in_alert'] : 'False'; $check_out_alert = isset($_POST['check_out_alert']) ? $_POST['check_out_alert'] : 'False'; $sop_alert = isset($_POST['sop_alert']) ? $_POST['sop_alert'] : 'False'; $sop_alert_sms = isset($_POST['sop_alert_sms']) ? $_POST['sop_alert_sms'] : 'False'; $autoleave_plan_call = isset($_POST['autoleave_plan_call']) ? $_POST['autoleave_plan_call'] : 'False'; $call_gaurdhouse = isset($_POST['call_gaurdhouse']) ? $_POST['call_gaurdhouse'] : 'False'; $sys_timezone = isset($_POST['sys_timezone']) ? $_POST['sys_timezone'] : '1'; $ofc_number = isset($_POST['ofc_number']) ? $_POST['ofc_number'] : ''; $data = array('call_gaurdhouse' => $call_gaurdhouse, 'autoleave_plan_call' => $autoleave_plan_call, 'sop_alert_sms' => $sop_alert_sms, 'sop_alert' => $sop_alert, 'check_out_alert' => $check_out_alert, 'check_in_alert' => $check_in_alert, 'autocall_time' => $autocall_time, 'autocall_confirm' => $autocall_confirm, 'sys_timezone' => $sys_timezone, 'ofc_number' => $ofc_number); $this->sysconf_model->updateSysConf($data, array('id' => $this->sysconf_model->id)); // $this->_save_assignment_rows(); set_message_note($this->lang->line('success_save'), MESSAGE_NOTE_SUCCESS); return true; } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } return false; }
public function toolbar_request_attendance() { require_once APPPATH . '/controllers/admin/staff_call' . EXT; $ids = form_checkids_ids('assignment_check_id'); if (count($ids) == 0) { set_message_note($this->lang->line('error_no_staff_check_id', 'request attendance'), MESSAGE_NOTE_WARNING); } $this->load->library('staff_phone_manager'); $staff_ins = new Staff_call(); //var_dump($ids); //exit; foreach ($ids as $id) { $this->staff_assignment_model->load_by_id($id); $next_shift = $this->_get_next_shift_date_time($this->staff_assignment_model->staff_id, $this->staff_assignment_model->site_id, $this->staff_assignment_model->shift_type); // var_dump($next_shift); exit; if ($next_shift) { if ($next_shift->call_type != 'Voice') { $this->staff_phone_manager->request_attendance($next_shift->staff_id, $next_shift->site_id, $next_shift->schedule_id, $next_shift->shift_type, $next_shift->start_time, $next_shift->call_type); } else { $res = $staff_ins->Random_Call($next_shift->staff_id, $next_shift->schedule_id); } } } redirect(uri_string()); jquery_tab_set_tab_index(2); }
protected function _save() { if ($this->form_validation->run()) { if ($this->_row->password and $this->_row->password != 'password') { $this->_row->password = $this->login_session->encrypt_password($this->_row->username, $this->_row->password); } else { unset($this->_row->password); } $this->user_model->update_row($this->_row); set_message_note($this->lang->line('success_save'), MESSAGE_NOTE_SUCCESS); } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } }
public function toolbar_remove_staff() { $ids = form_checkids_ids('assignment_check_id'); if (count($ids) == 0) { set_message_note($this->lang->line('error_no_staff_check_id', 'delete'), MESSAGE_NOTE_WARNING); } foreach ($ids as $id) { $this->staff_assignment_model->delete_id($id); } jquery_tab_set_tab_index(2); }
public function activate($ref) { $this->load->model('participant_model', 'company_model'); $this->form_validation->set_rules('new_password', 'new password', 'required|min_length[6]'); $this->form_validation->set_rules('new_password_again', 'new password again', 'required|min_length[6]'); if ($this->form_validation->run() == true) { $row = $this->form_validation->get_input_row(); if ($row->new_password == $row->new_password_again) { if ($user_row = $this->_activate_account($ref, $row->new_password)) { if ($user_row->owner_type == 'Participant') { $participant_row = $this->participant_model->get_row_by_id($user_row->owner_id); if ($participant_row) { if ($participant_row->status == 'Register') { $this->participant_model->set_status('Active', $participant_row->id); } } } set_message_note($this->lang->line('success_activation'), MESSAGE_NOTE_SUCCESS); if ($this->login_session->login($user_row->username, $row->new_password, 'User')) { if ($user_row->owner_type == 'Participant') { redirect('participant'); } redirect('company'); } redirect(''); } else { set_message_note($this->lang->line('error_activation'), MESSAGE_NOTE_WARNING); } } else { set_message_note($this->lang->line('error_activation_password_mismatch'), MESSAGE_NOTE_WARNING); } } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } $data = array(); $this->load->view('login_activation', $data); }
public function toolbar_send() { $checkid = $this->get_checkids(); //var_dump($checkid);exit; if ($checkid) { $this->send_message($checkid); } else { set_message_note($this->lang->line('error_no_check_id', 'Send'), MESSAGE_NOTE_WARNING); } }
protected function _call() { if ($this->form_validation->run()) { $staff_id = $_POST['staff_id']; $message = $_POST['text_msg']; $twilio_det = $this->twilio_model->get_row(); $twilio_number = $twilio_det->twilio_number; $twilio_sid = $twilio_det->twilio_sid; $twilio_token = $twilio_det->twilio_token; $client = new Services_Twilio($twilio_sid, $twilio_token); foreach ($staff_id as $id) { $str = '<Response> <Say voice="alice">Hello, This is an announcement call.</Say><Pause length="2"/><Say>' . $message . '</Say><Pause length="2"/><Say>Thank you.</Say> </Response>'; //echo 'http://twimlets.com/echo?Twiml=' . urlencode($str); exit; $staff_number = $this->staff_model->getNumber($id); try { $call = $client->account->calls->create($twilio_number, '+' . $staff_number, 'http://twimlets.com/echo?Twiml=' . urlencode($str), array('Timeout' => '120', 'Record' => 'false')); } catch (Exception $e) { echo 'Error starting phone call: ' . $e->getMessage() . "\n"; exit; } //$this->staff_phone_manager->send_sms_message($staff_number,$message); } set_message_note('Announcement call for staff is initiated.', MESSAGE_NOTE_SUCCESS); return true; } else { set_message_note($this->form_validation->error_string(), MESSAGE_NOTE_WARNING); } return false; }
public function import_attexcel() { $this->load->library('upload'); $this->load->helper('file'); $rootpath = $_SERVER['DOCUMENT_ROOT'] . '/uploads/staff/'; $config['upload_path'] = $rootpath; $config['allowed_types'] = 'xls|xlsx'; $config['max_size'] = '1000'; $this->upload->initialize($config); echo $this->upload->file_type; if (!$this->upload->do_upload('file')) { set_message_note($this->upload->display_errors(), MESSAGE_NOTE_FAILURE); } else { require_once APPPATH . '/libraries/PHPExcel.php'; require_once APPPATH . '/libraries/PHPExcel/IOFactory.php'; $upload_data = $this->upload->data(); //Returns array of containing all of the data related to the file you uploaded. $file_name = $upload_data['file_name']; $inputFileType = PHPExcel_IOFactory::identify($rootpath . $file_name); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($config['upload_path'] . $file_name); $objWorksheet = $objPHPExcel->setActiveSheetIndex(0); $highestRow = $objWorksheet->getHighestRow(); $checksite_name = $objWorksheet->getCellByColumnAndRow(0, 1)->getValue(); $checkstaff_code = $objWorksheet->getCellByColumnAndRow(1, 1)->getValue(); $checkdate = $objWorksheet->getCellByColumnAndRow(2, 1)->getValue(); $checkshift = $objWorksheet->getCellByColumnAndRow(3, 1)->getValue(); $checkintime = $objWorksheet->getCellByColumnAndRow(4, 1)->getValue(); $checkout_time = $objWorksheet->getCellByColumnAndRow(5, 1)->getValue(); $checkhours = $objWorksheet->getCellByColumnAndRow(6, 1)->getValue(); $checkstatus = $objWorksheet->getCellByColumnAndRow(7, 1)->getValue(); if (strtolower($checksite_name) !== "site") { set_message_note('site field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkstaff_code) !== "code") { set_message_note('code field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkdate) !== "date") { set_message_note('date field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkshift) !== "shift") { set_message_note('shift field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkintime) !== "in time") { set_message_note('In time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkout_time) !== "out time") { set_message_note('Out time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkhours) !== "hours") { set_message_note('Out time field is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } if (strtolower($checkstatus) !== "status") { set_message_note('status is not present in excel sheet', MESSAGE_NOTE_FAILURE); redirect('admin/attendance/import'); exit; } $err = ''; $scnt = 0; for ($i = 2; $i <= $highestRow; $i++) { $site_name = $objWorksheet->getCellByColumnAndRow(0, $i)->getValue(); $staff_code = $objWorksheet->getCellByColumnAndRow(1, $i)->getValue(); $att_date = $objWorksheet->getCellByColumnAndRow(2, $i)->getValue(); $att_shift = $objWorksheet->getCellByColumnAndRow(3, $i)->getValue(); $att_intime = $objWorksheet->getCellByColumnAndRow(4, $i)->getValue(); $att_out_time = $objWorksheet->getCellByColumnAndRow(5, $i)->getValue(); $att_hours = $objWorksheet->getCellByColumnAndRow(6, $i)->getValue(); $att_status = $objWorksheet->getCellByColumnAndRow(7, $i)->getValue(); $filter = filter_load('filter', array('id' => $staff_code, 'is_published' => 'True')); $existstaff = $this->staff_model->get_row_count($filter); $existsite = $this->site_model->checkcode($site_name); // var_dump($existstaff); if ($existstaff != false && $existsite != false && $att_date != '' && $att_shift != '' && (strtolower($att_status) == 'p' || strtolower($att_status) == 'a')) { //check staff site assignment in roster against the date provided $filter_sch = filter_load('filter', array('staff_id' => $staff_code, 'site_id' => $existsite[0]->id, 'start_date' => date('Y-m-d', strtotime($att_date)), 'shift_type' => $att_shift)); $is_sch = $this->schedule_model->get_row_count($filter_sch); if ($is_sch > 0) { $data = array('site_id' => $existsite[0]->id, 'staff_id' => $staff_code, 'att_date' => date('Y-m-d', strtotime($att_date)), 'att_in' => $att_intime, 'att_out' => $att_out_time, 'att_hours' => $att_hours, 'att_shift' => $att_shift, 'att_status' => $att_status); //var_dump($data); $this->attendance_model->insert($data); $scnt = $scnt + 1; } } else { $err .= ' Check staff or site or date or shift. Make sure status must be "P" or "A" at row number ' . $i . '<br/>'; } } if ($scnt > 0) { set_message_note($scnt . ' rows imported successfully'); } if (!empty($err)) { set_message_note($err, MESSAGE_NOTE_FAILURE); } } //exit; redirect('admin/attendance/import'); exit; }
public function staffurl_save() { $staff_url = $this->input->post('staff_url'); $data = array('staff_url' => $staff_url); $this->twilio_model->updateurl($data); set_message_note($this->lang->line('success_save'), MESSAGE_NOTE_SUCCESS); // echo $sop_url;exit; $this->getStaffData($staff_url); redirect('admin/staff'); return true; }