function checkLogin($b, $c) { $b = replaceMQ($b); $c = replaceMQ($c); $f = new db_query("SELECT adm_id \n\t\t\t\t\t\t\t FROM admin_users\n\t\t\t\t\t\t\t WHERE adm_loginname = '" . $b . "' AND adm_password = '******'"); if (mysqli_num_rows($f->result) > 0) { $g = mysqli_fetch_array($f->result); $h = $g["adm_id"]; $f->close(); unset($f); return $h; } else { $f->close(); unset($f); return 0; } }
function checkAccessCategory(){ $userlogin = getValue("userlogin", "str", "SESSION", "", 1); $password = getValue("password", "str", "SESSION", "", 1); $lang_id = getValue("lang_id", "int", "SESSION", 1); // Danh sách category đc phép truy cập $list_id = ""; $db_category= new db_query("SELECT adm_id, adm_isadmin, adm_access_category FROM admin_user WHERE adm_loginname = '" . $userlogin . "' AND adm_password='******' AND adm_active = 1"); //Check xem user co ton tai hay khong if($row = mysql_fetch_array($db_category->result)){ //Neu column adm_isadmin = 1 thi get all category if($row["adm_isadmin"] == 1) { $db_getall = new db_query("SELECT cat_id FROM categories_multi"); while($getall = mysql_fetch_array($db_getall->result)){ $list_id .= $getall["cat_id"] . ","; } unset($db_getall); } else{ preg_match_all('/\[(.*?)\]/is', $row["adm_access_category"], $matches); for($i=0; $i<count($matches[1]); $i++){ $list_id .= intval($matches[1][$i]) . ","; } } } $db_category->close(); unset($db_category); $list_id .= 0; return $list_id; }
} } //Phần hiển thị //Khởi tạo $left_control = ''; $right_control = ''; $left_column = ''; $right_column = ''; $context_menu = ''; $add_btn = getPermissionValue('add'); $edit_btn = getPermissionValue('edit'); $trash_btn = getPermissionValue('trash'); //control button trái $left_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1); $list_category = array(); $db_agencies = new db_query('SELECT * FROM agencies'); $list_category = $db_agencies->resultArray(); unset($db_agencies); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); $all_count = $db_count->total; unset($db_count); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $trash_count = $db_count->total; unset($db_count); ob_start(); ?> <ul class="list-unstyled list-vertical-crm"> <li data-cat="all"> <label class="active cat_name"><b><i class="fa fa-list fa-fw"></i> Tất cả (<?php echo $all_count; ?>
function forgetPass($email){ $email = replaceMQ($email); $user_id = 0; $db_check = new db_query("SELECT use_id FROM user_test WHERE use_email = '" . $email . "' AND use_active = 1"); if(mysql_num_rows($db_check->result) > 0){ $check = mysql_fetch_array($db_check->result); $user_id = $check["use_id"]; $db_check->close(); unset($db_check); return $user_id; } else{ ?> <script> alert('Bạn đã khai báo tên truy cập hoặc email không đúng.'); </script> <? $db_check->close(); unset($db_check); return false; } }
if($action == "update"){ //Check Error! $errorMsg .= $myform->checkdata(); if($errorMsg == ""){ $db_ex = new db_execute($myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"])); //echo $myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]); //Redirect to: redirect($_SERVER['REQUEST_URI']); exit(); } } //add form for javacheck $myform->addFormname("setting"); $myform->checkjavascript(); //Select data $db_data = new db_query("SELECT * FROM configuration WHERE con_lang_id = " . $_SESSION["lang_id"]); if (mysql_num_rows($db_data->result) > 0) { $row = mysql_fetch_array($db_data->result); $db_data->close(); unset($db_data); } else{ echo "Cannot find data"; exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
function get_category_thuoc() { $ll = new db_query('SELECT cat_id, cat_name FROM categories WHERE cat_type = ' . CATEGORY_TYPE_THUOC); return $ll->resultArray(); }
<?php //lấy ra list các danh mục bệnh $db_cat_disease = new db_query('SELECT * FROM cat_disease WHERE cdi_parent_id = 0 AND cdi_id <> ' . OTHER_DISEASE); $cat_disease = $db_cat_disease->resultArray(); unset($db_cat_disease); $rainTpl->assign('cat_disease', $cat_disease);
$load_header .= '<script language="javascript" src="../../resource/js/thickbox.js"></script>'; $load_header .= '<script language="javascript" src="../../resource/js/calendar.js"></script>'; $load_header .= '<script language="javascript" src="../../resource/js/tooltip.jquery.js"></script>'; $load_header .= '<script language="javascript" src="../../resource/js/jquery.jeditable.mini.js"></script>'; $load_header .= '<script language="javascript" src="../../resource/js/swfObject.js"></script>'; $load_header .= '<script language="javascript" src="../../resource/js/jwysiwyg/jquery.wysiwyg.js"></script>'; $fs_change_bg = 'onMouseOver="this.style.background=\'#DDF8CC\'" onMouseOut="this.style.background=\'#FEFEFE\'"'; //phan ngon ngu admin $db_language = new db_query("SELECT tra_text,tra_keyword FROM admin_translate"); $langAdmin = array(); while($row=mysql_fetch_assoc($db_language->result)){ $langAdmin[$row["tra_keyword"]] = $row["tra_text"]; } $db_con = new db_query("SELECT con_currency,con_exchange from configuration WHERE con_lang_id=" . $lang_id); if ($row=mysql_fetch_array($db_con->result)){ while (list($data_field, $data_value) = each($row)) { if (!is_int($data_field)){ //tao ra cac bien config $$data_field = $data_value; //echo $data_field . "= $data_value <br>"; } } } $db_con->close(); unset($db_con); $array_value = array( "nguoimua"=>translate_text("Dành cho người mua") ,"nguoiban"=>translate_text("Dành cho người bán") ,"quydinh"=>translate_text("Quy định")
function showInfo() { $array_return = array(); $cat_id = getValue('cat_id', 'int', 'POST', 0); $db_cus_cat = 'SELECT * FROM customer_cat WHERE cus_cat_id = ' . $cat_id . ''; $rs_cus_cat = new db_query($db_cus_cat); $list_category = $rs_cus_cat->resultArray(); foreach ($list_category as $cat) { $array_return = array('cus_cat_sales' => format_number($cat['cus_cat_sales']), 'cus_cat_discount' => $cat['cus_cat_discount']); } unset($db_cus_cat); die(json_encode($array_return)); }
function category_type($type, $parent_id = null) { if ($parent_id !== null) { $parent_id = (int) $parent_id; $db_query = new db_query('SELECT * FROM categories_multi WHERE cat_type ="' . $type . '" AND cat_parent_id = ' . $parent_id); } else { $db_query = new db_query('SELECT * FROM categories_multi WHERE cat_type ="' . $type . '"'); } $result = $db_query->resultArray(); return $result; }
<?php echo template_top(translate_text("Configuration page satics")); ?> <? if($errorMsg!=''){?><h1 class="error"><?php echo $errorMsg; ?> </h1><? }?> <form action="<?php echo getURL(); ?> " method="post" name="setting"> <table border="0" cellpadding="5" cellspacing="0" width="100%"> <? //config static module $db_static = new db_query("SELECT sta_id,sta_title FROM statics_multi WHERE statics_multi.lang_id = " . $lang_id ); if (mysql_num_rows($db_static->result) > 0) mysql_data_seek($db_static->result,0); //loop all static config $i=0; foreach($arrayStatic as $key=>$value){ $i++; ?> <tr <? if($i % 2 == 0){ echo "bgcolor='#EEE'"; }else{ echo "bgcolor='#FFF'"; } ?>> <td width="30%" nowrap="nowrap"> - <b><?php echo $value; ?> </b></td> <td> <?php echo get_config_combo($db_static->result, $key, ${$key}); ?>
<input class="form-control datetime-local input_date fl" value="' . date('d/m/Y', time() - 86400 * 30) . '" id="start_date" type="text"> <i class="fa fa-arrow-right fl pull_span"></i> <input class="form-control datetime-local input_date fl" value="' . date('d/m/Y') . '" id="end_date" type="text"> </label> <button class="btn btn-success" onclick="fillCustomers()"><i class="fa fa-check-circle-o"></i> Lọc dữ liệu </button> <button class="btn btn-danger"><i class="fa fa-file-excel-o"></i> Xuất excel </button> </div> <div class="clearfix"></div> '; // phấn menu left //lấy ra danh mục $bg_table = "customers"; $list_category = array(); $db_cat_customer = new db_query('SELECT * FROM customer_cat'); $list_category = $db_cat_customer->resultArray(); unset($db_cat_customer); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); unset($db_count); ob_start(); ?> <ul id="tree" class="list_category"> <li> <label><input type="checkbox" name="all_customers" id="chk_all"> <b>Tất cả</b> </label> </li> <li class="cat_parent list-vertical-item" > <?php //foreach lại 1 lần nữa trong mảng categoy để lấy ra các category con của cat cha hiện tại
function getOpenNode($table_name,$id_field,$parent_id_field,$parent_id,$where_clause="1",$field_list,$order_clause,$has_child_field,$array_parent_node,$level=0,$callback=0) { //select menu from database $db_menu = new db_query("SELECT " . $field_list . ", " . $has_child_field . " " . "FROM " . $table_name . " " . "WHERE " . $parent_id_field . "=" . $parent_id . " AND " . $where_clause . " " . "ORDER BY " . $order_clause); //lap de lay menu while ($row=mysql_fetch_assoc($db_menu->result)){ //tang so thu tu $this->stt++; //break field_list in to array $field_list_arr = explode(",",$field_list); //gan gia tri menu vao array for ($i=0;$i<count($field_list_arr);$i++){ $this->menu[$this->stt][$field_list_arr[$i]] = $row[$field_list_arr[$i]]; } //gan level cho menu $this->menu[$this->stt]["level"] = $level; $this->menu[$this->stt]["parent"] = 0; //de quy de lap lai, neu menu_id man trong array cac menu cha if (array_search($row[$id_field],$array_parent_node)!==false){ //thiet lap de biet day la` 1 nut cha $this->menu[$this->stt]["parent"] = 1; $this->getOpenNode($table_name,$id_field,$parent_id_field,$row[$id_field],$where_clause,$field_list,$order_clause,$has_child_field,$array_parent_node,$level+1,1); } } if ($callback==0){ $db_menu->close(); } unset($db_menu); //tra ve gia tri menu if ($callback==0) return $this->menu; }
} unset($db_count_desk); // lay ra vi tri ban $db_position_section = new db_query("SELECT * FROM desks\n LEFT JOIN sections ON des_sec_id = sec_id\n WHERE des_id = " . intval($desk_id)); $data_pos_sec = mysqli_fetch_assoc($db_position_section->result); unset($db_position_section); if (!$data_pos_sec) { return; } $desk_name = $data_pos_sec['des_name'] . ' - ' . $data_pos_sec['sec_name']; // lay ra danh sach khach hang $db_customer = new db_query('SELECT * FROM customers ORDER BY cus_id ASC'); $list_cus = $db_customer->resultArray(); unset($db_customer); // lay ra danh sach nhan vien $db_user = new db_query('SELECT * FROM users ORDER BY use_id ASC'); $list_use = $db_user->resultArray(); unset($db_user); //lay ra gio vao ban $db_current_desk = new db_query("SELECT cud_start_time FROM current_desk\n WHERE cud_desk_id = " . intval($desk_id)); $data_current_desk = mysqli_fetch_assoc($db_current_desk->result); unset($db_current_desk); $start_time = date('d/m/Y h:i', $data_current_desk['cud_start_time']); //danh sach thuc don $db_categories_menus = new db_query('SELECT * FROM categories_multi WHERE cat_type = "' . MENU_CAT_TYPE . '"'); $list_menu = ''; while ($data_cat_menu = mysqli_fetch_assoc($db_categories_menus->result)) { // danh sach cat_menu $list_menu .= '<li id="cat-menu-' . $data_cat_menu['cat_id'] . '"> <div class="name-price cat-menu">
$query_str = "INSERT INTO admin_user_language VALUES(" . $last_id . "," . $user_lang_id_list[$i] .")"; $db_ex = new db_execute($query_str); unset($db_ex); } } //category right redirect($ff_redirect_succ); exit(); } } } } $myform->evaluate(); $db_getallmodule = new db_query("SELECT * FROM modules ORDER BY mod_order DESC"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php echo $load_header; ?> </head> <body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <? /*------------------------------------------------------------------------------------------------*/ ?> <?php echo template_top(translate_text("Add new member")); ?>
$db = new db_query('SELECT cat_id,cat_name FROM categories_multi WHERE cat_type = "menus" AND cat_parent_id = 0'); while ($row = mysqli_fetch_assoc($db->result)) { $count = 0; //lấy ra các danh mục con $db_cat_child = new db_query('SELECT cat_id,cat_name FROM categories_multi WHERE cat_type = "menus" AND cat_parent_id = ' . $row['cat_id']); while ($row_cat_child = mysqli_fetch_assoc($db_cat_child->result)) { //lấy ra các menu con của danh mục này $db_menu = new db_query('SELECT men_id,men_name FROM menus WHERE men_cat_id = ' . $row_cat_child['cat_id']); $list_menu = $db_menu->resultArray(); $count += count($list_menu); $row_cat_child['list_menu_child'] = $list_menu; $row_cat_child['count_menu'] = count($list_menu); $row['list_cat_child'][] = $row_cat_child; } //lấy ra các menu của danh mục này $db_menu = new db_query('SELECT men_id,men_name FROM menus WHERE men_cat_id = ' . $row['cat_id']); $list_menu = $db_menu->resultArray(); $row['list_menu_child'] = $list_menu; $row['count_menu'] = $count + count($list_menu); unset($db_menu); unset($db_cat_child); $list_category_menu[] = $row; } $tmpTpl = new RainTPL(); $tmpTpl->assign('list_category_menu', $list_category_menu); $listing_menu = $tmpTpl->draw('v2/home/home_list_menu', 1); } //Lấy ra các bàn đang mở để active $desk_active_id = array(); $db_current_desk = new db_query('SELECT * FROM current_desk'); while ($row = mysqli_fetch_assoc($db_current_desk->result)) {
function searchRecord() { // TODO: Implement searchRecord() method. //Hàm tìm kiếm ở header $cat_id = getValue($this->cat_field, 'str', 'GET', ''); $html = ''; $this->_listAdd(); $class_context_menu = 'menu-normal'; switch ($cat_id) { case 'all': $this->list->addHiddenHeader($this->cat_field, $cat_id); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch()); $sql = 'SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch(); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $this->list->addHiddenHeader($this->cat_field, $cat_id); $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $this->bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($this->bg_table); $this->list->limit($total); break; default: $cat_id = (int) $cat_id; $this->list->addHiddenCondition($this->cat_field, $cat_id, 'int'); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' AND ' . $this->cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' WHERE 1 ' . $this->list->sqlSearch() . ' AND ' . $this->cat_field . ' = ' . $cat_id . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $this->list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $list_column = $this->_listColumn($row); $i++; $html .= $this->list->start_tr($i, $row[$this->id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$this->id_field] . ')" data-record_id="' . $row[$this->id_field] . '"'); $html .= $list_column; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $this->add($html); }
checkLogged('login.php'); $admin_id = getValue("user_id", "int", "SESSION"); $isAdmin = getValue("isAdmin", "int", "SESSION", 0); $isSuperAdmin = getValue('isSuperAdmin', 'int', 'SESSION', 0); if (!$isAdmin) { redirect('index.php'); } //ajax $isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; if ($isAjaxRequest) { $action = getValue('action', 'str', 'POST', ''); switch ($action) { case 'changeAgency': $age_id = getValue('age_id', 'int', 'POST', 0); $db_age = new db_query('SELECT sed_id, sed_name FROM service_desks WHERE sed_agency_id = ' . $age_id); $list_service_desk = $db_age->resultArray(); foreach ($list_service_desk as $k => $v) { ?> <option value="<?php echo $v['sed_id']; ?> "><?php echo $v['sed_name']; ?> </option> <?php } break; }
//Khởi tạo $left_control = ''; $right_control = ''; $footer_control = ''; $left_column_title = 'Nhóm khách hàng'; $right_column_title = 'Danh sách khách hàng'; $left_column = ''; $right_column = ''; $context_menu = ''; $add_btn = getPermissionValue('add'); $edit_btn = getPermissionValue('edit'); $trash_btn = getPermissionValue('trash'); //control button trái $left_control = list_admin_control_button($add_btn, $edit_btn, $trash_btn, 1); $db_cus_cat = "SELECT *FROM customer_cat ORDER BY cus_cat_id"; $rs_cus_cat = new db_query($db_cus_cat); $list_category = $rs_cus_cat->resultArray(); $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table); $all_count = $db_count->total; unset($db_count); $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $trash_count = $db_count->total; unset($db_count); ob_start(); ?> <ul class="list-unstyled list-vertical-crm"> <li data-cat="all"> <label class="active cat_name"><b><i class="fa fa-list fa-fw"></i> Tất cả (<?php echo $all_count; ?> )</b></label>
function loadMenuDetail() { //contextmenuclass cho phần chi tiết thực đơn $class_context_menu = ''; $record_id = getValue('record_id', 'int', 'POST', ''); $table = 'menu_products'; $html = ''; //Thêm hidden menu_id để gửi trong form công thức chế biến $html .= $this->form->hidden(array('name' => 'selected_menu', 'id' => 'selected_menu', 'value' => $record_id)); $this->list->add('', 'Nguyên liệu'); $this->list->add('', 'SL'); $this->list->add('', 'ĐVT'); $db_count = new db_count('SELECT count(*) as count FROM ' . $table . ' WHERE mep_menu_id = ' . $record_id . $this->list->sqlSearch()); $total = $db_count->total; unset($db_count); $sql = 'SELECT * FROM ' . $table . ' LEFT JOIN products ON pro_id = mep_product_id LEFT JOIN units ON uni_id = pro_unit_id WHERE mep_menu_id = ' . $record_id . $this->list->sqlSearch() . ' ORDER BY ' . $this->list->sqlSort() . ' pro_name ASC ' . $this->list->limit($total); $db_listing = new db_query($sql); $array_row = $db_listing->resultArray(); unset($db_listing); $total_row = count($array_row); $html .= $this->list->showHeader($total_row, '', 'id="menu_product_listing"'); $i = 0; foreach ($array_row as $row) { $i++; $html .= $this->list->start_tr($i, 'product_' . $row['pro_id'], 'class="' . $class_context_menu . ' menu-product-item" onclick="active_menu_product(' . $row['pro_id'] . ')" data-record_id="' . $row['pro_id'] . '" data-menu_id = "' . $record_id . '"'); $html .= '<td>' . $row['pro_name'] . '</td>'; $html .= '<td>' . $row['mep_quantity'] . '</td>'; $html .= '<td>' . $row['uni_name'] . '</td>'; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $html .= '<div class="pos_bottom alert-warning text-left"> <label>Lưu ý:</label> <br/> Định lượng nguyên liệu của một thực đơn dựa vào số lượng chế biến của nguyên liệu( chính là mặt hàng trong kho hàng). Nếu bạn muốn quản lý kho hàng và các mặt hàng được tự động trừ khi phục vụ thực đơn. Bạn phải tạo định lượng theo số lượng tương ứng. <br/> Với các mặt hàng không phải chế biến, có nghĩa là nhập về có thể bán được ngay(vd: bia, nước ngọt ...) thì bạn cũng phải tạo định lượng chế biến là 1 để khi bán hàng kho hàng tự động trừ tương ứng <label>Số lượng tồn của thực đơn</label> được tính toán dựa trên công thức chế biến của thực đơn đó và số lượng tồn của các nguyên liệu trong kho hàng. </div>'; $this->add($html); }
/** * db_count::db_count() * * @param string $sql : Cau lenh sql * @return int so ket qua */ function db_count($sql){ $db_ex = new db_query($sql); if( $row = mysql_fetch_assoc($db_ex->result)){ $this->total = intval($row["count"]); }else{ $this->total = 0; } $db_ex->close(); unset($db_ex); return $this->total; }
if( ($iCat == 0 || $sCat == '') && ($iData == 0 || $sData == '') ){ $con_site_title = isset($arrCatType[$module]) ? 'Xem các bài viết về ' . $arrCatType[$module]['typ_name'] : ''; $con_site_title .= $page != '' ? ' - Trang ' . $page : ''; $con_meta_description = $con_site_title; $con_meta_keywords = $con_site_title; } } /** * Detail News */ if(($type == 'news' || $type == 'thongbao') && ($iData != 0 || $sData != '') ){ if($type == 'thongbao'){ if($iData <= 334){ $db_thongbao_fix = new db_query("SELECT ntb_new_id FROM news_thongbao WHERE ntb_id = " . $iData . " LIMIT 1"); if($rowTb = mysql_fetch_assoc($db_thongbao_fix->result)) $iData = $rowTb['ntb_new_id']; $db_thongbao_fix->close(); unset($db_thongbao_fix); } } $sql = $iData != 0 ? " AND new_id = " . $iData : " AND new_title_rewrite = '" . $sData . "'"; $db_news = new db_query("SELECT new_id, new_category_id, new_title, new_title_rewrite, cat_id, cat_name, cat_type FROM news INNER JOIN categories_multi ON(cat_id = new_category_id AND cat_active = 1) WHERE new_active = 1 " . $sql . " "); if($row = mysql_fetch_assoc($db_news->result)){ $module = $module == '' ? $row["cat_type"] : $module;
function checkaccessmodule($module_id){ checkloged(); $userlogin = getValue("userlogin", "str", "SESSION", "", 1); $password = getValue("password", "str", "SESSION", "", 1); $lang_id = getValue("lang_id", "int", "SESSION", 1); $db_getright = new db_query("SELECT * FROM admin_user WHERE adm_loginname='" . $userlogin . "' AND adm_password='******' AND adm_active=1 AND adm_delete = 0"); //Check xem user co ton tai hay khong if ($row = mysql_fetch_array($db_getright->result)){ //Neu column adm_isadmin = 1 thi cho access if ($row['adm_isadmin'] == 1) { $db_getright->close(); unset($db_getright); return 1; } } //Ko co thi` fail luon else{ $db_getright->close(); unset($db_getright); return 0; } $db_getright->close(); unset($db_getright); //check user $db_getright = new db_query("SELECT * FROM admin_user, admin_user_right, modules WHERE adm_id = adu_admin_id AND mod_id = adu_admin_module_id AND adm_loginname='" . $userlogin . "' AND adm_password='******' AND adm_active=1 AND adm_delete = 0 AND mod_id = " . $module_id); if ($row=mysql_fetch_array($db_getright->result)){ $db_getright->close(); unset($db_getright); return 1; } else{ $db_getright->close(); unset($db_getright); return 0; } }
$isSuperAdmin = getValue('isSuperAdmin', 'int', 'SESSION', 0); $isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; //Lấy ra config nhà hàng if ($isAdmin) { $sql_configuration = 'SELECT * FROM configurations WHERE con_admin_id = ' . $admin_id . ' LIMIT 1'; } else { $sql_configuration = 'SELECT * FROM configurations LEFT JOIN admin_users ON adm_id WHERE con_admin_id = ' . $user_config . ' LIMIT 1'; } $db_con = new db_query($sql_configuration); $configuration = mysqli_fetch_assoc($db_con->result); unset($db_con); //lấy danh sách bàn trong cửa hàng hiện tại $db_desk = new db_query('SELECT * FROM desks LEFT JOIN sections ON sec_id = des_sec_id LEFT JOIN service_desks ON sed_id = sec_service_desk WHERE sed_agency_id = ' . $configuration['con_default_agency']); $_list_desk = $db_desk->resultArray(); unset($db_desk); //lấy danh sách khu vực trong cửa hàng hiện tại $db_section = new db_query('SELECT * FROM sections LEFT JOIN service_desks ON sed_id = sec_service_desk WHERE sed_agency_id = ' . $configuration['con_default_agency']); $_list_section = $db_section->resultArray(); unset($db_section); $load_header = $css_global . $js_global; $load_header .= '<title>Hệ thống quản lý CMS</title>';
$first = "<<"; $last = ">>"; $break_type = 1;//"1 => << < 1 2 [3] 4 5 > >>", "2 => < 1 2 [3] 4 5 >", "3 => 1 2 [3] 4 5", "4 => < >" $url = getURL(0,0,1,1,"page"); $db_count = new db_query($sql_count . $sqlWhere); $listing_count = mysql_fetch_array($db_count->result); $total_record = $listing_count["count"]; $current_page = getValue("page", "int", "GET", 1); if($total_record % $page_size == 0) $num_of_page = $total_record / $page_size; else $num_of_page = (int)($total_record / $page_size) + 1; if($current_page > $num_of_page) $current_page = $num_of_page; if($current_page < 1) $current_page = 1; $db_count->close(); unset($db_count); //End get page break params $db_listing = new db_query($sql_data . $sqlWhere . " ORDER BY " . $sqlOrderBy . " LIMIT " . ($current_page - 1) * $page_size . ", " . $page_size); ?> <? //Page break and search data?> <table width="98%" cellpadding="2" cellspacing="2"> <tr> <? if($total_record > $page_size){?> <td nowrap="nowrap" class="textBold"><?php echo generatePageBar($page_prefix, $current_page, $page_size, $total_record, $url, $normal_class, $selected_class, $previous, $next, $first, $last, $break_type); ?> </td> <? }?> <td align="right"> <table cellpadding="0" cellspacing="0"> <form name="search" action="<?php echo getURL(0, 0, 1, 0); ?>
} unset($db_access); //Select access channel $access_channel=""; //Select access languages $access_language=""; $db_access = new db_query("SELECT * FROM admin_user, admin_user_language, languages WHERE adm_id = aul_admin_id AND languages.lang_id = aul_lang_id AND adm_id =" . $iAdm); while($row_access = mysql_fetch_array($db_access->result)) $access_language .="[" . $row_access['lang_id'] . "]"; unset($row_access); //Check user exist or not $db_admin_sel = new db_query("SELECT * FROM admin_user WHERE adm_id = " . $iAdm); $db_getallmodule = new db_query("SELECT * FROM modules ORDER BY mod_order DESC"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php echo $load_header; ?> </head> <body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<?php $isAdmin = isset($_SESSION["isAdmin"]) ? intval($_SESSION["isAdmin"]) : 0; $user_id = isset($_SESSION["user_id"]) ? intval($_SESSION["user_id"]) : 0; $sql = ''; if ($isAdmin != 1) { $sql = ' INNER JOIN admin_users_right ON(adu_admin_module_id = mod_id AND adu_admin_id = ' . $user_id . ')'; } $db_menu = new db_query("SELECT * \n\t\t\t\t\t\t FROM modules\n\t\t\t\t\t\t " . $sql . "\n\t\t\t\t\t\t ORDER BY mod_order ASC, mod_id ASC"); ?> <ul> <?php $menu = $db_menu->resultArray(); foreach ($menu as $mod) { if (!file_exists("modules/" . $mod["mod_path"] . "/inc_security.php") && !file_exists("core/" . $mod["mod_path"] . "/inc_security.php")) { continue; } $filepath = file_exists("modules/" . $mod["mod_path"] . "/inc_security.php") ? 'modules' : 'core'; ?> <li class="module_link"> <label class="module_name collapsed" data-toggle="collapse" data-target="#module_<?php echo $mod['mod_id']; ?> " > <span class="menu-label"><?php echo $mod['mod_name']; ?> </span><i class="fa fa-angle-right"></i> </label> <?php $arraySub = explode("|", $mod["mod_listname"]);
function listRecord() { global $id_field; global $bg_table; global $cat_field; $cat_id = getValue('cat_id', 'str', 'POST', 0); $html = ''; $class_context_menu = 'menu-normal'; #Bắt đầu với datagrid $list = new dataGrid($id_field, 30); /*code something*/ $list->add('', 'Tên cửa hàng'); $list->add('', 'Điện thoại'); switch ($cat_id) { case 'all': $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch()); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC ' . $list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($bg_table); $list->limit($total); break; default: $cat_id = (int) $cat_id; $db_count = new db_count('SELECT count(*) as count FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' AND ' . $cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $bg_table . ' WHERE 1 ' . $list->sqlSearch() . ' AND ' . $cat_field . ' = ' . $cat_id . ' ORDER BY ' . $list->sqlSort() . ' ' . $id_field . ' ASC ' . $list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $i++; $html .= $list->start_tr($i, $row[$id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$id_field] . ')" data-record_id="' . $row[$id_field] . '"'); /*code something */ $html .= '<td>' . $row['sed_name'] . '</td>'; $html .= '<td class="right">' . $row['sed_phone'] . '</td>'; $html .= $list->end_tr(); } $html .= $list->showFooter(); echo $html; }
echo $form->text(array('label' => 'Tiêu đề', 'name' => 'mod_listname', 'id' => 'mod_listname', 'placeholder' => 'Cách nhau bởi dấu |')); ?> <?php echo $form->text(array('label' => 'URL file', 'name' => 'mod_listfile', 'id' => 'mod_listfile', 'placeholder' => 'Cách nhau bởi dấu |')); ?> <?php echo $form->form_action(array('label' => array('Thêm mới', 'Nhập lại'), 'type' => array('submit', 'reset'))); ?> <?php echo $form->form_close(); ?> </div> <div id="list_module"> <?php //select module $db_module = new db_query("SELECT * FROM modules ORDER BY mod_order ASC"); $listmodule = $db_module->resultArray(); unset($db_module); $i = 0; ?> <?php foreach ($listmodule as $mod) { if (!file_exists("../../modules/" . $mod["mod_path"] . "/inc_security.php") && !file_exists("../../core/" . $mod["mod_path"] . "/inc_security.php")) { continue; } $filepath = file_exists("../../modules/" . $mod["mod_path"] . "/inc_security.php") ? 'modules' : 'core'; if (file_exists("../../" . $filepath . "/" . $mod["mod_path"] . "/inc_security.php")) { require_once "../../" . $filepath . "/" . $mod["mod_path"] . "/inc_security.php"; $i++; ?> <?php
function searchRecord() { // TODO: Implement searchRecord() method. global $configuration; //Hàm tìm kiếm ở header $cat_id = getValue($this->cat_field, 'str', 'GET', ''); $html = ''; $this->_listAdd(); $class_context_menu = 'menu-normal'; //list kho hàng $list_stores = array(); foreach (category_type('stores') as $store) { $list_stores[$store['cat_id']] = $store['cat_name']; } $store_id = getValue('store_id', 'int', 'GET', $configuration['con_default_store']); $this->list->addSearch('Kho hàng', 'store_id', 'array', $list_stores, getValue('store_id', 'int', 'GET', $store_id)); $sql_search = ''; $sql_search .= ' AND store_id = ' . $store_id . ' '; switch ($cat_id) { case 'all': $this->list->addHiddenHeader($this->cat_field, $cat_id); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; case 'trash': $this->list->addHiddenHeader($this->cat_field, $cat_id); $class_context_menu = 'menu-trash'; $db_count = new db_count('SELECT count(*) as count FROM trash WHERE tra_table = "' . $this->bg_table . '"'); $total = $db_count->total; unset($db_count); $array_row = trash_list($this->bg_table); $this->list->limit($total); break; default: $cat_id = (int) $cat_id; $this->list->addHiddenCondition($this->cat_field, $cat_id, 'int'); $db_count = new db_count('SELECT count(*) as count FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' AND ' . $this->cat_field . ' = ' . $cat_id); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM ' . $this->bg_table . ' LEFT JOIN product_quantity ON pro_id = product_id WHERE 1 ' . $this->list->sqlSearch() . $sql_search . ' AND ' . $this->cat_field . ' = ' . $cat_id . ' ORDER BY ' . $this->list->sqlSort() . ' ' . $this->id_field . ' ASC ' . $this->list->limit($total)); $array_row = $db_listing->resultArray(); unset($db_listing); break; } $total_row = count($array_row); $html .= $this->list->showHeader($total_row); $i = 0; foreach ($array_row as $row) { $list_column = $this->_listColumn($row); $i++; $html .= $this->list->start_tr($i, $row[$this->id_field], 'class="' . $class_context_menu . ' record-item" onclick="active_record(' . $row[$this->id_field] . ')" data-record_id="' . $row[$this->id_field] . '"'); $html .= $list_column; $html .= $this->list->end_tr(); } $html .= $this->list->showFooter(); $this->add($html); }