function draw() { global $display; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `page` LIMIT 0,1', 'total_row', 0); $xml = "<?xml version='1.0' encoding='utf-8' ?>\n\t\t"; $xml .= "<pages>\n\t"; if ($total_row) { $pages = DB::fetch_all_array('SELECT * FROM `page`'); if ($pages) { foreach ($pages as $page) { $xml .= "<" . $page['name'] . ">\n\t\t"; $xml .= "<title>" . $page['title'] . "</title>\n\t\t"; $xml .= "<description>" . $page['description'] . "</description>\n\t\t"; $xml .= "<layout>" . $page['layout'] . "</layout>\n\t"; $blocks = DB::fetch_all_array('SELECT block.id, block.module_id, module.`name` as module_name, block.page_id, block.region, block.position, block.container_id FROM block INNER JOIN module ON block.module_id = module.id WHERE block.page_id = ' . $page['id']); if ($blocks) { $xml .= "\t"; $region = ''; $i = 0; $count_region = 0; $xml .= "<regions>\n\t\t\t"; foreach ($blocks as $block) { $count_region++; if ($region != $block['region']) { $region = $block['region']; $xml .= "<region name='" . $region . "'>\n\t\t\t\t"; } $xml .= "<module name='" . $block['module_name'] . "' position='" . $block['position'] . "' container='" . $block['container_id'] . "'/>\n\t\t\t"; // var_dump($region, $blocks[$i+1]['region']); if (!isset($blocks[$i + 1]) || $region != $blocks[$i + 1]['region']) { $xml .= "</region>\n\t\t"; if ($count_region < sizeof($blocks)) { $xml .= "\t"; } } else { $xml .= "\t"; } $i++; } $xml .= "</regions>\n\t"; } $xml .= "</" . $page['name'] . ">\n\t\t\n\t"; } } } $xml .= "</pages>"; $xmlobj = new SimpleXMLElement($xml); $xmlobj->asXML(ROOT_PATH . 'export/pages.xml'); echo 'export done: <a href="' . ROOT_PATH . 'export/pages.xml">pages.xml</a>'; }
/** * Get list product by condition search * * @author MinhNV * Date 2010/07/07 * */ private function getListProduct($cat_product_id) { $aryProduct = array(); $sql = "SELECT id, name, description FROM so_products_product WHERE category_id = " . $cat_product_id; $aryProduct = DB::fetch_all_array($sql); return $aryProduct; }
static function get_list_ban_ip() { $list_ip = array(); if (MEMCACHE_ON) { $list_ip = AZMemcache::do_get('list_ban_ip'); } if (!$list_ip) { $sql = "select * from ban_ip"; $list_ip_temp = DB::fetch_all_array($sql); foreach ($list_ip_temp as $value) { $list_ip[$value['ip']] = $value; } } return $list_ip; }
function draw() { global $display; $arrVar = array(); $this->beginForm(1); $arrVar['id'] = Url::get('id', 0); $options = ""; if ($arrVar['id'] == 0) { Url::redirect_current(); } EClassApi::getCats(); $where = ''; $filter = DB::fetch_all_array("select * from products_filter where id={$arrVar['id']}"); $filte_value = json_decode($filter[0]['filter_value']); $arrVar['filter'] = $filter[0]; $arrVar['filter_value'] = $filte_value; $item_per_page = 50; $limit = ''; $sql_count = "SELECT COUNT(*) AS total FROM products_extra_fields_group {$where}"; $total = DB::fetch($sql_count, 'total', 0); if ($total) { require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Nhóm trường', 'Trang'); $re = DB::query("SELECT * FROM products_extra_fields_group {$where} order by id desc {$limit}"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $products_extra_fields_group[$row['id']] = $row; } } } $filter_count = 0; foreach ($filte_value as $key => $val) { if ($filter_count < $val->order) { $filter_count = $val->order; } } if (count($filte_value) > $filter_count) { $filter_count = count($filte_value); } $categories = eb_memcache::do_get('categories_new'); if (!is_array($categories)) { //if($total){ require_once ROOT_PATH . 'core/ECPagging.php'; $re = DB::query("SELECT * FROM products_category order by orders"); if ($re) { while ($row = mysql_fetch_assoc($re)) { $categories[$row['parent_id']][$row['id']] = $row; } } eb_memcache::do_put('categories_new', $categories); } print_category($categories, 0, $options, $filter[0]['zone_id'], $filter[0]['cat_product_id']); $arrVar['options'] = $options; $arrVar['filter_count'] = $filter_count; $arrVar['zones'] = CGlobal::$allZones; $arrVar['paging'] = $paging; $arrVar['products_extra_fields_group'] = $products_extra_fields_group; $display->templateAdvance = TRUE; $display->setTemplate('ManageFilterEdit', $arrVar); $this->endForm(); }