public function index()
 {
     $data['menu_id'] = $this->menu_id;
     $data['modules_name'] = $this->modules_name;
     $data['current_user'] = $this->current_user;
     $data['perm'] = $this->perm;
     $data['result'] = new System_log();
     if (@$_GET['start_date'] != '' && @$_GET['end_date'] != '') {
         $data['result']->where("date(log_date) >= '" . $_GET['start_date'] . "' AND date(log_date) <= '" . $_GET['end_date'] . "'");
     } else {
         if (@$_GET['start_date'] != '' && @$_GET['end_date'] == '') {
             $data['result']->where("date(log_date) >= '" . $_GET['start_date'] . "'");
         }
     }
     if (@$_GET['end_date'] != '') {
         $data['result']->where("date(log_date) <= '" . $_GET['end_date'] . "'");
     }
     if (@$_GET['search'] != '') {
         $data['result']->where_related("user", "firstname LIKE '%" . $_GET['search'] . "%'");
     }
     if (@$_GET['org_id'] != '') {
         $data['result']->where_related("user", "org_id = " . $_GET['org_id']);
     }
     if (@$_GET['country_id'] != '') {
         $data['result']->where_related("user", "org_id in (select id from acm_organization where country_id=" . $_GET['country_id'] . ")");
     }
     $data["result"]->order_by("log_date", "DESC")->get_page();
     $data['no'] = empty($_GET['page']) ? 0 : ($_GET['page'] - 1) * 20;
     $data['page'] = empty($_GET['page']) ? 1 : $_GET['page'];
     if (@$_GET['submit'] == '') {
         save_logs($this->menu_id, 'View', 0, 'View System Logs ');
     }
     $this->template->build('system_logs/index', $data);
 }
Example #2
0
 public function delete($id)
 {
     if ($id) {
         $data = new Prefix($id);
         $action = 'DELETE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->org_name . ' Prefixes ');
         $data->delete();
     }
     redirect("admin/settings/prefixes");
 }
 public function save()
 {
     if ($this->perm->can_create == 'y') {
         $data = new Contents();
         $data->from_array($_POST);
         $data->save();
         save_logs($this->menu_id, 'Update', $data->id, ' Update Footage Contact  ');
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
 public function delete($id)
 {
     if ($id) {
         $data = new Hilight($id);
         $action = 'DELETE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->org_name . ' Organizations ');
         $data->delete();
     }
     redirect("admin/organizations");
 }
Example #5
0
 public function delete($id)
 {
     if ($id) {
         $data = new Hotel($id);
         $action = 'DELETE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->hotel_name . ' Hotel ');
         $data->delete();
     }
     redirect("admin/settings/hotels");
 }
 public function delete($id)
 {
     if (permission("reports", "extra")) {
         if ($id) {
             $data = new Result($id);
             $data->delete();
             save_logs('delete', $id);
         }
     }
     redirect("admin/reports");
 }
 public function delete($id = null)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new Country($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, $data->id, $action . ' ' . $data->country_name . ' Country');
             $data->delete();
         }
     }
     redirect("admin/" . $this->modules_name);
 }
 public function action()
 {
     if (login($this->input->post("username"), $this->input->post("password"))) {
         set_notify('success', 'ยินดีต้อนรับเข้าสู่ระบบ');
         //save_logs($menu_id, $action, $data_id, $description)
         save_logs(19, 'Log In', $this->session->userdata("id"), $_POST['username'] . ' Logged In ');
         redirect("admin");
     } else {
         set_notify('error', 'Username หรือ Password ไม่ถูกต้อง กรุณาตรวจสอบ');
         redirect("admin/signin");
     }
 }
 public function delete($id = null)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new State($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->state_name . ' State Detail');
             $data->delete();
         }
     }
     redirect("admin/" . $this->modules_name);
 }
 public function delete($id)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new User_Type($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->title . ' User Type Detail');
             $this->db->query("DELETE FROM acm_user_type_permission WHERE user_type_id = " . $data->id);
             $this->db->query("DELETE FROM acm_user_type WHERE id = " . $data->id);
         }
     }
     redirect("admin/settings/user_types");
 }
 public function save($id = false)
 {
     $id = $this->current_user->id;
     $_POST['updated_by'] = $this->current_user->id;
     if ($_POST) {
         $data = new User($id);
         //	ตรวจสอบชื่อ username ซ้ำ
         if (@$_POST["username"]) {
             $chk = new User();
             if ($id) {
                 $chk->where("id !=", $id);
             }
             $chk->where("username", strip_tags(trim($_POST["username"])))->get();
             if ($chk->id) {
                 redirect("admin/settings/users");
             }
         }
         //	ตรวจสอบชื่อ email ซ้ำ
         if (@$_POST["email"]) {
             $chk = new User();
             if ($id) {
                 $chk->where("id !=", $id);
             }
             $chk->where("email", strip_tags(trim($_POST["email"])))->get();
             if ($chk->id) {
                 //	redirect("admin/settings/users");
             }
         }
         //	Username
         //	$data->username = strip_tags(trim($_POST["username"]));
         if (!empty($_POST["password"])) {
             $data->password = encrypt_password(strip_tags(trim($_POST["password"])));
         }
         $data->titulation = strip_tags($_POST["titulation"]);
         $data->firstname = strip_tags($_POST["firstname"]);
         $data->lastname = strip_tags($_POST["lastname"]);
         $data->email = strip_tags($_POST["email"]);
         $data->tel = strip_tags($_POST["tel"]);
         $data->position = strip_tags($_POST['position']);
         if ($_POST['id'] == '') {
             $data->created_by = $this->current_user->id;
         } else {
             $data->updated_by = $this->current_user->id;
         }
         $data->save();
         $action = $_POST['id'] > 0 ? 'UPDATE' : 'CREATE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->firstname . ' ' . $data->lastname . ' User Detail');
     }
     redirect("admin/settings/profile");
 }
 function ordering()
 {
     if ($this->perm->can_create == 'y') {
         $mode = @$_GET['mode'];
         $table_name = 'acm_hilights';
         $id = @$_GET['id'];
         $step = 1;
         $ext_condition = '';
         $ext_condition = @$_GET['search'] != '' ? " AND title LIKE '%" . $_GET['search'] . "%' " : "";
         ordering_data($mode, $table_name, $id, $ext_condition, $step);
         $action = "UPDATE";
         save_logs($this->menu_id, $action, $id, $action . ' Hilights ');
     }
     redirect('admin/hilights/index?search=' . @$_GET['search']);
 }
 public function save()
 {
     if ($this->perm->can_create == 'y') {
         $data = new Contents();
         if ($_POST['id'] == '') {
             $_POST['created_by'] = $this->current_user->id;
         } else {
             $_POST['updated_by'] = $this->current_user->id;
         }
         $data->from_array($_POST);
         $data->save();
         save_logs($this->menu_id, 'Update', $this->session->userdata("id"), ' Update ASEAN Declaration ');
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
 public function save($id = null)
 {
     if ($this->perm->can_create == 'y') {
         if ($_POST) {
             $save = new Organization_Chart($id);
             if ($_POST['id'] == '') {
                 $_POST['created_by'] = $this->current_user->id;
             } else {
                 $_POST['updated_by'] = $this->current_user->id;
             }
             $save->from_array($_POST);
             $save->save();
             $action = 'Update ';
             save_logs($this->menu_id, $action, $save->id, $action . ' ' . $save->country->coutry_name . ' Organization Chart ');
         }
     }
     redirect("admin/organization_charts/index/" . $save->country_id);
 }
Example #15
0
 public function save()
 {
     if ($this->perm->can_create == 'y') {
         $data = new Configuration();
         $data->public_status = @$_POST['public_status'] == '' ? 'n' : $_POST['public_status'];
         $data->internal_status = @$_POST['internal_status'] == '' ? 'n' : $_POST['internal_status'];
         if ($_POST['id'] == '') {
             $_POST['created_by'] = $this->current_user->id;
             $_POST['created'] = date("Y-m-d H:i:s");
         } else {
             $_POST['updated_by'] = $this->current_user->id;
             $_POST['updated'] = date("Y-m-d H:i:s");
         }
         $data->from_array($_POST);
         $data->save();
         save_logs($this->menu_id, 'Update', $this->session->userdata("id"), ' Update Configurations ');
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
 public function delete($id)
 {
     if (permission("menus", "delete")) {
         if ($id) {
             $data = new Menu($id);
             $data->delete();
             save_logs('delete', $id);
         }
     }
     redirect("admin/menus");
 }
Example #17
0
 public function delete($id)
 {
     if ($id) {
         $data = new Organization($id);
         $this->db->query("DELETE FROM hotels_organizations WHERE org_id=" . $data->id);
         $action = 'DELETE';
         save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->org_name . ' Organizations ');
         $data->delete();
     }
     redirect("admin/settings/organizations");
 }
Example #18
0
 public function delete($id = null)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new User($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->firstname . ' ' . $data->lastname . ' User Detail');
             $this->db->query("DELETE FROM users WHERE id=" . $id);
         }
     }
     redirect('admin/settings/users');
 }
 public function image_delete($id)
 {
     if ($this->perm->can_create == 'y') {
         if ($id) {
             $data = new Heritage_image($id);
             @unlink("uploads/heritage_image/" . $data->image);
             $action = 'DELETE';
             $heritage = new Heritage($data->heritage_id);
             save_logs($this->menu_id, $action, @$heritage->id, $action . ' ' . $heritage->title . ' Heritage Image.');
             $data->delete();
         }
     }
 }
 public function delete($id = null)
 {
     $org_id = $current_user->org_id;
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new Register_data($id);
             if ($data->firstname == '') {
                 $org_id = $data->org_id;
                 $action = 'DELETE';
                 save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->register_code . ' ' . $data->firstname . ' ' . $data->lastname . ' Register Data');
                 $this->db->query("DELETE FROM register_datas WHERE id=" . $id);
             } else {
                 $data->titulation_id = null;
                 $data->titulation_other = null;
                 $data->firstname = null;
                 $data->lastname = null;
                 $data->gender = null;
                 $data->position = null;
                 $data->org_other = null;
                 $data->position = null;
                 $data->mobile_no = null;
                 $data->email = null;
                 $data->food_type = null;
                 $data->hotel_id = null;
                 $data->checkin_date = null;
                 $data->checkout_date = null;
                 $data->rest_with = null;
                 $data->ip_address = $_SERVER['REMOTE_ADDR'];
                 $data->updat_by = $this->current_user->id;
                 $data->update_date = date("Y-m-d H:i:s");
                 $org_id = $data->org_id;
                 $action = 'Clear';
                 save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->register_code . ' ' . $data->firstname . ' ' . $data->lastname . ' Register Data');
                 $data->save();
             }
         }
     }
     redirect("admin/" . $this->modules_name . "/index?rest_type=" . $data->rest_type);
 }
 public function delete($id = null)
 {
     if ($this->perm->can_delete == 'y') {
         if ($id) {
             $data = new Network($id);
             $action = 'DELETE';
             save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->title . ' Network');
             $data->delete();
         }
     }
     redirect("admin/networks");
 }
Example #22
0
 public function save($id = false)
 {
     $configurations = new Configuration(1);
     if ($configurations->public_status != 'y') {
         $this->offline();
     } else {
         if ($_POST) {
             $sql = "select count(*)max_register_number from register_datas where firstname='" . trim(@$_POST['firstname']) . "' AND lastname='" . trim(@$_POST['lastname']) . "'";
             $max_register_number = $this->db->query($sql)->result();
             $max_register_number = @$max_register_number[0];
             $max_register_number = $max_register_number->max_register_number;
             if ($max_register_number > 0) {
                 set_notify('error', 'ชื่อ - นามสกล ของคุณมีอยู่แล้วในระบบ');
                 $this->form();
             } else {
                 $id = '';
                 $data = new Register_data($id);
                 $data->register_type = 2;
                 $data->titulation_id = strip_tags($_POST["titulation_id"]);
                 $data->titulation_other = strip_tags($_POST["titulation_other"]);
                 $data->firstname = strip_tags(trim($_POST["firstname"]));
                 $data->lastname = strip_tags(trim($_POST["lastname"]));
                 $data->gender = strip_tags($_POST["gender"]);
                 $data->position = strip_tags($_POST["position"]);
                 $data->org_id = $_POST['org_id'];
                 $data->org_other = strip_tags($_POST["org_other"]);
                 $data->position = strip_tags($_POST['position']);
                 $data->mobile_no = strip_tags($_POST["mobile_no"]);
                 $data->email = strip_tags($_POST["email"]);
                 $data->rest_type = $_POST['rest_type'];
                 if ($data->rest_type != 'y' && $data->rest_type != 'n') {
                     $org = new Organization($_POST['org_id']);
                     if ($org->org_type_id > 0) {
                         $data->rest_type = $org->org_type_id == 2 ? 'y' : 'n';
                     } else {
                         $data->rest_type = $data->rest_type == 2 ? 'y' : 'n';
                     }
                 }
                 $data->food_type = $_POST['food_type'];
                 /*
                 					if ($data -> rest_type == 'y') {
                 						$data -> hotel_id = $_POST['hotel_id'];
                 						$checkin_date = $_POST['checkin_year'] . '-' . $_POST['checkin_month'] . '-' . $_POST['checkin_day'] . ' ' . $_POST['checkin_hour'] . ":" . $_POST['checkin_minute'];
                 						$data -> checkin_date = $checkin_date;
                 						$checkout_date = $_POST['checkout_year'] . '-' . $_POST['checkout_month'] . '-' . $_POST['checkout_day'] . ' ' . $_POST['checkout_hour'] . ":" . $_POST['checkout_minute'];
                 						;
                 						$data -> checkout_date = $checkout_date;
                 						$data -> rest_with = null;
                 						//$data->rest_with = $_POST['rest_with'];
                 					} else {
                 						$data -> hotel_id = null;
                 						$data -> checkin_date = null;
                 						$data -> checkout_date = null;
                 						$data -> rest_with = null;
                 					}
                 * 
                 */
                 $data->ip_address = $_SERVER['REMOTE_ADDR'];
                 $data->register_date = date("Y-m-d H:i:s");
                 $data->create_by = 0;
                 $data->create_date = date("Y-m-d H:i:s");
                 if ($data->register_code == '') {
                     $register_code = $data->rest_type == 'y' ? 'E02' : 'E01';
                     $sql = "select max(register_number)max_register_number from register_datas where rest_type='" . $data->rest_type . "' AND register_type = 2 ";
                     $max_register_number = $this->db->query($sql)->result();
                     $max_register_number = @$max_register_number[0];
                     $max_register_number = $max_register_number->max_register_number;
                     $register_code .= str_pad($max_register_number + 1, 2, "0", STR_PAD_LEFT);
                     $data->register_code = $register_code;
                     $data->register_number = $max_register_number + 1;
                 }
                 $data->save();
                 $action = 'CREATE';
                 save_logs($this->menu_id, $action, @$data->id, $action . ' ' . $data->firstname . ' ' . $data->lastname . ' Register Public');
                 set_notify('success', 'ลงทะเบียนเสร็จเรียบร้อย');
                 redirect("register/success");
             }
         }
     }
 }