- Timestamp:
- Apr 23, 2015 12:00:06 PM (10 years ago)
- Location:
- pro-violet-viettel/sourcecode/application/modules/collaborator/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/collaborator.php
r883 r906 14 14 $this->lang->load('messages', 'message'); 15 15 } 16 17 public function index() { 18 $data = array(); 19 $collaborator_info = $this->session->userdata('collaboratorInfo'); 20 if ($collaborator_info) { 21 $data['statistics'] = $this->getStatistics(); 22 $data['content'] = $this->getCollaborators(); 23 $this->load->view('collaborator/reportAsistant/index', $data); 24 } else { 25 $this->load->view('login'); 26 } 27 } 28 29 public function viewAsistant() { 30 $data = array(); 31 32 $collaborator_info = $this->session->userdata('collaboratorInfo'); 33 if ($collaborator_info) { 34 $id = $this->uri->segment(2); 35 $data['id'] = $id; 36 $data['statistics'] = $this->getStatistics($id); 37 $data['content'] = $this->getCollaboratorsUsers(array(), $id); 38 $this->load->view('collaborator/reportAsistant/indexCollaborator', $data); 39 } else { 40 $this->load->view('login'); 41 } 42 } 43 44 public function getStatistics($id = false) { 45 $data = array(); 46 47 $this_year['start'] = strtotime(date("Y") . "-01-01 00:00:00"); 48 49 $this->load->model('admin/collabolator_model'); 50 $collaborators = $this->collabolator_model->getAllCollaboratorUser($this_year['start'], $id); 51 for ($i = 1; $i <= 12; $i++) { 52 $statistics[$i] = 0; 53 } 54 $y = date("Y"); 55 foreach ($collaborators as $collaborator) { 56 for ($i = 1; $i <= 12; $i++) { 57 if ($i < 12) { 58 if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime($y . "-" . ($i + 1) . "-1 00:00:00")))) { 59 $statistics[$i] ++; 60 } 61 } else { 62 if (($collaborator['time'] > strtotime($y . "-" . $i . "-1 00:00:00")) && (($collaborator['time'] < strtotime(($y + 1) . "-1-1 00:00:00")))) { 63 $statistics[$i] ++; 64 } 65 } 66 } 67 } 68 69 $max = 0; 70 foreach ($statistics as $index => $total) { 71 if ($total > $max) { 72 $max = $total; 73 } 74 $chart[] = array($index, $total); 75 } 76 77 $data['max'] = $max; 78 $chard[] = array("color" => "#e67e22", "label" => "Lượng ngưá»i dùng giá»i thiá»u bá»i cá»ng tác viên theo từng tháng", "data" => $chart); 79 $data['chard'] = $chard; 80 81 return $this->load->view('collaborator/reportAsistant/statistics', $data, true); 82 } 83 84 public function getLastquarter() { 85 $current_month = date('m'); 86 $current_year = date('Y'); 87 88 if ($current_month >= 1 && $current_month <= 3) { 89 $start_date = strtotime('1-October-' . ($current_year - 1)); // timestamp or 1-October Last Year 12:00:00 AM 90 $end_date = strtotime('1-Janauary-' . $current_year); // // timestamp or 1-January 12:00:00 AM means end of 31 December Last year 91 } else if ($current_month >= 4 && $current_month <= 6) { 92 $start_date = strtotime('1-January-' . $current_year); // timestamp or 1-Janauray 12:00:00 AM 93 $end_date = strtotime('1-April-' . $current_year); // timestamp or 1-April 12:00:00 AM means end of 31 March 94 } else if ($current_month >= 7 && $current_month <= 9) { 95 $start_date = strtotime('1-April-' . $current_year); // timestamp or 1-April 12:00:00 AM 96 $end_date = strtotime('1-July-' . $current_year); // timestamp or 1-July 12:00:00 AM means end of 30 June 97 } else if ($current_month >= 10 && $current_month <= 12) { 98 $start_date = strtotime('1-July-' . $current_year); // timestamp or 1-July 12:00:00 AM 99 $end_date = strtotime('1-October-' . $current_year); // timestamp or 1-October 12:00:00 AM means end of 30 September 100 } 101 return array("start" => $start_date, "end" => $end_date); 102 } 103 104 105 public function getCollaboratorsUsers($filters = array(), $id = false) { 106 107 $this->load->helper('pagging'); 108 $this->load->model('admin/collabolator_model'); 109 $data['current_page'] = $this->uri->segment(5, 1); 110 111 $data['itemsoptions'] = array(10, 25, 50, 100); 112 $data['perpage'] = 10; 113 if (!$id) { 114 $data['id'] = $this->uri->segment(4, 1); 115 } else { 116 $data['id'] = $id; 117 } 118 119 $data['keyword'] = ""; 120 $data['sorting_order'] = "sorting_desc"; 121 $data['sorting_field'] = "id"; 122 123 if ($this->input->post('sorting_order')) { 124 if ($this->input->post('sorting_order') != "sorting") { 125 $data['sorting_order'] = $this->input->post('sorting_order'); 126 $data['sorting_field'] = $this->input->post('sorting_field'); 127 } 128 } 129 if ($this->input->post('items')) { 130 $data['perpage'] = $this->input->post('items'); 131 } 132 if ($this->input->post('keyword')) { 133 $data['search_field'] = ""; 134 $data['keyword'] = $this->input->post('keyword'); 135 136 if (preg_match("/[0-9]/", $data['keyword'])) { 137 $data['search_field'] = "cellphone"; 138 } 139 } 140 141 $data['daterange_start'] = ""; 142 $data['daterange_end'] = ""; 143 if ($this->input->post('daterange')){ 144 $daterange = explode(" - ", $this->input->post('daterange')); 145 $daterange[0] = str_replace('/', '-', $daterange[0]); 146 $daterange[1] = str_replace('/', '-', $daterange[1]); 147 $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0])); 148 $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day')); 149 } 150 151 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 152 $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data); 153 $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data); 154 foreach ($data['paidlogs'] as $index=>$paidlog) 155 { 156 $data['paidlogs'][$index]['username']=$this->get_fullname($paidlog['us_id']); 157 } 158 $data['paging_url'] = base_url() . "/cong_tac_vien/thong_ke_cong_tac_vien/trang_ctv/" . $data['id']; 159 $data['num_links'] = 2; 160 $data['paging'] = pagging($data); 161 162 if ($this->input->is_ajax_request()) { 163 return $this->load->view('collaborator/reportAsistant/listview_user', $data); 164 } 165 return $this->load->view('collaborator/reportAsistant/listview_user', $data, true); 166 } 167 168 private function get_fullname($us_id) { 169 $fullname=""; 170 $src = 'violet'; 171 $token = md5($us_id . self::TOKENPW); 172 $this->load->model('admin/user_model'); 173 $data = $this->user_model->get_user_info($src, $us_id, $token); 174 parse_str($data,$data); 175 if (isset($data['fullname'])) 176 { 177 $fullname=$data['fullname']; 178 } 179 return $fullname; 180 } 181 16 182 17 public function profile(){ 183 18 $collaborator_info = $this->session->userdata('collaboratorInfo'); 184 19 if ($collaborator_info) { 185 20 $data['collaborator_id'] = $collaborator_info['id']; 21 $data['username'] = $collaborator_info['login_name']; 22 $data['fullname'] = $collaborator_info['fullname']; 186 23 $this->load->view('collaborator/collaborator_profile', $data); 24 }else{ 25 $this->load->view('login'); 26 } 27 } 28 29 public function updateCollaborator(){ 30 $this->load->model('collaborator_model'); 31 $collaborator_info = $this->session->userdata('collaboratorInfo'); 32 $result['success'] = 0; 33 if ($collaborator_info) { 34 35 $collaborator_id = $collaborator_info['id']; 36 $login_name = $collaborator_info['login_name']; 37 $input = $this->input->post(); 38 if (strlen($input['fullname']) == 0) { 39 $result['errors'][] = array("content"=>lang('_SBG_FULLNAME_REQUIRED_MSG'),"field"=>"fullname_err"); 40 } 41 if (!isset($result['errors'])) { 42 $collaborator = array('full_name' => $input['fullname']); 43 $result['success'] = 1; 44 $result['data'] = $this->collaborator_model->updateCollaborator($collaborator_id, $collaborator); 45 $collaboratorData = array('login_name' => $login_name, 'id' => $collaborator_id, 'fullname' => $input['fullname'], 'logined_in' => TRUE); 46 $this->session->set_userdata('collaboratorInfo', $collaboratorData); 47 } 48 echo json_encode($result); 187 49 }else{ 188 50 $this->load->view('login'); … … 192 54 public function change_password(){ 193 55 $this->load->model('collaborator_model'); 194 //$collaborator_id = $this->uri->segment(4, 1);195 56 $collaborator_info = $this->session->userdata('collaboratorInfo'); 196 57 if ($collaborator_info) { -
pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/home.php
r883 r906 20 20 if ($collaborator_info) { 21 21 $id = $collaborator_info['id']; 22 $data['id'] = $id;23 22 $data['statistics'] = $this->getStatistics($id); 24 $data['content'] = $this->getCollaboratorsUsers(array(), $id);23 $data['content'] = $this->getCollaboratorsUsers(); 25 24 $this->load->view('collaborator/reportAsistant/indexCollaborator', $data); 26 25 } else { … … 122 121 123 122 124 public function getCollaboratorsUsers($filters = array(), $id = false) { 125 126 $this->load->helper('pagging'); 127 $this->load->model('admin/collabolator_model'); 128 $data['current_page'] = $this->uri->segment(5, 1); 129 130 $data['itemsoptions'] = array(10, 25, 50, 100); 131 $data['perpage'] = 10; 132 if (!$id) { 133 $data['id'] = $this->uri->segment(4, 1); 134 } else { 123 public function getCollaboratorsUsers() { 124 $collaborator_info = $this->session->userdata('collaboratorInfo'); 125 if ($collaborator_info) { 126 $this->load->helper('pagging'); 127 $this->load->model('admin/collabolator_model'); 128 $data['current_page'] = $this->uri->segment(5, 1); 129 130 $data['itemsoptions'] = array(10, 25, 50, 100); 131 $data['perpage'] = 10; 132 $id = $collaborator_info['id']; 135 133 $data['id'] = $id; 136 } 137 138 $data['keyword'] = ""; 139 $data['sorting_order'] = "sorting_desc"; 140 $data['sorting_field'] = "id"; 141 142 if ($this->input->post('sorting_order')) { 143 if ($this->input->post('sorting_order') != "sorting") { 144 $data['sorting_order'] = $this->input->post('sorting_order'); 145 $data['sorting_field'] = $this->input->post('sorting_field'); 146 } 147 } 148 if ($this->input->post('items')) { 149 $data['perpage'] = $this->input->post('items'); 150 } 151 if ($this->input->post('keyword')) { 152 $data['search_field'] = ""; 153 $data['keyword'] = $this->input->post('keyword'); 154 155 if (preg_match("/[0-9]/", $data['keyword'])) { 156 $data['search_field'] = "cellphone"; 157 } 158 } 159 160 $data['daterange_start'] = ""; 161 $data['daterange_end'] = ""; 162 if ($this->input->post('daterange')){ 163 $daterange = explode(" - ", $this->input->post('daterange')); 164 $daterange[0] = str_replace('/', '-', $daterange[0]); 165 $daterange[1] = str_replace('/', '-', $daterange[1]); 166 $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0])); 167 $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day')); 134 135 $data['keyword'] = ""; 136 $data['sorting_order'] = "sorting_desc"; 137 $data['sorting_field'] = "user_created_time"; 138 139 if ($this->input->post('sorting_order')) { 140 if ($this->input->post('sorting_order') != "sorting") { 141 $data['sorting_order'] = $this->input->post('sorting_order'); 142 $data['sorting_field'] = $this->input->post('sorting_field'); 143 } 144 } 145 if ($this->input->post('items')) { 146 $data['perpage'] = $this->input->post('items'); 147 } 148 if ($this->input->post('keyword')) { 149 $data['search_field'] = ""; 150 $data['keyword'] = $this->input->post('keyword'); 151 152 if (preg_match("/[0-9]/", $data['keyword'])) { 153 $data['search_field'] = "cellphone"; 154 } 155 } 156 157 $data['daterange_start'] = ""; 158 $data['daterange_end'] = ""; 159 if ($this->input->post('daterange')){ 160 $daterange = explode(" - ", $this->input->post('daterange')); 161 $daterange[0] = str_replace('/', '-', $daterange[0]); 162 $daterange[1] = str_replace('/', '-', $daterange[1]); 163 $data['date_start'] = $daterange[0]; 164 $data['date_end'] = $daterange[1]; 165 $data['daterange_start'] = date('Y-m-d H:i:s', strtotime($daterange[0])); 166 $data['daterange_end'] = date('Y-m-d H:is:s', strtotime($daterange[1].' + 1 day')); 167 } 168 169 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 170 $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data); 171 $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data); 172 foreach ($data['paidlogs'] as $index => $paidlog) 173 { 174 $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']); 175 } 176 $data['paging_url'] = base_url() . "collaborator/home/getCollaboratorsUsers/".$data['id']; 177 $data['num_links'] = 2; 178 $data['paging'] = pagging($data); 179 180 if ($this->input->is_ajax_request()) { 181 return $this->load->view('collaborator/reportAsistant/listview_user', $data); 182 } 183 return $this->load->view('collaborator/reportAsistant/listview_user', $data, true); 184 }else{ 185 $this->load->view('login'); 168 186 } 169 170 $data['start'] = ($data['current_page'] - 1) * $data['perpage'];171 $data['total'] = $this->collabolator_model->countCountCollaboratorUsers($data);172 $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data);173 174 foreach ($data['paidlogs'] as $index => $paidlog)175 {176 177 $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']);178 }179 180 $data['paging_url'] = base_url() . "cong_tac_vien/thong_ke_nguoi_dung/trang/" ;181 $data['num_links'] = 2;182 $data['paging'] = pagging($data);183 184 if ($this->input->is_ajax_request()) {185 return $this->load->view('collaborator/reportAsistant/listview_user', $data);186 }187 return $this->load->view('collaborator/reportAsistant/listview_user', $data, true);188 187 } 189 188 … … 202 201 } 203 202 203 204 public function export(){ 205 206 $collaborator_info = $this->session->userdata('collaboratorInfo'); 207 if ($collaborator_info) { 208 $id = $collaborator_info['id']; 209 $data['id'] = $id; 210 $data['fullname'] = $collaborator_info['fullname']; 211 $this->load->model('admin/collabolator_model'); 212 //$data['perpage'] = $this->uri->segment(4, 10); 213 $data['keyword'] = $this->uri->segment(5); 214 if ($data['keyword'] == 'default') $data['keyword'] = null; 215 if (preg_match("/[0-9]/", $data['keyword'])) { 216 $data['search_field'] = "cellphone"; 217 } 218 $data['daterange_start'] = $this->uri->segment(6); 219 $data['daterange_end'] = $this->uri->segment(7); 220 if ($data['daterange_start'] == 'default') $data['daterange_start'] = null; 221 if ($data['daterange_end'] == 'default') $data['daterange_end'] = null; 222 if ($data['daterange_start']) 223 $data['daterange_start'] = date ( 'Y-m-d H:i:s', strtotime ( $data ['daterange_start'] ) ); 224 if ($data['daterange_end']) 225 $data['daterange_end'] = date ( 'Y-m-d H:i:s', strtotime ( $data['daterange_end'] . ' + 1 day' ) ); 226 227 $data['sorting_field'] = "user_created_time"; 228 $data['sorting_order'] = $this->uri->segment(8); 229 230 $data['paidlogs'] = $this->collabolator_model->getCountCollaboratorUsers($data); 231 232 foreach ($data['paidlogs'] as $index => $paidlog) 233 { 234 $data['paidlogs'][$index]['username'] = $this->get_fullname($paidlog['us_id']); 235 } 236 $users = $data['paidlogs']; 237 238 ob_end_clean(); 239 $this->load->library("PHPExcel"); 240 $sheet = $this->phpexcel->getActiveSheet(); 241 242 $sheet->setTitle("bao cao cua CTV " . date('m') . " - " . date('Y')); 243 $sheet->getColumnDimension('A')->setWidth(10); 244 $sheet->getColumnDimension('B')->setWidth(25); 245 $sheet->getColumnDimension('C')->setWidth(25); 246 $sheet->getColumnDimension('D')->setWidth(25); 247 $sheet->getColumnDimension('E')->setWidth(15); 248 $sheet->getColumnDimension('F')->setWidth(15); 249 $sheet->getColumnDimension('G')->setWidth(15); 250 $sheet->getColumnDimension('H')->setWidth(25); 251 $sheet->getColumnDimension('I')->setWidth(25); 252 253 254 $sheet->setCellValue('B1', "TẬP ÄOÃN VIá»N THÃNG QUÃN Äá»I"); 255 $style = array( 256 'font' => array('bold' => true, 'size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 257 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 258 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 259 'wrap' => true ) 260 ); 261 $sheet->mergeCells('B1:E1'); 262 $sheet->getStyle('B1')->applyFromArray($style); 263 264 $sheet->setCellValue('B2', "Tá»NG CÃNG TY VIá»N THÃNG VIETTEL"); 265 $style = array( 266 'font' => array('size' => 12, 'name' =>'Cambria', 'color' => array('rgb' => '0070bf')), 267 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 268 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 269 'wrap' => true ) 270 ); 271 $sheet->mergeCells('B2:E2'); 272 $sheet->getStyle('B2')->applyFromArray($style); 273 274 275 $sheet->setCellValue('A4', "DANH SÃCH NGƯá»I DÃNG DO Cá»NG TÃC VIÃN GIá»I THIá»U"); 276 $style = array( 277 'font' => array('bold' => true, 'size' => 14, 'name' =>'Cambria'), 278 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 279 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 280 'wrap' => true ) 281 ); 282 $sheet->mergeCells('A4:E4'); 283 $sheet->getStyle('A4')->applyFromArray($style); 284 285 286 287 $style = array( 288 'font' => array('size' => 11, 'name' =>'Cambria'), 289 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 290 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 291 'wrap' => true), 292 'borders' => array( 293 'allborders' => array( 294 'style' => \PHPExcel_Style_Border::BORDER_THIN 295 ) 296 ) 297 ); 298 299 $sheet->setCellValue('B6', "Từ ngà y: ".$data['daterange_start']); 300 $sheet->setCellValue('C6', "Äến ngà y: ".$data['daterange_end']); 301 $sheet->setCellValue('B7', "Ngà y kết xuất: ".date("d")."/".date("m")."/".date("Y")); 302 $sheet->setCellValue('C7', "CTV: ".$data['fullname']); 303 304 $sheet->getStyle('B6')->applyFromArray($style); 305 $sheet->getStyle('C6')->applyFromArray($style); 306 $sheet->getStyle('B7')->applyFromArray($style); 307 $sheet->getStyle('C7')->applyFromArray($style); 308 309 $sheet->setCellValue('A9', 'STT'); 310 $sheet->setCellValue('B9', 'Tên ngưá»i dùng'); 311 $sheet->setCellValue('C9', 'Sá» thuê bao'); 312 $sheet->setCellValue('D9', 'Ngà y giá» giá»i thiá»u'); 313 $style = array( 314 'font' => array('bold' => true, 'size' => 11, 'name' =>'Cambria'), 315 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 316 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 317 'wrap' => true), 318 'borders' => array( 319 'allborders' => array( 320 'style' => \PHPExcel_Style_Border::BORDER_THIN 321 ) 322 ) 323 ); 324 $sheet->getStyle('A9:D9')->applyFromArray($style); 325 326 $style = array( 327 'font' => array('size' => 11, 'name' =>'Cambria'), 328 'alignment' => array('horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 329 'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER, 330 'wrap' => true), 331 'borders' => array( 332 'allborders' => array( 333 'style' => \PHPExcel_Style_Border::BORDER_THIN 334 ) 335 ) 336 ); 337 338 $dem = 0; 339 foreach ($users as $index => $user): 340 $sheet->setCellValue('A' . ($dem + 10), $index + 1); 341 $sheet->setCellValue('B' . ($dem + 10), $user['username']); 342 $sheet->setCellValueExplicit('C' . ($dem + 10), $user['user_cellphone'], PHPExcel_Cell_DataType::TYPE_STRING); 343 $sheet->setCellValue('D' . ($dem + 10), $user['user_created_time']); 344 $sheet->getStyle('A' . ($dem + 10).':D'.($dem + 10))->applyFromArray($style); 345 $dem++; 346 endforeach; 347 348 $writer = new PHPExcel_Writer_Excel5($this->phpexcel); 349 header('Content-Type: application/vnd.ms-excel'); 350 header('Content-Disposition: attachment; filename="danhsachnguoidung_ctv_'.date('d/m/Y').'.xls"'); 351 $writer->save('php://output'); 352 }else{ 353 $this->load->view('login'); 354 } 355 } 356 204 357 } -
pro-violet-viettel/sourcecode/application/modules/collaborator/controllers/user.php
r883 r906 22 22 $this->load->view('collaborator/user/index', $data); 23 23 }else{ 24 show_404();24 $this->load->view(login); 25 25 } 26 26 } … … 32 32 $collaborator = $collaborator_info['login_name']; 33 33 $config['upload_path'] = './upload/uploads/'; 34 $config['allowed_types'] = 'xls|xlsx'; 35 /*$config['max_size'] = '100'; 36 $config['max_width'] = '1024'; 37 $config['max_height'] = '768';*/ 38 34 $config['allowed_types'] = '*'; 39 35 $this->load->library('upload', $config); 40 36 … … 43 39 $error = array('error' => $this->upload->display_errors('', '')); 44 40 $data['success'] = 0; 45 $data[' process'] = $error;41 $data['upload_error'] = $error; 46 42 } 47 43 else … … 49 45 $data = array('upload_data' => $this->upload->data()); 50 46 $file = $data['upload_data']['full_path']; 51 //$result = $this->processData($file);52 47 $process = $this->processData($file, $collaborator); 53 48 if ($process){ 54 49 $data['process'] = $process; 55 56 50 }else{ 57 $data['process'] = null; 51 $data['process'] = null; 58 52 } 59 53 $data['success'] = 1; … … 61 55 $result = $this->load->view('collaborator/user/result', $data, true); 62 56 echo json_encode($result); 57 63 58 }else{ 64 show_404();59 $this->load->view('login'); 65 60 } 66 61 } … … 93 88 $this->load->model('collaborator_model'); 94 89 $data = $this->readExcelFile($file); 90 95 91 $result = array(); 96 92 $user = array(); … … 104 100 $user['district'] = $arrPD['district']; 105 101 $user['school'] = $value['E']; 106 $user['username'] = $this->services_model->formatPhoneNumber( $value['F'], 2);102 $user['username'] = $this->services_model->formatPhoneNumber((string)$value['F'], 2); 107 103 $user['service'] = $value['G']; 108 104 $user['amount'] = $value['H']; 109 105 $user['collboratorId'] = $value['I']; 110 106 107 111 108 if ($user['username']){ 112 109 113 110 if (!preg_match('/^([0-9]{10,11}$)$/', $user['username'])) { 114 $result[$index ]['success'] = 0;115 $result[$index ]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG');116 $result[$index ]['user'] = $user;111 $result[$index-1]['success'] = 0; 112 $result[$index-1]['error'] = lang('_SBG_MO_PHONENUM_WRONG_FORMAT_MSG'); 113 $result[$index-1]['user'] = $user; 117 114 }else{ 118 $result[$index] = $this->collaborator_model->processUser($user, $sentNumber); 119 120 115 $result[$index-1] = $this->collaborator_model->processUser($user, $sentNumber); 121 116 } 122 $result[$index]['date'] = date('d-m-Y H:i:s');123 117 } 124 118 125 119 endforeach; 126 120 } 127 128 121 return $result; 129 122 }
Note: See TracChangeset
for help on using the changeset viewer.