本文整理汇总了PHP中AZLib::convertCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::convertCurrency方法的具体用法?PHP AZLib::convertCurrency怎么用?PHP AZLib::convertCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::convertCurrency方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CartPrint
function CartPrint($row)
{
Module::Module($row);
CGlobal::$website_title = "in đơn hàng";
$id = URL::get('id', 0);
if ($id) {
CartPrint::$cart = DB::select("cart", "id={$id}");
if (CartPrint::$cart && (User::have_permit(ADMIN_ITEM) || CartPrint::$cart['user_id'] == User::id() || CartPrint::$cart['session'] == CGlobal::$cart_sess_id)) {
$re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . CartPrint::$cart['id'] . " ORDER BY id DESC");
$cart_item_del = '';
$item_ids = '';
if ($re) {
while ($cart_item = mysql_fetch_assoc($re)) {
$item_ids .= ($item_ids != '' ? ',' : '') . $cart_item['item_id'];
CartPrint::$cart_items[$cart_item['id']] = $cart_item;
}
}
if ($item_ids != '') {
$re = DB::query("SELECT * FROM item WHERE id IN(" . $item_ids . ") AND status=1 AND price>0");
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
$item['price'] = number_format(AZLib::convertCurrency($item['price'], $item['currency_id']), null, null, '.');
CartPrint::$items[$item['id']] = $item;
}
}
}
$cart_item_del = '';
foreach (CartPrint::$cart_items as $cart_item) {
if (isset(CartPrint::$items[$cart_item['item_id']])) {
if ($cart_item['price'] != CartPrint::$items[$cart_item['item_id']]['price'] || $cart_item['sku'] != CartPrint::$items[$cart_item['item_id']]['sku']) {
$cart_item['price'] = CartPrint::$items[$cart_item['item_id']]['price'];
$cart_item['sku'] = CartPrint::$items[$cart_item['item_id']]['sku'];
DB::update('cart_item', array('price' => $cart_item['price'], 'sku' => $cart_item['sku']), "id={$cart_item['id']}");
}
CartPrint::$cart_items[$cart_item['id']] = $cart_item;
} else {
$cart_item_del .= ($cart_item_del != '' ? ',' : '') . $cart_item['id'];
}
}
if ($cart_item_del != '') {
DB::delete('cart_item', "id IN({$cart_item_del})");
}
} else {
AZLib::closePopup();
exit;
}
}
if (!CartPrint::$cart) {
AZLib::closePopup();
exit;
}
require_once 'forms/CartPrint.php';
$this->add_form(new CartPrintForm());
}
示例2: item_history
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);
}
示例3: CartEditForm
function CartEditForm()
{
Form::Form('CartEditForm');
CGlobal::$website_title = "Xem & Sửa đơn hàng";
$this->link_js('javascript/aznet/cart.js');
$id = URL::get('id', 0);
if ($id) {
$this->cart = DB::select("cart", "id={$id}");
if ($this->cart) {
$re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . $this->cart['id'] . " ORDER BY id DESC");
$cart_item_del = '';
$item_ids = '';
if ($re) {
while ($cart_item = mysql_fetch_assoc($re)) {
$item_ids .= ($item_ids != '' ? ',' : '') . $cart_item['item_id'];
$this->cart_items[$cart_item['id']] = $cart_item;
}
}
if ($item_ids != '') {
$re = DB::query("SELECT * FROM item WHERE id IN(" . $item_ids . ") AND status=1 AND price>0");
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
$this->items[$item['id']] = $item;
}
}
}
$cart_item_del = '';
foreach ($this->cart_items as $cart_item) {
if (isset($this->items[$cart_item['item_id']])) {
if ($cart_item['price'] != $this->items[$cart_item['item_id']]['price'] || $cart_item['sku'] != $this->items[$cart_item['item_id']]['sku']) {
$cart_item['price'] = $this->items[$cart_item['item_id']]['price'];
$cart_item['sku'] = $this->items[$cart_item['item_id']]['sku'];
DB::update('cart_item', array('price' => $cart_item['price'], 'sku' => $cart_item['sku']), "id={$cart_item['id']}");
}
$this->cart_items[$cart_item['id']] = $cart_item;
} else {
$cart_item_del .= ($cart_item_del != '' ? ',' : '') . $cart_item['id'];
}
}
if ($cart_item_del != '') {
DB::delete('cart_item', "id IN({$cart_item_del})");
}
}
}
if (!$this->cart) {
URL::redirect_current();
}
if (Url::get('act') == 'del_item') {
$id = Url::get('ci_id', 0);
if ($id && $this->cart && isset($this->cart_items[$id])) {
DB::delete('cart_item', "id={$id} AND cart_id=" . $this->cart['id']);
DB::update("cart", array("time_change" => TIME_NOW), "id=" . $this->cart['id']);
}
$cart_price = DB::fetch("SELECT SUM(price * quantity) AS price_total FROM cart_item WHERE cart_id=" . $this->cart['id'] . " AND checked=1 AND price>0 ANd quantity>0", 'price_total', 0);
$cart_quantity = DB::fetch("SELECT SUM(quantity) AS price_quantity FROM cart_item WHERE cart_id=" . $this->cart['id'] . " AND checked=1 AND price>0 ANd quantity>0", 'price_quantity', 0);
if ($this->cart['price'] != $cart_price || $this->cart['quantity'] != $cart_quantity) {
$this->cart['price'] = $cart_price;
$this->cart['quantity'] = $cart_quantity;
DB::update("cart", array('price' => $cart_price, 'quantity' => $cart_quantity), 'id=' . $this->cart['id']);
}
Url::redirect_current(array('cmd', 'id'));
}
}
示例4: draw
function draw()
{
global $display;
if ($this->search_catid) {
$keywords = AZLib::getParam('keywords');
if ($keywords != '') {
global $display;
$page_no = (int) Url::get('page_no', 1);
if ($page_no <= 0) {
$page_no = 1;
}
$item_per_page = 30;
$sql = 'SELECT * FROM item WHERE ';
$where = '';
$curMainCat = CGlobal::$curMainCat;
$curLevel2Cat = CGlobal::$curLevel2Cat;
$sql .= CGlobal::$item_condition . " ORDER BY item_order ASC";
$total_row = DB::count("item", CGlobal::$item_condition);
if (CGlobal::$allCategories[$this->search_catid]['parent_id'] && isset(CGlobal::$allCategories[CGlobal::$allCategories[$this->search_catid]['parent_id']])) {
$ebname = CGlobal::$allCategories[CGlobal::$allCategories[$this->search_catid]['parent_id']]['ebname'] . '-' . CGlobal::$allCategories[$this->search_catid]['ebname'];
} else {
$ebname = CGlobal::$allCategories[$this->search_catid]['ebname'];
}
#######################################################################################
#Paging
$filter_get = Url::get('filter');
$min = Url::get('min');
$max = Url::get('max');
$order = Url::get('order');
$paging = AZPagging::paging_list($limit, $total_row, $item_per_page, 10, 'page_no', '', true, 'Sản phẩm', 'Trang');
$sql .= $limit;
#Paging
#######################################################################################
$items = array();
$re = DB::query($sql);
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
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['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']}";
}
}
$items[$item['id']] = $item;
}
}
$display->add('page', $page_no);
$display->add('items', $items);
$display->add('paging', $paging);
$display->output("sphinx_search");
} else {
echo '<div style="padding:20px;color:#f00;font-size:18px;border:1px solid #ccc" align="center">
Bạn chưa nhập vào từ khóa cần tìm kiếm!
</div>';
}
} else {
echo '<div style="padding:20px;color:#f00;font-size:18px;border:1px solid #ccc" align="center">
Bạn chưa chọn danh mục tìm kiếm!
</div>';
}
}
示例5: draw
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']);
//.........这里部分代码省略.........
示例6: Cart
function Cart($row)
{
Module::Module($row);
if (Url::get('cmd') == 'success') {
require_once 'forms/CartSuccess.php';
$this->add_form(new CartSuccessForm());
return;
}
Cart::$cart_item_ids = isset($_COOKIE['cart_items']) ? $_COOKIE['cart_items'] : '';
if (CGlobal::$cart_sess_id == '') {
CGlobal::$cart_sess_id = session_id();
AZLib::my_setcookie('cart_sess_id', session_id(), time() + 3600 * 24 * 365);
}
$cart_items = '';
Cart::$cart = DB::select("cart", "session='" . CGlobal::$cart_sess_id . "' AND status=1 ORDER BY id DESC");
$cart_price = 0;
$cart_quantity = 0;
if (Cart::$cart) {
$items = array();
if (Cart::$cart_item_ids != '') {
$re = DB::query("SELECT * FROM item WHERE id IN(" . Cart::$cart_item_ids . ") AND status=1 AND price>0 ORDER BY find_in_set(id,'" . Cart::$cart_item_ids . "')");
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
Cart::$items[$item['id']] = $item;
}
}
$items = Cart::$items;
$re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . Cart::$cart['id'] . " ORDER BY find_in_set(item_id,'" . Cart::$cart_item_ids . "')");
} else {
$re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . Cart::$cart['id'] . " ORDER BY id DESC");
}
$cart_item_del = '';
if ($re) {
while ($cart_item = mysql_fetch_assoc($re)) {
if (isset(Cart::$items[$cart_item['item_id']])) {
if ($cart_item['price'] != Cart::$items[$cart_item['item_id']]['price'] || $cart_item['sku'] != Cart::$items[$cart_item['item_id']]['sku']) {
$cart_item['price'] = Cart::$items[$cart_item['item_id']]['price'];
$cart_item['sku'] = Cart::$items[$cart_item['item_id']]['sku'];
DB::update('cart_item', array('price' => $cart_item['price'], 'sku' => $cart_item['sku']), "id={$cart_item['id']}");
}
if ($cart_item['checked']) {
$cart_price += $cart_item['price'] * $cart_item['quantity'];
$cart_quantity += $cart_item['quantity'];
}
unset($items[$cart_item['item_id']]);
$cart_items .= ($cart_items != '' ? ',' : '') . $cart_item['item_id'];
Cart::$cart_items[$cart_item['id']] = $cart_item;
} else {
$cart_item_del .= ($cart_item_del != '' ? ',' : '') . $cart_item['id'];
}
}
}
if ($items) {
foreach ($items as $item) {
$cart_items .= ($cart_items != '' ? ',' : '') . $item['id'];
$cart_item = array('cart_id' => Cart::$cart['id'], 'item_id' => $item['id'], 'sku' => $item['sku'], 'price' => $item['price'], 'quantity' => 1, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'time_add' => TIME_NOW, 'time_change' => TIME_NOW, 'status' => 1, 'checked' => 1);
$cart_item['id'] = DB::insert("cart_item", $cart_item);
$cart_price += $cart_item['price'];
$cart_quantity += 1;
Cart::$cart_items[$cart_item['id']] = $cart_item;
Cart::$items[$item['id']] = $item;
}
}
if ($cart_item_del != '') {
DB::delete('cart_item', "id IN({$cart_item_del})");
}
} elseif (Cart::$cart_item_ids != '') {
Cart::$cart = array('session' => CGlobal::$cart_sess_id, 'ip' => $_SERVER['REMOTE_ADDR'], 'time_create' => TIME_NOW, 'time_change' => TIME_NOW, 'time_finish' => 0, 'time_finish' => 0, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'customer_name' => '', 'customer_email' => '', 'customer_phone' => '', 'customer_address' => '', 'customer_note' => '', 'note' => '', 'price' => 0, 'quantity' => 0, 'mm_user_id' => 0, 'mm_time_modify' => '', 'mm_user_name' => '', 'status' => 1);
Cart::$cart['id'] = DB::insert("cart", Cart::$cart);
$re = DB::query("SELECT * FROM item WHERE id IN(" . Cart::$cart_item_ids . ") AND status=1 AND price>0 ORDER BY find_in_set(id,'" . Cart::$cart_item_ids . "')");
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
$cart_items .= ($cart_items != '' ? ',' : '') . $item['id'];
$cart_item = array('cart_id' => Cart::$cart['id'], 'item_id' => $item['id'], 'sku' => $item['sku'], 'price' => $item['price'], 'quantity' => 1, 'user_id' => (int) User::id(), 'user_name' => User::user_name(), 'time_add' => TIME_NOW, 'time_change' => TIME_NOW, 'status' => 1, 'checked' => 1);
$cart_price += $item['price'];
$cart_quantity += 1;
$cart_item['id'] = DB::insert("cart_item", $cart_item);
Cart::$cart_items[$cart_item['id']] = $cart_item;
Cart::$items[$item['id']] = $item;
}
}
}
if (Cart::$cart['price'] != $cart_price || Cart::$cart['quantity'] != $cart_quantity) {
Cart::$cart['price'] = $cart_price;
Cart::$cart['quantity'] = $cart_quantity;
DB::update("cart", array('price' => $cart_price, 'quantity' => $cart_quantity), 'id=' . Cart::$cart['id']);
}
if ($cart_items != Cart::$cart_item_ids) {
Cart::$cart_item_ids = $cart_items;
AZLib::my_setcookie('cart_items', Cart::$cart_item_ids, time() + 3600 * 24 * 365);
}
$cmd = Url::get('cmd');
switch ($cmd) {
case 'delete':
$id = Url::get('id', 0);
if ($id && Cart::$cart && isset(Cart::$cart_items[$id])) {
//echo Cart::$cart_item_ids,"<br /><br />";
//echo "$id";
//.........这里部分代码省略.........
示例7: BuildPrint
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());
}
示例8: draw
//.........这里部分代码省略.........
$link .= "&filter[{$get_gid}]={$get_fid}";
}
}
}
if (isset($this->filter_get[$fgid]) && $this->filter_get[$fgid] == $filter['id']) {
if ($this->min) {
$link .= "&min=" . $this->min;
}
if ($this->max) {
$link .= "&max=" . $this->max;
}
$group_filter['filters'] = array($fid => array('link' => $link, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid], 'remove' => 1));
break;
} else {
$link .= "&filter[{$fgid}]={$filter['id']}";
//$link = str_replace(array('?filter=&','?filter=','&filter='),array('?','',''),$link);
if ($this->min) {
$link .= "&min=" . $this->min;
}
if ($this->max) {
$link .= "&max=" . $this->max;
}
}
$group_filter['filters'][$fid] = array('link' => $link, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid]);
}
}
if ($group_filter) {
$filter_groups[$fgid] = $group_filter;
}
}
}
}
}
$display->add('url_filter', Url::build_current(array('mode', 'bcatid' => Build::$bcatid)));
$display->add('cat_name', CGlobal::$allCategories[Build::$bcatid]['name']);
if (isset(Build::$cats[Build::$bcatid]['next_id']) && Build::$cats[Build::$bcatid]['next_id']) {
$display->add('next_url', Url::build_current(array('mode', 'bcatid' => Build::$cats[Build::$bcatid]['next_id'])));
} else {
$display->add('next_url', Url::build_current());
}
$display->add('recomend', str_replace(chr(13) . chr(10), "<br />", CGlobal::$allCategories[Build::$bcatid]['recomend']));
$display->add('filter_groups', $filter_groups);
$display->add('filter_price', $this->filter_price);
$sql = 'SELECT * FROM item WHERE ';
$where = '';
$sql .= CGlobal::$item_condition . " ORDER BY price ASC";
$total_row = DB::count("item", CGlobal::$item_condition);
#######################################################################################
#Paging
$filter_get = Url::get('filter');
$min = Url::get('min');
$max = Url::get('max');
$order = Url::get('order');
$paging = AZPagging::paging_list($limit, $total_row, 10, 10, 'page_no', '', true, 'Linh kiện', 'Trang');
$sql .= $limit;
#Paging
#######################################################################################
$re = DB::query($sql);
if ($re) {
while ($item = mysql_fetch_assoc($re)) {
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['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
if ($item['price']) {
$item['price'] = number_format($item['price'], 0, ',', '.') . " VNĐ";
} else {
$item['price'] = 'Liên hệ';
}
if ($item['list_brief'] == '') {
$item['list_brief'] = $item['brief'];
}
$item['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($item['list_brief'], ENT_QUOTES, "UTF-8"))));
$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, '');
$item['select'] = Url::build_current(array('bcatid' => $item['category_id'], 'mode', 'item_id' => $item['id']));
$items[$item['id']] = $item;
}
}
$display->add('items', $items);
$display->add('paging', $paging);
}
$display->add('bcats', Build::$cats);
if (Build::$price) {
$display->add('total_price', number_format(Build::$price, 0, ',', '.') . " VNĐ");
}
$display->add('bitems', Build::$items);
$display->add('bcatid', Build::$bcatid);
$display->add('cur_url', $_SERVER['REQUEST_URI']);
$display->add("print_link", Url::open_popup(Url::build('build_print'), 1000, 800, false, false, false, false, false, 1, 1));
$build_catids = @CGlobal::$configs['BuildCatIDs']['conf_val'];
$display->add('build_catids', $build_catids);
$display->add('is_admin', User::is_admin());
$display->add('begin_form', $this->beginForm(false, 'post', false, false, 1));
$display->add('end_form', $this->endForm(1));
$display->output('Build');
}
示例9: processItem
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;
}
示例10: draw
function draw()
{
global $display;
$this->item['price'] = AZLib::convertCurrency($this->item['price'], $this->item['currency_id']);
$this->item['price_out'] = AZLib::convertCurrency($this->item['price_out'], $this->item['currency_id']);
$this->item['currency_id'] = 1;
//For ajax_upload form
$display->add('url_gallery', WEB_ROOT . AZRewrite::formatUrl('?page=gallery&is_popup=1&user_id=' . $this->item['user_id']));
////$display->add('no_img_upload',AZLib::getImageSrc('',100,100));
$display->add('browser_is_ie', $this->browser_is_ie);
$display->add('no_img_upload', $this->no_image);
$display->add('user_id', User::id());
$display->add('item_user_id', $this->item['user_id']);
$display->add('is_can_edit', (int) User::have_permit(ADMIN_ITEM));
$display->add('user_name', $this->item['user_name']);
if (isset($_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));
} elseif ($this->item['img_url']) {
$avatar['img_server'] = $this->item['img_server'];
$avatar['img_url'] = $this->item['img_url'];
$avatar['thumb280_280'] = AZLib::getImageThumb($this->item['img_url'], 280, 280, 0, $this->item['img_server']);
$avatar['max_path'] = AZLib::getImageThumbMax($this->item['img_url'], $this->item['name'], 1, $this->item['img_server']);
$display->add('avatarInfo', $avatar);
$display->add('avatar', json_encode($avatar));
}
$display->output('ajax_upload');
//For ajax_upload form
$this->beginForm(true);
//$display->add('img_fnkjgk',json_encode($bakjgkj));
$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));
if ($this->item['level_1_catid'] != $this->item['category_id']) {
$first = $this->item['level_1_catid'];
$second = $this->item['category_id'];
} else {
$first = $this->item['category_id'];
$second = 0;
}
$display->add('first_combo', (int) Url::get('first_combo', $first));
$display->add('second_combo', (int) Url::get('second_combo', $second));
///$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('item_filters', $this->item['filter_ids']);
$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('multi_upload', User::have_permit(ADMIN_ITEM));
$display->add('no_img', $this->no_image);
$display->add('post_img', $display->output('post_img', true));
$display->add('currency_id_option', AZLib::getOption(CGlobal::$currency, Url::get('currency_id', $this->item['currency_id'])));
$display->add('msg', $this->showFormErrorMessages(1));
$display->add('name', stripslashes(Url::get('name', $this->item['name'])));
$display->add('sku', Url::get('sku', $this->item['sku']));
$display->add('offer', stripslashes(Url::get('offer', $this->item['offer'])));
if (isset(CGlobal::$allCategories[$this->item['category_id']])) {
$item_href = WEB_DIR . CGlobal::$allCategories[$this->item['category_id']]['nice_name'] . "/p{$this->item['id']}/" . AZLib::safe_title($this->item['name']) . ".html";
} else {
$item_href = WEB_DIR . "p{$this->item['id']}/" . AZLib::safe_title($this->item['name']) . ".html";
}
$display->add('item_href', $item_href);
$display->add('name_length', 120 - mb_strlen(AZLib::stripUnicode(Url::get('name', $this->item['name'])), "UTF-8"));
$display->add('brief', stripslashes(Url::get('brief', $this->item['brief'])));
$display->add('item_description', stripslashes(Url::get('item_description', $this->item['description'])));
$display->add('mode', "CẬP NHẬT");
$display->add('price', number_format(Url::get('price', $this->item['price']), 0, ',', '.'));
$display->add('price_out', number_format(Url::get('price_out', $this->item['price_out']), 0, ',', '.'));
$display->add('quantity', number_format(Url::cdouble(Url::get('quantity', $this->item['quantity'])), 0, ',', '.'));
$display->add('item_order', (int) Url::get('item_order', $this->item['item_order']));
$display->add('made_in', Url::get('made_in', $this->item['made_in']));
$display->add('warranty', Url::get('warranty', $this->item['warranty']));
$display->output('post_sale');
$this->endForm();
}
示例11: load_shop_label
function load_shop_label()
{
if (!CGlobal::$user_profile) {
User::check_get_user();
}
if (CGlobal::$user_profile) {
$mode_default = 'comment';
if (!CGlobal::$shop_setting) {
if (CGlobal::$user_profile['shop_setting']) {
CGlobal::$shop_setting = unserialize(stripslashes(CGlobal::$user_profile['shop_setting']));
}
if (!CGlobal::$shop_setting) {
CGlobal::$shop_setting = array('shop_name' => CGlobal::$user_profile['full_name'] ? CGlobal::$user_profile['full_name'] : CGlobal::$user_profile['user_name'], 'default_mode' => 1, 'default_layout' => 1, 'item_list_mode' => 0, 'adv_banner' => '');
}
}
if (CGlobal::$shop_setting && !isset(CGlobal::$shop_setting['default_layout'])) {
CGlobal::$shop_setting['default_layout'] = 1;
}
if (Url::get("mode") == "comment" || CGlobal::$shop_setting['default_mode'] == 2) {
CGlobal::$website_title = 'Lưu bút - Shop ' . CGlobal::$user_profile['user_name'];
}
if (!CGlobal::$shop_setting['default_mode']) {
if (Url::get('mode') == 'shop' || DB::select('item', 'user_id=' . CGlobal::$user_profile['id'] . ' AND status=1')) {
//Nếu có sp, mặc định là vào shop
CGlobal::$shop_setting['default_mode'] = 1;
$mode_default = 'shop';
} else {
//Nếu ko có sản phẩm, mặc định vào lưu bút
CGlobal::$shop_setting['default_mode'] = 2;
$mode_default = 'comment';
}
} else {
if (CGlobal::$shop_setting['default_mode'] == 1) {
$mode_default = 'shop';
} else {
$mode_default = 'comment';
}
}
}
if (CGlobal::$shop_label) {
CGlobal::$website_title .= ' | ' . CGlobal::$shop_label['name'];
$this->label_id = CGlobal::$shop_label['id'];
} else {
$this->label_id = (int) Url::get('label_id', 0);
if ($this->label_id) {
CGlobal::$shop_label = DB::select("label", "id=" . $this->label_id);
}
if (!CGlobal::$shop_label) {
$this->label_id = 0;
}
}
$page_shop_item = (int) Url::get('page_shop_item', 1);
$label_id = (int) Url::get("label_id", 0);
$list_type = (int) Url::get("list_type", 0);
global $display;
$display->add('top_level_id', $label_id);
$display->add('list_type', $list_type);
$display->add('can_edit', User::have_permit(ADMIN_ITEM) || User::id() == CGlobal::$user_profile['id']);
$status_check = User::id() == CGlobal::$user_profile['id'] || User::have_permit(ADMIN_ITEM) ? ' status IN(0,1,2,3,4,5)' : ' status =1';
if ($label_id) {
$total_item = DB::fetch('SELECT count(*) AS total_row FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id, 'total_row', 0);
} else {
$total_item = DB::fetch('SELECT count(*) AS total_row FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'], 'total_row', 0);
}
$pagging = '';
$items = array();
$divID = 'shop_item';
$item_per_page = 0;
if ($total_item) {
$item_per_page = 9;
$limit = '';
$url_path = WEB_DIR . 'ajax.php?act=shop&code=load_shop_label&user_id=' . CGlobal::$user_profile['id'] . '&label_id=' . $label_id . (!$list_type ? '' : '&list_type=' . $list_type);
$pagging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_shop_item', '', false, false, $url_path, $divID, true);
if ($label_id) {
$display->add('label_name', CGlobal::$shop_label['name']);
$select = 'SELECT I.id, I.name,I.sapo, I.user_name, I.user_id,I.description,I.category_id, I.read_count, I.reply_count, I.currency_id, I.price, I.province_id, I.up_time,I.price_out, I.brief, I.img_url, I.status, I.state, I.img_server
FROM label_item AS L JOIN item AS I ON L.item_id=I.id AND I.' . $status_check . ' AND I.user_id=' . CGlobal::$user_profile['id'] . ' WHERE L.user_id=' . CGlobal::$user_profile['id'] . ' AND L.label_id=' . $label_id . ' ORDER BY shop_order, up_time DESC' . $limit;
} else {
$select = 'SELECT id, name, sapo, user_name, user_id, description, category_id, read_count, reply_count, currency_id, price, brief, img_url, province_id, up_time, price_out, status, state, img_server,sticky FROM item WHERE ' . $status_check . ' AND user_id=' . CGlobal::$user_profile['id'] . ' ORDER BY shop_order, up_time DESC' . $limit;
}
$re = DB::query($select);
if (User::is_login()) {
$wids = User::get_wishlist('wish_list_items');
$w_items = array();
if ($wids) {
$w_items = explode(',', $wids);
}
}
if ($re) {
AZLib::getProvinces();
AZLib::getCats();
$item_ids = '';
while ($item = mysql_fetch_assoc($re)) {
$item['price'] = AZLib::convertCurrency($item['price'], $item['currency_id']);
$item['price_out'] = AZLib::convertCurrency($item['price_out'], $item['currency_id']);
$item['currency_id'] = 1;
if ($item['img_url']) {
$item['image_url'] = AZLib::getImageThumb($item['img_url'], 200, 200, 0, $item['img_server']);
}
if (isset(CGlobal::$allCategories[$item['category_id']])) {
//.........这里部分代码省略.........