function draw() { $this->beginForm(); global $display; $item_per_page = 20; $sql_count = 'SELECT COUNT(*) AS total_item FROM support'; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); if ($total) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Tin', 'Trang'); $sql = 'SELECT * FROM support ORDER BY id DESC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'contents'), 'cmd=delete&id=' . $row['id']); if ($row['created']) { $row['created'] = date("d/m/Y", $row['created']); } $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('items', $items); $display->add('contents', Url::get('contents')); $display->add('paging', $paging); $display->output('list'); $this->endForm(); }
function draw() { $this->beginForm(); global $display; $user_id = intval(Url::get('user_id')); $user_info = DB::select('account', 'id="' . $user_id . '"'); $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); //search theo ngay thang nam $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('-', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } if (Url::get('created_time_to')) { $date_arr = explode('-', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]); } } $search_value = ' 1 '; if ($created_time_from) { $search_value .= ' AND created_time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND created_time <= ' . $created_time_to; } $item_per_page = 50; $sql_count = 'SELECT COUNT(id) AS total_item FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); if ($total) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Giao dịch', 'Trang'); $sql = 'SELECT id,name,created_time,up_time,up_count,user_id,user_name,status FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY up_time DESC ' . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['ebname'] = EClassApi::safe_title($row['name']); $row['up_time'] = date('d/m/y H:i', $row['up_time']); $row['created_time'] = date('d/m/y H:i', $row['created_time']); $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=delete&id=' . $row['id'] . '&user_id=' . $row['user_id']); $items[$row['id']] = $row; } } } else { $paging = ''; } $display->add('user_info', $user_info); $display->add('total_item', $total); $display->add('items', $items); $display->add('paging', $paging); $display->output('item_list'); $this->endForm(); }
function draw() { global $display; $arrVar = array(); $this->beginForm(1); $options = ""; EClassApi::getCats(); $where = ''; $group_id = Url::get('group_id', ''); $group_name = Url::get('group_name', ''); if ($group_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " id = '{$group_id}' "; $arrVar['group_id'] = $group_id; } if ($group_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " name = '{$group_name}' "; $arrVar['group_name'] = $group_name; } $item_per_page = 50; $limit = ''; $sql_count = "SELECT COUNT(*) AS total FROM products_extra_fields_group {$where}"; $total = DB::fetch($sql_count, 'total', 0); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Nhóm trường', 'Trang'); $re = DB::query("SELECT * FROM products_extra_fields_group {$where} order by id desc {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $products_extra_fields_group[$row['id']] = $row; } } } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options); //} $arrVar['options'] = $options; $arrVar['zones'] = CGlobal::$allZones; $arrVar['paging'] = $paging; $arrVar['products_extra_fields_group'] = $products_extra_fields_group; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilterAdd', $arrVar); $this->endForm(); }
function draw() { global $display; $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_faq'))); $filter_name = trim(Url::get('filter_name')); $filter_id = intval(trim(Url::get('filter_id'))); $filter_active = intval(trim(Url::get('filter_active'))); $faq_ids = Url::get('banner_ids'); if (!empty($faq_ids) && !empty($bulk_action)) { $faq_ids = implode(',', $faq_ids); switch ($bulk_action) { case '1': $query = 'UPDATE faq SET is_active = 1 WHERE id IN (' . $faq_ids . ')'; DB::query($query); break; case '2': $query = 'UPDATE faq SET is_active = 0 WHERE id IN (' . $faq_ids . ')'; DB::query($query); break; case '3': $query = 'DELETE FROM faq WHERE id IN (' . $faq_ids . ')'; DB::query($query); break; } if (isset($query)) { DB::query($query); } } $cond = array(); if (!empty($filter_id)) { $cond[] = 'id LIKE "%' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } if (!empty($filter_name)) { $cond[] = 'name LIKE "%' . $filter_name . '%" '; $display->add('filter_name', $filter_name); } if (!empty($_POST)) { switch ($filter_active) { case 0: $cond[] = ' is_active = ' . $filter_active; break; case 1: $cond[] = ' is_active = ' . $filter_active; break; default: break; } $display->add('filter_active', $filter_active); } else { $display->add('filter_active', 2); } $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_faq = array(); $paging = ''; $total_row = Faq::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_faq = Faq::get_collection($limit, $cond, ' ORDER BY question ASC'); } $error_message = $this->getErrorMessage('admin/faq/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_faq', $list_faq); $display->output('List'); $this->endForm(); }
function draw() { global $display; if (!User::is_login()) { return; } $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); if (CGlobal::$lang == 1) { $display->add('lng', language::$LNG['personal']['en']); } else { $display->add('lng', language::$LNG['personal']['vn']); } $item_per_page = 6; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `order` o WHERE o.uid = ' . User::$current->data['id'] . ' AND o.status <> 0 LIMIT 0,1', 'total_row', 0); $list_bill = array(); $paging = ''; if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT *, o.id as oid FROM `order` o WHERE o.uid = ' . User::$current->data['id'] . ' AND o.status <> 0 ORDER BY o.id DESC ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { if ($_COOKIE['lang'] == 1) { $row['delivery_time'] = date('H:i:s m-d-Y', $row['delivery_time'] * 60 + $row['time']); } else { $row['delivery_time'] = date('H:i:s d-m-Y', $row['delivery_time'] * 60 + $row['time']); } $row['total'] = EClassApi::numberFormat($row['total']); $list_bill[] = $row; } } $display->add('list_bill', $list_bill); $display->add('total_row', $total_row); $display->add('paging', $paging); } $var = null; $sql = "SELECT DISTINCT a.*, d.name AS district_name, d.name_en AS district_name_en, p.id AS pid, p.name AS city_name, p.name_en AS city_name_en FROM delivery_address a INNER JOIN district d ON a.did = d.id INNER JOIN city p ON d.pid = p.id WHERE uid = " . User::$current->data['id']; //Get city $result = DB::query($sql); $list_delivery = array(); $address_default = null; if ($result) { while ($row = mysql_fetch_assoc($result)) { //$address = $row['address']; //$city_name = $row['city_name']; //$district_name = $row['district_name']; //$note = $row['note']; if ($row['is_default'] == 1) { $address_default = $row; } $list_delivery[] = $row; } } $display->add('list_delivery', $list_delivery); $display->add('address_default', $address_default); $user = PersonalDB::get_account_information(); $next_reward = 100 - $user['point'] % 100; $display->add('next_reward', $next_reward); $display->add('list_city', City::get_list()); if (!empty($address_default) && !empty($address_default['pid'])) { $display->add('list_district', City::get_districts($address_default['pid'])); } $display->add('user', $user); $display->add('lang', CGlobal::$lang); $display->add('error_message', $this->getErrorMessage('personal/change_password')); $display->add('success_message', $this->getSuccessMessage('personal/change_password')); $display->add('form_data', $this->getSuccessMessage('personal/form_data')); $display->setTemplate('ManageOrder', $var); $this->endForm(); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $filter_type = intval(trim(Url::get('filter_type'))); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '"'; $display->add('filter_id', $filter_id); } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } $cond[] = ' type_id = -1 '; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_log = array(); $paging = ''; $total_row = Logs::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_log = Logs::get_collection($limit, $cond, ' ORDER BY id DESC'); foreach ($list_log as $k => $l) { $l['data'] = unserialize($l['data']); if ($l['data']['type'] != 'VIP') { if (isset($l['data']['status'])) { if ($l['data']['status'] == '00') { $list_log[$k]['status'] = 1; } else { $list_log[$k]['status'] = 0; } } else { $list_log[$k]['status'] = 0; } if (!empty($l['data']['status'])) { $list_log[$k]['fail'] = 0; } else { $list_log[$k]['fail'] = 1; } } else { $list_log[$k]['status'] = 1; $list_log[$k]['fail'] = 0; } $list_log[$k]['data'] = $l['data']; } } $display->add('paging', $paging); $display->add('list_log', $list_log); $display->add('is_admin', User::is_admin()); $display->add('is_root', User::is_root()); $display->output('ListCoin'); // $this->endForm(); }
function draw() { global $display; $this->beginForm(false, 'post', false, Url::build_current()); $item_per_page = 15; $sql_count = 'SELECT count(*) AS total_row FROM `order` o INNER JOIN account a ON o.uid = a.id'; $list_orders = array(); $paging = ''; // Get Filter Parameters $order_code = EClassApi::getParam('order_code'); $from_date = EClassApi::getParam('from_date'); $fdo = $from_date; $uid = Url::get('id'); $to_date = EClassApi::getParam('to_date'); $tdo = $to_date; $rid = EClassApi::getParam('rid'); $scope = EClassApi::getParam('scope'); if (!empty($from_date)) { $from_date = SupplierHelper::get_time_stamp($from_date); } if (!empty($to_date)) { $to_date = SupplierHelper::get_time_stamp($to_date, 1); } $conditions = ''; if (intval($uid) > 0) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND o.uid = " . $uid; } else { $conditions .= " WHERE o.uid = " . $uid; } } if (!empty($order_code)) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND order_code LIKE '" . $order_code . "%'"; } else { $conditions .= " WHERE order_code LIKE '" . $order_code . "%'"; } } if (!empty($from_date)) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND time >= " . $from_date; } else { $conditions .= " WHERE time >= " . $from_date; } } if (!empty($to_date)) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND time <= " . $to_date; } else { $conditions .= " WHERE time <= " . $to_date; } } if (strstr($conditions, 'WHERE')) { $conditions .= " AND o.status <> 0 "; } else { $conditions .= " WHERE o.status <> 0 "; } $sql_count .= $conditions . ' LIMIT 0, 1'; $total_row = DB::fetch($sql_count, 'total_row', 0); if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT p.name AS city_name, d.name AS district_name, s.name AS cod_name, o.*, a.user_name, a.id as account_id, a.email AS account_email FROM `order` o INNER JOIN account a ON o.uid = a.id LEFT JOIN cod s ON o.cod_id = s.id INNER JOIN district d ON o.ship_district = d.id INNER JOIN city p ON d.pid = p.id' . $conditions . ' ORDER BY id DESC ' . $limit; $res = DB::query($sql); $today = date('d/m/Y'); if ($res) { while ($row = mysql_fetch_assoc($res)) { $row['order_time'] = trim(date('d/m/Y', $row['time'])); if ($today == $row['order_time']) { $row['order_time'] = date('H:i', $row['time']); } $row['total'] = EClassApi::numberFormat($row['total']); $list_orders[] = $row; } } mysql_free_result($res); } $display->add('list_orders', $list_orders); $display->add('total_row', $total_row); $display->add('id', $uid); $display->add('order_code', $order_code); $display->add('from_date', $fdo); $display->add('to_date', $tdo); $display->add('rid', $rid); $display->add('scope', $scope); $display->add('paging', $paging); $display->output('list_order'); $this->endForm(); }
function show_mes_outbox() { $search_text = EClassApi::getParam('search_text'); $is_archive = Url::get('is_archive', 0); $table_topics = 'message_topics'; $table_text = 'message_text'; $url_archive = ''; $url_cmd = ''; if ($is_archive) { $table_topics = $table_topics . '_archive'; $table_text = $table_text . '_archive'; $url_cmd = '&cmd=archive'; $url_archive = '&is_archive=1'; } $condition = $table_topics . '.mt_owner_id =' . User::id() . ' AND ' . $table_topics . '.mt_vid_folder = "sent" AND ' . $table_topics . '.mt_newest = 0'; if ($search_text && $search_text != "Account thành viên") { $condition .= " AND mt_to_name LIKE '%{$search_text}%' "; } $str_content = '<form name="message"> <div id="boxFunctions"> Chọn: <a style="cursor:pointer" id="select_all">Tất cả</a>, <a style="cursor:pointer" id="select_read">Đã đọc</a>, <a style="cursor:pointer" id="select_unchecked">Không chọn</a> <div id="boxFunctionRight"> <div id="btn_del_mess" align="center" class="btnAllNewFeedback" onmouseout="this.className=\'btnAllNewFeedback\'" onmouseover="this.className=\'btnAllNewFeedbackHover\'" style="width:40px;"> <div class="btnRightAllFeedback" align="center" style="width:40px"><a title="Xóa tất cả tin nhặn đã chọn" href="javascript:void(0)" onClick="return delMessage(0,\'true\',\'outbox\')">Xoá</a></div> </div> </div> </div> '; $str_content .= '<table cellpadding="3" cellspacing="0" border="0" width="100%">'; $sql_count = 'SELECT COUNT(mt_id) AS total_row FROM ' . $table_topics . ' WHERE ' . $condition; $total_item = DB::fetch($sql_count, 'total_row', 0); $item_per_page = 15; $limit = ''; $divID = 'mess_content'; $url_path = WEB_DIR . 'ajax.php?act=personal&code=show_mes_outbox' . $url_archive . '&search_text=' . $search_text; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_mes', '', false, false, $url_path, $divID, true); $sql = 'SELECT ' . $table_text . '.msg_id, ' . $table_text . '.msg_author_name, ' . $table_text . '.msg_date, ' . $table_text . '.msg_post, ' . $table_topics . '.mt_id, ' . $table_topics . '.mt_ref_id, ' . $table_topics . '.mt_title, ' . $table_topics . '.mt_from_id, ' . $table_topics . '.mt_owner_id, ' . $table_topics . '.mt_read, ' . $table_topics . '.mt_owner_name, ' . $table_topics . '.mt_to_name, account.avatar_url, account.img_server FROM ' . $table_text . ', ' . $table_topics . ', account WHERE ' . $table_text . '.msg_id = ' . $table_topics . '.mt_msg_id AND ' . $table_topics . '.mt_from_id = account.id AND ' . $condition . ' ORDER BY ' . $table_text . '.msg_date DESC ' . $limit; //echo $sql; //exit; $result = DB::query($sql); $stt = 0; if ($result) { while ($row = mysql_fetch_assoc($result)) { if ($stt < $item_per_page) { if ($row['mt_ref_id']) { $sourceTitle = DB::select($table_topics, 'mt_id = ' . $row['mt_ref_id']); if ($sourceTitle['mt_title']) { $row['mt_title'] = $sourceTitle['mt_title']; } //else //{ // $sentTitle = DB::select($table_topics,'mt_mgsid = ' . $row['mt_ref_id']); //} $row["mt_id"] = $row['mt_ref_id']; $row['mt_ref_id'] = 0; } if ($row['avatar_url']) { $row['avatar_url'] = EClassApi::getImageThumb($row['avatar_url'], 50, 50, 0, $row['img_server']); } else { $row['avatar_url'] = "style/images/50x50.gif"; } //$row['msg_date'] = EClassApi::duration_time($row['msg_date']); $msg_date = date('H:i | ', $row['msg_date']); if (date('d.m.y', $row['msg_date']) == date('d.m.y', TIME_NOW)) { $msg_date .= '<font color="green">Hôm nay</font>'; } else { $msg_date .= date('d.m.y', $row['msg_date']); } $row['msg_date'] = $msg_date; $row['msg_post'] = preg_replace("/\n/", "<br />", $row['msg_post']); $row['msg_post'] = strip_tags(EClassApi::parseBBCode(EClassApi::convert_one_br($row['msg_post'])), '<br />'); if (strlen($row['msg_post']) > 40) { $row['msg_post_short'] = EClassApi::word_limit($row['msg_post'], 40, ' ...'); //$row['msg_post_short'] = EClassApi::cleanHtml(EClassApi::word_limit($row['msg_post'],40,' ...')); } else { $row['msg_post_short'] = $row['msg_post']; //$row['msg_post_short'] = EClassApi::cleanHtml($row['msg_post']); } //$str_title = '<a onclick="fn_show_mes_detail('.$row["mt_id"].')" rel="history" href="message.html'.$url_cmd.'#outbox/'.$row["mt_id"].'" id="a_'.$row["mt_id"].'" title="Hiển thị chi tiết" >'.$row["mt_title"].'</a> - <span class="textMestime">'.$row['msg_date'].'</span>'; if ($row['mt_owner_id'] != User::id()) { $strUser = '******' . $row["mt_owner_name"] . '">' . $row["mt_owner_name"] . '</a>'; } else { $strUser = '******' . $row["mt_to_name"] . '">' . $row["mt_to_name"] . '</a>'; } if ($row["mt_read"] == 0 && !$is_archive) { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html?tab=gt' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết" ><b>' . $row["mt_title"] . '</b></a>'; $read_class = ' unreadMessage'; } else { $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html?tab=gt' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết">' . $row["mt_title"] . '</a>'; $read_class = ''; } $str_content .= '<tr id="' . $row["mt_id"] . '"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" class="rowbox' . $read_class . '" id="inbox_' . $row["mt_id"] . '" name="inbox[]" value="' . $row["mt_id"] . '"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="' . $row["msg_author_name"] . '"><img src="' . $row["avatar_url"] . '"/></a> </td> <td valign="top" class="listMessage' . $read_class . '" style="white-space:nowrap; padding-right:15px; vertical-align:middle;"> <div>' . $strUser . '</div> <div class="textMestime">' . $row['msg_date'] . '</div> </td> <td valign="top" class="listMessage clickable' . $read_class . '" style="padding-right:15px;width:65%;" lang="' . $row["mt_id"] . '"> <div style="margin-top:6px;">' . $str_title . '</div> <div style="margin:6px 0;color:#808080">' . $row['msg_post_short'] . '</div> </td> <td align="center" class="listMessage' . $read_class . '" style="padding-right:10px;"> <span><a title="Xóa tin nhắn" onClick="return delMessage(' . $row["mt_id"] . ',\'false\',\'inbox\')" href="javascript:void(0)" style="padding:20px;" class="deleteButton"> </a></span></td> </tr> '; /*$str_content .= '<tr id="'.$row["mt_id"].'"> <td align="center" class="listMessage' . $read_class . '"><input type="checkbox" id="inbox_'.$row["mt_id"].'" name="inbox[]" value="'.$row["mt_id"].'"></td> <td align="center" class="listMessage' . $read_class . '"> <a href="'.$row["mt_to_name"].'"><img src="'.$row["avatar_url"].'" vspace="4" hspace="4"/></a> <div><a href="'.$row["mt_to_name"].'">'.$row["mt_to_name"].'</a></div> </td> <td valign="top" style="width:65%;" class="listMessage' . $read_class . '"> <div>'.$str_title.'</div> <div style="margin-top:6px">'.$row['msg_post_short'].'</div> </td> <td align="center" class="listMessage' . $read_class . '"> <span><a title="Xóa tin nhắn" onClick="delMessage('.$row["mt_id"].',\'false\',\'sent\')" href="javascript:void(0)"> <img src="style/images/icon_delete.gif" width="9" height="9" /></a></span></td> </tr>';*/ } $stt++; } } if ($stt > 0) { $str_content .= '<tr><td></td><td> </td><td colspan="2"><div style="float:right">' . $paging . '</div><div style="clear:right"></div></td></tr>'; } else { $str_content .= '<tr><td></td><td colspan="3"> <center><div class="noMess">Không có Tin nhắn nào trong tin đã gửi</div></center> </td></tr>'; } $str_content .= '</table></form>'; echo $str_content; exit; }
function draw() { global $display; $this->beginForm(false, 'post', false, Url::build_current()); $name = trim(Url::get('name')); $order_by = Url::get('order_by', 'id'); $order_dir = Url::get('order_dir', 'DESC'); $cond = ' 1 '; if ($name != '') { $cond .= ' AND name LIKE "%' . $name . '%"'; } $item_per_page = 50; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `page` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0); $items = array(); $paging = ''; if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id ,name,title, description FROM `page` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['href'] = Url::build('edit_page', array('id' => $row['id'])); $items[$row['id']] = $row; } } } if ($order_dir == 'ASC') { $order_dir = 'DESC'; } else { $order_dir = 'ASC'; } $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir)); $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir)); $href_des = Url::build_current(array('order_by' => 'description', 'order_dir' => $order_dir)); $href_title = Url::build_current(array('order_by' => 'title', 'order_dir' => $order_dir)); $img_id = ''; $img_name = ''; $img_title = ''; $img_des = ''; if ($order_by == 'id') { $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'name') { $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'description') { $img_des = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'title') { $img_title = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('img_title', $img_title); $display->add('img_des', $img_des); $display->add('href_id', $href_id); $display->add('href_title', $href_title); $display->add('href_name', $href_name); $display->add('href_des', $href_des); $display->add('name', $name); $display->add('paging', $paging); $display->add('items', $items); $display->add('hover', EClassApi::mouse_hover('#E2F1DF', true)); $display->output('list'); $this->endForm(); }
function draw() { global $display; $this->beginForm(); $join_field = ''; $join = ''; $where_join = ''; $where = ''; $order_by = Url::get('order_by', 1); $time = "sms_user_active.c_time"; if ($order_by == 1) { $order = ' ORDER BY sms_user_active.id DESC'; } elseif ($order_by == 2) { $order = ' ORDER BY sms_user_active.a_time,sms_user_active.id'; $time = "sms_user_active.a_time"; } elseif ($order_by == 3) { $order = ' ORDER BY sms_user_active.c_time,sms_user_active.id'; } elseif ($order_by == 4) { $order = ' ORDER BY sms_user_active.l_time,sms_user_active.id'; $time = "sms_user_active.l_time"; } elseif ($order_by == 5) { $order = ' ORDER BY sms_user_active.sms_total DESC,sms_user_active.id'; $time = "sms_user_active.l_time"; } elseif ($order_by == 6) { $order = ' ORDER BY sms_user_active.sms_total,sms_user_active.id'; $time = "sms_user_active.l_time"; } $page = Url::get('page', 1); $a_id = Url::get('a_id', 0); $m_user_name = Url::get('m_user_name', ''); $user_name = Url::get('user_name'); $status = Url::get('status', 0); if ($user_name) { $user = User::getByUserName($user_name); if ($user) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.user_id = '{$user['id']}'"; } else { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " 0 "; } } if ($m_user_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.m_user_name = '{$m_user_name}'"; } if ($a_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.id = {$a_id}"; } if ($status == 3) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = 0"; } elseif ($status == 4) { $join_field = ", account.level"; $join = " LEFT JOIN account ON account.id = sms_user_active.user_id"; $where_join = ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = 1 AND (account.level < 1 OR account.level IS NULL)"; //$where.=($where!=''?' AND ':'WHERE ')." (status = 1 AND user_id IN (SELECT id FROM account WHERE level < 1))"; } elseif ($status) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " sms_user_active.status = {$status}"; } $date_start = Url::get('date_start'); $date_end = Url::get('date_end'); if ($date_start) { $arr = explode('-', $date_start); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " {$time}>=" . mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } if ($date_end) { $arr = explode('-', $date_end); $where .= ($where != '' ? ' AND ' : 'WHERE ') . " {$time}<=" . mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } $display->add('a_id', $a_id); $display->add('date_start', $date_start); $display->add('date_end', $date_end); $display->add('m_user_name', $m_user_name); $display->add('order_by', $order_by); $display->add('user_name', $user_name); $display->add('status', $status); $total = DB::fetch("SELECT COUNT(*) AS total_row FROM sms_user_active {$join} {$where} {$where_join}", 'total_row', 0); $display->add('total', $total); $pagging = ''; $items = array(); $sms_rows = array(); $item_ids = ''; if ($total) { //----- Pagging --------------- $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $pagging = ECPagging::pagingSE($limit, $total, 50, 10, 'page_no', true, ' Thành viên'); //----- Pagging --------------- // Lấy danh sách user_id để kiểm tra xem user đã thực sự được active trong bảng account hay chưa $lstIDs = ''; $sql = "SELECT user_id FROM sms_user_active {$where} {$order} {$limit}"; $reIDs = DB::query($sql); if ($reIDs) { $lstECSActive = ''; while ($row = mysql_fetch_assoc($reIDs)) { $lstECSActive .= $lstECSActive ? ',' : ''; $lstECSActive .= $row['user_id']; } if ($reIDs) { $sql = "SELECT id FROM account WHERE level > 0 AND id IN(" . $lstECSActive . ")"; $reActiveIDs = DB::query($sql); if ($reActiveIDs) { while ($row = mysql_fetch_assoc($reActiveIDs)) { $lstIDs .= $lstIDs ? ',' : ''; $lstIDs .= $row['id']; } } } } $sql = "SELECT sms_user_active.id,sms_user_active.user_id, sms_user_active.user_name, sms_user_active.sms_total, sms_user_active.c_time, \n\t\t\t\t\tsms_user_active.l_time, sms_user_active.a_time, sms_user_active.status, sms_user_active.m_time, sms_user_active.m_user_name, \n\t\t\t\t\tsms_user_active.note {$join_field} FROM sms_user_active {$join} {$where} {$where_join} {$order} {$limit}"; $re = DB::query($sql); if ($re) { while ($sms_row = mysql_fetch_assoc($re)) { if ($lstIDs) { if (strpos(',' . $lstIDs . ',', ',' . $sms_row['user_id'] . ',') === false && $sms_row['status']) { if ($sms_row['level'] != '') { // Nếu thành viên thực sự được kích hoạt ảo $sms_row['activeStyle'] = ' style="color:#C02C00;"'; } else { // Nếu thành viên đã được kích hoạt, nhưng đã bị xóa khỏi db $sms_row['activeStyle'] = ' style="color:#666666; text-decoration: line-through"'; } } } $sms_row['c_time'] = date('H\\hi d.m.Y', $sms_row['c_time']); if ($sms_row['l_time']) { $sms_row['l_time'] = date('H\\hi d.m.Y', $sms_row['l_time']); } else { $sms_row['l_time'] = ''; } if ($sms_row['m_time']) { $sms_row['m_user_name'] = "<b>Sửa:</b> {$sms_row['m_user_name']}<br /><b>Lúc:</b> " . date('H\\hi d.m.Y', $sms_row['m_time']); } else { $sms_row['m_user_name'] = ''; $sms_row['m_time'] = ''; } if ($sms_row['a_time']) { $sms_row['a_time'] = date('H\\hi d.m.Y', $sms_row['a_time']); } else { $sms_row['a_time'] = ''; } if ($sms_row['status'] != 1) { $sms_row['start_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=active&id={$sms_row['id']}"); } if ($sms_row['status'] == 1) { $sms_row['stop_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=deactive&id={$sms_row['id']}"); } $sms_row['del_link'] = WEB_DIR . ECRewrite::formatUrl("?page=user_active&cmd=del&id={$sms_row['id']}"); if ($sms_row['status'] == 0) { $sms_row['status'] = '<font color="orange">Chưa KH</font>'; } elseif ($sms_row['status'] == 1) { $sms_row['status'] = '<font color="green">Đã KH</font>'; } elseif ($sms_row['status'] == 2) { $sms_row['status'] = '<font color="brown">Vi phạm, không được KH</font>'; } $sms_row['edit_link'] = "?page=user_active&cmd=edit&id={$sms_row['id']}"; $sms_rows[$sms_row['id']] = $sms_row; } } } $display->add('is_root', User::is_root()); $display->add('items', $sms_rows); $display->add('pagging', $pagging); $display->output('UserActive'); $this->endForm(); }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); //search theo ngay thang nam $display->add('created_time_from', Url::get('created_time_from')); $display->add('created_time_to', Url::get('created_time_to')); $created_time_from = 0; $created_time_to = 0; if (Url::get('created_time_from')) { $date_arr = explode('/', Url::get('created_time_from')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_from = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('created_time_to')) { $date_arr = explode('/', Url::get('created_time_to')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $created_time_to = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } $search_value = 1; $last_log = (int) Url::get('last_log'); if ($last_log) { if ($created_time_from) { $search_value .= ' AND last_login >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND last_login <= ' . $created_time_to; } } else { if ($created_time_from) { $search_value .= ' AND create_time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND create_time <= ' . $created_time_to; } } $display->add('last_log', $last_log); if (Url::get('active') == 1) { $search_value .= ' AND (is_active=1)'; $display->add('active_checked', 'checked'); } else { $display->add('active_checked', ''); } if (Url::get('tracking') == 1) { $search_value .= ' AND (tracking=1)'; $display->add('tracking_checked', 'checked'); } else { $display->add('tracking_checked', ''); } if (Url::get('invalid') == 1) { $search_value .= ' AND (invalid_time > 0 OR invalid_time = -1)'; $order_by = ' ORDER BY invalid_time DESC '; $display->add('invalid_checked', 'checked'); } else { //$search_value .= ' AND invalid_time = 0'; $order_by = ' ORDER BY id DESC '; $display->add('invalid_checked', ''); } if (Url::get('block') == 1) { $search_value .= ' AND (block_time >= ' . TIME_NOW . ' OR block_time = -1)'; $order_by = ' ORDER BY block_time DESC '; $display->add('block_checked', 'checked'); } else { //$search_value .= ' AND block_time!=-1 AND block_time <= '.TIME_NOW; $display->add('block_checked', ''); } $od_by = Url::get('order_by'); $od_dir = Url::get('order_dir', 'DESC'); if ($od_by == 'name') { $order_by = ' ORDER BY user_name ' . $od_dir; } elseif ($od_by == 'id') { $order_by = ' ORDER BY id ' . $od_dir; } elseif ($od_by == 'time') { $order_by = ' ORDER BY create_time ' . $od_dir; } elseif ($last_log) { $order_by = ' ORDER BY last_login ' . $od_dir; } if (Url::get('ava')) { $search_value .= ' AND avatar_url != ""'; $display->add('ava_checked', 'checked'); } else { $display->add('ava_checked', ''); } // search ô textbox ID $id_search = (int) Url::get('id_search', 0); if ($id_search) { $search_value .= ' AND id=' . $id_search; } if ($id_search == 0) { $id_search = ''; } $display->add('id_search', $id_search); // search ô textbox tài khoản if (Url::get('text_value') != '') { $text_value = trim(Url::get('text_value')); $display->add('text_value', $text_value); $str_search = str_replace("'", '"', $text_value); $str_search = str_replace("'", '"', $str_search); $str_search = str_replace(""", '"', $str_search); $s_user = User::getByUserName($str_search, true); if ($s_user) { $search_value .= " AND id='{$s_user['id']}' "; } else { $search_value .= " AND 0 "; } } $cid = 0; if (Url::get('cid') != 0) { $cid = trim(Url::get('cid')); $search_value .= ' AND (CONCAT(",", class_id, ",") LIKE "%,' . $cid . ',%") '; } $display->add('id_phone', Url::get('id_phone')); $item_per_page = Url::get('item_per_page', 50); $sql_count = 'SELECT COUNT(id) AS total_item FROM account WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); $str_id = ''; $uids = ''; if ($total) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thành viên', 'Trang'); $sql = 'SELECT * FROM account WHERE ' . $search_value . ' ' . $order_by . $limit; $result = DB::query($sql); if ($result) { while ($row = mysql_fetch_assoc($result)) { $row['create_time'] = date('d/m/y H:i', $row['create_time']); if ($row['last_login']) { $row['last_login'] = date('d/m/y H:i', $row['last_login']); } else { $row['last_login'] = false; } if ($row['block_time'] > TIME_NOW || $row['block_time'] == -1) { if ($row['block_time'] != -1) { $row['status'] = "<font color=red><b>" . date('H:i d/m/y', $row['block_time']) . '</b></font>'; } else { $row['status'] = '<font color=red><b>Khóa vĩnh viễn</b></font>'; } $row['bgcolor'] = 'bgcolor="#CCCCCC"'; $row['is_block'] = true; $display->add('type_reason', 'Khóa'); } else { $row['status'] = ""; $row['bgcolor'] = ''; $row['is_block'] = false; } $row['gender'] = ''; $row['unban_nick'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=unban_nick&id=' . $row['id']); if (User::is_root()) { $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=del_user&id=' . $row['id']); } $row['detail'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id'])); $row['openids'] = array(); $row['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $row['id']); $uids .= ($uids ? ',' : '') . $row['id']; $items[$row['id']] = $row; } } } else { $paging = ''; } // // if($uids){ // $re = DB::query("SELECT openid_url,user_id FROM openid WHERE user_id IN($uids)"); // // if($re){ // while ($oid = mysql_fetch_assoc($re)) { // $items[$oid['user_id']]['openids'][] = $oid['openid_url']; // } // } // } //lay ly do khoa nicks hoac kiem duyet nick $arr_reason = array(); if ($str_id) { $where = ''; if (Url::get('block') == 1) { $where = ' AND type IN (0,1) '; } else { if (Url::get('invalid') == 1) { $where = ' AND type = 2 '; } } $sql = 'SELECT user_id, time, note, type,admin_id, admin_name FROM acc_lock WHERE user_id IN(' . $str_id . ') ' . $where . ' ORDER BY id ASC'; $result = DB::query($sql); while ($row = mysql_fetch_assoc($result)) { $arr_reason[$row['user_id']] = $row; } } foreach ($items as $value) { if (isset($arr_reason[$value['id']]['user_id']) && $value['id'] == $arr_reason[$value['id']]['user_id']) { $items[$value['id']]['lock_reason'] = EClassApi::filter_title($arr_reason[$value['id']]['note']); $items[$value['id']]['lock_type'] = $arr_reason[$value['id']]['type']; $items[$value['id']]['time_lock'] = date("d/m/y H:i", $arr_reason[$value['id']]['time']); $items[$value['id']]['create_time_lock'] = $arr_reason[$value['id']]['time']; $items[$value['id']]['admin_name'] = $arr_reason[$value['id']]['admin_name']; } else { $items[$value['id']]['lock_reason'] = ''; $items[$value['id']]['lock_type'] = ''; $items[$value['id']]['time_lock'] = ''; $items[$value['id']]['create_time_lock'] = 0; $items[$value['id']]['admin_name'] = ''; } } //end lay ly do khoa nick if ($od_dir == 'ASC') { $od_dir = 'DESC'; } else { $od_dir = 'ASC'; } $href_id = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=id&order_dir=' . $od_dir); $href_name = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=name&order_dir=' . $od_dir); $href_up = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=up&order_dir=' . $od_dir); $href_time = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'order_by=time&order_dir=' . $od_dir); $img_id = '<img src="style/images/admin/downarrow.png" alt="">'; //default $img_name = ''; $img_up = ''; $img_time = ''; if ($od_by == 'id') { $img_id = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($od_by == 'name') { $img_name = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } if ($od_by == 'up') { $img_up = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } if ($od_by == 'time') { $img_time = '<img src="style/images/admin/' . ($od_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; $img_id = ''; } // neu show cac thanh vien bi khoa, se sap xep theo thoi diem khoa hien tai giam dan if (Url::get('block') == 1) { usort($items, array("ListUserAdminForm", "cmp")); } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('img_up', $img_up); $display->add('img_time', $img_time); $display->add('href_id', $href_id); $display->add('href_name', $href_name); $display->add('href_up', $href_up); $display->add('href_time', $href_time); $display->add('total_account', $total); $display->add('limit_date', BAN_NICK_DATE); $display->add('items', $items); $display->add('cid', $cid); //System::debug($items); $display->add('paging', $paging); $display->add('is_root', User::is_root()); $display->output('list'); $this->endForm(); }
function draw() { global $display; $arrVar = array(); $this->beginForm(); EClassApi::getCats(); $where = ''; $filter_id = Url::get('filter_id', ''); $filter_name = Url::get('filter_name', ''); $cat_product_id = Url::get('cat_product_id', ''); $zone_id = Url::get('zone_id', ''); $arrVar['zone_id'] = $zone_id; $arrVar['cat_product_id'] = $cat_product_id; if ($filter_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " id = '{$filter_id}' "; $arrVar['filter_id'] = $filter_id; } if ($filter_name) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " filter_name = '{$filter_name}' "; $arrVar['filter_name'] = $filter_name; } if ($cat_product_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " cat_product_id = '{$cat_product_id}' "; } else { if ($zone_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " zone_id = '{$zone_id}' "; } } $item_per_page = 50; $limit = ''; $item_vips = array(); $sql_count = "SELECT COUNT(*) AS total FROM products_filter {$where} "; $total = DB::fetch($sql_count, 'total', 0); $paging = ''; $filters = array(); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 20, 'page_no', true); $re = DB::query("SELECT * FROM products_filter {$where} order by orders {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $filters[$row['id']] = $row; } } } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options, $zone_id, $cat_product_id); $arrVar['options'] = $options; $arrVar['zones'] = CGlobal::$allZones; $arrVar['filters'] = $filters; $arrVar['paging'] = $paging; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilter', $arrVar); $this->endForm(); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $filter_type = intval(trim(Url::get('filter_type'))); $type_id = intval(trim(Url::get('type_id'))); $cid = intval(trim(Url::get('cid'))); $display->add('cid', $cid); $display->add('type_id', $type_id); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '"'; $display->add('filter_id', $filter_id); } if (!empty($filter_type)) { switch ($filter_type) { case 1: $cond[] = ' type_id = ' . $filter_type; break; case 2: $cond[] = ' type_id = ' . $filter_type; break; case 0: $cond[] = ' type_id = ' . $filter_type; break; default: // $cond[] = ' type_id = 0'; break; } $display->add('filter_type', $filter_type); } else { $cond[] = ' type_id = 0'; $display->add('filter_type', 0); } if (!empty($type_id) && $type_id != 0) { $cond[] = 'object_id = ' . $type_id; if (!empty($cid)) { $cond[] = ' (CONCAT(",", class_id, ",") LIKE "%,' . $cid . ',%") '; } } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_log = array(); $paging = ''; $total_row = Logs::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_log = Logs::get_collection($limit, $cond, ' ORDER BY id DESC'); } $list_class = Classes::get_collection_with_join(null); $list_lesson = Lessons::get_collection_with_join(null); $list_exam = Exam::get_collection(null); $error_message = $this->getErrorMessage('admin/log/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_log', $list_log); $display->add('list_class', $list_class); $display->add('list_lesson', $list_lesson); $display->add('list_exam', $list_exam); $display->add('is_admin', User::is_admin()); $display->output('ListLog'); // $this->endForm(); }
function draw() { global $display; $arrVar = array(); $this->beginForm(1); $arrVar['id'] = Url::get('id', 0); $options = ""; if ($arrVar['id'] == 0) { Url::redirect_current(); } EClassApi::getCats(); $where = ''; $filter = DB::fetch_all_array("select * from products_filter where id={$arrVar['id']}"); $filte_value = json_decode($filter[0]['filter_value']); $arrVar['filter'] = $filter[0]; $arrVar['filter_value'] = $filte_value; $item_per_page = 50; $limit = ''; $sql_count = "SELECT COUNT(*) AS total FROM products_extra_fields_group {$where}"; $total = DB::fetch($sql_count, 'total', 0); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Nhóm trường', 'Trang'); $re = DB::query("SELECT * FROM products_extra_fields_group {$where} order by id desc {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $products_extra_fields_group[$row['id']] = $row; } } } $filter_count = 0; foreach ($filte_value as $key => $val) { if ($filter_count < $val->order) { $filter_count = $val->order; } } if (count($filte_value) > $filter_count) { $filter_count = count($filte_value); } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options, $filter[0]['zone_id'], $filter[0]['cat_product_id']); $arrVar['options'] = $options; $arrVar['filter_count'] = $filter_count; $arrVar['zones'] = CGlobal::$allZones; $arrVar['paging'] = $paging; $arrVar['products_extra_fields_group'] = $products_extra_fields_group; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilterEdit', $arrVar); $this->endForm(); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $cid = intval(trim(Url::get('cid'))); $display->add('cid', $cid); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } if (!empty($cid)) { $cond[] = 'cid = ' . $cid; } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } // if (intval(date('d')) < 5) // $month = date('n'); // else // $month= date('n', strtotime('+1 month')); $month = date('n'); $cond[] = 'month = ' . $month; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_extend = array(); $paging = ''; $total_row = PersonalDB::count_all_paid($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_extend = PersonalDB::get_student_paid($limit, $cond, ' ORDER BY uid DESC'); } foreach ($list_extend as $extend) { $time = date('H:i:s d/m/Y', $extend['time']); $list_extend[$extend['id']]['time'] = $time; } $list_class = Classes::get_collection_with_join(null); $error_message = $this->getErrorMessage('admin/log/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_extend', $list_extend); $display->add('list_class', $list_class); $display->add('is_admin', User::is_admin()); $display->output('Extend'); // $this->endForm(); }
function draw() { global $display; $this->beginForm(false, 'get', false, Url::build_current()); $item_per_page = 15; $sql_count = 'SELECT count(*) AS total_row FROM news_category'; $list_categories = array(); $paging = ''; // Get Filter Parameters $name = Url::get('name'); $is_active = Url::get('is_active', 0); $conditions = ''; $id = intval(Url::get('id', 0)); if (!empty($id)) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND id = " . $id; } else { $conditions .= " WHERE id = " . $id; } $display->add('id', $id); } if (!empty($name)) { if (strstr($conditions, 'WHERE')) { $conditions .= " AND name LIKE '%" . $name . "%'"; } else { $conditions .= " WHERE name LIKE '%" . $name . "%'"; } $display->add('name', $name); } if ($is_active > 0) { if ($is_active == 2) { $is_active = 0; $display->add('name', 2); } else { $display->add('name', $is_active); } if (strstr($conditions, 'WHERE')) { $conditions .= " AND is_active = " . $is_active; } else { $conditions .= " WHERE is_active = " . $is_active; } } $total_row = DB::fetch($sql_count, 'total_row', 0); if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT * FROM news_category ' . $conditions . ' ORDER BY id DESC ' . $limit; $res = DB::query($sql); if ($res) { while ($row = mysql_fetch_assoc($res)) { if (empty($row['post_day'])) { $row['post_day'] = time(); } $row['post_day_formatted'] = date('d/m/Y', $row['post_day']); $list_categories[] = $row; } } mysql_free_result($res); } $display->add('error_message', $this->getErrorMessage('news/category/error')); $display->add('success_message', $this->getSuccessMessage('news/category/success')); $display->add('list_categories', $list_categories); $display->add('total_row', $total_row); $display->add('paging', $paging); $display->output('List'); $this->endForm(); }
function getCommentSubItem() { global $display; $winner = array(); global $user_id_arr, $stt, $item_per_page; $stt = 0; $is_admin_mod = array(); $user_arr = array(); $user_id_arr = array(); $items = array(); $limit = ''; $subItemId = Url::get('subItemId'); $divID = 'comment_list'; $cmd = 'pagging_comment'; $url_path = WEB_DIR . "ajax.php?act=comment&code=getCommentSubItem&show_all=1&id={$subItemId}&cmd=" . $cmd; $item_per_page = 100; $display->add('show_all', true); $pagging = ECPagging::fb_pagging($limit, $item_per_page, true, 'fb_page', $url_path, $divID); $sql = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id, have_child,receiver_user_id,sub_item_id FROM comment WHERE sub_item_id=" . $subItemId . " AND parent_id = 0 ORDER BY order_time DESC {$limit}"; /*Đếm tổng số comment cho SubItem*/ $select_comment_count = "SELECT comment_count FROM item_sub WHERE id={$subItemId} LIMIT 1"; $subItemResult = DB::fetch($select_comment_count); $comment_count = 0; if (isset($subItemResult['comment_count']) && $subItemResult['comment_count'] > 0) { $comment_count = $subItemResult['comment_count']; } $display->add('comment_count', $comment_count); /*End comment count*/ $allItems = $this->get_comment_thoitrang($sql); if ($allItems) { $items = $allItems['item']; if ($allItems['id_parent']) { $sql_sub = "SELECT id, time, content, item_id, sender_email, sender_user_name, sender_user_id,parent_id,receiver_user_id,sub_item_id FROM comment WHERE parent_id IN({$allItems['id_parent']}) ORDER BY order_time DESC"; $subComment_all = $this->get_comment_thoitrang($sql_sub, 1); if ($subComment_all) { $sub_comments = $subComment_all['item']; foreach ($sub_comments as $id => $subs) { if (isset($items[$id])) { $items[$id]['sub_comment'] = $subs; } } } } unset($allItems); } if ($stt <= $item_per_page) { $pagging = ECPagging::fb_pagging($limit, $item_per_page, false, 'fb_page', $url_path, $divID); $display->add('show_fb_page', false); } else { $display->add('show_fb_page', true); } if ($user_id_arr) { $uid = implode(',', $user_id_arr); if ($uid != '') { $re = DB::query("SELECT id, avatar_url, gids, block_time, img_server FROM account WHERE id IN({$uid})"); if ($re) { while ($user = mysql_fetch_assoc($re)) { $user_arr[$user['id']] = $user; } } } } if ($items && $user_arr) { foreach ($items as &$item) { $item['content'] = $this->process_description($item['content']); if (isset($item['sub_comment']) && $item['sub_comment']) { foreach ($item['sub_comment'] as &$sub_item) { if ($sub_item['sender_user_id']) { if (isset($user_arr[$sub_item['sender_user_id']])) { $sub_item['avatar_url'] = $user_arr[$sub_item['sender_user_id']]['avatar_url']; $sub_item['block_time'] = $user_arr[$sub_item['sender_user_id']]['block_time']; $sub_item['gids'] = $user_arr[$sub_item['sender_user_id']]['gids']; $sub_item['img_server'] = $user_arr[$sub_item['sender_user_id']]['img_server']; } if ($sub_item['avatar_url']) { $sub_item['sender_avatar_url'] = EClassApi::getImageThumb($sub_item['avatar_url'], 60, 0, 1, $sub_item['img_server']); if ($sub_item['parent_id'] > 0) { $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>'; } else { $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="' . $sub_item['sender_avatar_url'] . '" width="40" class="lazyload"/></a>'; } } else { $sub_item['sender_avatar_url'] = 'style/avatar/1.png'; $html_content = '<a href="' . $sub_item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" class="lazyload"/></a>'; } if ($sub_item['block_time'] > TIME_NOW) { $sub_item['is_block'] = 1; } else { $sub_item['is_block'] = 0; } $sub_item['htmlContent'] = $html_content; //set quyen quan tri if ($sub_item['gids']) { $is_admin_mod = CGlobal::$group[User::check_admin($sub_item['gids'])]; } else { $is_admin_mod = array(); } $sub_item['is_admin_mod'] = $is_admin_mod; } } } if ($item['sender_user_id']) { if (isset($user_arr[$item['sender_user_id']])) { $item['avatar_url'] = $user_arr[$item['sender_user_id']]['avatar_url']; $item['block_time'] = $user_arr[$item['sender_user_id']]['block_time']; $item['gids'] = $user_arr[$item['sender_user_id']]['gids']; $item['img_server'] = $user_arr[$item['sender_user_id']]['img_server']; } if ($item['avatar_url']) { $item['sender_avatar_url'] = EClassApi::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']); $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="40"/></a>'; } else { $item['sender_avatar_url'] = 'style/avatar/1.png'; $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/avatar/1.png" width="40" height="40" /></a>'; } $item['htmlContent'] = $html_content; if ($item['block_time'] > TIME_NOW) { $item['is_block'] = 1; } else { $item['is_block'] = 0; } //set quyen quan tri if ($item['gids']) { $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])]; } else { $is_admin_mod = array(); } $item['is_admin_mod'] = $is_admin_mod; } } } $account = null; if (User::is_login() && Item::$item['user_id'] == User::id()) { $account = User::$current->data; } else { if (isset(Item::$item['user_id'])) { $account = User::getUser(Item::$item['user_id']); } if (!$account) { $account = array('id' => 0, 'user_name' => '', 'create_time' => '', 'blast' => '', 'email' => '', 'show_email' => '', 'skype_id' => '', 'yahoo_id' => ''); } } if (User::is_login()) { if (User::$current->data['mobile_phone'] != '') { $display->add('user_phone', true); $user_phone = User::$current->data['mobile_phone']; } elseif (User::$current->data['home_phone'] != '') { $display->add('user_phone', true); $user_phone = User::$current->data['home_phone']; } else { $display->add('user_phone', false); $user_phone = ''; } $display->add('cur_user_name', User::$current->data['user_name']); $display->add('cur_created_time', User::$current->data['create_time']); $cur_user_name = User::$current->data['user_name']; $cur_created_time = User::$current->data['create_time']; if (User::$current->data['avatar_url'] == '') { $cur_avatar_url = 'style/avatar/1.png'; } else { $cur_avatar_url = EClassApi::getImageThumb(User::$current->data['avatar_url'], 60, 0, 1, User::$current->data['img_server']); } } else { $cur_user_name = ''; $cur_created_time = ''; $user_phone = ''; $cur_avatar_url = 'style/avatar/1.png'; $display->add('cur_user_name', ''); $display->add('cur_created_time', ''); $display->add('check_user_name', ''); $display->add('user_phone', false); } $guest_name = 'Số điện thoại'; $guest_email = 'Email'; if (isset($_COOKIE['guest_name'])) { if ($_COOKIE['guest_name'] == 'undefined' || $_COOKIE['guest_email'] == 'undefined') { $guest_name = 'Số điện thoại'; $guest_email = 'Email'; } else { $guest_name = $_COOKIE['guest_name']; $guest_email = $_COOKIE['guest_email']; } } $display->add('cur_user_name', $cur_user_name); $display->add('guest_name', $guest_name); $display->add('guest_email', $guest_email); $display->add('check_user_name', $account['user_name']); $display->add('cur_id', (int) User::id()); $display->add('pagging', $pagging); $display->add('item_comments', $items); $display->add('item_id', Item::$item['id']); $display->add('category_id', Item::$item['category_id']); $display->add('item_name', Item::$item['name']); //rewrite URL $display->add('name_url', EClassApi::safe_title(Item::$item['name'])); //End rewrite URL if (strtolower(Url::get('page')) == 'allfeedback' || Url::get('cmd') == $cmd) { echo '<div id="totalReplyCount" style="display:none;">' . @Item::$item['reply_count'] . '</div>'; } $display->output('AllFeedbackList', false, 'AllFeedback'); }
function draw() { $user_ids = Url::get('id'); global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'history_lesson'))); $filter_id = intval(trim(Url::get('filter_id'))); $sid = intval(trim(Url::get('subject'))); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $display->add('subject', $sid); $list_subject = Subjects::get_collection(null); if (!empty($sid)) { $list_lesson = Lessons::get_collection(null, ' subject = ' . $sid); } else { $list_lesson = Lessons::get_collection(null); } $display->add('list_subject', $list_subject); $display->add('list_lesson', $list_lesson); $cond = array(); if (!empty($filter_id)) { $cond[] = 'id LIKE "%' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } $cond[] = 'uid = ' . $user_ids; $cond[] = 'type_id = 1'; $str_lesson = ''; foreach ($list_lesson as $lesson) { $str_lesson .= $str_lesson == '' ? $lesson['id'] : ', ' . $lesson['id']; } $cond[] = ' object_id IN (' . $str_lesson . ') '; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_user_log = array(); $paging = ''; $total_row = Logs::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_user_log = Logs::get_collection($limit, $cond, 'ORDER BY id DESC'); } $error_message = $this->getErrorMessage('admin/category/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('user_ids', $user_ids); $display->add('list_user_log', $list_user_log); $display->add('is_admin', User::is_admin()); $display->output('history'); // $this->endForm(); }
function draw() { global $display; //$this->beginForm(false,'post',false,Url::build_current()); $this->beginForm(); $name = trim(Url::get('name')); $order_by = Url::get('order_by', 'id'); $order_dir = Url::get('order_dir', 'DESC'); $cond = ' 1 '; if ($name != '') { $cond .= ' AND name LIKE "%' . $name . '%"'; } $item_per_page = 50; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `module` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0); $items = array(); $paging = ''; if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id ,name FROM `module` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { if (Url::check('page_id')) { $row['onclick'] = ' onclick="location=\'' . Url::build('edit_page', array('module_id' => $row['id'], 'id' => (int) Url::get('page_id', 0), 'region', 'after', 'replace', 'href')) . '\';" style="cursor:pointer;" title="Click vào đây để cắm Module vào Page"'; } else { $row['onclick'] = ''; } $re2 = DB::query('SELECT page.id,page.name FROM block INNER JOIN page ON page.id=block.page_id WHERE module_id="' . $row['id'] . '"'); if ($re2) { while ($page = mysql_fetch_assoc($re2)) { $row['pages'][$page['id']] = $page; } } else { $row['pages'] = array(); } $items[$row['id']] = $row; } } } if ($order_dir == 'ASC') { $order_dir = 'DESC'; } else { $order_dir = 'ASC'; } $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir)); $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir)); $img_id = ''; $img_name = ''; if ($order_by == 'id') { $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } if ($order_by == 'name') { $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">'; } $display->add('img_id', $img_id); $display->add('img_name', $img_name); $display->add('href_id', $href_id); $display->add('href_name', $href_name); $display->add('name', $name); $display->add('paging', $paging); $display->add('items', $items); $display->add('hover', EClassApi::mouse_hover('#E2F1DF', true)); $display->output('list'); $this->endForm(); }
function list_comments() { global $display; require_once 'modules/Profile/db.php'; $user_id = EClassApi::getParam('user_id'); $user = DB::fetch('SELECT id, user_name FROM account WHERE id="' . $user_id . '"'); $is_admin = false; if (User::is_admin()) { $is_admin = true; } $display->add('is_admin', $is_admin); $limit = ''; $divID = 'comment_list'; $cmd = 'comment_list_pagging'; $item_per_page = 10; if (Url::get('cmd') == $cmd) { $display->add('load_ajax_page', true); } else { $display->add('load_ajax_page', false); } $url_path = WEB_DIR . "ajax.php?act=user&code=comments&user_id=" . $user['id']; $count = ProfileDB::get_total_comment($user['id']); require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::AjaxPaging($limit, $count['acount'], $item_per_page, 5, 'comment_page_no', '', false, false, $url_path, $divID); $comments = ProfileDB::get_comments($user['id'], $item_per_page, $limit); $display->add('user_id', $user['id']); $display->add('is_login', (int) User::is_login()); if (User::is_login()) { $display->add('cur_id', (int) User::$current->data['id']); $display->add('cur_user_name', User::$current->data['user_name']); if (User::$current->data['avatar_url'] == '') { $cur_avatar_url = 'style/images/50x50.gif'; } else { $cur_avatar_url = EClassApi::getImageThumb(User::$current->data['avatar_url'], 50, 50, 0, User::$current->data['img_server']); } $display->add('cur_avatar', $cur_avatar_url); } else { $display->add('cur_id', '0'); $display->add('cur_user_name', ''); $display->add('cur_avatar', 'style/images/50x50.gif'); $cur_avatar_url = ""; } $display->add('comments', $comments); $display->add('paging', $paging); $display->add('user_name', User::$current->data['user_name']); $display->output('comment', false, 'Profile'); System::halt(); }