function draw() { global $display; $cat_newss = array(); $display->add('is_admin', User::have_permit(ADMIN_NEWS)); $display->add('url_home', WEB_DIR); $display->add('time_now', News::displayTime()); $display->add('cat_name', $this->news_cat['name']); $display->add('cat_url', URL::build('news_list', array('news_catid' => $this->news_cat['id'], 'azname' => AZLib::safe_title($this->news_cat['name'])))); $condition = ' status=1 '; $total = DB::count("news", $condition); $limit = ''; //$pagging = AZPagging::paging_list($limit,20,'page_no'); $pagging = AZPagging::paging_list($limit, $total, 20); $re = DB::query('SELECT * FROM news WHERE ' . $condition . ' ORDER BY id DESC' . $limit); if ($re) { while ($news = mysql_fetch_assoc($re)) { $news['title'] = stripslashes($news['title']); $news['brief'] = stripslashes($news['brief']); $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title']))); if ($news['image']) { $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']); } $news['news_h'] = date('H:i', $news['time_created']); $news['news_d'] = date('d-m-Y', $news['time_created']); $news['admin_link'] = News::admin_link($news); $cat_newss[$news['id']] = $news; } } $display->add('pagging', $pagging); $display->add('cat_newss', $cat_newss); $display->output("NewsPage"); }
function draw() { global $display; if (User::id() != 0) { if (User::$current->data["avatar_url"] != "") { $avatar = '<img src="' . AZLib::getImageThumb(User::$current->data["avatar_url"], 100, 100, 0, User::$current->data["img_server"]) . '" />'; } else { $avatar = '<img src="style/images/no_avatar_item.gif" width="94" height="94"/>'; } $display->add('avatar', $avatar); $display->add('user_name', User::$current->data["user_name"]); $display->add('get_cmd', Url::get('cmd')); $display->add('get_action', Url::get('action')); $display->add('get_page', Url::get('page')); $display->add('get_page', AZNet::$page['name']); $display->add('get_cmd', Url::get('cmd')); $display->add('user_name', User::user_name()); $display->add('can_edit_blast', User::is_admin() || !User::is_block()); $blast = User::$current->data['blast']; $avatar_link = ''; $avatar_url = 'style/images/no_avatar_item.gif'; if (User::$current->data['avatar_url'] != '') { $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url']; $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']); } if ($blast == '') { $blast = '...'; } else { $blast = ' ' . $blast; if (strpos($blast, 'http://')) { $user_blast = $blast; while (strpos($user_blast, 'http://')) { $tmp = substr($user_blast, strpos($user_blast, 'http://')); if (strpos($tmp, ' ') || strpos($tmp, '<')) { if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) { $blast_url = substr($tmp, 0, strpos($tmp, '<')); } else { $blast_url = substr($tmp, 0, strpos($tmp, ' ')); } } else { $blast_url = $tmp; } $user_blast = str_replace($blast_url, '', $user_blast); } $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>'; $blast = substr($user_blast . $new_blast_url, 1); } } $display->add('avatar_link', $avatar_link); $display->add('avatar_url', $avatar_url); $display->add('blast', $blast); $display->add('user_id', User::id()); $TopMenu = $display->output('TopMenu', true, 'Personal'); $display->add('TopMenu', $TopMenu); $display->output('change_pass', false, 'Personal'); } else { Url::redirect('home'); } }
function draw() { global $display; $this->beginForm(); $user = $this->user; if ($user['show_home_phone'] == 0) { $user['show_home_phone'] = ''; } else { $user['show_home_phone'] = '(Đã ẩn)'; } if ($user['show_email'] == 0) { $user['show_email'] = ''; } else { $user['show_email'] = '(Đã ẩn)'; } if ($user['email_alert'] == 0) { $user['email_alert'] = ''; } else { $user['email_alert'] = '(Nhận email thông báo)'; } if ($user['birth_day']) { $arrBirtday = explode('-', $user['birth_day']); $user['birth_day'] = $arrBirtday['2'] . '-' . $arrBirtday['1'] . '-' . $arrBirtday['0']; } if ($user['avatar_url'] != "") { $user['avatar_url'] = '<img src="' . AZLib::getImageThumb($user['avatar_url'], 100, 100, 0, $user['img_server']) . '" />'; } else { $user['avatar_url'] = '<img src="style/images/no_avatar_item.gif" width="94" height="94" />'; } $user['create_time'] = date('d/m/y H:i', $user['create_time']); $user['reg_ip'] = ($user['reg_ip'] ? "RegIP: <b>{$user['reg_ip']}</b>" : '') . ($user['last_ip'] ? "LastIP: <b>{$user['last_ip']}</b>" : ''); if ($user['block_time'] > TIME_NOW || $user['block_time'] == -1) { if ($user['block_time'] != -1) { $user['status'] = "<font color=red><b>" . date('H:i d/m/y', $user['block_time']) . '</b></font>'; } else { $user['status'] = '<font color=red><b>Khóa vĩnh viễn</b></font>'; } } elseif ($user['invalid_time']) { $user['status'] = "<font color=red><b>Đang bị kiểm duyệt</b></font>"; } else { $user['status'] = "Bình thường"; } $display->add('msg', $this->showFormErrorMessages(1)); $display->add('user', $user); $openids = array(); $re = DB::query("SELECT id, openid_url FROM openid WHERE user_id=" . $user['id']); if ($re) { while ($openid = mysql_fetch_assoc($re)) { $openid['openid'] = $openid['openid_url']; $openids[$openid['id']] = $openid; } } $display->add('openids', $openids); $display->add('user', $user); $display->output('UserDetail'); $this->endForm(); }
function draw() { global $display; $item_ids = ''; $item_news = array(); $configs = @CGlobal::$configs['ItemNew']['conf_val']; if ($configs) { $configs = unserialize(stripslashes($configs)); $title_new = $configs['title']; $item_ids = $configs['item_ids']; } else { $title_new = "SẢN PHẨM MỚI"; $item_ids = ''; } if ($item_ids) { $re = DB::query("SELECT * FROM item WHERE id IN({$item_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_ids}')"); if ($re) { while ($product = mysql_fetch_assoc($re)) { if ($product['img_url']) { $product['image'] = AZLib::getImageThumb($product['img_url'], 160, 150, 0, $product['img_server']); } else { $product['image'] = ""; //"style/images/no-images-35x35.gif"; } if (isset(CGlobal::$allCategories[$product['category_id']])) { $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } else { $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } $product['name'] = stripslashes($product['name']); if ($product['list_brief'] == '') { $product['list_brief'] = $product['brief']; } $product['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($product['list_brief'], ENT_QUOTES, "UTF-8")))); $product['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $product['list_brief']); $product['list_brief'] = str_replace(array("'", "\""), array("", " "), $product['list_brief']); $product['list_brief'] = AZLib::word_limit($product['list_brief'], 50, ''); $product['list_brief'] = '<b>' . str_replace(array("'", "\""), array("", " "), $product['name']) . '</b><br />' . $product['list_brief']; $product['price_num'] = $product['price']; $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']); $item_news[$product['id']] = $product; } } } if (User::is_admin()) { $display->add("is_admin", 1); $display->add("msg", $this->showFormErrorMessages(1)); $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1)); $display->add('end_form', $this->endForm(true)); } $display->add('title_new', $title_new); $display->add('item_ids', $item_ids); $display->add('item_news', $item_news); $display->output("ItemNew"); }
function draw() { global $display; $display->add('get_cmd', Url::get('cmd')); $display->add('get_action', Url::get('action')); $display->add('get_page', Url::get('page')); echo '<script language="javascript"> var url_root = "' . WEB_ROOT . '" </script>'; $display->add('get_page', AZNet::$page['name']); $display->add('get_cmd', Url::get('cmd')); $display->add('user_name', User::user_name()); $display->add('can_edit_blast', User::is_admin() || !User::is_block()); $blast = User::$current->data['blast']; $avatar_link = ''; $avatar_url = 'style/images/no_avatar_item.gif'; if (User::$current->data['avatar_url'] != '') { $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url']; $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']); } if ($blast == '') { $blast = '...'; } else { $blast = ' ' . $blast; if (strpos($blast, 'http://')) { $user_blast = $blast; while (strpos($user_blast, 'http://')) { $tmp = substr($user_blast, strpos($user_blast, 'http://')); if (strpos($tmp, ' ') || strpos($tmp, '<')) { if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) { $blast_url = substr($tmp, 0, strpos($tmp, '<')); } else { $blast_url = substr($tmp, 0, strpos($tmp, ' ')); } } else { $blast_url = $tmp; } $user_blast = str_replace($blast_url, '', $user_blast); } $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>'; $blast = substr($user_blast . $new_blast_url, 1); } } $display->add('avatar_link', $avatar_link); $display->add('avatar_url', $avatar_url); $display->add('blast', $blast); $display->add('user_id', User::id()); $TopMenu = $display->output('TopMenu', true, 'Personal'); $display->add('TopMenu', $TopMenu); $display->output('success', false, 'Personal'); }
function draw() { global $display; $avatar_link = ''; $avatar_url = 'style/images/no_avatar_item.gif'; if (User::$current->data['avatar_url'] != '') { $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url']; $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']); } $display->add('full_name', User::$current->data['full_name']); $display->add('avatar_link', $avatar_link); $display->add('avatar_url', $avatar_url); $display->add('user_name', User::user_name()); $display->output('DashboardLeftNav'); }
function draw() { if (Item::$item && isset(Item::$item['display']) && Item::$item['display']) { global $display; $re = DB::query("SELECT relate_id FROM item_relate WHERE item_id = " . Item::$item['id']); $relate_ids = ''; $relate_arrs = array(); if ($re) { while ($relate = mysql_fetch_assoc($re)) { $relate_ids .= ($relate_ids != '' ? "," : "") . $relate['relate_id']; } } if ($relate_ids) { $re = DB::query("SELECT * FROM item WHERE id IN({$relate_ids}) AND status = 1 ORDER BY item_order"); $relate_ids = ''; if ($re) { while ($product = mysql_fetch_assoc($re)) { $relate_ids .= ($relate_ids != '' ? ',' : '') . $product['id']; if ($product['img_url']) { $product['image'] = AZLib::getImageThumb($product['img_url'], 180, 0, 0, $product['img_server']); } else { $product['image'] = ""; //"style/images/no-images-35x35.gif"; } if (isset(CGlobal::$allCategories[$product['category_id']])) { $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } else { $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } $product['name'] = stripslashes($product['name']); $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']); $relate_arrs[] = $product; } } } $display->add('relate_ids', $relate_ids); $display->add('relate_arrs', $relate_arrs); $display->add('item_detail', Item::$item); $display->add("share_url", urlencode("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])); $display->add('WEB_NAME', WEB_NAME); if (User::have_permit(ADMIN_ITEM)) { $display->add('is_admin', 1); $display->add('begin_form', $this->beginForm(false, 'post', false, false, 1)); $display->add('end_form', $this->endForm(true)); } $display->output("ItemRelate"); } }
function draw() { global $display; $display->add('msg', $this->showFormErrorMessages(1)); $display->add("customer_name", stripslashes(URL::get('customer_name', Cart::$cart['customer_name']))); $display->add("customer_email", stripslashes(URL::get('customer_email', Cart::$cart['customer_email']))); $display->add("customer_phone", stripslashes(URL::get('customer_phone', Cart::$cart['customer_phone']))); $display->add("customer_address", stripslashes(URL::get('customer_address', Cart::$cart['customer_address']))); $display->add("customer_note", stripslashes(URL::get('customer_note', Cart::$cart['customer_note']))); //$quantity_total =0; $price_total = 0; $cart_items = array(); if (Cart::$cart_items) { foreach (Cart::$cart_items as $cart_item_id => $cart_item) { $item = Cart::$items[$cart_item['item_id']]; if (isset(CGlobal::$allCategories[$item['category_id']])) { $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $cart_item['name'] = $item['name']; $cart_item['price_num'] = $item['price']; $cart_item['price'] = number_format($item['price'], 0, ',', '.'); if ($item['img_url']) { $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']); } else { $item['img_url'] = ''; } $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : ''; $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0; //$quantity_total += $cart_item['checked'] ? $cart_item['quantity'] : 0; $cart_items[$cart_item['id']] = $cart_item; } } //$display->add('quantity_total',number_format($quantity_total,null,null,'.')); $display->add('price_total', number_format($price_total, null, null, '.')); $display->add('url_finish', Url::build_current(array('cmd' => 'finish'))); $display->add('cart_items', $cart_items); $display->add('cart_id', "Cart_" . Cart::$cart['id']); $this->beginForm(); $display->output('CartFinish'); $this->endForm(); }
function draw() { global $display; if (User::is_admin()) { $display->add("is_admin", 1); } $display->add('url_home', WEB_DIR); $display->add('time_create', News::displayTime($this->news['time_created'])); $display->add('title', stripslashes($this->news['title'])); $display->add('brief', stripslashes($this->news['brief'])); $display->add('content', stripslashes($this->news['content'])); $display->add('pen_name', stripslashes($this->news['pen_name'])); if ($this->news['source'] != '') { $display->add('source', " ( theo <i>" . stripslashes($this->news['source']) . "</i> )"); } else { $display->add('source', ""); } if (User::have_permit(ADMIN_NEWS)) { $display->add('admin_link', News::admin_link($this->news)); } if ($this->news['image']) { $display->add('img_full_url', "http://" . CGlobal::$img_server[$this->news['img_server']] . $this->news['image']); $display->add('img_max_path', AZLib::getImageThumbMax($this->news['image'], '', 1, $this->news['img_server'])); $display->add('image_title', stripslashes($this->news['image_title'])); $display->add('image_url', AZLib::getImageThumb($this->news['image'], 180, 0, 0, $this->news['img_server'])); //AZLib::safe_title($this->news['title'])) $display->add('image_oringin', $this->news['image']); } $news_cart = CGlobal::$allNewsCategories[$this->news['news_catid']]; $display->add('news_home_link', Url::build('news')); if ($news_cart) { $display->add('cat_link', Url::build('news', array('news_catid' => $news_cart['id'], 'azname' => AZLib::safe_title($news_cart['name'])))); $display->add('cat_name', $news_cart['name']); } $display->add("share_title", urlencode(CGlobal::$website_title)); $display->add("share_url", "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); $display->add("share_des", urlencode(trim(CGlobal::$meta_desc))); $display->output("NewsDetail"); }
function draw() { global $display; $display->add('msg', $this->showFormErrorMessages(1)); $quantity_total = 0; $price_total = 0; $cart_items = array(); if (Cart::$cart_items) { foreach (Cart::$cart_items as $cart_item_id => $cart_item) { $item = Cart::$items[$cart_item['item_id']]; if (isset(CGlobal::$allCategories[$item['category_id']])) { $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $cart_item['name'] = $item['name']; $cart_item['price_num'] = $item['price']; $cart_item['price'] = number_format($item['price'], 0, ',', '.'); if ($item['img_url']) { $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']); } else { $item['img_url'] = ''; } $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : ''; $cart_item['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $cart_item['id'])); $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0; $quantity_total += $cart_item['checked'] ? $cart_item['quantity'] : 0; $cart_items[$cart_item['id']] = $cart_item; } } $display->add('quantity_total', number_format($quantity_total, null, null, '.')); $display->add('price_total', number_format($price_total, null, null, '.')); $display->add('url_finish', Url::build_current(array('cmd' => 'finish'))); $display->add('cart_items', $cart_items); $display->add("print_link", Url::open_popup(Url::build('cart_print', array('id' => Cart::$cart['id'])), 1000, 800, false, false, false, false, false, 1, 1)); $this->beginForm(); $display->output('Cart'); $this->endForm(); }
function draw() { global $display; $home_newss = array(); $display->add('is_admin', User::have_permit(ADMIN_NEWS)); $display->add('url_home', WEB_DIR); $display->add('time_now', News::displayTime()); $one_cart = ''; AZLib::getNewsCats(); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $news_catid => $news_cat) { if ($news_cat['public']) { $newss = array(); $re = DB::query("SELECT * FROM news WHERE status=1 AND news_catid={$news_catid} ORDER BY id DESC LIMIT 0,4"); if ($re) { $i = 1; while ($news = mysql_fetch_assoc($re)) { if ($i == 1) { if ($news['image']) { $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']); } $i++; } $news['url'] = URL::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title']))); $news['news_h'] = date('H:i', $news['time_created']); $news['news_d'] = date('d-m-Y', $news['time_created']); $newss[$news['id']] = $news; } } if ($newss) { $home_newss[$news_catid] = array('name' => $news_cat['name'], 'url' => URL::build('news_list', array('news_catid' => $news_catid, 'azname' => AZLib::safe_title($news_cat['name']))), 'newss' => $newss); } } } } $display->add('home_newss', $home_newss); $display->output("NewsHome"); }
function draw() { $this->beginForm(); global $display; $search_value = ''; $display->add('up_checked', 'checked="checked"'); if (Url::get('root_img')) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' root_id=0 '; $display->add('root_img_checked', 'checked="checked"'); } else { //$search_value.=($search_value!=''?' AND ':' WHERE').' img.root_id>0 '; $display->add('root_img_checked', ''); } if (Url::get('no_item_img')) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' item_id=0 '; $display->add('no_item_img_checked', 'checked="checked"'); } else { //$search_value.=($search_value!=''?' AND ':' WHERE').' root_id>0 '; $display->add('no_item_img_checked', ''); } // search ô textbox if (Url::get('user_name') != '') { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' user_name LIKE "%' . Url::get('user_name') . '%" '; } //search theo ngay thang nam $created_time_from = 0; $created_time_to = 0; $current_time_from = null; $current_time_to = null; if (Url::get('created_time_from')) { $current_time_from = Url::get('created_time_from'); $date_arr = explode('-', $current_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')) { $current_time_to = Url::get('created_time_to'); $date_arr = explode('-', $current_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]); } } if ($created_time_from) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to; } if ($search_value == '') { //create current date $date = Date('d-m-Y'); $current_time_from = $date; $date_arr = explode('-', $current_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]); } $current_time_to = $date; $date_arr = explode('-', $current_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]); } if ($created_time_from) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value != '' ? ' AND ' : ' WHERE') . ' time <= ' . $created_time_to; } } $display->add('created_time_from', $current_time_from); $display->add('created_time_to', $current_time_to); $item_per_page = 120; $sql_count = 'SELECT count(*) AS total_img FROM item_image ' . $search_value; $total = DB::fetch($sql_count, 'total_img', 0); $items = array(); if ($total) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true); $sql = 'SELECT id,img_server, img_url,item_id, title, des, time, user_name, user_id, img_server FROM `item_image`'; $sql .= $search_value . ' ORDER BY id ASC ' . $limit; $item_ids = ''; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['link_gallery'] = WEB_DIR . AZRewrite::formatUrl('?page=gallery&user_id=' . $row['user_id'] . '&year=' . date('Y', $row['time']) . '&month=' . (int) date('m', $row['time']) . '&day=' . (int) date('d', $row['time'])); if (date('d.m.y', $row['time']) == date('d.m.y', TIME_NOW)) { $row['time'] = date('H:i', $row['time']); } elseif (date('y', $row['time']) == date('y', TIME_NOW)) { $row['time'] = date('d/m H:i', $row['time']); } else { $row['time'] = date('d/m/y H:i', $row['time']); } //if(!eregi('/',$row['img_url'])){ // $row['link_img']='http://'.CGlobal::$img_server[$row['img_server']].'uploaded/items/'.$row['img_url']; //} //else{ $row['link_img'] = 'http://' . CGlobal::$img_server[$row['img_server']] . $row['img_url']; //} if ($row['item_id']) { $item_ids .= ($item_ids ? ',' : '') . $row['item_id']; if (isset($row['name'])) { $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}&ebname=" . AZLib::safe_title($row['name'])); if (date('d.m.y', $row['created_time']) == date('d.m.y', TIME_NOW)) { $row['created_time'] = date('H:i', $row['created_time']); } elseif (date('y', $row['created_time']) == date('y', TIME_NOW)) { $row['created_time'] = date('d/m H:i', $row['created_time']); } else { $row['created_time'] = date('d/m/y H:i', $row['created_time']); } } else { $row['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$row['item_id']}"); $row['created_time'] = ''; } $row['title'] = stripslashes($row['title']); } else { $row['title'] = stripslashes($row['des']); $row['created_time'] = ''; $row['item_link'] = ''; } $row['image_thumb'] = AZLib::getImageThumb($row['img_url'], 110, 0, 1, $row["img_server"]); $row['image_max'] = AZLib::getImageThumbMax($row['img_url'], $row['title'], 1, $row["img_server"]); $row['images_url_root'] = 'http://' . CGlobal::$img_server[$row['img_server']]; $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id'), 'cmd=delete&id=' . $row['id']); $items[$row['id']] = $row; } if ($item_ids) { $all_items = array(); $sql = "SELECT id, name, created_time FROM item WHERE id IN({$item_ids})"; $re = DB::query($sql); if ($re) { while ($item = mysql_fetch_assoc($re)) { $all_items[$item['id']] = $item; } } foreach ($items as &$item_img) { if ($item_img['item_id'] && isset($all_items[$item_img['item_id']])) { $item_img['item_link'] = WEB_DIR . AZRewrite::formatUrl("?page=item_detail&id={$item_img['item_id']}&ebname=" . AZLib::safe_title($all_items[$item_img['item_id']]['name'])); if (date('d.m.y', $all_items[$item_img['item_id']]['created_time']) == date('d.m.y', TIME_NOW)) { $item_img['created_time'] = date('H:i', $all_items[$item_img['item_id']]['created_time']); } elseif (date('y', $all_items[$item_img['item_id']]['created_time']) == date('y', TIME_NOW)) { $item_img['created_time'] = date('d/m H:i', $all_items[$item_img['item_id']]['created_time']); } else { $item_img['created_time'] = date('d/m/y H:i', $all_items[$item_img['item_id']]['created_time']); } } else { $item_img['item_link'] = ''; $item_img['created_time'] = ''; } } } } } else { $paging = ''; } AZLib::my_setcookie("page_img_id", Url::get("page_no") != "" ? intval(Url::get("page_no")) : 1, 60 * 60 * 24 * 365 + TIME_NOW); $display->add("uri", CGlobal::$request_uri); $display->add("images_url_root", 'http://' . CGlobal::$img_server[IMAGE_SERVER_NO]); $display->add('user_name', Url::get('user_name')); $display->add('item_title', Url::get('item_title')); $display->add('items', $items); $display->add('paging', $paging); $display->output('ManageImage'); $this->endForm(); }
function draw() { global $display; $display->add('msg', $this->showFormErrorMessages(1)); if ($this->cart['user_id']) { $display->add("user_name", $this->cart['user_name']); } $display->add("user_id", $this->cart['user_id']); $display->add("customer_name", stripslashes(URL::get('customer_name', $this->cart['customer_name']))); $display->add("customer_email", stripslashes(URL::get('customer_email', $this->cart['customer_email']))); $display->add("customer_phone", stripslashes(URL::get('customer_phone', $this->cart['customer_phone']))); $display->add("customer_address", stripslashes(URL::get('customer_address', $this->cart['customer_address']))); $display->add("customer_note", stripslashes(URL::get('customer_note', $this->cart['customer_note']))); $display->add("note", stripslashes(URL::get('note', $this->cart['note']))); //$quantity_total =0; $price_total = 0; $cart_items = array(); if ($this->cart_items) { foreach ($this->cart_items as $cart_item_id => $cart_item) { $item = $this->items[$cart_item['item_id']]; if (isset(CGlobal::$allCategories[$item['category_id']])) { $cart_item['url'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $cart_item['url'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $cart_item['name'] = $item['name']; $cart_item['price_num'] = $item['price']; $cart_item['price'] = number_format($item['price'], 0, ',', '.'); if ($item['img_url']) { $cart_item['img_url'] = AZLib::getImageThumb($item['img_url'], 120, 120, 0, $item['img_server']); } else { $item['img_url'] = ''; } $cart_item["delete"] = Url::build_current(array('cmd', 'id', 'act' => 'del_item', 'ci_id' => $cart_item['id'])); $cart_item['row_total'] = $cart_item['checked'] ? number_format($item['price'] * $cart_item['quantity'], null, null, '.') . ' VNĐ' : ''; $price_total += $cart_item['checked'] ? $item['price'] * $cart_item['quantity'] : 0; //$quantity_total += $cart_item['checked'] ? $cart_item['quantity'] : 0; $cart_items[$cart_item['id']] = $cart_item; } } $display->add('price_total', number_format($price_total, null, null, '.')); $display->add('url_finish', Url::build_current(array('cmd' => 'finish'))); $display->add('cart_items', $cart_items); //1:Chưa cập nhật; 2: Đã gửi đơn hàng ; 3: Đã TT; 4: Hủy đơn hàng; 5: Đã duyệt $status_arr = array(6 => "--Tất cả--", 2 => "Đã gửi đơn hàng", 1 => "Chưa cập nhật", 3 => "Đã Thanh toán", 5 => "Đã duyệt", 4 => "Đã hủy"); $display->add("status_option", AZLib::getOption($status_arr, $this->cart['status'])); $display->add('cart_id', "Cart_" . $this->cart['id']); $display->add("time_create", date('d/m/Y H:i:s', $this->cart['time_create'])); $display->add("time_change", date('d/m/Y H:i:s', $this->cart['time_change'])); if ($this->cart['time_finish']) { $display->add("time_finish", date('d/m/Y H:i:s', $this->cart['time_finish'])); } else { $display->add("time_finish", "Chưa hoàn thành!"); } $this->beginForm(); $display->output('CartEdit'); $this->endForm(); }
if (isset($all_items[$topcid]['subs'][$seccid])) { if ($item['quantity']) { $item['quantity'] = "Có hàng"; } else { $item['quantity'] = "<font color=red>Call</font>"; } if ($item['price']) { if ($item['currency_id'] == 2) { $item['price'] = $item['price'] * CGlobal::$exchange; } $item['price'] = Url::currency_format($item['price']); } else { $item['price'] = "Liên hệ"; } if ($item['img_url']) { $item['img_url'] = $url . AZLib::getImageThumb($item['img_url'], 80, 80, 0, $item['img_server']); } else { $item['img_url'] = ''; } $item['name'] = stripslashes($item['name']); $item['list_brief'] = stripslashes($item['list_brief']); $item['url'] = WEB_ROOT . CGlobal::$allCategories[$seccid]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; unset($all_check_items[$topcid]['subs'][$seccid]); $all_items[$topcid]['subs'][$seccid]['items'][$item['id']] = $item; } } } if ($all_check_items) { foreach ($all_check_items as $topid => $topcat) { if ($topcat['subs']) { foreach ($topcat['subs'] as $sid => $scat) {
function draw() { global $display; $item_cat_ids = ''; $offer_cats = array(); $item_cats = array(); $item_cat_offer = array(); $configs = @CGlobal::$configs['ItemOffer']['conf_val']; if ($configs) { $configs = unserialize(stripslashes($configs)); } else { $configs = array('title' => "SẢN PHẨM KHUYẾN MẠI", 'item_cat_offer' => array()); } foreach (CGlobal::$subCategories as $top_id => $sub_cats) { if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) { $topcat = CGlobal::$allCategories[$top_id]; if ($topcat['status'] == "HOME") { $item_ids = isset($configs['item_cat_offer'][$top_id]) ? $configs['item_cat_offer'][$top_id] : ''; if ($item_ids) { $item_cat_ids .= ($item_cat_ids != '' ? ',' : '') . $item_ids; } $arr = array('id' => $top_id, 'name' => "<a href='" . WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}'>{$topcat['name']}</a>", 'item_ids' => $item_ids, 'sub' => array(), 'sub_display' => 0); foreach ($sub_cats as $sid => $subcat) { $item_ids = isset($configs['item_cat_offer'][$sid]) ? $configs['item_cat_offer'][$sid] : ''; if ($item_ids) { $arr['sub_display'] = 1; $item_cat_ids .= ($item_cat_ids != '' ? ',' : '') . $item_ids; } $arr['sub'][$sid] = array('id' => $sid, 'name' => "<a href='" . WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}'>{$subcat['name']}</a>", 'item_ids' => $item_ids); } $item_cat_offer[$top_id] = $arr; } } } if ($item_cat_ids) { $re = DB::query("SELECT * FROM item WHERE id IN({$item_cat_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_cat_ids}')"); if ($re) { while ($product = mysql_fetch_assoc($re)) { if ($product['img_url']) { $product['image'] = AZLib::getImageThumb($product['img_url'], 235, 150, 0, $product['img_server']); } else { $product['image'] = ""; //"style/images/no-images-35x35.gif"; } if (isset(CGlobal::$allCategories[$product['category_id']])) { $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } else { $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html"; } $product['name'] = stripslashes($product['name']); $product['price_num'] = $product['price']; $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']); if ($product['price_out']) { if ($product['price_num'] < $product['price_out']) { $product['sale_off'] = floor(100 * ($product['price_out'] - $product['price_num']) / $product['price_out']); } $product['price_out'] = AZLib::getPrice($product['price_out'], $product['currency_id']); } //level_1_catid //$topcat_id = if (isset($configs['item_cat_offer'][$product['level_1_catid']]) && in_array($product['id'], explode(',', $configs['item_cat_offer'][$product['level_1_catid']]))) { $offer_cats[$product['level_1_catid']] = CGlobal::$allCategories[$product['level_1_catid']]; $item_cats[$product['level_1_catid']][$product['id']] = $product; } if (isset($configs['item_cat_offer'][$product['category_id']]) && in_array($product['id'], explode(',', $configs['item_cat_offer'][$product['category_id']]))) { $offer_cats[$product['category_id']] = CGlobal::$allCategories[$product['category_id']]; $item_cats[$product['category_id']][$product['id']] = $product; } } } } if (User::is_admin()) { $display->add("is_admin", 1); $display->add("msg", $this->showFormErrorMessages(1)); $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1)); $display->add('end_form', $this->endForm(true)); } $display->add('title_offer', $configs['title']); $display->add('item_cat_offer', $item_cat_offer); $display->add('item_cats', $item_cats); $display->add('offer_cats', $offer_cats); ################################################################################################################ #ADV config $config = @CGlobal::$configs['AdvItemOffer']['conf_val']; $status = 0; $url_detail = ''; $type_display = 1; if ($config != '') { $config_arr = explode("\n", $config); $status = (int) $config_arr[0]; $url_detail = $config_arr[1]; $type_display = (int) $config_arr[2]; } if ($status) { //Bật if ($type_display == 1) { $display->add('adv_banner', DATA_PATH . 'adv/AdvItemOffer.gif'); } else { $display->add('adv_banner', DATA_PATH . 'adv/AdvItemOffer.swf'); } $display->add('type_display', $type_display); $display->add('url_detail', $url_detail); } else { //tắt $display->add('adv_banner', ''); } $display->add('adv_status', $status); if (User::is_admin()) { $status_arr = array(0 => 'Tắt', 1 => 'Bật'); $display->add('status_option', AZLib::getOption($status_arr, $status)); $display->add('url', $url_detail); $type_arr = array(1 => 'Ảnh', 2 => 'Flash'); $type = URL::get('type', 'int', $type_display); $display->add('type_option', AZLib::getOption($type_arr, $type)); } else { $display->add('adv_config', ''); $display->add('is_admin', 0); } $display->add('adv_width', 200); $display->add('adv_height', 560); #ADV config ################################################################################################################ /*System::debug($item_cats); */ $display->output("ItemOffer"); }
function Build($row) { Module::Module($row); ################################################################################################## $build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val']; if ($build_catids != '') { $arr = explode(',', $build_catids); $build_catids = ''; $last = 0; if ($arr) { foreach ($arr as $catid) { if (isset(CGlobal::$allCategories[$catid]) && CGlobal::$allCategories[$catid]['status'] != 'HIDE') { $build_catids .= ($build_catids != '' ? ',' : '') . $catid; Build::$cats[$catid] = array('id' => $catid, 'name' => CGlobal::$allCategories[$catid]['name'], 'recomend' => str_replace(chr(13) . chr(10), "<br />", CGlobal::$allCategories[$catid]['recomend']), 'img' => AZLib::getImageThumb("category/{$catid}.gif", 40, 40, 0, 0), 'item_id' => 0, 'item_name' => '', 'item_url' => '', 'item_price' => '', 'item_warranty' => '', 'list_brief' => ''); if ($last) { Build::$cats[$last]['next_id'] = $catid; } $last = $catid; } } } } self::$bcatid = (int) Url::get('bcatid'); if (self::$bcatid) { if (isset(Build::$cats[self::$bcatid])) { self::$bcat = Build::$cats[self::$bcatid]; } else { Url::redirect_current(array('mode')); } } else { self::$bcat = reset(Build::$cats); if (self::$bcat) { self::$bcatid = (int) self::$bcat['id']; } } ################################################################################################## $item_ids = ''; $build_ids = isset($_SESSION['build_ids']) ? $_SESSION['build_ids'] : ''; $build_price = 0; if ($build_ids != '') { $items = array(); $re = DB::query("SELECT * FROM item WHERE id IN(" . $build_ids . ") AND status=1 AND price>0 AND quantity>0 ORDER BY find_in_set(category_id,'" . $build_catids . "')"); if ($re) { while ($item = mysql_fetch_assoc($re)) { if (isset(Build::$cats[$item['category_id']]) && Build::$cats[$item['category_id']]['item_id'] == 0) { Build::$price += $item['price']; $item_ids .= ($item_ids != '' ? ',' : '') . $item['id']; if (isset(CGlobal::$allCategories[$item['category_id']])) { $item_url = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item_url = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } if ($item['list_brief'] == '') { $item['list_brief'] = $item['brief']; } $item['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['list_brief']); $item['list_brief'] = str_replace(array("'", "\""), array("", " "), $item['list_brief']); $item['list_brief'] = AZLib::word_limit($item['list_brief'], 50, ''); Build::$items[$item['id']] = $item; Build::$cats[$item['category_id']]['item_id'] = $item['id']; Build::$cats[$item['category_id']]['item_name'] = $item['name']; Build::$cats[$item['category_id']]['item_url'] = $item_url; Build::$cats[$item['category_id']]['item_price'] = number_format($item['price'], 0, ',', '.') . " VNĐ"; Build::$cats[$item['category_id']]['item_warranty'] = $item['warranty']; Build::$cats[$item['category_id']]['list_brief'] = $item['list_brief']; } } } } $item_id = (int) Url::get('item_id'); $bcatid = (int) Url::get('bcatid'); if ($item_id && $bcatid) { $item = Item::get_item($item_id); if ($item && $item['status'] == 1 && $item['price'] > 0 && $item['quantity'] > 0 && isset(Build::$cats[$item['category_id']])) { if (!isset(Build::$items[$item['id']])) { if (Build::$cats[$item['category_id']]['item_id'] > 0) { unset(Build::$items[Build::$cats[$item['category_id']]['item_id']]); } Build::$items[$item['id']] = $item; //$item_ids .= ($item_ids!='' ? ',' : '') . $item['id']; $item_ids = implode(',', array_keys(Build::$items)); $_SESSION['build_ids'] = "{$item_ids}"; $last = 0; foreach (array_keys(Build::$cats) as $catid) { if ($last == self::$bcatid) { Url::redirect_current(array('mode', 'bcatid' => $catid), '#select_item'); } $last = $catid; } } } Url::redirect_current(array('mode', 'bcatid')); } $_SESSION['build_ids'] = "{$item_ids}"; $cmd = Url::get('cmd'); switch ($cmd) { case 'success': require_once 'forms/BuildSuccess.php'; $this->add_form(new BuildSuccessForm()); break; case 'reset': $_SESSION['build_ids'] = ""; Url::redirect_current(); break; case 'order': if ($item_ids != '') { $cart_item_ids = isset($_COOKIE['cart_items']) ? $_COOKIE['cart_items'] : ''; if ($cart_item_ids != '') { $buil_item_arr = explode(',', $item_ids); $item_ids = $cart_item_ids; $cat_item_arr = explode(',', $cart_item_ids); foreach ($buil_item_arr as $item_id) { if (!in_array($item_id, $cat_item_arr)) { $item_ids .= ($item_ids != '' ? ',' : '') . $item_id; } } } if ($item_ids != $cart_item_ids) { AZLib::my_setcookie('cart_items', $item_ids, time() + 3600 * 24 * 365); } $_SESSION['build_ids'] = ""; Url::redirect('cart'); } Url::redirect_current(); break; case '': default: require_once 'forms/Build.php'; $this->add_form(new BuildForm()); break; } }
function get_trans_notify_bar() { AZLib::getCats(); $json = ""; if (!User::is_login()) { $json = '({"msg":"no_login"})'; echo $json; exit; } if (User::is_login()) { AZLib::getCats(); //Notify bar // danh sach giao dich $select = 'SELECT id, name, category_id, level_1_catid, img_url, read_count, up_time, img_server FROM item WHERE status = 1 AND user_id=' . User::id() . ' ORDER BY shop_order, up_time DESC LIMIT 0,50'; $re = DB::query($select); $items = array(); if ($re) { $json = ''; while ($item = mysql_fetch_assoc($re)) { $ebname = AZLib::safe_title($item['name']); if (isset(CGlobal::$allCategories[$item['level_1_catid']])) { $cat_name = CGlobal::$allCategories[$item['level_1_catid']]['name']; $item['href'] = WEB_DIR . AZLib::safe_title($cat_name) . "/p{$item['id']}/{$ebname}.html"; } else { $item['href'] = WEB_DIR . "/p{$item['id']}/{$ebname}.html"; } if ($item['img_url']) { $item['img_url'] = AZLib::getImageThumb($item['img_url'], 60, 0, 1, $item['img_server']); } else { $item['img_url'] = 'style/images/no-images-69x53.jpg'; } $item['up_time'] = date('H:i | d-m-Y', $item['up_time']); $json .= '{"id":"' . $item['id'] . '","read_count":"' . $item['read_count'] . '","time":"' . $item['up_time'] . '","name":"' . $item['name'] . '","link":"' . $item['href'] . '","images":"' . $item['img_url'] . '"},'; } if ($json) { $json = '[' . substr($json, 0, -1) . ']'; } else { $json = '({"msg":"no_trans"})'; } } echo $json; exit; } }
function draw() { global $display; $this->beginForm(true); $cmd = Url::get('cmd'); $display->add('cmd', $cmd); $re = DB::query("SELECT id,name,parent_id ,position FROM category ORDER BY parent_id,position"); $all_cats = array(); $all_subcats = array(); $all_top_cat = array(0 => '-Chọn danh mục cha-'); $level1_cats = array(); $level2_cats = array(); if ($re) { while ($cat = mysql_fetch_assoc($re)) { $cat['name'] = "[{$cat['id']}] {$cat['name']}"; if ($cat['parent_id']) { if (!isset($all_cats[$cat['parent_id']])) { $level1_cats[$cat['parent_id']] = array('id' => $cat['parent_id'], 'name' => "[{$cat['parent_id']}] Đã xóa (ko tồn tại)", "max" => $cat['position']); } $all_subcats[$cat['parent_id']][$cat['id']] = $cat; $cat['max'] = 0; if ($cat['position'] > $level1_cats[$cat['parent_id']]['max']) { $level1_cats[$cat['parent_id']]['max'] = $cat['position']; } $level2_cats[$cat['id']] = $cat; } else { $cat['max'] = 0; $level1_cats[$cat['id']] = $cat; if (!isset($all_subcats[$cat['id']])) { $all_subcats[$cat['id']] = array(); } } $all_cats[$cat['id']] = $cat; } } $display->add('level1_cats', json_encode($level1_cats)); $display->add('level2_cats', json_encode($level2_cats)); foreach ($all_subcats as $topid => $subcats) { if (isset($level1_cats[$topid]) && $level1_cats[$topid]['max']) { if (!isset($all_cats[$topid])) { $all_cats[$topid] = array('id' => $topid, 'name' => "[{$topid}] Đã xóa (ko tồn tại)"); } $all_cats[$topid]['name'] .= " ({$level1_cats[$topid]['max']})"; } $all_top_cat[$topid] = $all_cats[$topid]['name']; foreach ($subcats as $subcat) { if (isset($level2_cats[$subcat['id']]) && $level2_cats[$subcat['id']]['max']) { $subcat['name'] .= " ({$level2_cats[$subcat['id']]['max']})"; } $all_top_cat[$subcat['id']] = "-----" . $subcat['name']; } } if (!isset($this->cat['id'])) { $this->cat['id'] = 0; } $display->add('cat_image', AZLib::getImageThumb('category/' . $this->cat['id'] . '.gif', 200, 200, 0, $this->cat['img_server'])); $display->add('msg', $this->showFormErrorMessages(true)); $display->add('name', Url::get('name', $this->cat['name'])); $display->add('brief_name', Url::get('brief_name', $this->cat['brief_name'])); $display->add('keywords', Url::get('keywords', $this->cat['keywords'])); $display->add('description', Url::get('description', $this->cat['description'])); $display->add('option_parent_id', AZLib::getOption($all_top_cat, Url::get('parent_id', $this->cat['parent_id']))); $display->add('option_status', AZLib::getOption(array('HIDE' => 'Ẩn', 'SHOW' => 'SHOW', 'HOME' => 'HOME'), Url::get('status', $this->cat['status']))); $max_pos = 1 + DB::fetch("SELECT MAX(position) AS max_pos FROM category WHERE parent_id=0", "max_pos", 0); $display->add('max_pos', $max_pos); if (Url::get('cmd') == 'add' || Url::get('cmd') == 'edit' && $this->cat['parent_id'] == 0) { //Sửa danh mục $zones = array(); if (Url::get('cmd') == 'edit' && $this->cat['parent_id'] == 0) { //Sửa danh mục $zones = $this->zones; } $re = DB::query("SELECT id,name, status FROM category_zone ORDER BY position"); $all_zone = array(); if ($re) { while ($zone = mysql_fetch_assoc($re)) { if ($zone['status'] == 0) { $zone['name'] .= ' (Ẩn)'; } $all_zone[$zone['id']] = $zone['name']; } } $display->add('option_zones', AZLib::getOptionMulti($all_zone, array_keys($zones))); } if (Url::get('cmd') == 'edit') { //Sửa danh mục $display->add('option_position', AZLib::getOptionNum(1, $max_pos, Url::get('position', $this->cat['position']))); $display->add('cur_position', $this->cat['position']); } else { $display->add('option_position', AZLib::getOptionNum(1, $max_pos, Url::get('position', $max_pos))); $display->add('cur_position', 0); } $filter_groups = array(); $other_filter_groups = CGlobal::$all_gfilters; $max_pos_gfilter = 1; if ($this->cat['id']) { /*$max_pos_gfilter = 1 + DB::fetch("SELECT MAX(pos) AS max_pos FROM filter_group WHERE catid=".$this->cat['id']."","max_pos",0); $re = DB::query("SELECT * FROM filter_group WHERE catid=".$this->cat['id']." ORDER BY pos"); if($re) { while($filter_group = mysql_fetch_assoc($re)) { $filter_group['link'] = Url::build_current(array('cmd'=>'filter','fgroup_id'=>$filter_group['id'])); $filter_group['del'] = Url::build_current(array('cmd','id','fgroup_del'=>$filter_group['id'])); $filter_groups[$filter_group['id']] = $filter_group; } }*/ if (isset(CGlobal::$filters[$this->cat['id']])) { foreach (CGlobal::$filters[$this->cat['id']] as $filter_group) { unset($other_filter_groups[$filter_group['id']]); if ($max_pos_gfilter <= $filter_group['pos']) { $max_pos_gfilter = $filter_group['pos'] + 1; } $filter_group['link'] = Url::build_current(array('cmd' => 'filter', 'fgroup_id' => $filter_group['id'])); $filter_group['remove'] = Url::build_current(array('cmd', 'id', 'fgroup_remove' => $filter_group['id'])); $filter_groups[$filter_group['id']] = $filter_group; } } } if ($other_filter_groups) { foreach ($other_filter_groups as $filter_group) { if ($max_pos_gfilter <= $filter_group['pos']) { $max_pos_gfilter = $filter_group['pos'] + 1; } $filter_group['link'] = Url::build_current(array('cmd' => 'filter', 'fgroup_id' => $filter_group['id'])); $filter_group['add'] = Url::build_current(array('cmd', 'id', 'fgroup_add' => $filter_group['id'])); $other_filter_groups[$filter_group['id']] = $filter_group; } } $display->add('filter_groups', $filter_groups); $display->add('other_filter_groups', $other_filter_groups); $display->add('catid', $this->cat['id']); $display->add('parent_id', $this->cat['parent_id']); $display->add('option_gfilter_pos', AZLib::getOptionNum(1, $max_pos_gfilter, $max_pos_gfilter)); $display->add('tag_search', Url::get('tag_search', $this->cat['tag_search'])); $display->add('price_str', Url::get('price_str', $this->cat['price_str'])); $display->add('recomend', Url::get('recomend', $this->cat['recomend'])); $display->output('edit'); $this->endForm(); }
function draw() { if (Item::$item && isset(Item::$item['display']) && Item::$item['display']) { global $display; AZLib::getCats(); $item_detail = Item::$item; $item_detail['name_url'] = AZLib::safe_title($item_detail['name']); //rewrite URL $item_detail['modify_time'] = date('Y') != date('Y', $item_detail['modify_time']) ? date('H:i, d/m/Y', $item_detail['modify_time']) : date('H:i, d/m', $item_detail['modify_time']); $item_detail['created_time'] = date('Y') != date('Y', $item_detail['created_time']) ? date('H:i, d/m/Y', $item_detail['created_time']) : date('H:i, d/m', $item_detail['created_time']); $item_detail['price'] = AZLib::convertCurrency($item_detail['price'], $item_detail['currency_id']); $item_detail['price_out'] = AZLib::convertCurrency($item_detail['price_out'], $item_detail['currency_id']); if (isset(CGlobal::$allCategories[$item_detail['category_id']])) { $item_detail['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item_detail['id'] . '&ebname=' . AZLib::safe_title($item_detail['name']) . '&nice_name=' . CGlobal::$allCategories[$item_detail['category_id']]['nice_name']); } else { $item_detail['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item_detail['id'] . '&ebname=' . AZLib::safe_title($item_detail['name'])); } //$display->add('currency_id',$item_detail['price']?CGlobal::$currency[$item_detail['currency_id']]:''); $display->add('currency_id', $item_detail['price'] ? 'VNĐ' : ''); $item_detail['price'] = $item_detail['price'] ? number_format($item_detail['price'], 0, ',', '.') : 'Liên hệ'; $item_detail['price_out'] = $item_detail['price_out'] ? number_format($item_detail['price_out'], 0, ',', '.') : ''; //item images $display->add("item_images", $item_detail['images']); $display->add("count_img", count($item_detail['images'])); $display->add("images_url_root", isset($item_detail['img_server']) ? 'http://' . CGlobal::$img_server[(int) $item_detail['img_server']] : ''); //END item images $this->admin_links($item_detail); //Highlight keyword search $this->highlight_searchword($item_detail); //END Highlight keyword search $show_error = false; if ($item_detail['status'] == 2) { $show_error = true; if (User::have_permit(ADMIN_ITEM)) { $display->add('modify_by', ' (bởi <b>' . $item_detail['modify_user_name'] . '</b> lúc <b>' . date('d/m/Y H:i', $item_detail['modify_time']) . '</b>)'); } } $display->add("show_error", $show_error); $link_item = "p" . $item_detail['id'] . "/" . AZLib::safe_title($item_detail['name']) . ".html"; if (isset(CGlobal::$allCategories[$item_detail['category_id']])) { $link_item = CGlobal::$allCategories[$item_detail['category_id']]['nice_name'] . '/' . $link_item; } $first_img = false; if (Item::$item['images']) { foreach (Item::$item['images'] as $img) { $first_img = $img; break; } } elseif (Item::$item['img_url']) { $first_img['i'] = 1; $first_img['img_server'] = Item::$item['img_server']; $first_img['thumb316'] = AZLib::getImageThumb(Item::$item['img_url'], 316, 0, 0, Item::$item['img_server']); $first_img['img_full_url'] = "http://" . CGlobal::$img_server[Item::$item['img_server']] . Item::$item['img_url']; $first_img['max_path'] = AZLib::getImageThumbMax(Item::$item['img_url'], '', 1, Item::$item['img_server']); } $display->add('first_img', $first_img); if ($item_detail['status'] == 1) { $display->add('json_item', $item_detail['id']); } else { $display->add('json_item', 0); } //end list ly do khoa topic //for view images $display->add("request_uri", CGlobal::$request_uri); //Current url $display->add("url_flash_xml", urlencode('ebxml.php?act=item&code=tiltviewer_gallery&item_id=' . $item_detail['id'])); //END for view images $display->add("msg", $this->showFormErrorMessages(1, "THÔNG BÁO")); $arr = $this->process_description($item_detail); $item_detail['brief'] = $arr['filter_brief']; $item_detail['description'] = $arr['filter_des']; /* $item_detail['description'] = preg_replace('#(<[/]?img.*>)#iU', '', html_entity_decode($item_detail['description'])); $item_detail['description'] = preg_replace("/\\[([\s]*[0-9]{1,2}[\s]*)\]/eis", "\$this->embeded('$1')",$item_detail['description']); $item_detail['description'] = preg_replace('/<a[\s]*(.*)[\s]*href=[\'"](.*)[\'"][\s]*[^>]*[\s]*>(.*)<\/a>/eisU', "\$this->filter_link('$2','$3')", $item_detail['description']);*/ $display->add('is_admin', (int) (!User::is_block() && User::have_permit(ADMIN_USER))); $display->add("item_info", $item_detail); $display->add("item_id", $item_detail['id']); //$display->add("share_url", urlencode("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])); $cat_url = ''; $cat_name = ''; if (CGlobal::$curLevel2Cat) { $cat_url = "c" . CGlobal::$curLevel2Cat['id'] . "/" . CGlobal::$curMainCat['ebname'] . "-" . CGlobal::$curLevel2Cat['ebname']; $cat_name = CGlobal::$curLevel2Cat['name']; } elseif (CGlobal::$curMainCat) { $cat_url = "c" . CGlobal::$curMainCat['id'] . "/" . CGlobal::$curMainCat['ebname']; $cat_name = CGlobal::$curMainCat['name']; } $display->add("cat_url", $cat_url); $display->add("cat_name", $cat_name); $display->add("cat_name", $cat_name); if (isset($_SERVER['REQUEST_URI'])) { $display->add("http_referer", $_SERVER['REQUEST_URI']); } else { $display->add("http_referer", ""); } /*//if(isset($_SERVER['HTTP_REFERER']) && eregi('enbac.com/c', $_SERVER['HTTP_REFERER'])){ if(isset($_SERVER['HTTP_REFERER']) && eregi(WEB_ROOT.'c', $_SERVER['HTTP_REFERER'])){ $display->add("ref_url", $_SERVER['HTTP_REFERER']); } else{ $display->add("ref_url", $cat_url); } //$display->add("go_back", (isset($_SERVER['HTTP_REFERER']) && eregi('enbac.com/c', $_SERVER['HTTP_REFERER']))); $display->add("go_back", (isset($_SERVER['HTTP_REFERER']) && eregi(WEB_ROOT.'c', $_SERVER['HTTP_REFERER'])));*/ #################################################################################################################################################################################### //Rating product $display->add('ranking', AZLib::getRank($item_detail, true)); $display->add('login', (int) User::is_login()); $display->add('rate_num', $item_detail['rate_num']); $display->add('_rank', number_format($item_detail['rank'], 1, '.', ',')); $display->add('_f_rank', number_format($item_detail['f_rank'], 1, '.', ',')); $display->add('_d_rank', number_format($item_detail['d_rank'], 1, '.', ',')); $display->add('_u_rank', number_format($item_detail['u_rank'], 1, '.', ',')); if ($item_detail['f_rank']) { $f_rank = number_format($item_detail['f_rank'], 1, '.', ','); } else { $f_rank = 0; } $display->add('f_rank_', round($item_detail['f_rank'])); $display->add('f_rank', $f_rank); $display->add('f_rate_num', $item_detail['f_rate_num']); if (User::have_permit(ADMIN_ITEM) || User::is_login() && !DB::select("item_rating", "type=0 AND user_id=" . User::id() . " AND item_id=" . $item_detail['id'])) { $display->add('block_f_rank', 1); } else { $display->add('block_f_rank', 0); } if ($item_detail['d_rank']) { $d_rank = number_format($item_detail['d_rank'], 1, '.', ','); } else { $d_rank = 0; } $display->add('d_rank_', round($item_detail['d_rank'])); $display->add('d_rank', $d_rank); $display->add('d_rate_num', $item_detail['d_rate_num']); if (User::have_permit(ADMIN_ITEM) || User::is_login() && !DB::select("item_rating", "type=1 AND user_id=" . User::id() . " AND item_id=" . $item_detail['id'])) { $display->add('block_d_rank', 1); } else { $display->add('block_d_rank', 0); } if ($item_detail['u_rank']) { $u_rank = number_format($item_detail['u_rank'], 1, '.', ','); } else { $u_rank = 0; } $display->add('u_rank_', round($item_detail['u_rank'])); $display->add('u_rank', $u_rank); $display->add('u_rate_num', $item_detail['u_rate_num']); if (User::have_permit(ADMIN_ITEM) || User::is_login() && !DB::select("item_rating", "type=2 AND user_id=" . User::id() . " AND item_id=" . $item_detail['id'])) { $display->add('block_u_rank', 1); } else { $display->add('block_u_rank', 0); } //End Rating product #################################################################################################################################################################################### $display->output("ItemDetail"); } else { $content = 'Sản phẩm này hiện không tồn tại.'; if (Item::$item && isset(Item::$item['status']) && isset(Item::$item['category_id']) && Item::$item['category_id'] && isset(CGlobal::$allCategories[Item::$item['category_id']])) { $ebname = CGlobal::$allCategories[Item::$item['category_id']]['ebname']; $pid = CGlobal::$allCategories[Item::$item['category_id']]['parent_id']; if ($pid && isset(CGlobal::$allCategories[$pid])) { $ebname = CGlobal::$allCategories[$pid]['ebname'] . "-" . $ebname; $pid = CGlobal::$allCategories[$pid]['parent_id']; if ($pid && isset(CGlobal::$allCategories[$pid])) { $ebname = CGlobal::$allCategories[$pid]['ebname'] . "-" . $ebname; } } //header("HTTP/1.0 404 Not Found"); $content .= " Click <a href='" . WEB_DIR . "c" . Item::$item['category_id'] . "/{$ebname}'>vào đây</a> để xem các sản phẩm liên quan."; } elseif (Item::$item && isset(Item::$item['status']) && isset(Item::$item['level_1_catid']) && Item::$item['level_1_catid'] && isset(CGlobal::$allCategories[Item::$item['level_1_catid']])) { $ebname = CGlobal::$allCategories[Item::$item['level_1_catid']]['ebname']; //header("HTTP/1.0 404 Not Found"); $content .= " Click <a href='" . WEB_DIR . "c" . Item::$item['level_1_catid'] . "/{$ebname}'>vào đây</a> để xem các sản phẩm liên quan."; } else { $content .= " Click <a href='" . WEB_DIR . "'>vào đây</a> để trở về Trang chủ."; } AZLib::show_error_mes($content); } }
function BuildPrint($row) { Module::Module($row); ################################################################################################## $build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val']; if ($build_catids != '') { $arr = explode(',', $build_catids); $build_catids = ''; if ($arr) { foreach ($arr as $catid) { if (isset(CGlobal::$allCategories[$catid]) && CGlobal::$allCategories[$catid]['status'] != 'HIDE') { $build_catids .= ($build_catids != '' ? ',' : '') . $catid; BuildPrint::$cats[$catid] = array('id' => $catid, 'name' => CGlobal::$allCategories[$catid]['name'], 'img' => AZLib::getImageThumb("category/{$catid}.gif", 40, 40, 0, 0), 'item_id' => 0, 'item_name' => '', 'item_url' => '', 'item_price' => '', 'item_warranty' => '', 'list_brief' => ''); } } } } self::$bcatid = (int) Url::get('bcatid'); if (self::$bcatid) { if (isset(BuildPrint::$cats[self::$bcatid])) { self::$bcat = BuildPrint::$cats[self::$bcatid]; } else { Url::redirect_current(array('mode')); } } else { self::$bcat = reset(BuildPrint::$cats); if (self::$bcat) { self::$bcatid = (int) self::$bcat['id']; } } ################################################################################################## $item_ids = ''; $build_ids = isset($_SESSION['build_ids']) ? $_SESSION['build_ids'] : ''; $build_price = 0; if ($build_ids != '') { $items = array(); $re = DB::query("SELECT * FROM item WHERE id IN(" . $build_ids . ") AND status=1 AND price>0 AND quantity>0 ORDER BY find_in_set(category_id,'" . $build_catids . "')"); if ($re) { while ($item = mysql_fetch_assoc($re)) { if (isset(BuildPrint::$cats[$item['category_id']]) && BuildPrint::$cats[$item['category_id']]['item_id'] == 0) { $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); BuildPrint::$price += $item['price']; $item_ids .= ($item_ids != '' ? ',' : '') . $item['id']; if (isset(CGlobal::$allCategories[$item['category_id']])) { $item_url = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item_url = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } if ($item['list_brief'] == '') { $item['list_brief'] = $item['brief']; } $item['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['list_brief']); $item['list_brief'] = str_replace(array("'", "\""), array("", " "), $item['list_brief']); $item['list_brief'] = AZLib::word_limit($item['list_brief'], 50, ''); BuildPrint::$items[$item['id']] = $item; BuildPrint::$cats[$item['category_id']]['item_id'] = $item['id']; BuildPrint::$cats[$item['category_id']]['item_name'] = $item['name']; BuildPrint::$cats[$item['category_id']]['item_url'] = $item_url; BuildPrint::$cats[$item['category_id']]['item_price'] = number_format($item['price'], 0, ',', '.'); BuildPrint::$cats[$item['category_id']]['item_warranty'] = $item['warranty']; BuildPrint::$cats[$item['category_id']]['list_brief'] = $item['list_brief']; } } } } $_SESSION['build_ids'] = "{$item_ids}"; require_once 'forms/BuildPrint.php'; $this->add_form(new BuildPrintForm()); }
function show_mes_outbox() { $search_text = AZLib::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; $paging = AZPagging::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, user.avatar_url, user.img_server FROM ' . $table_text . ', ' . $table_topics . ', user WHERE ' . $table_text . '.msg_id = ' . $table_topics . '.mt_msg_id AND ' . $table_topics . '.mt_from_id = user.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'] = AZLib::getImageThumb($row['avatar_url'], 50, 50, 0, $row['img_server']); } else { $row['avatar_url'] = "style/images/50x50.gif"; } //$row['msg_date'] = AZLib::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(AZLib::parseBBCode(AZLib::convert_one_br($row['msg_post'])), '<br />'); if (strlen($row['msg_post']) > 40) { $row['msg_post_short'] = AZLib::word_limit($row['msg_post'], 40, ' ...'); //$row['msg_post_short'] = AZLib::cleanHtml(AZLib::word_limit($row['msg_post'],40,' ...')); } else { $row['msg_post_short'] = $row['msg_post']; //$row['msg_post_short'] = AZLib::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' . $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' . $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; //For ajax_upload form $display->add('url_gallery', WEB_ROOT . AZRewrite::formatUrl('?page=gallery&is_popup=1&user_id=' . User::id())); //$display->add('no_img_upload',AZLib::getImageSrc('',100,100)); $display->add('no_img_upload', $this->no_image); // Keep item avatar when update false if (isset($_POST["avatar_img_server"]) && $_POST["avatar_img_server"]) { $avatar['img_server'] = $_POST["avatar_img_server"]; $avatar['img_url'] = $_POST["avatar_img_url"]; $avatar['thumb280_280'] = AZLib::getImageThumb($_POST["avatar_img_url"], 280, 280, 0, $_POST["avatar_img_server"]); $avatar['max_path'] = AZLib::getImageThumbMax($_POST["avatar_img_url"], 'thumb_max', 1, $_POST["avatar_img_server"]); $display->add('avatarInfo', $avatar); $display->add('avatar', json_encode($avatar)); } $display->add('item_user_id', User::id()); $display->add('user_name', User::user_name()); $display->add('user_id', User::id()); $display->add('is_can_edit', (int) User::have_permit(ADMIN_ITEM)); $display->add('browser_is_ie', $this->browser_is_ie); $display->output('ajax_upload'); //For ajax_upload form $this->beginForm(true); $display->add('max_image_page', $this->max_image_page); $display->add('images_per_page', $this->images_per_page); $display->add('post_item_images', $this->item_images); $display->add('jsImages', json_encode($this->jsImages)); $display->add('first_combo', (int) Url::get('first_combo')); $display->add('second_combo', (int) Url::get('second_combo')); //$display->add('category_tree',json_encode(AZLib::getCategoriesTree(0,true))); $display->add('category_tree', json_encode(AZLib::getCategoriesTree(true))); $display->add('currency_tree', json_encode(CGlobal::$currency)); $display->add('az_filters', json_encode(CGlobal::$filters)); $display->add('image_path', 'http://' . IMAGE_PATH); $display->add('img_cur_server', IMAGE_SERVER_NO); $display->add('img_server', json_encode(CGlobal::$img_server)); $display->add('no_img', $this->no_image); $display->add('multi_upload', User::have_permit(ADMIN_ITEM)); $display->add('post_img', $display->output('post_img', true)); $display->add('currency_id_option', AZLib::getOption(CGlobal::$currency, Url::get('currency_id', 1))); $display->add('msg', $this->showFormErrorMessages(1)); $display->add('mode', "ĐĂNG"); $display->add('sku', Url::get('sku')); $display->add('name', stripslashes(Url::get('name'))); $display->add('offer', stripslashes(Url::get('offer'))); $display->add('brief', stripslashes(Url::get('brief'))); $display->add('item_description', stripslashes(Url::get('item_description'))); $display->add('price', number_format(Url::cdouble(Url::get('price')), 0, ',', '.')); $display->add('price', number_format(Url::cdouble(Url::get('price')), 0, ',', '.')); $display->add('price_out', number_format(Url::cdouble(Url::get('price_out')), 0, ',', '.')); $display->add('quantity', number_format(Url::cdouble(Url::get('quantity')), 0, ',', '.')); $display->add('item_order', (int) Url::get('item_order')); $display->add('made_in', Url::get('made_in')); $display->add('warranty', Url::get('warranty')); $display->add('add_for_user', User::have_permit(ADMIN_ITEM)); $display->output('post_sale'); $this->endForm(); }
function item_history() { $itemids = Url::get('itemids'); $item_history = array(); if ($itemids) { $re = DB::query("SELECT id, name, price, currency_id, img_url, img_server, status, state FROM item WHERE id IN({$itemids}) ORDER BY find_in_set(id, '{$itemids}')"); if ($re) { while ($fitem = mysql_fetch_assoc($re)) { if ($fitem['status'] == 1 && $fitem['state'] == 0) { $item['item_id'] = $fitem['id']; $item['item_url'] = "p" . $fitem['id'] . "/" . AZLib::safe_title($fitem['name']) . ".html"; $item['item_title'] = ucfirst(AZLib::remove_4_js($fitem['name'])); // $item['price'] = $fitem['price']?number_format($fitem['price'],0,',','.'):'Liên hệ'; $item['price'] = $fitem['price'] ? number_format(AZLib::convertCurrency($fitem['price'], $fitem['currency_id']), 0, ',', '.') : 'Liên hệ'; //$item['item_image'] = ($fitem['img_url']) ? AZLib::getImageThumbIn($fitem['img_url'],150,120,$fitem['img_server']) : ''; $item['item_image'] = $fitem['img_url'] ? AZLib::getImageThumb($fitem['img_url'], 120, 105, 0, $fitem['img_server']) : ''; $item_history[] = $item; } } } } echo json_encode($item_history); }
function draw() { global $display; $this->beginForm(); $sql = "SELECT * FROM category ORDER BY position"; $re = DB::query($sql); $items = array(); $sub_items = array(); $all_cats = array(); if ($re) { $last_id = 0; while ($row = mysql_fetch_assoc($re)) { $all_cats[$row['id']] = $row; $row['image_src'] = 'http://' . CGlobal::$img_server[$row['img_server']] . 'category/' . $row['id'] . '.gif'; $row['image'] = AZLib::getImageThumb('category/' . $row['id'] . '.gif', 50, 50, 0, $row['img_server']); $row['del_image'] = Url::build_current(array('cmd' => 'del_image', 'id' => $row['id'])); $row['edit_link'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id'])); if ($row['status'] == 'HOME') { $row['status'] = '<b>HOME</b> [ <a href="' . Url::build_current(array('cmd' => 'show', 'id' => $row['id'])) . '">Not set HOME</a> ] [ <a href="' . Url::build_current(array('cmd' => 'hide', 'id' => $row['id'])) . '">Ẩn Danh mục</a> ]'; } elseif ($row['status'] == 'SHOW') { $row['status'] = 'SHOW [ <a href="' . Url::build_current(array('cmd' => 'set_home', 'id' => $row['id'])) . '">Set HOME</a> ] [ <a href="' . Url::build_current(array('cmd' => 'hide', 'id' => $row['id'])) . '">Ẩn Danh mục</a> ]'; } elseif ($row['status'] == 'HIDE') { $row['status'] = '<font color="#FF0000"><b>HIDE</b></font> [ <a href="' . Url::build_current(array('cmd' => 'set_home', 'id' => $row['id'])) . '">Set HOME</a> ] [ <a href="' . Url::build_current(array('cmd' => 'show', 'id' => $row['id'])) . '">Hiện Danh mục</a> ]'; } $row['validate'] = ''; if ($row['parent_id']) { //Là danh mục cấp 2 hoặc 3 $sub_items[$row['parent_id']][$row['id']] = $row; } else { //Top cat if (!isset($sub_items[$row['id']])) { $sub_items[$row['id']] = array(); } if ($last_id) { $items[$last_id]['down'] = '<a href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $last_id)) . '"><img src="style/images/admin/down_arrow_.gif" /></a>'; $row['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $row['id'])) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } else { $row['up'] = ''; } $row['down'] = ''; $items[$row['id']] = $row; $last_id = $row['id']; } } if ($last_id && $items[$last_id]['position'] > 1) { $items[$last_id]['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $last_id)) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } } foreach ($sub_items as $id => $subs) { if (isset($items[$id])) { //Nếu tồn tại DM cha là danh mục cấp 1 $last_id = 0; foreach ($sub_items[$id] as $sub_id => $sub) { if ($last_id) { $sub_items[$id][$last_id]['down'] = '<a href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $last_id)) . '"><img src="style/images/admin/down_arrow_.gif" /></a>'; $sub_items[$id][$sub_id]['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $sub_id)) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } else { $sub_items[$id][$sub_id]['up'] = ''; } $row['down'] = ''; $last_id = $sub_id; } if ($last_id && $sub_items[$id][$last_id]['position'] > 1) { $sub_items[$id][$last_id]['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $last_id)) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } $items[$id]['sub_cat'] = $sub_items[$id]; } elseif (isset($all_cats[$id]) && $all_cats[$id]['parent_id']) { //Nếu tồn tại DM cha là danh mục cấp 2 $parent_id = $all_cats[$id]['parent_id']; if (isset($items[$parent_id])) { if (!isset($items[$parent_id]['sub_cat'][$id])) { $items[$parent_id]['sub_cat'][$id] = array('id' => $id, 'name' => $all_cats[$id]['name']); } $last_id = 0; foreach ($sub_items[$id] as $sub_id => $sub) { if ($last_id) { $sub_items[$id][$last_id]['down'] = '<a href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $last_id)) . '"><img src="style/images/admin/down_arrow_.gif" /></a>'; $sub_items[$id][$sub_id]['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $sub_id)) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } else { $sub_items[$id][$sub_id]['up'] = ''; } $row['down'] = ''; $last_id = $sub_id; } if ($last_id && $sub_items[$id][$last_id]['position'] > 1) { $sub_items[$id][$last_id]['up'] = '<a href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $last_id)) . '"><img src="style/images/admin/up_arrow_.gif" /></a>'; } $items[$parent_id]['sub_cat'][$id]['subcat'] = $sub_items[$id]; } else { $items[$parent_id] = array('id' => $parent_id, 'name' => '(Đã bị xóa)', 'sub_cat' => array($id => array('id' => $id, 'name' => $all_cats[$id]['name'], 'subcat' => $subs))); } } else { $items[$id] = array('id' => $id, 'name' => '(Đã bị xóa)', 'sub_cat' => $subs); } } //echo "<pre>"; //print_r($items); $display->add('items', $items); $display->add('hover', ''); $display->output('list'); $this->endForm(); }
function processItem($item, $admin_item) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['href'] = WEB_DIR . CGlobal::$allCategories[$item['category_id']]['nice_name'] . "/p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } else { $item['href'] = WEB_DIR . "p{$item['id']}/" . AZLib::safe_title($item['name']) . ".html"; } $item['modify_time'] = date('H:i | d.m.y', $item['modify_time']); $item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); $item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); $item['currency_id'] = 1; $item['price_num'] = (int) $item['price']; if ($item['price']) { $item['price'] = number_format($item['price'], 0, ',', '.'); } else { $item['price'] = ''; } $item['price_title'] = 'Giá bán'; if ($item['price_out'] > 0) { $item['price_out'] = number_format($item['price_out'], 0, ',', '.') . ($item['currency_id'] == ' ' ? ' ' . CGlobal::$currency[$item['currency_id']] : ''); } else { $item['price_out'] = '0'; } //$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']); //$item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']); if ($admin_item) { $item['description'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($item['description'], ENT_QUOTES, "UTF-8")))); $item['description'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $item['description']); $item['description'] = str_replace(array("'", "\""), array("", " "), $item['description']); $item['description'] = AZLib::word_limit($item['description'], 200, ''); } $item['name'] = AZLib::filter_title($item['name']); if ($item['img_url']) { $item['img_thumb_wl'] = AZLib::getImageThumb($item['img_url'], 180, 0, 1, $item['img_server']); } else { $item['img_url'] = ''; } if (!CGlobal::$curLevel2Cat) { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['cat_name'] = CGlobal::$allCategories[$item['category_id']]['name']; } else { $item['cat_name'] = "ID: {$item['category_id']}"; } } return $item; }
static function get_item_images($item_id, $del_cache = 0) { $sql = 'SELECT * FROM item_image WHERE item_id = ' . $item_id . ' ORDER BY position '; //$item_images = AZCache::cache($sql,__LINE__.__FILE__,1,0,'','',$del_cache); $item_images = AZCache::cache($sql, __LINE__ . __FILE__, 0, 0, '', '', $del_cache); if (!$del_cache) { $_item_images = false; if ($item_images) { foreach ($item_images as $value) { if ($value && $value['img_url']) { $i = $value['position']; $title = str_replace(array('"', "'"), array('"', '\\\''), stripslashes($value['title'])); $_item_images[$i] = $value; $_item_images[$i]['i'] = $i; $_item_images[$i]['id'] = $value['id']; $_item_images[$i]['title'] = $title; $_item_images[$i]['img_server'] = $value['img_server']; $_item_images[$i]['thumb316'] = AZLib::getImageThumb($value['img_url'], 316, 0, 0, $value['img_server']); $_item_images[$i]['thumb80_80'] = AZLib::getImageThumb($value['img_url'], 80, 80, 0, $value['img_server']); $_item_images[$i]['img_full_url'] = "http://" . CGlobal::$img_server[$value['img_server']] . $value['img_url']; $_item_images[$i]['max_path'] = AZLib::getImageThumbMax($value['img_url'], $title, 1, $value['img_server']); } } unset($item_images); return $_item_images; } return array(); } return true; }
function draw2() { $keywords = AZLib::getParam('keywords'); $total_item = 0; $search_result = false; $items = array(); $paging = ''; $cmd = ''; $cat_search_id = 0; $item_array = array(); $listCat = array(); if ($keywords) { //AZLib::getCats(); require "./includes/sphinxapi.class.php"; foreach (CGlobal::$allCategories as $value) { if ($value['parent_id'] == 0) { $cat_list[$value['id']] = $value['brief_name']; } } $category = $this->getTotalPerCategory($keywords); foreach ($category as $row) { $row['brief_name'] = isset($cat_list[$row['level_1_catid']]) && $cat_list[$row['level_1_catid']] ? $cat_list[$row['level_1_catid']] : "Khác"; $listCat[$row['level_1_catid']] = array("level_1_catid" => $row["level_1_catid"], "brief_name" => $row['brief_name'], "count_ad" => $row['@count']); } $total = 0; $catid = 0; $catActive = ''; $total_cat = 0; if ($listCat) { $first_val = array_slice($listCat, 0, 1); $total = $first_val[0]['count_ad']; $catid = $first_val[0]['level_1_catid']; $catActive = $first_val[0]['brief_name']; $total_cat = count($listCat); } $i = 0; $allrecord = 0; $otherCat = ''; $cat_content = ""; foreach ($listCat as $cat) { if ($i < 3) { $active = $i == 0 ? "class=\"active\"" : ""; $cat_content .= "<li id=\"tab_{$i}\" {$active} onclick=\"javascript:acive_tab_cat(this);\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></li>"; } else { $otherCat .= "<div class=\"other\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);acive_tab_cat(this);\" id=\"tab_{$i}\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></div>"; } $i++; $allrecord = $allrecord + $cat['count_ad']; } $display->add("cat_content", $cat_content); $display->add("CatActiveId", $catid); $display->add("catActive", $catActive); $display->add("listCat", $listCat); $display->add("allrecord", $allrecord); $display->add("otherCat", str_replace(array(chr(13), chr(10)), "", $otherCat)); $display->add("total_cat", $total_cat); //Init for sphinx search paging $pager = new Pager(); //config $limit = SEARCH_LIMIT; $pager->type = "search"; $pager->catid = $catid; $pager->total = $total; $pager->limit = $limit; $pager->page_param = 'page'; $pager->page = 1; $offset = $pager->get_offset(); $limit_from = $pager->limit_from(); $limit_to = $pager->limit_to(); //Sphinx search by Nova $q = $keywords; $mode = SPH_MATCH_EXTENDED2; //Init config $host = SPHINX_SERVER; $port = SPHINX_PORT; //$index = SPHINX_INDEX; $index = "enbac delta"; $filtervals = array(); $ranker = SPH_RANK_WORDCOUNT; $cl = new SphinxClient(); $cl->SetServer($host, $port); $cl->SetConnectTimeout(1); $cl->SetWeights(array(100, 1)); $cl->SetMatchMode($mode); //filter if ($catid) { $cl->SetFilter('level_1_catid', array($catid)); } $cl->SetFilter('status', array('1')); $cl->SetFieldWeights(array('user_name' => 10000, 'name' => 1000, 'description' => 1)); //$cl->SetSortMode( SPH_SORT_EXTENDED, 'up_time DESC' ); //$cl->SetSortMode( SPH_SORT_RELEVANCE);//Sort theo kq chính xác nhất //$cl->SetSortMode ( SPH_SORT_EXPR, "@weight + ( user_karma + ln(pageviews) )*0.1"); $cl->SetSortMode(SPH_SORT_EXPR, "@weight"); //Sort theo trọng số //SPH_RANK_WORDCOUNT //SPH_MATCH_EXTENDED2 //end filter $cl->SetLimits($offset, $limit, 10000); $cl->SetRankingMode($ranker); $cl->SetArrayResult(true); $res = $cl->Query($q, $index); /*echo '<pre>'; print_r($res["matches"]);*/ if ($res && isset($res["matches"])) { if (is_array($res["matches"])) { foreach ($res["matches"] as $results) { $list_item_id[] = $results['id']; } } $comma_separated = join(",", $list_item_id); } if ($total) { if ($limit_to > $total) { $limit_to = $total; } $comma_separated = join(",", $list_item_id); if ($comma_separated) { //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1 ORDER BY up_time DESC"; //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1 AND state=0 ORDER BY find_in_set(id,'$comma_separated')"; $sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN({$comma_separated}) AND status=1 ORDER BY find_in_set(id,'{$comma_separated}')"; $search_result = DB::query($sql); $pager->total = $total; $paging = $pager->page_link(); } } } $highlight = ''; if ($keywords) { $highlight = $str_search = str_replace(array('+', '/', '|', '-', '*'), "", $keywords); $highlight = AZLib::trimSpace($highlight); $highlight = str_replace("'", '', $highlight); $highlight = str_replace("'", '', $highlight); $highlight = str_replace(""", '', $highlight); } $highlight1 = ''; if ($highlight) { $arr = explode(' ', $highlight); if ($arr) { $highlight = ""; foreach ($arr as $word) { $highlight = ($highlight ? $highlight . ', ' : '') . "'{$word}'"; $highlight1 = ($highlight1 ? $highlight1 . ',' : '') . $word; } } } if ($keywords && $search_result) { while ($item = mysql_fetch_assoc($search_result)) { $item['profile_url'] = WEB_DIR . $item['user_name']; $item['name_hl'] = AZLib::HighLightKeyword(strip_tags(AZLib::filter_title($item['name'])), $highlight1); $item_time = TIME_NOW - $item['up_time']; //neu nho hon 1h thi tinh ra phut if ($item_time < 3600) { $item['item_time'] = floor($item_time / 60) . " phút trước đây"; } elseif ($item_time < 86400) { $item['item_time'] = floor($item_time / 3600) . " giờ trước đây"; } else { $item['item_time'] = date('\\n\\gà\\y j \\t\\há\\n\\g n', $item['up_time']); } $item['description'] = AZLib::HighLightKeyword(AZLib::delDoubleSpace(AZLib::trimSpace(strip_tags(AZLib::post_db_parse_html(preg_replace('/\\[[0-9]{1,3}\\]/', '', $item['description']))))), $highlight1, 35, "background:yellow;font-size:14px;font-weight:bold;color:blue;"); $ebname = AZLib::safe_title($item['name']); $ebname_tmp = substr(AZLib::safe_title($item['name']), 0, 20); if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname . '&nice_name=' . CGlobal::$allCategories[$item['category_id']]['nice_name']); $item['item_url_tmp'] = WEB_ROOT . CGlobal::$allCategories[$item['category_id']]['nice_name'] . '/p' . $item['id'] . '/' . $ebname_tmp . '...'; } else { $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname); $item['item_url_tmp'] = WEB_ROOT . 'p' . $item['id'] . '/' . $ebname_tmp . '...'; } if ($item['img_url']) { $item['img_url'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item['img_server']); } $item['price'] = number_format($item['price'], 0, ',', '.'); $item_array[] = $item; } } global $start_rb; $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $end_rb = $mtime; $search_time = round($end_rb - $start_rb, 3); $display->add('limit_from', $limit_from); $display->add('limit_to', $limit_to); $display->add('search_time', $search_time); $display->add('keywords', $keywords); $display->add('base_url', WEB_ROOT); $display->add('highlight', $highlight); $display->add('total_item_cat', $total); $display->add('name_item_cat', $catActive); $display->add('block_id', Module::$block_id); $display->add('paging', $paging); $display->add('items', $item_array); $display->output('sphinx_search'); }
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 = 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; $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('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 { $order_by = ' ORDER BY id DESC '; //$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 = 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); $search_value .= " AND (user_name LIKE '%" . $str_search . "%' OR email LIKE '%" . $str_search . "%')"; } // search so dien thoai if (Url::get('id_phone') != '') { $id_phone = Url::get('id_phone'); $search_value .= " AND (home_phone LIKE '%" . $id_phone . "%' OR mobile_phone LIKE '%" . $id_phone . "%')"; } $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 user WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_item', 0); $items = array(); $str_id = ''; $uids = ''; if ($total) { $limit = ''; $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Thành viên', 'Trang'); $sql = 'SELECT * FROM user WHERE ' . $search_value . ' ' . $order_by . $limit; $result = DB::query($sql); if ($result) { AZLib::getProvinces(); while ($row = mysql_fetch_assoc($result)) { if ($row['block_time'] > TIME_NOW || $row['block_time'] == -1 || $row['invalid_time'] > 0 || $row['invalid_time'] == -1) { $str_id .= ($str_id == '' ? '' : ',') . $row['id']; } $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; } if ($row['invalid_time'] > 0 || $row['invalid_time'] == -1) { $row['status'] = $row['invalid_time'] == -1 ? "<font color=red><b>kiểm duyệt vĩnh viễn</b></font>" : "<font color=red><b>" . date('H:i d/m/y', $row['invalid_time']) . '</b></font>'; $row['is_invalid'] = true; $display->add('type_reason', 'Kiểm duyệt'); } else { //$row['status'] = ""; //$row['bgcolor'] = ''; $row['is_invalid'] = false; } if ($row['province_id'] && isset(CGlobal::$provinces[$row['province_id']])) { $row['city'] = CGlobal::$provinces[$row['province_id']]['name']; } else { $row['city'] = ''; } $row['gender'] = ''; if ($row['website'] && strpos($row['website'], 'http://') === false) { $row['website'] = 'http://' . $row['website']; } if ($row['avatar_url']) { $row['avatar_preview'] = AZLib::getImageThumb($row['avatar_url'], 60, 0, 1, $row['img_server']); $row['avatar_src'] = 'http://' . CGlobal::$img_server[$row['img_server']] . $row['avatar_url']; $row['del_avatar'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=del_avatar&id=' . $row['id']); } else { $row['avatar_preview'] = ''; $row['avatar_src'] = ''; $row['del_avatar'] = ''; } $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' => 'detail', 'id' => $row['id'])); $row['edit'] = 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 user_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'] = AZLib::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_user', $total); $display->add('limit_date', BAN_NICK_DATE); $display->add('items', $items); $display->add('paging', $paging); $display->add('is_root', User::is_root()); $display->output('list'); $this->endForm(); }
function get_gallery_entry() { if (User::is_login()) { global $display; if ((User::have_permit(ADMIN_ITEM) || User::is_mod()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) { $user_id = (int) Url::get('user_id', 0); $display->add('user_id', $user_id); } else { $user_id = User::id(); } $search_value = ' user_id=' . $user_id . ' AND root_id=0 '; //search theo ngay thang nam //$year=(int)Url::get('year',date('Y')); $year = (int) Url::get('year', -1); //$mon= (int)Url::get('month',(int)date('m')); $mon = (int) Url::get('month', -1); $day = (int) Url::get('day', -1); if ($year == 0) { $year = -1; } if ($mon == 0) { $mon = -1; } if ($day == 0) { $day = -1; } $created_time_from = 0; $created_time_to = 0; if ($year != -1) { if ($mon != -1) { if ($day != -1) { $created_time_from = mktime(0, 0, 0, $mon, $day, $year); $created_time_to = mktime(23, 59, 59, $mon, $day, $year); } else { $max_day = 31; if (in_array($mon, array(4, 6, 9, 11))) { $max_day = 30; } elseif ($mon == 2) { $year % 4 ? $max_day = 28 : ($max_day = 29); } $created_time_from = mktime(0, 0, 0, $mon, 1, $year); $created_time_to = mktime(23, 59, 59, $mon, $max_day, $year); } } else { $created_time_from = mktime(0, 0, 0, 1, 1, $year); $created_time_to = mktime(23, 59, 59, 12, 31, $year); } } $y_arr = array(-1 => '-Lọc theo Năm-'); for ($i = 2008; $i <= date('Y'); $i++) { $y_arr[$i] = "---Năm {$i}-"; } $m_arr = array(-1 => '-Lọc theo Tháng-'); for ($i = 1; $i <= 12; $i++) { $m_arr[$i] = "---Tháng {$i}-"; } $d_arr = array(0 => '-Lọc theo Ngày-'); for ($i = 1; $i <= 31; $i++) { $d_arr[$i] = "---Ngày {$i}-"; } $display->add('option_year', AZLib::getOption($y_arr, $year)); $display->add('option_month', AZLib::getOption($m_arr, $mon)); $display->add('option_day', AZLib::getOption($d_arr, $day)); if ($created_time_from) { $search_value .= ' AND time >= ' . $created_time_from; } if ($created_time_to) { $search_value .= ' AND time <= ' . $created_time_to; } $keywords = AZLib::trimSpace(AZLib::getParam('keywords')); $display->add('keywords', $keywords); if ($keywords) { $search_value .= ' AND des LIKE "%' . $keywords . '%" '; } $item_per_page = 20; $sql_count = 'SELECT count(*) AS total_img FROM item_image WHERE ' . $search_value; $total = DB::fetch($sql_count, 'total_img', 0); $paging = ''; $items = array(); $gallery_url = WEB_DIR . 'ajax.php' . Url::build_all(array('page_no')); if ($total) { $limit = ''; $paging = AjaxGalleryPaging($limit, $total, $item_per_page, 5, $gallery_url, 'gallery_content'); $sql = 'SELECT id, des, item_id, title, img_server, img_url, time FROM `item_image` WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['image_url'] = $row['img_url']; $row['img_url'] = AZLib::getImageThumb($row['img_url'], 100, 100, 0, $row['img_server']); $items[$row['id']] = $row; } } } $display->add('items', $items); $display->add('total', $total); $display->add('paging', $paging); $display->output('gallery_ajax_entry', false, 'Personal'); System::halt(); } else { echo "Bạn chưa đăng nhập hoặc đã thoát khỏi hệ thống - Hãy đăng nhập lại!"; } }
function draw() { global $display; AZLib::getCats(); $this->beginForm(false, 'post', false, Url::build_current()); $created_time_from = 0; $created_time_to = 0; $time_from = ""; $time_to = ""; $phrase_checked = ""; $free_cat_checked = ""; $up_checked = ""; $pagging = ""; $limit = ""; $lock_checked = ''; $select_subcat_checked = ''; $items = array(); $id_search = (int) Url::get("id_search"); $censor = Url::get("censor", 1); $user_name = AZLib::getParam("user_name"); $zone_id = Url::get("zone_id"); $searchByCat = Url::get("searchByCat"); $searchByCatType = Url::get("searchByCatType", 0); $searchBySubCat = Url::get("searchBySubCat"); $searchBySubCatType = Url::get("searchBySubCatType", 0); $sort_type = Url::get("sort_type", 1); $keywords = Url::get("keywords"); $have_img = Url::get("have_img", 0); $lock_item = Url::get("lock"); $phrase_selected = Url::get("phrase"); $free_cat_selected = Url::get("free_cat"); $up = Url::get("up"); $select_subcat = Url::get("select_subcat", ""); $opt_have_img = AZLib::getOption(array(0 => "-Tìm theo ảnh-", 1 => "-Có ảnh-", 2 => "-Không ảnh-"), $have_img); if (isset($_REQUEST["created_time"]) && $_REQUEST["created_time"]) { $time_from = Url::get("created_time"); } if (isset($_REQUEST["created_time_to"]) && $_REQUEST["created_time_to"]) { $time_to = Url::get("created_time_to"); } if ($time_from) { $date_arr = explode("-", $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 ($time_to) { $date_arr = explode("-", $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 = ""; $where = ""; //$order_by = "ORDER BY del_time DESC"; $order_by = ""; $total_item = 0; if ($keywords) { $search_value = ($search_value == "" ? " WHERE " : " AND ") . "id IN (0)"; } if ($sort_type == 1) { $order_by = "ORDER BY id DESC"; } elseif ($sort_type == 2) { $order_by = "ORDER BY modify_time DESC"; } elseif ($sort_type == 3) { $order_by = "ORDER BY item_order ASC"; } if ($free_cat_selected) { $free_cat_checked = "checked"; $catids = implode(",", array_keys(CGlobal::$allCategories)); $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id NOT IN({$catids})"; $order_by = $order_by != "" ? $order_by : "ORDER BY id DESC"; } else { if ($searchBySubCat) { if ($searchBySubCatType) { // Nếu chỉ tìm trong danh mục con của danh mục cấp 2 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_2_catid = " . $searchBySubCat; // Lọc những item có trường level_2_catid là danh mục cấp 2 } else { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchBySubCat; // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 2 } } elseif ($searchByCat) { // Nếu chỉ tìm trong danh mục con của danh mục cấp 1 if ($searchByCatType) { // Lọc những item có trường level_1_catid là danh mục cấp 1 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_1_catid = " . $searchByCat; } else { // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 1 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchByCat; } } } if ($censor != 9) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "status=" . $censor; } if ($user_name != "") { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "user_name ='{$user_name}'"; } if ($select_subcat) { $select_subcat_checked = "checked"; } if ($up) { if ($created_time_from) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time >= " . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time <= " . $created_time_to; } $up_checked = "checked"; } else { if ($created_time_from) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time >= " . $created_time_from; } if ($created_time_to) { $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time <= " . $created_time_to; } } if ($have_img == 1) { //có ảnh $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=1"; } elseif ($have_img == 2) { //ko có ảnh $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=0"; } if ($id_search) { //ID sản phẩm $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "id={$id_search}"; } if (Url::get("up")) { $order_by = $order_by != "" ? $order_by : "ORDER BY created_time DESC"; } else { $order_by = $order_by != "" ? $order_by : "ORDER BY modify_time DESC"; } $sql = "SELECT * FROM item {$search_value} {$order_by}"; $sql_count = "SELECT count(*) AS total_row FROM item {$search_value}"; $total_item = (int) DB::fetch($sql_count, "total_row"); if ($total_item) { $pagging = AZPagging::pagingSE($limit, $total_item, 50, 10, 'page_no', true, 'Sản phẩm', 'Trang'); $sql .= $limit; } $re = DB::query($sql); if ($re) { $index_temp = 0; while ($item = mysql_fetch_assoc($re)) { //trạng thái sản phẩm: if ($item['status'] == -1) { $item['bgcolor'] = "bgcolor=\"#FF6633\""; } elseif ($index_temp) { $item['bgcolor'] = "bgcolor=\"#EFEFEF\""; } else { $item['bgcolor'] = ""; } $index_temp = 1 - $index_temp; $item['created_time'] = 'Đăng: <b>' . date("d/m/Y H:i", $item['created_time']) . '</b>'; if ($item['del_time'] && $item['del_user'] && $item['status'] == -1) { $item['del_time'] = '<br /><font color=red>Xoá: <b>' . date("d/m/Y H:i", $item['del_time']) . '</font></b> ( <a target="_blank" href="' . WEB_DIR . $item['del_user'] . '"><strong>' . $item['del_user'] . '</strong></a>)'; } else { $item['del_time'] = ''; } if ($item['modify_user_name'] && $item['status'] != -1) { $item['is_modify'] = '<br><font color=gray>Sửa: <b>' . date("d/m/Y H:i", $item['modify_time']) . '</font></b>'; $item['is_modify'] .= ' ( <a target="_blank" href="' . WEB_DIR . $item['modify_user_name'] . '"><strong>' . $item['modify_user_name'] . '</strong></a>)'; } else { $item['is_modify'] = ''; } $item['name'] = AZLib::filter_title($item['name']); $item['description'] = AZLib::remove_4_js(AZLib::plainText($item['description'])); $item['price'] = number_format($item['price'], 0, ',', '.'); $item['price_out'] = number_format($item['price_out'], 0, ',', '.'); $item['currency_option'] = AZLib::getOption(array(1 => "VNĐ", 2 => "\$"), $item['currency_id']); //$item['price'] = "Giá bán: ".AZLib::priceFomart($item['price'],$item['currency_id']); //$item['price_out'] = "<br /><font color='#999999'>Giá TT: ".AZLib::priceFomart($item['price_out'],$item['currency_id']).'</font>'; if ($item['level_1_catid'] > 0) { if (isset(CGlobal::$allCategories[$item['level_1_catid']])) { $item['cat_name'] = '<b>' . CGlobal::$allCategories[$item['level_1_catid']]['name'] . ' (' . $item['level_1_catid'] . ')</b>'; } else { $item['cat_name'] = '<b><font color=red>(' . $item['level_1_catid'] . ')</font></b>'; } if ($item['category_id'] > 0 && $item['category_id'] != $item['level_1_catid'] || $item['cat_name'] == '') { if (isset(CGlobal::$allCategories[$item['category_id']])) { $item['cat_name'] .= ' - <i>' . CGlobal::$allCategories[$item['category_id']]['name'] . ' (' . $item['category_id'] . ')</i>'; } else { $item['cat_name'] .= ' - <i><b><font color=red>(' . $item['category_id'] . ')</font></b></i>'; } } } if ($item['img_url']) { $item['image_src'] = 'http://' . CGlobal::$img_server[$item['img_server']] . $item['img_url']; $item['image'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item["img_server"]); } else { $item['image_src'] = ''; $item['image'] = ''; } $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title($item['name'])); $item['edit'] = Url::build('post_item', array('cmd' => 'edit', 'id' => $item['id'])); if ($item['status'] == -1) { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=del_forever&id=' . $item['id']); $item['re_post'] = Url::build_all(array('cmd', 'id'), 'cmd=re_post&id=' . $item['id']); } elseif ($item['status'] == 2) { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']); $item['show_link'] = Url::build_all(array('cmd', 'id'), 'cmd=show&id=' . $item['id']); } else { $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']); $item['hide_link'] = Url::build_all(array('cmd', 'id'), 'cmd=hide&id=' . $item['id']); } $item['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $item['id']); $items[$item['id']] = $item; } } $display->add('items', $items); $type_arr = array(1 => "-Sản phẩm không ẩn-", 2 => "-Sản phẩm ẩn-"); if (User::have_permit(ADMIN_DEL_ITEM)) { $type_arr[-1] = "-Sản phẩm đã xoá-"; $type_arr[9] = "-Tất cả các sản phẩm (Cả sản phẩm xóa)-"; } $option_censor = AZLib::getOption($type_arr, Url::get('censor', 1)); $display->add('censor', $censor); $display->add('option_censor', $option_censor); $display->add('have_img_option', $opt_have_img); $display->add('lock_checked', $lock_checked); $display->add('user_name', $user_name); $display->add('created_time', $time_from); $display->add('created_time_to', $time_to); $display->add('phrase_checked', $phrase_checked); $display->add('free_cat_checked', $free_cat_checked); $display->add('up_checked', $up_checked); $display->add('select_subcat_checked', $select_subcat_checked); $display->add('id_search', $id_search); $item_cat_search = $this->GetCatTree(); $display->add('list_top_cat_js', AZLib::getOption(AZLib::getTopCats(), 999999999)); $display->add('IS_ADMIN', User::is_admin()); $display->add('page_no', Url::get('page_no')); $display->add('paging', $pagging); $display->add('total_item', $total_item); $display->add('item_cat', AZLib::getOption($this->getOtionCats(), Url::get('id_cats'))); $display->add('category_tree', json_encode($item_cat_search)); $display->add('catSelected', Url::get('searchByCat', 0)); $display->add('catSelectedType', Url::get('searchByCatType', 0)); $display->add('subCatSelected', Url::get('searchBySubCat', 0)); $display->add('subCatSelectedType', Url::get('searchBySubCatType', 0)); $display->add('keywords', $keywords); $display->add('sort_type', $sort_type); $display->output('ManageItem'); $this->endForm(); }