function draw() { global $display; $display->add('msg', $this->showFormErrorMessages(1)); $display->add("url_admin", Url::build_current()); $status_select = Url::get('status_select', 6); //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, $status_select)); $date_begin = Url::get('date_begin'); $date_end = Url::get('date_end'); $display->add("date_begin", $date_begin); $display->add("date_end", $date_end); $created_time_from = 0; $created_time_to = 0; if ($date_begin) { $date_arr = explode("-", $date_begin); 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 ($date_end) { $date_arr = explode("-", $date_end); 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]); } } $condition = ""; if ($status_select != 6) { $condition .= "status=" . $status_select; } if ($created_time_from) { $condition .= ($condition != '' ? ' AND ' : '') . ' time_create >=' . $created_time_from; } if ($date_end) { $condition .= ($condition != '' ? ' AND ' : '') . " time_create <={$created_time_to}"; } $total = DB::count("cart", $condition); $limit = ''; $display->add('paging', AZPagging::paging_list($limit, $total, 40, 10, 'page_no', '', true, 'Đơn hàng')); $all_carts = array(); $re = DB::query("SELECT * FROM cart " . ($condition != '' ? 'WHERE ' : '') . $condition . " ORDER BY id DESC {$limit}"); if ($re) { while ($Cart = mysql_fetch_assoc($re)) { $Cart["time_create"] = date('d/m/Y H:i:s', $Cart['time_create']); $Cart["time_change"] = date('d/m/Y H:i:s', $Cart['time_change']); $Cart["url"] = Url::build_current(array('cmd' => 'edit', 'id' => $Cart['id'])); $Cart["status"] = $status_arr[$Cart['status']]; $Cart["delete"] = Url::build_current(array('cmd' => 'delete', 'id' => $Cart['id'])); $Cart["price"] = number_format($Cart['price'], null, null, '.'); $all_carts[$Cart['id']] = $Cart; } } $display->add('all_carts', $all_carts); $display->add('is_admin', User::is_admin()); $this->beginForm(); $display->output('CartAdmin'); $this->endForm(); }
function draw() { global $display; $this->beginForm(); if (Url::get('cmd') == 'edit') { $display->add('mode', "Sửa"); } elseif (Url::get('cmd') == 'copy') { $display->add('mode', "Copy"); } else { $display->add('mode', "Thêm"); } $display->add('msg', $this->showFormErrorMessages(1)); $display->add('name', Url::get('name', $this->page['name'])); $display->add('title', Url::get('title', $this->page['title'])); $display->add('description', Url::get('description', $this->page['description'])); $display->add('option_layout', AZLib::getOption($this->get_all_layouts(), Url::get('status', $this->page['layout']))); $display->output('edit'); $this->endForm(); }
function draw() { global $display; $re = DB::query('SELECT block.id, block.module_id, block.page_id, block.region, block.position,module.name FROM `block` INNER JOIN module ON module.id=module_id WHERE page_id=' . $_REQUEST['id'] . ' ORDER BY position'); $this->all_blocks = array(); if ($re) { while ($block = mysql_fetch_assoc($re)) { $this->all_blocks[$block['id']] = $block; } } if (file_exists($this->page['layout'])) { $this->layout_text = file_get_contents($this->page['layout']); } $this->get_regions(); $text = $this->layout_text . ($this->undefined_regions ? '<p><h1>Các module ngoài Layout</h1>[[|undefined_regions|]]</p>' : ''); $result = ''; while (($pos = strpos($text, '[[|')) !== false) { if ($pos2 = strpos($text, '|', $pos + 3)) { $var = substr($text, $pos + 3, $pos2 - $pos - 3); if (isset($this->regions[$var])) { $item = $this->regions[$var]; } if ($item) { $result .= substr($text, 0, $pos) . $item; $text = substr($text, $pos2 + 3, strlen($text) - $pos2 - 3); } else { $result .= substr($text, 0, $pos + 3); $text = substr($text, $pos + 3, strlen($text) - $pos - 3); } } else { $result .= substr($text, 0, $pos + 3); $text = substr($text, $pos + 3, strlen($text) - $pos - 3); } } $regions = $result . $text; $display->add('name', $this->page['name']); $display->add('id', $this->page['id']); $display->add('regions', $regions); $display->add('option_layout', AZLib::getOption($this->get_all_layouts(), Url::get('status', $this->page['layout']))); $display->add('page_content', $this->page); $display->output('page_content'); }
function draw() { global $display; $this->beginForm(); if (Url::get('cmd') == 'edit') { $display->add('mode', "Sửa"); } else { $display->add('mode', "Thêm"); } $display->add('msg', $this->showFormErrorMessages(1)); $display->add('name', Url::get('name', $this->province['name'])); $display->add('brief_name', Url::get('brief_name', $this->province['brief_name'])); $display->add('area', Url::get('url', $this->province['area'])); $display->add('position', (int) Url::get('position', $this->province['position'])); $display->add('total_item', (int) Url::get('position', $this->province['total_item'])); $display->add('option_area', AZLib::getOption(array(1 => 'Bắc', 2 => 'Trung', 3 => 'Nam'), Url::get('area', $this->province['area']))); $display->add('option_status', AZLib::getOption(array('SHOW' => 'Hiện', 'HIDE' => 'Ẩn', 'HOME' => 'HOME'), Url::get('status', $this->province['status']))); $display->output('edit'); $this->endForm(); }
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() { 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(); }
function draw() { require_once 'modules/ManageContent/forms/ManageContent.php'; $this->beginForm(); global $display; $display->add('action', AZLib::getParam('action')); $total = $this->total_record ? $this->total_record : Url::get('total'); if ($total) { $this->setFormSucces("", "Đã gửi tin nhắn cho {$total} thành viên!"); } $display->add('msg', $this->showFormSuccesMessages(1)); $display->add('send_all', AZLib::getParam('send_all')); $display->add('user_sell', AZLib::getParam('user_sell')); $display->add('subject', AZLib::getParam('subject')); $display->add('content', AZLib::getParam('content')); $display->add('item_cat', AZLib::getOption(ManageContentForm::getOtionCats(), Url::get('id_cats'))); $display->output('send_multi_mess'); $this->endForm(); }
function draw() { global $display; $this->beginForm(true); $display->add('mode', "Thêm"); $display->add('msg', $this->showFormErrorMessages(1)); $status_arr = array(1 => "OK", 2 => "Disable"); $display->add('status_option', AZLib::getOption($status_arr, Url::get('status', $this->a_row['status']))); $display->add('h_start_option', AZLib::getOptionNum(0, 23, Url::get('h_start', date('h', $this->a_row['time_start'])))); $display->add('min_start_option', AZLib::getOptionNum(0, 59, Url::get('min_start', date('i', $this->a_row['time_start'])))); $display->add('date_start', Url::get('date_start', date('d-m-Y', $this->a_row['time_start']))); $display->add('h_end_option', AZLib::getOptionNum(0, 23, Url::get('h_end', date('h', $this->a_row['time_end'])))); $display->add('min_end_option', AZLib::getOptionNum(0, 59, Url::get('min_end', date('i', $this->a_row['time_end'])))); $display->add('date_end', Url::get('date_end', date('d-m-Y', $this->a_row['time_end']))); $display->add('title', Url::get('title', $this->a_row['title'])); $display->add('note', Url::get('note', $this->a_row['note'])); $display->output('e_product_add'); $this->endForm(); }
function draw() { global $display; AZLib::get_config(); /*if (CGlobal::$curZone) { $zone_id = CGlobal::$curZone['id']; } else { $zone_id = 0; }*/ $zid = (int) Url::get("zone_id", 0); $display->add('cur_page', AZNet::$page['name']); $display->add('ADMIN_LOGO', User::have_permit(ADMIN_LOGO)); $in_detail_page = AZNet::$page['name'] == 'item_detail'; $topcats = array(); $pcats = array(); $stt = 0; $stt2 = 0; 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") { $topcat['name'] = $topcat['brief_name']; if (count($sub_cats) > 7) { $stt2++; } $topcat['left'] = "-" . (($stt2 - 1) * 30 + 10) . "px"; $topcat['url'] = WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}"; $topcat['selected'] = (int) (CGlobal::$curMainCat && CGlobal::$curMainCat['id'] == $topcat['id']); $topcat['selected2'] = 0; if ($topcat['selected']) { if ($sub_cats) { $topcat['class'] = "hm_item_list_sub"; } else { $topcat['class'] = "hm_item_seleted"; } } else { $topcat['class'] = "hm_item"; } if ($sub_cats) { $topcat['subs'] = array(); $num_sub = 0; foreach ($sub_cats as $sid => $subcat) { if ($subcat['status'] != "HIDE") { $subcat['url'] = WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}"; //$subcat['name'] = $subcat['brief_name']; if (CGlobal::$curLevel2Cat && CGlobal::$curLevel2Cat['id'] == $subcat['id']) { $topcat['selected2'] = 1; $topcat['class'] = "hm_item_seleted"; $subcat['class'] = "class='sub_seleted'"; } $topcat['subs'][$sid] = $subcat; $num_sub++; } } if ($topcat['selected'] && !$topcat['selected2']) { $max_per_col = ceil($num_sub / 5); if ($max_per_col <= 0) { $max_per_col = 1; } $display->add('max_per_col', $max_per_col); $display->add('subcat_items', $topcat['subs']); } } $topcats[$top_id] = $topcat; // if($stt++ >= 6) //break; } } } $display->add('topcats', $topcats); $display->add('web_dir', WEB_DIR); $display->add('DATA_PATH', DATA_PATH); //Load Logo //$test_time = mktime(0,0,0,11,26,2010); AZLib::getWebsiteLogo(); if (CGlobal::$websiteLogo !== FALSE && isset(CGlobal::$websiteLogo['current']['expired']) && CGlobal::$websiteLogo['current']['expired'] && CGlobal::$websiteLogo['current']['expired'] < TIME_NOW) { // Nếu Logo đang sử dụng đã hết hạn, lấy Logo còn hạn hoặc lấy Logo mặc định AZLib::getWebsiteLogo(1); } $display->add('logo', CGlobal::$websiteLogo['current']); $display->add('logos', CGlobal::$websiteLogo['logos']); //Top menu if (!isset($_SESSION['is_load_page_first'])) { $_SESSION['is_load_page_first'] = 0; } $display->add('url_root', WEB_ROOT); if (!User::is_login()) { $num_mess = 0; } else { $num_mess = User::$current->data['total_pm'] > 0 ? User::$current->data['total_pm'] : 0; } if (User::id()) { $display->add('user_id', User::id()); $user_name = User::$current->data['user_name']; $display->add('user_name', $user_name); } $referer_login_url = ''; $yahoo_open_id_href = ''; $google_open_id_href = ''; if (isset($_SESSION['openid_url']) && $_SESSION['user_id'] != 0) { $display->add('show_openid', FALSE); } elseif (!User::is_az_team()) { AZLib::check_uri(); $referer_login_url = base64_encode(CGlobal::$query_string); $yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string); $google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string); $display->add('show_openid', TRUE); } $display->add('OID_URL', $yahoo_open_id_href); $display->add('OID_URL_GOG', $google_open_id_href); $display->add('referer_login_url', $referer_login_url); $display->add('google_open_id_href', $google_open_id_href); $display->add('yahoo_open_id_href', $yahoo_open_id_href); $display->add('openid_on', OPENID_ON); $display->add('num_mess', $num_mess); $display->add('is_login', (int) User::is_login()); $display->add('is_admin', (int) User::is_az_team()); $display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM)); $display->add('is_root', User::is_root()); //End Top menu $display->add('category_id', CGlobal::$curCategory); $display->add('keywords', AZLib::cleanHtml(Url::get('keywords', ''))); $display->add('not_error_page', (int) (AZNet::$page['name'] != 'error')); $display->add('is_load_page_first', $_SESSION['is_load_page_first']); // Tỷ giá AZLib::get_config(); //$exchange = CGlobal::$configs['exchange']['conf_val']; //$display->add('exchange', number_format($exchange, 0, ',', '.')); // End Tỷ giá if ($_SESSION['is_load_page_first'] == 1) { $_SESSION['is_load_page_first'] = 0; } //End of top menu $curMainCat = CGlobal::$curMainCat; $curLevel2Cat = CGlobal::$curLevel2Cat; //Cat menu $sub_menu = FALSE; $sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]); $display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']); $display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']); $display->add('CURENT_CITY_ID', CGlobal::$curCity); $display->add('cur_page', Url::get('page')); $display->add('sub_menu', $sub_menu); $display->add('block_id', Module::$block_id); // System::debug($display->get_template_vars()); //End Cat menu if (User::is_root()) { $display->add("DEBUG", DEBUG); $display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG)))); } ################################################################################################################ #Event config $event_on = @CGlobal::$configs['event_on']['conf_val']; $submit = Url::get('submit', ''); if (User::is_admin()) { if ($submit == 'Cập nhật') { $display->add('msg', $this->showFormErrorMessages(1)); } $status_arr = array(0 => 'Tắt', 1 => 'Bật'); $display->add('status_option', AZLib::getOption($status_arr, $event_on)); } $display->add('event', $event_on); $display->add("data_path", DATA_PATH); #Event config ################################################################################################################ ################################################################################################################ #Search $search_catid = (int) Url::get('search_catid'); $search_cat_arr = array(-1 => '--Tất cả danh mục--'); 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'] != "HIDE") { $search_cat_arr[$top_id] = $topcat['name']; if ($sub_cats) { foreach ($sub_cats as $sid => $subcat) { if ($subcat['status'] != "HIDE") { $search_cat_arr[$sid] = "-----" . $subcat['name']; } } } } } } $display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid)); #Search ################################################################################################################ /* System::debug($topcats);*/ $cat_newss = array(); $news_cat_id = Url::get('news_catid', 'id', 0); AZLib::getNewsCats(); $display->add('news_cat_id', $news_cat_id); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $news_cat) { if ($news_cat['public']) { $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name']))); $cat_newss[$news_cat['id']] = $news_cat; } } } $display->add('cat_newss', $cat_newss); $display->output("Header"); // $display->output("header_old"); }
function draw() { global $display; $catid = Url::get('catid', 0); $max_name = 0; $baners = array(); $h_banner = array(); $configs = @CGlobal::$configs['home_banner']['conf_val']; if ($configs) { $configs = unserialize(stripslashes($configs)); } else { $configs = array(); } $dir = scandir(DATA_PATH . "home_banner/"); $i = 1; foreach ($dir as $fd) { if (is_file(DATA_PATH . "home_banner/{$fd}")) { $ext = strtolower(AZLib::getExtension($fd)); if (in_array($ext, array('.swf', '.gif', '.jpg', '.jpeg', '.png'))) { $arr = array(); if ($ext == '.swf') { $arr['type'] = 1; } else { $arr['type'] = 2; } $arr['stt'] = $i++; $arr['name'] = (int) basename($fd, $ext); if ($max_name < $arr['name']) { $max_name = $arr['name']; } $arr['path'] = DATA_PATH . "home_banner/{$fd}"; $arr['del'] = "?cmd=del_hb&id={$arr['name']}"; if (isset($configs[$arr['name']])) { $h_banner[$arr['name']] = $configs[$arr['name']]['time'] . '000'; $arr['time'] = $configs[$arr['name']]['time']; if ($configs[$arr['name']]['url'] != '') { $arr['url'] = urldecode($configs[$arr['name']]['url']); } else { $arr['url'] = ''; } } else { $h_banner[$arr['name']] = 15000; $arr['time'] = 15; $arr['url'] = ''; } $baners[$arr['name']] = $arr; } } } $display->add("baners", $baners); $display->add("h_banner", json_encode($h_banner)); $display->add("max", $i - 1); $arr = array(0 => "Up mới!"); if ($max_name > 0) { for ($i = 1; $i <= $max_name; $i++) { $arr[$i] = "Thay banner {$i}"; } } $display->add("hb_option", AZLib::getOption($arr, 0)); 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)); } //ngannv settting JW Image Rotator $display->add("jw_swf_file", STATIC_URL . FOLDER_JS . 'imagerotator/imagerotator.swf'); $settingFile = DATA_PATH . 'banner_home.php'; if (!file_exists(ROOT_PATH . $settingFile)) { $settingFile = DATA_PATH . 'banner_setting_default.xml'; //không có file này nữa thì ^^ } $display->add("jw_xml_file", $settingFile); //end JW Image Rotator $display->output("IntroBanner"); }
function draw() { global $display; $this->beginForm(); AZLib::getCats(); $items = array(); $item_bookings = array(); $where = ''; $order = 'id DESC'; $catid = Url::get('catid', 0); $item_id = Url::get('item_id', 0); $user_add = Url::get('user_add', ''); $num_contract = Url::get('num_contract', ''); $status = Url::get('status', 0); $time_start = 0; $time_end = 0; $date_start = Url::get('date_start'); $date_end = Url::get('date_end'); if ($date_start) { $arr = explode('-', $date_start); $time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } if ($date_end) { $arr = explode('-', $date_end); $time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } if ($time_start >= $time_end) { $date_end = ''; $time_end = 0; } if ($time_start) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_start >= {$time_start}"; $order = 'time_start ASC, id DESC'; } if ($time_end) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_start <= {$time_end}"; } $display->add('date_start', $date_start); $display->add('date_end', $date_end); $time_start2 = 0; $time_end2 = 0; $date_start2 = Url::get('date_start2'); $date_end2 = Url::get('date_end2'); if ($date_start2) { $arr = explode('-', $date_start2); $time_start2 = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]); } if ($date_end2) { $arr = explode('-', $date_end2); $time_end2 = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]); } if ($time_start2 >= $time_end2) { $date_end2 = ''; $time_end2 = 0; } if ($time_start2) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_end >= {$time_start2}"; if ($order != 'time_start ASC, id DESC') { $order = 'time_end ASC, id DESC'; } } if ($time_end2) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_end <= {$time_end2}"; } $display->add('date_start2', $date_start2); $display->add('date_end2', $date_end2); if ($status != 3) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " status = {$status}"; } elseif ($status == 3) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " status in (0,1)"; } if ($item_id) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " item_id = {$item_id}"; } if ($user_add != '') { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " user_add = '{$user_add}'"; } if ($num_contract != '') { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " num_contract = '{$num_contract}'"; } $zone_id = Url::get("zone_id", 0); $arr = array(0 => "-- Tất cả Zone --"); foreach (CGlobal::$allZones as $zone) { $arr[$zone['id']] = $zone['name']; } $display->add('zone_option', AZLib::getOption($arr, $zone_id)); $arr = array(0 => "-- Tất cả Danh mục --"); if (isset(CGlobal::$allCategories[$catid])) { if (CGlobal::$allCategories[$catid]['parent_id']) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " cat_id = {$catid}"; } else { if (isset(CGlobal::$subCategories[$catid]) && CGlobal::$subCategories[$catid]) { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " (top_cat = {$catid} OR cat_id IN(" . implode(",", array_keys(CGlobal::$subCategories[$catid])) . "))"; } else { $where .= ($where != '' ? ' AND ' : 'WHERE ') . " top_cat = {$catid}"; } } } if (CGlobal::$allCategories && CGlobal::$subCategories) { foreach (CGlobal::$subCategories as $topid => $subcats) { if (!$zone_id || $zone_id && isset(CGlobal::$allCategories[$topid]) && in_array($zone_id, CGlobal::$allCategories[$topid]['zones'])) { if (isset(CGlobal::$allCategories[$topid])) { $arr[$topid] = CGlobal::$allCategories[$topid]['name'] . " ({$topid})"; } else { $arr[$topid] = "({$topid})"; } foreach ($subcats as $cid => $cat) { $arr[$cid] = "--------{$cat['name']} ({$cid})"; } } } } $display->add('cat_option', AZLib::getOption($arr, $catid)); $display->add('item_id', $item_id); $display->add('status', $status); $display->add('user_add', $user_add); $display->add('num_contract', $num_contract); $re = DB::query("SELECT * FROM bookings_vip {$where} ORDER BY {$order}"); $item_ids = ''; if ($re) { while ($v_item = mysql_fetch_assoc($re)) { $zid = 0; $zone_name = 0; $topcid = 0; $cid = 0; if ($v_item['cat_id']) { $cid = $v_item['cat_id']; if (isset(CGlobal::$allCategories[$cid])) { $topcid = CGlobal::$allCategories[$cid]['parent_id']; } } elseif ($v_item['top_cat']) { $topcid = $v_item['top_cat']; } if (!$topcid && $cid) { if (isset(CGlobal::$allCategories[$cid])) { $topcid = CGlobal::$allCategories[$cid]['parent_id']; } } if ($topcid) { if (isset(CGlobal::$allCategories[$topcid])) { foreach (CGlobal::$allCategories[$topcid]['zones'] as $zoneid) { if ($zoneid) { $zid = $zoneid; break; } } } } $zone_name = "[{$zid}] "; if ($zid && isset(CGlobal::$allZones[$zid])) { $zone_name .= CGlobal::$allZones[$zid]['name']; } if (!$zone_id || $zone_id && $zid == $zone_id) { $v_item['zone'] = $zone_name; $v_item['time'] = "<b>Tạo:</b> " . date("d/m/Y H:i", $v_item['time_add']) . " bởi <b>" . $v_item['user_add'] . "</b>"; if ($v_item['time_add'] != $v_item['time_edit']) { $v_item['time'] .= "<br /><b>Sửa:</b> " . date("d/m/Y H:i", $v_item['time_edit']) . " bởi <b>" . $v_item['user_edit'] . "</b>"; } if ($v_item['user_update_status'] != '' && $v_item['time_update_status'] != 0) { $v_item['time'] .= "<br /><b>Update:</b> " . date("d/m/Y H:i", $v_item['time_update_status']) . " bởi <b>" . $v_item['user_update_status'] . "</b>"; } switch ($v_item['status']) { case -1: $v_item['str_status'] = "<font color=red><b>Đã xóa <br/>{$v_item['user_del']}</b></font>"; break; case 1: $v_item['str_status'] = "<font color=black><b>Đã xử lý</b></font>"; break; default: $v_item['str_status'] = "<font color=green><b>Chưa xử lý</b></font>"; $v_item['permis'] = 0; if (User::have_permit(ADMIN_VIP_ITEM)) { $v_item['permis'] = 1; $v_item['update_status'] = Url::build_current(array('cmd' => 'update_status', 'id' => $v_item['id'])); $v_item['active'] = Url::build_current(array('cmd' => 'active', 'id' => $v_item['id'])); } $v_item['edit'] = Url::build_current(array('cmd' => 'edit', 'id' => $v_item['id'])); $v_item['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $v_item['id'])); break; } if ($v_item['time_start'] > TIME_NOW) { $v_item['time_start'] = '<font color="#c00"><b>' . date("d/m/Y", $v_item['time_start']) . '</b></font>'; } else { $v_item['time_start'] = date("d/m/Y", $v_item['time_start']); } if ($v_item['time_end']) { if ($v_item['time_end'] < TIME_NOW) { $v_item['time_end'] = '<font color="#f00"><b>' . date("d/m/Y", $v_item['time_end']) . '</b></font>'; } else { $v_item['time_end'] = date("d/m/Y", $v_item['time_end']); } } else { $v_item['time_end'] = ''; } $item_ids .= ($item_ids != '' ? ',' : '') . $v_item['item_id']; //check vi tri vip $v_item['top_cat'] != 0 ? $cat_id = $v_item['top_cat'] : ($cat_id = $v_item['cat_id']); $item_vip = DB::select_all('item_vip', "(catid = {$cat_id} OR level_1_catid = {$cat_id}) AND status = 1 AND time_end >" . TIME_NOW); $i = 0; $sa = $v_item['time_start']; $ea = $v_item['time_end']; foreach ($item_vip as $item) { if ($sa > $item['time_start'] && $sa < $item['time_end']) { $i++; } elseif ($ea > $item['time_start'] && $ea < $item['time_end']) { $i++; } elseif ($sa < $item['time_start'] && $ea > $item['time_end']) { $i++; } } $v_item['over_slot'] = 0; if ($i >= 2) { $v_item['over_slot'] = 1; } //end check vi tri //check trung ID $v_item['exist_id'] = 0; foreach ($item_vip as $item) { if ($v_item['item_id'] == $item['item_id']) { $v_item['exist_id'] = 1; } } //end check trung ID $item_bookings[$v_item['id']] = $v_item; } } } if ($item_ids != '') { $re = DB::query("SELECT * FROM item WHERE id IN({$item_ids})"); if ($re) { while ($item = mysql_fetch_assoc($re)) { $item['item_link'] = Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']))); $items[$item['id']] = $item; } } } foreach ($item_bookings as &$v_item) { if (isset($items[$v_item['item_id']])) { $v_item['item_link'] = $items[$v_item['item_id']]['item_link']; $v_item['item_name'] = stripslashes($items[$v_item['item_id']]['name']); if ($items[$v_item['item_id']]['status'] == -1) { $v_item['item_name'] .= ' <font color="#c00">Tin xoá</font>'; } elseif ($items[$v_item['item_id']]['status'] != 1) { $v_item['item_name'] .= ' <font color="#c00">KD</font>'; } $top_catid = $items[$v_item['item_id']]['level_1_catid']; $catid = $items[$v_item['item_id']]['category_id']; $v_item['top_cat_name'] = $v_item['top_cat'] ? CGlobal::$allCategories[$v_item['top_cat']]['name'] : ''; $v_item['cat_name'] = $v_item['cat_id'] ? CGlobal::$allCategories[$v_item['cat_id']]['name'] : ''; if ($v_item['cat_id'] && $v_item['cat_id'] != $catid) { $v_item['wrong_cat'] = '<font color="red">(sai chủng loại)</font>'; } $v_item['item_cat_name'] = "<font color=blue>" . CGlobal::$allCategories[$top_catid]['name'] . '</font> /<br /><font color=green>' . CGlobal::$allCategories[$catid]['name'] . '</font>'; if (isset(CGlobal::$allCategories[$v_item['cat_id']])) { $v_item['cat_vip'] = CGlobal::$allCategories[$v_item['cat_id']]['name']; } else { $v_item['cat_vip'] = ''; } } else { $v_item['item_name'] = 'Tin không tồn tại'; $v_item['cat_name'] = ''; } } $display->add('items', $item_bookings); $display->output('ManageBookingVip'); $this->endForm(); }
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 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(); }
function draw() { global $display; AZLib::getNewsCats(); $display->add('url_add', Url::build_current(array('cmd' => 'add'))); $display->add('msg', $this->showFormErrorMessages(1)); $news_catid = Url::get('news_catid', 0); $status = Url::get('status', 3); $date_begin = Url::get('date_begin'); $date_end = Url::get('date_end'); $keyword = Url::get('searchtext'); $hot = Url::get('hot', 1); for ($i = 1; $i <= 3; $i++) { $display->add('selected_' . $i, ''); } $display->add('selected_' . Url::get('status', 3), 'selected'); for ($i = 1; $i <= 2; $i++) { $display->add('tinnhanh_' . $i, ''); } $display->add('tinnhanh_' . Url::get('tinnhanh', 2), 'selected'); $condition = ' 1 '; if ($news_catid) { $condition .= " AND news_catid ={$news_catid} "; } if ($keyword != '') { $condition .= " AND ((title like '%{$keyword}%') OR (brief like '%{$keyword}%')) "; } $created_time_from = 0; $created_time_to = 0; if ($date_begin) { $date_arr = explode("-", $date_begin); 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 ($date_end) { $date_arr = explode("-", $date_end); 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) { $condition .= ' AND time_created >=' . $created_time_from; } if ($date_end) { $condition .= " AND time_created <={$created_time_to}"; } if ($status != 3) { $condition .= ' and status=' . $status; } if ($hot == 2) { $condition .= ' and hot=' . $hot; } $cat_arr = array(0 => "--Danh mục tin--"); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $news_cat) { $cat_arr[$news_cat['id']] = "[{$news_cat['id']}] " . $news_cat['name'] . ($news_cat['public'] == 0 ? ' (Đã ẩn)' : ''); } } //$news_catid $display->add('news_cat_option', AZLib::getOption($cat_arr, $news_catid)); $display->add('hot_option', AZLib::getOption(array('1' => "Tất cả", 2 => "Tin Hot"), $hot)); $display->add('status_option', AZLib::getOption(array(3 => "Tất cả", 1 => "Hiện", 2 => "Ẩn"), $status)); $display->add('keyword', $keyword); $display->add('date_begin', $date_begin); $display->add('date_end', $date_end); $totalRows = DB::count("news", $condition); $limit = ''; $pagging = AZPagging::pagingSE($limit, $totalRows, 20, 10, 'page_no', "tin"); //$pagging = AZPagging::paging_list($limit,20,'page_no'); $items = array(); $re = DB::query('SELECT * FROM news WHERE ' . $condition . " ORDER BY id DESC " . $limit, __LINE__ . __FILE__, false, false, false, true); if ($re) { while ($item = mysql_fetch_assoc($re)) { $item['admin_link'] = News::admin_link($item); if ($item['image']) { $item['image'] = AZLib::getImageThumb($item['image'], 150, 0, 0, $item['img_server']); } $item['cat'] = "[{$item['news_catid']}] " . @CGlobal::$allNewsCategories[$item['news_catid']]['name']; $item['time_created'] = date('d/m/Y', $item['time_created']); $item['brief'] = stripslashes($item['brief']); $item['title'] = stripslashes($item['title']); $item['url'] = Url::build('news_detail', array('news_catid' => $item['news_catid'], 'news_id' => $item['id'])); $items[$item['id']] = $item; } } $display->add('items', $items); $display->add('pagging', $pagging); $this->beginForm(); $display->output("NewsAdmin"); $this->endForm(); }
function draw() { global $display; $config = @CGlobal::$configs['AdvHomeBottom']['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/AdvHomeBottom.gif'); } else { $display->add('adv_banner', DATA_PATH . 'adv/AdvHomeBottom.swf'); } $display->add('type_display', $type_display); $display->add('url_detail', $url_detail); } else { //tắt $display->add('adv_banner', ''); } $display->add('status', $status); if (User::have_permit(ADMIN_ADV)) { $display->add('beginform', $this->beginForm(true, 'POST', false, false, true)); $display->add('endform', $this->endForm(true)); $display->add('msg', $this->showFormErrorMessages(1)); $status_arr = array(0 => 'Tắt', 1 => 'Bật'); $display->add('status_option', AZLib::getOption($status_arr, $status)); $display->add('is_admin', 1); $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', 1000); $display->add('adv_height', 200); $display->output("AdvHomeBottom"); }
function draw() { global $display; $this->beginForm(); $display->add('msg', $this->showFormErrorMessages(1)); $display->add('txt_title', stripslashes(Url::get('txt_title', $this->public_survey['title']))); $display->add('type_option', AZLib::getOption(array(0 => "Nhiều lựa chọn", 1 => "Một lựa chọn"), Url::get('type', $this->public_survey['type']))); $display->add('txt_question', stripslashes(Url::get('txt_question', $this->public_survey['question']))); $display->add('url_admin', Url::build('admin_survey')); $display->output('EditSurvey'); $this->endForm(); }
function draw() { global $display; $this->beginForm(true); $display->add('msg', $this->showFormErrorMessages(true)); $re = DB::query("SELECT id,name, status FROM category WHERE parent_id=0 ORDER BY position"); $all_top_cat = array(); if ($re) { /*while($cat=mysql_fetch_assoc($re)){ if($cat['status'] == 'HOME'){ $cat['name'].=' (HOME)'; } elseif($cat['status'] == 'HIDE'){ $cat['name'].=' (HIDE)'; } $all_top_cat[$cat['id']]=$cat['name']; }*/ while ($cat = mysql_fetch_assoc($re)) { $all_top_cat[$cat['id']] = $cat; } } $display->add('all_top_cat', $all_top_cat); //$display->add('option_cat_ids',AZLib::getOptionMulti($all_top_cat,Url::get('catids',array_keys($this->cats)))); $id = (int) Url::get('id', 0); $re1 = DB::query('SELECT category.id,name, status,category_zone_cat.position FROM category LEFT JOIN category_zone_cat ON category.id = category_zone_cat.catid WHERE category_zone_cat.zoneid=' . $id . ' ORDER BY category_zone_cat.position'); $items = array(); if ($re1) { $last_id = 0; while ($row = mysql_fetch_assoc($re1)) { /*if($row['status'] == 1){ $row['status']='<b>Hiện</b>'; } else{ $row['status']='<b>Ẩn</b>'; } if($last_id){ $items[$last_id]['down']='<a href="'.Url::build_current(array('mod','cmd'=>'move_zonecat_down','catid'=>$last_id,'id'=>$id)).'"><img src="style/images/admin/down_arrow_.gif" /></a>'; $row['up']='<a href="'.Url::build_current(array('mod','cmd'=>'move_zonecat_up','catid'=>$row['id'],'id'=>$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('mod','cmd'=>'move_zonecat_up','catid'=>$last_id,'id'=>$id)).'"><img src="style/images/admin/up_arrow_.gif" /></a>'; }*/ } $display->add('items', $items); $display->add('catids', Url::get('catids', $this->cats)); $display->add('name', Url::get('name', $this->cat_zone['name'])); $display->add('brief_name', Url::get('brief_name', $this->cat_zone['brief_name'])); $display->add('option_status', AZLib::getOption(array(0 => 'Ẩn', 1 => 'Hiện'), Url::get('status', $this->cat_zone['status']))); $display->add('option_position', AZLib::getOptionNum(1, 100, Url::get('position', $this->cat_zone['position']))); $display->add('class', Url::get('class', $this->cat_zone['class'])); $display->output('zone_edit'); $this->endForm(); }
function draw() { global $display; $config = @CGlobal::$configs['AdvCover']['conf_val']; $status = 0; $url_detail = ''; $type_ = 0; if ($config != '') { $config = unserialize(stripslashes($config)); $status = (int) $config['status']; $type_ = (int) $config['type']; $url_detail = $config['url_detail']; } if ($type_ == 0) { $type_ = 'promotion'; } else { $type_ = 'f_promotion'; } $display->add('type_promotion', $type_); if (!isset($_SESSION['adv_cover_top']) || isset($_SESSION['adv_cover_top']) && (int) $_SESSION['adv_cover_top'] < 1) { if ($status) { if ($url_detail != '') { $display->add('url_detail', $url_detail); } $_SESSION['adv_cover_top'] = 1; } $display->add('adv_on', $status); } else { $display->add('adv_on', 0); } if (User::have_permit(ADMIN_ADV)) { $display->add('beginform', $this->beginForm(true, 'POST', false, false, true)); $display->add('endform', $this->endForm(true)); $display->add('url', $url_detail); $display->add('msg', $this->showFormErrorMessages(1)); $type_arr = array(0 => 'Ảnh', 1 => 'Flash'); $type = (int) Url::get('type', 0); $display->add('type_option', AZLib::getOption($type_arr, $type)); $status_arr = array(0 => 'Tắt', 1 => 'Bật'); $display->add('status_option', AZLib::getOption($status_arr, $status)); $display->add('admin_url', Url::build('admin_promotion')); } $display->output("AdvCover"); }
function draw() { global $display; $this->beginForm(false, "POST", false, Url::build_current()); $display->add('msg', $this->showFormErrorMessages(1)); $display->add('url_admin', Url::build_current()); $key_word = Url::get('key_word'); $display->add('key_word', $key_word); $display->add('option_date1', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date1', 1))); $display->add('option_month1', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month1', 1))); $display->add('option_year1', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year1', 2011))); $display->add('option_date2', AZLib::getOptionNum(1, 31, (int) Url::get('cmb_date2', date('d')))); $display->add('option_month2', AZLib::getOptionNum(1, 12, (int) Url::get('cmb_month2', date('m')))); $display->add('option_year2', AZLib::getOptionNum(2011, date("Y"), (int) Url::get('cmb_year2', date('Y')))); $display->add('url_add', Url::build_current(array('cmd' => 'add'))); if (Url::get('cmb_date1') != '' && Url::get('cmb_month1') != '' && Url::get('cmb_year1') != '') { $from_date = mktime(0, 0, 0, Url::get('cmb_month1'), Url::get('cmb_date1'), Url::get('cmb_year1')); } else { $from_date = 0; } if (Url::get('cmb_date2') != '' && Url::get('cmb_month2') != '' && Url::get('cmb_year2') != '') { $to_date = mktime(23, 59, 59, Url::get('cmb_month2'), Url::get('cmb_date2'), Url::get('cmb_year2')); } else { $to_date = 0; } $condition = ''; $status = Url::get('status', 0); $user_c = Url::get('user_c'); $user_m = Url::get('user_m'); if ($status == 1) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' status=1'; } elseif ($status == 2) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' status=0'; } if ($user_c != '') { $condition .= ($condition != '' ? ' AND ' : ' ') . ' user_c LIKE "%' . $user_c . '%"'; } if ($user_m != '') { $condition .= ($condition != '' ? ' AND ' : ' ') . ' user_m LIKE "%' . $user_m . '%"'; } if ($from_date && $to_date) { $condition .= ($condition != '' ? ' AND ' : ' ') . ' time_c >=' . $from_date . ' AND time_c <= ' . $to_date; } $display->add('user_c', $user_c); $display->add('user_m', $user_m); $display->add('status_option', AZLib::getOption(array(0 => "Tất cả", 1 => "Hiện", 2 => "Ẩn SP"), $status)); if ($key_word) { $key_word_s = ''; $arr = explode(' ', $key_word); if ($arr) { foreach ($arr as $key) { $key = trim($key); if ($key != '') { $key_word_s .= ($key_word_s == '' ? '+' : ' +') . "{$key}"; } } } if ($key_word_s != '') { $condition .= " AND MATCH(title, des) AGAINST ('{$key_word_s}' IN BOOLEAN MODE)"; } //$condition .= ' AND (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")'; } /*if(Url::get('key_word','str','')) $condition.=($condition!=''?' AND ':' ').' (title LIKE "%'.$key_word.'%" OR des LIKE "%'.$key_word.'%")';*/ $total_item = DB::count('document', $condition); $LIMIT = ''; $paging = AZPagging::paging_list($LIMIT, $total_item, 20, 10, 'page_no', '', true, "Tài liệu", 'Trang'); $display->add('paging', $paging); $condition = ($condition != '' ? 'WHERE' : '') . $condition; $documents = array(); $sql = 'SELECT * FROM document ' . $condition . ' ORDER BY id DESC ' . $LIMIT; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $row['title'] = stripslashes($row['title']); $row['des'] = stripslashes($row['des']); if ($row['status'] == 1) { $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/unexam.gif', 'Disable'); $row['bgcolor'] = "#FFFFFF"; $row['status'] = 'OK'; } else { $row['change'] = AZLib::button(Url::build_current(array('cmd' => 'change', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/exam.gif', 'Enable'); $row['bgcolor'] = "#FF9900"; $row['status'] = 'Disable'; } $row['time_last'] = $row['time_last'] ? date("H\\hi:s d/m/Y", $row['time_last']) : ''; $row['time_c'] = date("H\\hi:s d/m/Y", $row['time_c']) . " bởi {$row['user_c']}"; $row['time_m'] = date("H\\hi:s d/m/Y", $row['time_m']) . " bởi {$row['user_m']}"; $row['edit'] = AZLib::button(Url::build_current(array('cmd' => 'edit', 'id' => $row['id'], "href" => urlencode(Url::build_all()))), 'style/images/edit.gif', 'Sửa tài liệu'); $row['delete'] = AZLib::buttonDel(Url::build_current(array('cmd' => 'delete', 'id' => $row['id'], "href" => urlencode('?' . $_SERVER['QUERY_STRING']))), 'style/images/delete.gif', 'Sửa tài liệu'); if ($row['url']) { $row['document_detail'] = $row['url']; } else { $row['document_detail'] = WEB_DIR . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html"; $row['url'] = WEB_ROOT . "download-{$row['id']}/" . AZLib::safe_title($row['title']) . ".html"; } $documents[$row['id']] = $row; } } $display->add('documents', $documents); $display->output('DocumentAdmin'); $this->endForm(); }
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 draw() { global $display; $this->beginForm(1); $display->add('msg', $this->showFormErrorMessages(1)); $allCatArr = array(0 => "--Chọn Danh Mục Tin--"); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $cat) { $allCatArr[$cat['id']] = "[{$cat['id']}] {$cat['name']}" . ($cat['public'] == 0 ? ' (Đã ẩn)' : ''); } } $display->add('news_catid_option', AZLib::getOption($allCatArr, Url::get('news_catid'))); $display->add('status_option', AZLib::getOption(array(1 => "Ẩn", 2 => "Hiện"), Url::get('status', 2))); if (Url::get('hot', 0)) { $display->add('checked', "checked='checked'"); } else { $display->add('checked', ""); } if (Url::get('focus', 0)) { $display->add('focus_checked', "checked='checked'"); } else { $display->add('focus_checked', ""); } $display->add('title', stripslashes(Url::get('title'))); $display->add('brief', stripslashes(Url::get('brief'))); $display->add('content', stripslashes(Url::get('content'))); $display->add('image_title', stripslashes(Url::get('image_title'))); $display->add('pen_name', stripslashes(Url::get('pen_name'))); $display->add('source', stripslashes(Url::get('source'))); $display->output("NewsAdminAdd"); $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(); }
function draw() { global $display; $status_arr = array('0' => 'Chưa trả lời / phản hồi', '1' => 'Đã phản hồi / phản hồi', '2' => 'Tất cả'); $status = (int) Url::get('status', 0); $display->add('url_admin', Url::build_current()); $display->add('status_option', AZLib::getOption($status_arr, $status)); $item_per_page_arr = array('20' => '20', '50' => '50', '100' => '100', '150' => '150', '200' => '200', '300' => '300', '500' => '500'); $item_per_page = (int) Url::get('row_per_page', 20); $display->add('row_per_page_option', AZLib::getOption($item_per_page_arr, $item_per_page)); $from_date_arr[-1] = '--Từ ngày--'; for ($i = 30; $i >= 0; $i--) { $time_from = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $from_date_arr[$time_from] = date('d/m/Y', $time_from); } $to_date_arr[-1] = '--Đến ngày--'; for ($i = 0; $i <= 30; $i++) { $time_to = mktime(23, 59, 59, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW)) - $i * 24 * 3600; $to_date_arr[$time_to] = date('d/m/Y', $time_to); } $from_date = Url::get('from_date', -1); $to_date = Url::get('to_date', -1); $display->add('from_date_option', AZLib::getOption($from_date_arr, $from_date)); $display->add('to_date_option', AZLib::getOption($to_date_arr, $to_date)); $sql = ' 1 '; if ($from_date > -1) { $sql .= " AND time>=" . $from_date; } if ($to_date > -1) { $sql .= " AND time<=" . $to_date; } $txt_ykien = Url::get('txt_ykien', ''); if ($txt_ykien != '') { $sql .= " AND content like '%{$txt_ykien}%'"; } $display->add('txt_ykien', $txt_ykien); if ($status != 2) { $sql .= ' AND status=' . $status; } $num_of_row = DB::count('feedback', $sql); $limit = ''; $display->add('pagging', AZPagging::paging_list($limit, $num_of_row, $item_per_page, 10, 'page_no', '', true, 'Liên hệ')); $page_no = (int) Url::get('page_no', 1); if ($page_no <= 0) { $page_no = 1; } $i = 0; $all_feedbacks = array(); $sql = "SELECT * FROM feedback WHERE {$sql} ORDER BY id DESC {$limit}"; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { $email = ''; if ($row['name']) { $email = stripslashes($row['name']) . " "; } if ($row['address']) { $email .= "( " . stripslashes($row['address']) . ") "; } $email .= '<a href="mailto:' . $row['email'] . '"><font color=blue>' . $row['email'] . "</font></a>"; $row['email'] = $email; $row['date'] = date("d/m/Y H:i:s", $row['time']); $row['date2'] = AZLib::duration_time($row['time']); $row['url_del'] = AZLib::buttonDel(Url::build_current(array('id' => $row['id'], 'cmd' => 'delete')), 'style/images/delete.gif', 'Xóa ý kiến'); $row['url_reply'] = Url::build_current(array('id' => $row['id'], 'cmd' => 'reply')); if ($row['reply_content']) { $row['reply_content'] = stripslashes($row['reply_content']); } else { $row['reply_content'] = "Chưa có"; } if (!$row['status']) { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'exam')), 'style/images/exam.gif', 'Duyệt liên hệ'); } else { $row['exam'] = AZLib::button(Url::build_current(array('id' => $row['id'], 'cmd' => 'unexam')), 'style/images/unexam.gif', 'Bỏ duyệt liên hệ'); } if ($i % 2 == 0) { $row['bgcolor'] = '#FFFFFF'; } else { $row['bgcolor'] = '#CCFF99'; } $i++; $row['i'] = ($page_no - 1) * $item_per_page + $i; $all_feedbacks[$row['id']] = $row; } } $display->add('all_feedbacks', $all_feedbacks); $this->beginForm(); $display->output("FeedbackAdmin"); $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; $this->beginForm(1); $display->add('msg', $this->showFormErrorMessages(1)); $display->add('url_detail', Url::build('news_detail', array('news_catid' => $this->news['news_catid'], 'news_id' => $this->news['id']))); if ($this->news['image']) { $display->add('delete', AZLib::buttonDel(Url::build_current(array('cmd' => 'del_img', 'news_id' => $this->news['id'], 'href' => urlencode(Url::build_all()))), 'delete.gif', "Xóa ảnh khỏi tin")); } else { $display->add('delete', ''); } $allCatArr = array(0 => "--Chọn Danh Mục Tin--"); if (CGlobal::$allNewsCategories) { foreach (CGlobal::$allNewsCategories as $cat) { $allCatArr[$cat['id']] = "[{$cat['id']}] {$cat['name']}" . ($cat['public'] == 0 ? ' (Đã ẩn)' : ''); } } $display->add('news_catid_option', AZLib::getOption($allCatArr, Url::get('news_catid', $this->news['news_catid']))); $display->add('status_option', AZLib::getOption(array(0 => "Ẩn", 1 => "Hiện"), Url::get('status', $this->news['status']))); if (Url::get('hot', $this->news['hot'])) { $display->add('checked', "checked='checked'"); } else { $display->add('checked', ""); } if (Url::get('focus', $this->news['focus'])) { $display->add('focus_checked', "checked='checked'"); } else { $display->add('focus_checked', ""); } $display->add('title', stripslashes(Url::get('title', $this->news['title']))); $display->add('brief', stripslashes(Url::get('brief', $this->news['brief']))); $display->add('content', stripslashes(Url::get('content', $this->news['content']))); $display->add('main_image_src', AZLib::getImageThumb($this->news['image'], 150, 0, 0, $this->news['img_server'])); $display->add('image_title', stripslashes(Url::get('image_title', $this->news['image_title']))); $display->add('pen_name', stripslashes(Url::get('pen_name', $this->news['pen_name']))); $display->add('source', stripslashes(Url::get('source', $this->news['source']))); $display->output("NewsAdminEdit"); $this->endForm(); }