Пример #1
0
 function draw()
 {
     global $display;
     //$this->beginForm(false,'post',false,Url::build_current());
     $this->beginForm();
     $name = trim(Url::get('name'));
     $order_by = Url::get('order_by', 'id');
     $order_dir = Url::get('order_dir', 'DESC');
     $cond = ' 1 ';
     if ($name != '') {
         $cond .= ' AND name LIKE "%' . $name . '%"';
     }
     $item_per_page = 50;
     $total_row = DB::fetch('SELECT count(*) AS total_row FROM `module` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0);
     $items = array();
     $paging = '';
     if ($total_row) {
         $limit = '';
         require_once ROOT_PATH . 'core/ECPagging.php';
         $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true);
         $sql = 'SELECT  id ,name FROM  `module` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit;
         $re = DB::query($sql);
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 if (Url::check('page_id')) {
                     $row['onclick'] = ' onclick="location=\'' . Url::build('edit_page', array('module_id' => $row['id'], 'id' => (int) Url::get('page_id', 0), 'region', 'after', 'replace', 'href')) . '\';"  style="cursor:pointer;" title="Click vào đây để cắm Module vào Page"';
                 } else {
                     $row['onclick'] = '';
                 }
                 $re2 = DB::query('SELECT page.id,page.name FROM block INNER JOIN page ON page.id=block.page_id WHERE module_id="' . $row['id'] . '"');
                 if ($re2) {
                     while ($page = mysql_fetch_assoc($re2)) {
                         $row['pages'][$page['id']] = $page;
                     }
                 } else {
                     $row['pages'] = array();
                 }
                 $items[$row['id']] = $row;
             }
         }
     }
     if ($order_dir == 'ASC') {
         $order_dir = 'DESC';
     } else {
         $order_dir = 'ASC';
     }
     $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir));
     $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir));
     $img_id = '';
     $img_name = '';
     if ($order_by == 'id') {
         $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     if ($order_by == 'name') {
         $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     $display->add('img_id', $img_id);
     $display->add('img_name', $img_name);
     $display->add('href_id', $href_id);
     $display->add('href_name', $href_name);
     $display->add('name', $name);
     $display->add('paging', $paging);
     $display->add('items', $items);
     $display->add('hover', EClassApi::mouse_hover('#E2F1DF', true));
     $display->output('list');
     $this->endForm();
 }
Пример #2
0
 function draw()
 {
     global $display;
     $this->beginForm(false, 'post', false, Url::build_current());
     $name = trim(Url::get('name'));
     $order_by = Url::get('order_by', 'id');
     $order_dir = Url::get('order_dir', 'DESC');
     $cond = ' 1 ';
     if ($name != '') {
         $cond .= ' AND name LIKE "%' . $name . '%"';
     }
     $item_per_page = 50;
     $total_row = DB::fetch('SELECT count(*) AS total_row FROM `page` WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0);
     $items = array();
     $paging = '';
     if ($total_row) {
         $limit = '';
         require_once ROOT_PATH . 'core/ECPagging.php';
         $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true);
         $sql = 'SELECT  id ,name,title, description FROM  `page` WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit;
         $re = DB::query($sql);
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 $row['href'] = Url::build('edit_page', array('id' => $row['id']));
                 $items[$row['id']] = $row;
             }
         }
     }
     if ($order_dir == 'ASC') {
         $order_dir = 'DESC';
     } else {
         $order_dir = 'ASC';
     }
     $href_id = Url::build_current(array('order_by' => 'id', 'order_dir' => $order_dir));
     $href_name = Url::build_current(array('order_by' => 'name', 'order_dir' => $order_dir));
     $href_des = Url::build_current(array('order_by' => 'description', 'order_dir' => $order_dir));
     $href_title = Url::build_current(array('order_by' => 'title', 'order_dir' => $order_dir));
     $img_id = '';
     $img_name = '';
     $img_title = '';
     $img_des = '';
     if ($order_by == 'id') {
         $img_id = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     if ($order_by == 'name') {
         $img_name = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     if ($order_by == 'description') {
         $img_des = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     if ($order_by == 'title') {
         $img_title = '<img src="style/images/admin/' . ($order_dir != 'DESC' ? 'down' : 'up') . 'arrow.png" alt="">';
     }
     $display->add('img_id', $img_id);
     $display->add('img_name', $img_name);
     $display->add('img_title', $img_title);
     $display->add('img_des', $img_des);
     $display->add('href_id', $href_id);
     $display->add('href_title', $href_title);
     $display->add('href_name', $href_name);
     $display->add('href_des', $href_des);
     $display->add('name', $name);
     $display->add('paging', $paging);
     $display->add('items', $items);
     $display->add('hover', EClassApi::mouse_hover('#E2F1DF', true));
     $display->output('list');
     $this->endForm();
 }
Пример #3
0
    /**
     * Search box advance
     * 
     * @author MinhNV
     * Date 2010/07/01
     *
     */
    private function searchBoxAdvance()
    {
        global $display;
        $category_id = Url::get('category_id');
        $cat_product_id = Url::get('cat_product_id');
        $txt_search = Url::get('txt_search');
        //get from cookie
        $cookie_search = Url::get('so_advanced_category_id_search', 0);
        if ($cookie_search != '') {
            $cookie_search = unserialize($cookie_search);
        } else {
            $cookie_search = array();
        }
        $cookie_search[$category_id] = array('txt_search' => $txt_search, 'cat_product_id' => $cat_product_id);
        $cookie_search = serialize($cookie_search);
        $minute_expire = 3600 + TIME_NOW;
        EClassApi::set_cookie('so_advanced_category_id_search', $cookie_search, $minute_expire);
        $page_no = Url::get('page_no', 1);
        $page = Url::get('page');
        $order_by = Url::get('order_by', 'id');
        $order_dir = Url::get('order_dir', 'DESC');
        $cond = ' TRUE ';
        $paging = '';
        $aryDataSearch = array();
        $total_row = 0;
        if ($category_id > 0 && (!User::is_admin() && User::has_permit_cat($category_id) || User::is_admin())) {
            $cond .= ' AND category_id=' . $category_id;
        } elseif (!User::is_admin()) {
            $cond .= ' AND ' . User::get_query_permit_cat(false, 'category_id');
        }
        if ($cat_product_id > 0 && (!User::is_admin() && User::has_permit_cat_product($cat_product_id) || User::is_admin())) {
            $cond .= ' AND cat_product_id=' . $cat_product_id;
        } elseif (!User::is_admin()) {
            $temp = User::get_query_permit_all_table('cat_product_id', false);
            $cond .= ' AND ' . ($temp != '' ? $temp : ' TRUE ');
        }
        if ($txt_search != '') {
            $cond .= ' AND b.`name` like "%' . $txt_search . '%" ';
        }
        $item_per_page = CGlobal::$number_per_page;
        $total_row = DB::fetch('SELECT count(*) AS total_row FROM so_box_advanced  b WHERE ' . $cond . ' LIMIT 0,1', 'total_row', 0);
        if ($total_row) {
            $limit = '';
            $url_path = 'ajax.php?act=so_advanced&code=search_box_advance&category_id=' . $category_id . '&txt_search=' . $txt_search . '&cat_product_id=' . $cat_product_id . '&page=' . $page;
            BMPaging::AjaxPagingTemplate($paging, $limit, $total_row, CGlobal::$number_per_page, CGlobal::$number_pages_show, 'page_no', true, $url_path, 'paging_box_advanced_template');
            $sql = 'SELECT 
					b.`id`,
					b.`category_id`,
					b.`cat_product_id`,
					b.`product_id`,
					b.`name`,
					b.`description`,
					b.`image`,
					b.`link_fix`,
					b.`product_relate`,
					b.`total_item`,
					b.`product_relate_full`,
					b.`status`,
					b.`created_date`,
					c.`name` as category_name,
					d.`name` as product_category_name
					FROM so_box_advanced b LEFT JOIN so_category c ON b.category_id = c.id
							       LEFT JOIN so_products_category d ON cat_product_id = d.id
					WHERE ' . $cond . ' ORDER BY ' . $order_by . ' ' . $order_dir . ' ' . $limit;
            $re = DB::query($sql);
            if ($re) {
                while ($row = mysql_fetch_assoc($re)) {
                    //$row ['image'] = ImageUrl::getBoxAvancedImage ( 70, true, true, $row ['image'] ); // lay URL tu csdl cua image
                    $row['image'] = SoImg::getImage($row['image'], $row['id'], SoImg::FOLDER_BOX_ADVANCED, $row['created_date'], '100x50');
                    array_push($aryDataSearch, $row);
                }
            }
        }
        $display->add('hover', EClassApi::mouse_hover(COLOR_MOUSE_HOVER, true));
        $display->add('aryBox', $aryDataSearch);
        //$display->add('paging', $paging);
        $display->add('total_row', $total_row);
        $display->add('page', $page);
        $aryHtml = $display->output('list_box_advanced', true, 'SoBoxAdvanced');
        $aryData = array();
        $aryData['html'] = $aryHtml;
        $aryData['intIsOK'] = 1;
        $aryData['page'] = $paging;
        echo json_encode($aryData);
        exit;
    }
Пример #4
0
 function draw_list($region, $modules)
 {
     $i = 0;
     $last = false;
     if ($modules) {
         foreach ($modules as $key => $item) {
             if ($i) {
                 if ($i > 1) {
                     $last['move_up'] = '<a href="' . Url::build_current(array('cmd' => 'move', 'id' => $this->page['id'], 'block_id' => $last['id'], 'move' => 'up')) . '"><img src="style/images/admin/up_arrow_.gif" alt="Move up"></a>';
                     $last['move_top'] = '<a href="' . Url::build('edit_page', array('id' => $this->page['id'], 'block_id' => $last['id'], 'cmd' => 'move_top')) . '">MoveTop</a>';
                 }
                 $last['move_down'] = '<a href="' . Url::build('edit_page', array('cmd' => 'move', 'id' => $this->page['id'], 'block_id' => $last['id'], 'move' => 'down')) . '"><img src="style/images/admin/down_arrow_.gif" alt="Move down"></a>';
                 $last['move_bottom'] = '<a href="' . Url::build('edit_page', array('id' => $this->page['id'], 'block_id' => $last['id'], 'cmd' => 'move_bottom')) . '">MoveBottom</a>';
             }
             $i++;
             $last =& $modules[$key];
             $last['move_up'] = '';
             $last['move_down'] = '';
         }
         if ($i > 1) {
             $modules[$key]['move_up'] = '<a href="' . Url::build('edit_page', array('cmd' => 'move', 'id' => $this->page['id'], 'block_id' => $item['id'], 'move' => 'up')) . '"><img src="style/images/admin/up_arrow_.gif" alt="Move up"></a>';
             $modules[$key]['move_top'] = '<a href="' . Url::build('edit_page', array('id' => $this->page['id'], 'block_id' => $item['id'], 'cmd' => 'move_top')) . '">MoveTop</a>';
         }
     }
     global $display;
     $display->add('hover', EClassApi::mouse_hover('#CCCCCC', true));
     $display->add('id', $this->page['id']);
     $display->add('name', $region);
     $display->add('items', $modules);
     return $display->output('list_block', true);
 }