function index() { //authen $pageID = 2; Authen::AllowPage($pageID, $this->session->userdata('role'), '/register'); $this->load->model('register/course_m', 'course_m'); //paging $limit = setting::$limit; $page = !$this->uri->segment(4) ? 1 : $this->uri->segment(4); $offset = (int) ($page * $limit - $limit); $courseID = 0; $this->course_m->context['limit'] = $limit; // $this->course_m->context['page'] = $page; $this->course_m->context['page'] = $offset; $this->course_m->context['filter'] = $_GET; $qry = ""; if (!empty($_GET)) { if (isset($_GET['course']) && trim($_GET['course']) == '' && isset($_GET['month']) && trim($_GET['month']) == 0 && isset($_GET['year']) && trim($_GET['year']) == 0 && isset($_GET['status']) && trim($_GET['status']) == 0) { $coursecode = ''; $this->course_m->context['courseID'] = $courseID; $res = $this->course_m->getCourseList(true); } else { //$coursecode = trim($_GET['course']); //$this->course_m->context['coursecode'] = $coursecode; $this->course_m->context['course'] = $_GET['course']; $this->course_m->context['month'] = $_GET['month']; $this->course_m->context['year'] = $_GET['year']; $this->course_m->context['status'] = $_GET['status']; $res = $this->course_m->searchCourse(); $arrQry = array('course' => $_GET['course'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'status' => $_GET['status']); $qry = "?"; $qry .= http_build_query($arrQry); } } else { $coursecode = ''; $this->course_m->context['courseID'] = $courseID; $res = $this->course_m->getCourseList(true); } $total = $this->course_m->getCountCourseList(true); $pages = util::paging($total, $limit, 'register/course/index/%s/' . $qry, 'Page', $page); //var_dump($total); $data = array(); $data['data'] = $res; $data['paging'] = $pages; $data['cntCourse'] = $total; $data['course_list'] = $this->course_m->getCourseCode(); //load template $this->template->set_template('admin'); $this->template->write('title', setting::$WINDOW_TITLE); $this->template->write_view('content', 'register/course_index', $data); $this->template->render(); }
function index() { $pageID = 5; Authen::AllowPage($pageID, $this->session->userdata('role')); $this->load->model('register/course_m', 'course_m'); //paging $limit = setting::$limit; $page = !$this->uri->segment(4) ? 1 : $this->uri->segment(4); $offset = (int) ($page * $limit - $limit); $courseID = 0; $this->course_m->context['limit'] = $limit; $this->course_m->context['page'] = $offset; $this->course_m->context['filter'] = $_GET; if (!empty($_GET)) { if (!isset($_GET['course']) && trim($_GET['course']) == '' && !isset($_GET['month']) && trim($_GET['month']) == 0 && !isset($_GET['year']) && trim($_GET['year']) == 0) { $coursecode = ''; $this->course_m->context['courseID'] = $courseID; $res = $this->course_m->getCourseList(); } else { $coursecode = trim($_GET['course']); $this->course_m->context['coursecode'] = $coursecode; $this->course_m->context['month'] = $_GET['month']; $this->course_m->context['year'] = $_GET['year']; $res = $this->course_m->searchCourse(); } } else { $coursecode = ''; $this->course_m->context['courseID'] = $courseID; $res = $this->course_m->getCourseList(); } $total = $this->course_m->getCountCourseList(); $pages = util::paging($total, $limit, 'register/nametag/index/%s/', 'Page', $page); $data = array(); $data['data'] = $res; $data['paging'] = $pages; $data['cntCourse'] = $total; $data['course_list'] = $this->course_m->getCourseCode(); //load template $this->template->set_template('admin'); $this->template->write('title', setting::$WINDOW_TITLE); $this->template->write_view('content', 'register/course_nametag', $data); $this->template->render(); }
function all_members() { $pageID = 3; Authen::AllowPage($pageID, $this->session->userdata('role')); $limit = setting::$limit; $page = !$this->uri->segment(4) ? 1 : $this->uri->segment(4); $offset = (int) ($page * $limit - $limit); $this->load->model('register/user_m', 'user_m'); $this->load->model('register/hospital_m', 'hospital_m'); $this->user_m->context['filter'] = $_GET; $this->user_m->context['limit'] = $limit; $this->user_m->context['page'] = $offset; $res = $this->user_m->getAllUserList(); $total = $this->user_m->getCountAllUserListByFilter(); $total_user = $this->user_m->getCountAllUserList(); //load template //var_dump($this->uri);exit; $data = array(); $arr = $_GET; $data['g_name'] = isset($arr['name']) ? $arr['name'] : ''; $data['g_lastname'] = isset($arr['lastname']) ? $arr['lastname'] : ''; $data['g_register_type'] = isset($arr['register_type']) ? $arr['register_type'] : ''; $data['g_occupation'] = isset($arr['position']) ? $arr['position'] : ''; $data['g_hospital'] = isset($arr['hospital']) ? $arr['hospital'] : ''; $data['g_course'] = isset($arr['course']) ? $arr['course'] : ''; $data['_row'] = $offset; $arrQuery = array('name' => $data['g_name'], 'lastname' => $data['g_lastname'], 'register_type' => $data['g_register_type'], 'position' => $data['g_occupation'], 'hospital' => $data['g_hospital'], 'course' => $data['g_course']); foreach ($arrQuery as $key => $val) { if ($val == '') { unset($arrQuery[$key]); } } $txt_query = count($arrQuery) > 0 ? '?' . http_build_query($arrQuery) : ''; $data['paging'] = util::paging($total, $limit, 'register/user/all_members/%s/' . $txt_query, 'Page', $page); $data['hospital_list'] = $this->hospital_m->getHospital(); $data['totalRegister'] = $total_user; $data['occupation'] = $this->user_m->getOccupation(); $data['position'] = $this->user_m->getPosition(); $data['sent_type'] = $this->user_m->getAddType(); // array('0' => 'บ้าน', '1' => 'ที่ทำงาน'); $data['register_type'] = $this->user_m->getRegisType(); // array('0' => 'สมัครเอง', '1' => 'สรพ สมัครให้', '2' => 'ผู้ประสานงานสถานพยาบาลสมัครให้'); $data['data'] = $res; $this->template->set_template('admin'); $this->template->write('title', setting::$WINDOW_TITLE); $this->template->write_view('content', 'register/all_members', $data); $this->template->render(); }
function index() { $pageID = 3; Authen::AllowPage($pageID, $this->session->userdata('role')); $limit = setting::$limit; $page = !$this->uri->segment(4) ? 1 : $this->uri->segment(4); $offset = (int) ($page * $limit - $limit); $courseID = 0; // (!$this->uri->segment(4)) ? 0 : $this->uri->segment(4); $this->load->model('register/user_m', 'user_m'); $this->load->model('register/hospital_m', 'hospital_m'); $this->load->model('register/course_m', 'course_m'); $this->user_m->context['filter'] = $_GET; if (!isset($_GET['course']) || trim($_GET['course']) == '') { $resLastCourse = $this->user_m->getLastCourse(); $courseID = count($resLastCourse) > 0 ? $resLastCourse[0]['courseID'] : 0; $this->user_m->context['filter']['course'] = $courseID; } else { $courseID = trim($_GET['course']); } $this->user_m->context['courseID'] = $courseID; $this->user_m->context['limit'] = $limit; $this->user_m->context['page'] = $offset; $res = $this->user_m->getUserList(); $total = $this->user_m->getCountUserListByFilter(); //load template //var_dump($this->uri);exit; $data = array(); $arr = $_GET; $data['g_name'] = isset($arr['name']) ? $arr['name'] : ''; $data['g_lastname'] = isset($arr['lastname']) ? $arr['lastname'] : ''; $data['g_register_type'] = isset($arr['register_type']) ? $arr['register_type'] : ''; $data['g_occupation'] = isset($arr['position']) ? $arr['position'] : ''; $data['g_hospital'] = isset($arr['hospital']) ? $arr['hospital'] : ''; $data['g_course'] = isset($arr['course']) ? $arr['course'] : ''; $data['_row'] = $offset; $arrQuery = array('name' => $data['g_name'], 'lastname' => $data['g_lastname'], 'register_type' => $data['g_register_type'], 'position' => $data['g_occupation'], 'hospital' => $data['g_hospital'], 'course' => $data['g_course']); foreach ($arrQuery as $key => $val) { if ($val == '') { unset($arrQuery[$key]); } } $txt_query = count($arrQuery) > 0 ? '?' . http_build_query($arrQuery) : ''; $dataCourse = $this->course_m->getCourse($courseID); $opt = $this->course_m->getCourseOptionalsList($dataCourse[0]['courseID']); $optional = ''; foreach ($opt as $keyO => $valO) { $optional .= $valO['optional'] . ' '; } $data['paging'] = util::paging($total, $limit, 'register/user/index/%s/' . $txt_query, 'Page', $page); $data['hospital_list'] = $this->hospital_m->getHospital(); $data['last_course'] = count($dataCourse) > 0 ? $dataCourse[0] : null; $data['totalRegister'] = $this->user_m->getTotalRegisterByCourse($courseID); $data['optional'] = $optional; $data['course_list'] = $this->course_m->getAllCourses(); $data['occupation'] = $this->user_m->getOccupation(); $data['position'] = $this->user_m->getPosition(); $data['sent_type'] = $this->user_m->getAddType(); // array('0' => 'บ้าน', '1' => 'ที่ทำงาน'); $data['register_type'] = $this->user_m->getRegisType(); // array('0' => 'สมัครเอง', '1' => 'สรพ สมัครให้', '2' => 'ผู้ประสานงานสถานพยาบาลสมัครให้'); $data['showCourse'] = false; // ($this->uri->segment(3)) ? true : false; $data['data'] = $res; $this->template->set_template('admin'); $this->template->write('title', setting::$WINDOW_TITLE); $this->template->write_view('content', 'register/user_index', $data); $this->template->render(); }