public function detail() { // Form validation $this->form_validation->onlyGet(); $this->form_validation->allRequest(); $this->formCheck(); // Receiving parameter $id = (int) t_Request('id'); // Business logic if (!is_int($id) || $id <= 0) { resDie('id should be integer'); } $this->mLoadModel('staff_group_model'); $staff = $this->staff_group_model->get_staff_group_by_id($id); // Response resOk($staff); }
public function get_data_for_holder() { // Form validation $this->form_validation->allRequest(); $this->form_validation->set_rules('txt_table_id', 'required|numeric'); $this->form_validation->set_rules('txt_product_id', 'required|numeric'); $this->formcheck(); // Receiving parameter $Data = array(); $Data['table_id'] = t_Request('txt_table_id'); $Data['product_id'] = t_Request('txt_product_id'); // Business logic $dataLIst = $this->root_badge_model->getAllWithRelationForHolder($Data); // response if (!$dataLIst) { resdie(array(), "can not get data"); } resOk($dataLIst); }
public function getCurrentAccessToken() { $current_access_token = t_Request('txt_access_token'); if ($current_access_token == "") { $headers = apache_request_headers(); if (@$headers["Authorization"] != "") { $Bearer_str = @$headers["Authorization"]; $Bearer_str = trimSpaceBarBetweenWord(@$Bearer_str); $Bearer_str_array = explode(" ", $Bearer_str); if (strtolower(trim($Bearer_str_array[0])) == "bearer") { $Bearer_access_token = trim(@$Bearer_str_array[1]); if ($Bearer_access_token != "") { $current_access_token = $Bearer_access_token; } } } } if ($current_access_token == "") { $current_access_token = $this->getAccessTokenFromCookie(); } return trim($current_access_token); }
function t_GetInt($string) { return intval(t_Request($string)); }
public function detail() { // Form validation $this->form_validation->onlyGet(); $this->form_validation->allRequest(); $this->formCheck(); // Receiving parameter $id = (int) t_Request('id'); // Business logic if (!is_int($id) || $id <= 0) { resDie('id should be integer'); } $this->mLoadModel('table_model'); $this->mLoadModel('customer_mathto_customer_group_model'); $this->mLoadModel('customer_model'); $table_id = $this->table_model->get_table_id('customer'); $customer = $this->customer_model->get_customer_by_id($table_id, $id); $customer['groups'] = $this->customer_mathto_customer_group_model->get_customers($id); // Response resOk($customer); }
public function getshortdatabyid() { // authentication none // Form validation $this->form_validation->allRequest(); $this->form_validation->set_rules('txt_promotion_id', 'required|numeric'); $this->formcheck(); // Receiving parameter $promotion_id = t_Request('txt_promotion_id'); // Business logic $dataLIst = $this->root_promotion_model->getShortDataById($promotion_id); // response if (!$dataLIst) { resdie(array(), 'can not get promotion_row data'); } resok($dataLIst); }
public function upload_image() { $this->load->library("form_validation"); $this->form_validation->onlyPost(); $this->form_validation->set_rules("txt_name", "required|trim"); $this->form_validation->requireFile('txt_file'); $this->formCheck(); $txt_name = t_Request("txt_name"); //$dataSend["FILES"] = $_FILES; $this->load->model("root_image_model"); $uploadData = $this->root_image_model->uploadWithData('txt_file', array("title" => $txt_name)); /* foreach ($uploadData["successFiles"] as $key => $value) { if(@$value["db_file_id"]!=""){ $this->root_image_model->updateDataById($value["db_file_id"],array("title"=>$txt_name)); } } */ $this->logSave(); resOk($uploadData); }
public function rotate() { $this->load->library('form_validation'); $this->form_validation->onlyPost(); $this->form_validation->set_rules('txt_image_id', 'trim|required|numeric'); $this->form_validation->set_rules('txt_rotate_degree', 'trim|required|numeric'); $this->formCheck(); $txt_image_id = t_Request("txt_image_id"); $txt_rotate_degree = t_Request("txt_rotate_degree"); $this->load->model("root_image_model"); $result = $this->root_image_model->rotateImageById($txt_image_id, $txt_rotate_degree); resOk($result); }
public function detail() { // Form validation $this->form_validation->onlyGet(); $this->form_validation->allRequest(); $this->formCheck(); // Receiving parameter $id = (int) t_Request('id'); // Business logic if (!is_int($id) || $id <= 0) { resDie('id should be integer'); } $this->mLoadModel('customer_group_model'); $this->mLoadModel('customer_mathto_customer_group_model'); $this->mLoadModel('customer_model'); $this->mLoadModel('table_model'); $this->mLoadModel('image_model'); $customer_group = $this->customer_group_model->get_group_by_id($id); if ($customer_group) { $table_id = $this->table_model->get_table_id('customer'); $customers = $this->customer_mathto_customer_group_model->get_customers($id); $customer_group['customers'] = []; foreach ($customers as $customer) { $customer = array_merge($customer, $this->image_model->get_image($table_id, $customer['customer_id'])); $customer_group['customers'][] = $customer; } } // Response resOk($customer_group); }