Example #1
0
function news_admin_main()
{
    $paging = new Paging('p', _result_per_page(), 1, 9);
    $paging->sCurrentPageClass = 'current';
    $paging->sPageNextClass = 'next';
    $sqlOrder = 'news_id desc';
    if (!empty($_GET['sortby'])) {
        $sortby = $_GET['sortby'];
        $sort = $_GET['sort'];
        if ($sort == 'asc') {
            $sqlOrder = $sortby . ' asc';
        } else {
            if ($sort == 'desc') {
                $sqlOrder = $sortby . ' desc';
            }
        }
    }
    $sqlOrder = 'ordering DESC,is_category desc,' . $sqlOrder;
    $data = array();
    $db = _db();
    $pid = 0;
    $parent = null;
    if (!empty($_GET['pid'])) {
        $pid = $_GET['pid'];
        if ($pid != 0) {
            $db->prepare('SELECT news_id, parent_id FROM `_prefix_news` WHERE news_id=:ID');
            $db->bindValue(':ID', $pid, PARAM_INT);
            $db->execute();
            if ($parent = $db->fetch()) {
                $data['parent'] = $parent;
            } else {
                $pid = 0;
            }
        }
    }
    $cats[0] = '-- Không thuộc nhóm --';
    getCategoryList($cats);
    $data['category'] = $cats;
    $db->prepare('SELECT SQL_CALC_FOUND_ROWS ordering ,is_quantam, is_tieudiem,news_id, news_created, news_title, is_category, is_enabled, is_showintroimage,introimage FROM `_prefix_news` WHERE parent_id=:PARENT_ID ORDER BY :ORDER LIMIT :OFFSET, :TOTAL');
    $db->bindValue(':PARENT_ID', $pid, PARAM_INT);
    $db->bindValue(':ORDER', $sqlOrder, PARAM_NONE);
    $db->bindValue(':OFFSET', $paging->getResultRowStart(), PARAM_INT);
    $db->bindValue(':TOTAL', _result_per_page(), PARAM_INT);
    $db->execute();
    die('xyz');
    if ($items = $db->fetchAll()) {
        $data['items'] = $items;
    }
    //Lay tong cong so record
    $paging->nTotalRow = $db->total_last_limit_query();
    $data['paging'] = $paging;
    return $data;
}
Example #2
0
function getCategoryList($parent_id = 0)
{
    $sql = "SELECT cat_id,cat_name FROM " . $GLOBALS['ecs']->table('category') . " WHERE parent_id='{$parent_id}' AND is_show=1 ORDER BY sort_order ASC";
    $categorys = $GLOBALS['db']->getAll($sql);
    if (!empty($categorys)) {
        foreach ($categorys as $key => $category) {
            if (!isEndCategory($category['cat_id'])) {
            }
            $categorys[$key]['childrenCategory'] = getCategoryList($category['cat_id']);
        }
    }
    return $categorys;
}
    $cbcollection->delete_category($_GET['delete_category']);
}
//$cats = $cbcollection->get_categories();
//$pid = $cbcollection->get_category_field($_GET['category'],'parent_id');
$cats = getCategoryList(array('type' => 'collection'));
if ($pid) {
    $selected = $pid;
}
//$parent_cats = $cbcollection->admin_area_cats($selected);
//Updating Category Order
if (isset($_POST['update_order'])) {
    foreach ($cats as $cat) {
        if (!empty($cat['category_id'])) {
            $order = $_POST['category_order_' . $cat['category_id']];
            $cbcollection->update_cat_order($cat['category_id'], $order);
        }
    }
    $cats = getCategoryList(array('type' => 'collection'));
}
assign('manage_categories_title', 'Manage collection categories');
assign('type', 'collection');
$Smarty->assign_by_ref('obj', $cbcollection);
//Assing Category Values
assign('category', $cats);
assign('categories', $cats);
//Assing Category Values
assign('total', $cbcollection->total_categories());
subtitle("Collection Category Manager");
Assign('msg', @$msg);
template_files('category.html');
display_it();
Example #4
0
}
//Delete Category
if (isset($_GET['delete_category'])) {
    $cbvid->delete_category($_GET['delete_category']);
}
$cats = getCategoryList(array('type' => 'v'));
if ($pid) {
    $selected = $pid;
}
$parent_cats = $cbvid->admin_area_cats($selected);
//Updating Category Order
if (isset($_POST['update_order'])) {
    foreach ($cats as $cat) {
        if (!empty($cat['category_id'])) {
            $order = $_POST['category_order_' . $cat['category_id']];
            $cbvid->update_cat_order($cat['category_id'], $order);
        }
    }
    $cats = getCategoryList(array('type' => 'v'));
}
assign('manage_categories_title', 'Manage video categories');
assign('type', 'video');
$Smarty->assign_by_ref('obj', $cbvid);
//Assing Category Values
assign('categories', $cats);
assign('parent_cats', $parent_cats);
assign('total', $cbvid->total_categories());
subtitle("Video Category Manager");
Assign('msg', @$msg);
template_files('category.html');
display_it();
Example #5
0
 function createCheckBox($field, $multi = FALSE)
 {
     if ($field['value'][0] == 'category') {
         $values_array = $field['value'][1][0];
         $type = $field['category_type'] ? $field['category_type'] : 'video';
         $catArray = getCategoryList(array("type" => $type));
         if (is_array($catArray)) {
             $params['categories'] = $catArray;
             $params['field'] = $field;
             $params['collapsed'] = false;
             $this->listCategoryCheckBox($params, $multi);
             return;
         } else {
             return "There is no category to select";
         }
     }
     /* Categories end */
     $arrayName = $this->rmBrackets($field['name']);
     $check = '%s';
     $count = 0;
     if ($multi) {
         global $multi_cat_id;
         @$multi_cat_id++;
     }
     foreach ($field['value'] as $key => $value) {
         if (is_array($values_array)) {
             foreach ($values_array as $cat_val) {
                 if ($cat_val == $key || $field['checked'] == 'checked') {
                     $checked = sprintf($check, 'checked="checked"');
                     break;
                 } else {
                     $checked = sprintf($check, '');
                 }
             }
         }
         if (!$multi) {
             $field_name = $field['name'];
         } else {
             $field_name = $field['name'];
             $field_name = $this->rmBrackets($field_name);
             $field_name = $field_name . $multi_cat_id . '[]';
         }
         if (!empty($field['id'])) {
             $field_id = $field['id'] . '_' . $count;
         } else {
             $field_id = $arrayName . '_' . $count;
         }
         if ($field['multi']) {
             preg_match_all('/#([0-9]+)#/', $field['checked'], $m);
             $multiVals = $m[1];
             if (in_array($key, $multiVals)) {
                 $checked = sprintf($check, 'checked="checked"');
             } else {
                 $checked = sprintf($check, '');
             }
         } else {
             if ($key == $field['checked']) {
                 $checked = sprintf($check, 'checked="checked"');
             } else {
                 $checked = sprintf($check, '');
             }
         }
         echo '<input name="' . $field_name . '" id="' . $field_id . '" type="checkbox" value="' . $key . '" ' . $checked . ' ' . $field['extra_tags'] . ' />';
         echo '<label for="' . $field_id . '">' . $value . '</label>';
         $count++;
     }
     #foreach end
 }
 public function ckeditor()
 {
     $this->assign('categoryList', getCategoryList());
     $ua['url'] = U('Admin/Blog/addBlog');
     $ua['bid'] = 0;
     $this->assign('ua', $ua);
     $this->display('Blog/ckeditor');
 }
Example #7
0
function getSmartyCategoryList($params)
{
    return getCategoryList($params);
}
Example #8
0
function get_property_cat_id_name($postid = '')
{
    global $wpdb;
    $bedcatid = get_cat_id_from_name(get_option('ptthemes_bedroomcategory'));
    $bedcatarr = getCategoryList($bedcatid);
    if ($bedcatarr) {
        foreach ($bedcatarr as $key => $val) {
            if ($val['ID']) {
                $bed_catid_arr[] = $val['ID'];
                $bed_catname_arr[$val['ID']] = $val['name'];
            }
        }
    }
    $typecatid = get_cat_id_from_name(get_option('ptthemes_property_typecategory'));
    $typecatarr = getCategoryList($typecatid);
    if ($typecatarr) {
        foreach ($typecatarr as $key => $val) {
            if ($val['ID']) {
                $type_catid_arr[] = $val['ID'];
                $type_catname_arr[$val['ID']] = $val['name'];
            }
        }
    }
    $loccatid = get_cat_id_from_name(get_option('ptthemes_locationcategory'));
    $loccatarr = getCategoryList($loccatid);
    if ($loccatarr) {
        foreach ($loccatarr as $key => $val) {
            if ($val['ID']) {
                $loc_catid_arr[] = $val['ID'];
                $loc_catname_arr[$val['ID']] = $val['name'];
            }
        }
    }
    /*$pricecatid = get_cat_id_from_name(get_option('ptthemes_pricecategory'));
    	$pricecatarr = getCategoryList($pricecatid);
    	if($pricecatarr)
    	{
    		foreach($pricecatarr as $key=>$val)
    		{
    			if($val['ID'])
    			{
    				$price_catid_arr[] = $val['ID'];
    				$price_catname_arr[$val['ID']] = $val['name'];
    			}
    		}
    	}*/
    $pn_categories_obj = $wpdb->get_var("SELECT GROUP_CONCAT(distinct({$wpdb->terms}.term_id)) as cat_ID \r\r\n\t                            FROM {$wpdb->term_taxonomy},  {$wpdb->terms},  {$wpdb->term_relationships}\r\r\n                                WHERE {$wpdb->term_taxonomy}.term_id =  {$wpdb->terms}.term_id AND {$wpdb->term_taxonomy}.taxonomy = 'category'\r\r\n\t\t\t\t\t\t\t\tand {$wpdb->term_relationships}.term_taxonomy_id={$wpdb->term_taxonomy}.term_taxonomy_id and {$wpdb->term_relationships}.object_id=\"{$postid}\"");
    $post_cats_arr = explode(',', $pn_categories_obj);
    if ($post_cats_arr) {
        for ($i = 0; $i < count($post_cats_arr); $i++) {
            if ($bed_catid_arr && in_array($post_cats_arr[$i], $bed_catid_arr)) {
                $post_cat_info['bed'] = array('id' => $post_cats_arr[$i], 'name' => $bed_catname_arr[$post_cats_arr[$i]]);
            }
            if ($loc_catid_arr && in_array($post_cats_arr[$i], $loc_catid_arr)) {
                $post_cat_info['location'] = array('id' => $post_cats_arr[$i], 'name' => $loc_catname_arr[$post_cats_arr[$i]]);
            }
            /*if($price_catid_arr && in_array($post_cats_arr[$i],$price_catid_arr))
            		{
            			$post_cat_info['price'] = array('id'=>$post_cats_arr[$i],'name'=>$price_catname_arr[$post_cats_arr[$i]]);
            		}*/
        }
    }
    return $post_cat_info;
}
Example #9
0
function getCategoryList($parent_id, $level)
{
    global $category_list, $languages_id;
    $cat_query = tep_db_query('SELECT DISTINCT c.categories_id, c.sort_order, cd.categories_name FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND c.parent_id = "' . $parent_id . '" AND cd.language_id = "' . (int) $languages_id . '"ORDER BY c.sort_order asc, cd.categories_name asc');
    while ($categories = tep_db_fetch_array($cat_query)) {
        /*language fallback*/
        if (LANGUAGE_FALLBACK == 'true' && $categories['categories_name'] == '') {
            $language_fallback_query = tep_db_query('SELECT categories_name FROM categories_description WHERE categories_id = "' . $categories['categories_id'] . '" AND language_id = "1"');
            $language_fallback = tep_db_fetch_array($language_fallback_query);
            $categories['categories_name'] = $language_fallback['categories_name'];
        }
        /*language fallback*/
        $category_list .= '<li><a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $categories['categories_id']) . '" title="' . $categories['categories_name'] . ' - ' . STORE_NAME . '">' . $categories['categories_name'] . '</a>';
        if (tep_has_category_subcategories($categories['categories_id'])) {
            $category_list .= '<ul class="level_' . $level . '">';
            $new_level = $level + 1;
            getCategoryList($categories['categories_id'], $new_level);
            $category_list .= '</ul>';
        }
        $category_list .= '</li>';
    }
    return $category_list;
}
Example #10
0
 function createDropDown($field, $multi = FALSE)
 {
     global $LANG;
     //First Checking if value is CATEGORY
     if ($field['value'][0] == 'category') {
         $values_array = $field['value'][1][0];
         $field['value'] = '';
         //Generate Category list
         $type = $field['type'] ? $field['type'] : 'video';
         $catArray = getCategoryList(array("type" => $field['category_type']));
         foreach ($catArray as $cat) {
             $field['value'][$cat['category_id']] = $cat['category_name'];
         }
     }
     if (!$multi) {
         $field_name = $field['name'];
     } else {
         $field_name = $field['name'] . '[]';
     }
     $ddFieldStart = '<select name="' . $field_name . '" id="' . $field['id'] . '" class="' . $field['class'] . '">';
     $arrayName = $this->rmBrackets($field['name']);
     if (is_array($field['value'])) {
         foreach ($field['value'] as $key => $value) {
             if (!empty($_POST[$arrayName]) || !empty($field['checked'])) {
                 if ($_POST[$arrayName] == $key || $field['checked'] == $key) {
                     $checked = ' selected="selected" ';
                 } else {
                     $checked = '  ';
                 }
             } else {
                 if ($count == 0) {
                     $checked = ' selected="selected" ';
                 } else {
                     $checked = '';
                 }
                 $count++;
             }
             $fieldOpts .= '<option value="' . $key . '" ' . $checked . ' ' . $field['extra_tags'] . '>' . $value . '</option>';
         }
     }
     $ddFieldEnd = '</select>';
     echo $ddFieldStart . $fieldOpts . $ddFieldEnd;
 }
//@$q = explode('/', $q);
//echo "<h1>q[0] : ".$q[0]."</h1>";
//echo "<p>Some stuff and q is : ".$q."</p>";
@session_start();
switch ($q) {
    //case 'test': test(); break;
    case 'addCategory':
        addCategory();
        break;
        //send a post to the EditCategories.php
    //send a post to the EditCategories.php
    case 'listCategories':
        listCategories($r);
        break;
    case 'getCategoryList':
        getCategoryList($r);
        break;
    case 'changeCategory':
        changeCategory($q[1]);
        break;
    case 'removeCategory':
        removeCategory($r);
        break;
    case 'getCategory':
        getCategory(intval($r), $s);
        break;
    case 'getProduct':
        getProduct(intval($r), $s);
        break;
    case 'addProduct':
        addProduct(intval($r));
Example #12
0
		<?php 
    echo form::field('image_title', 80, 80, getImagename());
    ?>
</p>
		<table width="80%">
			<tr>
				<td><label for="content_mode">Format:</label></td>
				<td><label for="image_category">Catégorie:</label></td>
			</tr>
			<tr>
				<td><?php 
    echo form::combo('content_mode', array('Wiki' => 'wiki', 'HTML' => 'redim'), getImageMode());
    ?>
</td>
				<td><?php 
    echo form::combo('image_category', getCategoryList());
    ?>
</td>
			</tr>
		</table>
		<p><label for="image_content">Texte:</label><br/>
		<?php 
    echo form::textarea('image_content', 100, 10, getImageBody());
    ?>
</p>
	</fieldset>
	<br/>
	<fieldset>
		<legend>Horodatage / Commentaires / Trackbacks</legend>
		<p><label for="image_file">Autoriser les commentaires:</label>
		<?php 
Example #13
0
<?php 
include_once "./header.php";
include_once "./commonlib.php";
$conn = getConnection("ibabymall");
$ary = getCategoryList($conn);
/* process page */
$showpage = (int) $_GET['page'] ? (int) $_GET['page'] : 1;
$each_page_count = 50;
$page_max = ceil(sizeof($ary) / $each_page_count);
$showpage = max(1, min($showpage, $page_max));
?>

    <table class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>#</th>
                <th>類別名稱</th>
                <th>商品數量</th>
            </tr>
        </thead>
        <tbody>
        
        <?php 
for ($i = ($showpage - 1) * $each_page_count; $i < min($showpage * $each_page_count, sizeof($ary)); $i++) {
    $id = $ary[$i][0];
    echo "<td>" . ($i + 1) . "</td>" . "<td><a href='./category.php?id={$id}' >" . $ary[$i][1] . "</a></td>" . "<td>" . $ary[$i][2] . "</td>" . "</tr>";
}
?>
  
        </tbody>
    </table>
${"GLOBALS"}["rgwmxhgsjhvm"] = "current";
${"GLOBALS"}["udjpppr"] = "categories";
${"GLOBALS"}["onkisubv"] = "ret";
${"GLOBALS"}["xpczwzdn"] = "parent";
${"GLOBALS"}["lkexuii"] = "idx";
${"GLOBALS"}["vnpsuhdspaq"] = "table";
${"GLOBALS"}["gjqtcorlfwyz"] = "tds";
${"GLOBALS"}["cqbhckll"] = "id_parent";
${"GLOBALS"}["zqgiawh"] = "id_category";
${"GLOBALS"}["pslyplyknxc"] = "sql";
include_once dirname(__FILE__) . "/../../config/config.inc.php";
include_once dirname(__FILE__) . "/../../init.php";
$qnhvofplgdnv = "res";
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
${"GLOBALS"}["xlymah"] = "res";
${$qnhvofplgdnv} = getCategoryList(intval(Tools::getValue("id_category")));
die(${${"GLOBALS"}["xlymah"]});
function getCategoryList($id_category)
{
    $hdyxec = "last";
    ${${"GLOBALS"}["pslyplyknxc"]} = "SELECT id_parent FROM " . _DB_PREFIX_ . "category WHERE id_category=" . ${${"GLOBALS"}["zqgiawh"]};
    ${"GLOBALS"}["whgbpyh"] = "id_parent";
    ${"GLOBALS"}["cjpsyzpoaj"] = "id_parent";
    $gvvynhcp = "tds";
    $cdqfzxanro = "idx";
    ${${"GLOBALS"}["cqbhckll"]} = Db::getInstance()->getValue(${${"GLOBALS"}["pslyplyknxc"]});
    if (${${"GLOBALS"}["cjpsyzpoaj"]} <= 1) {
        ${${"GLOBALS"}["whgbpyh"]} = 1;
    }
    ${${"GLOBALS"}["gjqtcorlfwyz"]} = array();
    if (intval(Tools::getValue("id_category")) > 0) {
Example #15
0
<?php

if (!defined('WEB_ROOT')) {
    exit;
}
$categoryList = getCategoryList();
$categoriesPerRow = 3;
$numCategory = count($categoryList);
$columnWidth = (int) (100 / $categoriesPerRow);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="20">
<?php 
if ($numCategory > 0) {
    $i = 0;
    for ($i; $i < $numCategory; $i++) {
        if ($i % $categoriesPerRow == 0) {
            echo '<tr>';
        }
        // we have $url, $image, $name, $price
        extract($categoryList[$i]);
        echo "<td width=\"{$columnWidth}%\" align=\"center\"><a href=\"{$url}\"><img src=\"{$image}\" border=\"0\"><br>{$name}</a></td>\r\n";
        if ($i % $categoriesPerRow == $categoriesPerRow - 1) {
            echo '</tr>';
        }
    }
    if ($i % $categoriesPerRow > 0) {
        echo '<td colspan="' . ($categoriesPerRow - $i % $categoriesPerRow) . '">&nbsp;</td>';
    }
} else {
    ?>
	<tr><td width="100%" align="center" valign="center">No categories yet</td></tr>
Example #16
0
    assign("edit_category", "show");
    if (isset($_POST['update_category'])) {
        $cbgroup->update_category($_POST);
    }
    assign('cat_details', $cbgroup->get_category($_GET['category']));
}
//Delete Category
if (isset($_GET['delete_category'])) {
    $cbgroup->delete_category($_GET['delete_category']);
}
$cats = getCategoryList(array('type' => 'group'));
//Updating Category Order
if (isset($_POST['update_order'])) {
    foreach ($cats as $cat) {
        if (!empty($cat['category_id'])) {
            $order = $_POST['category_order_' . $cat['category_id']];
            $cbgroup->update_cat_order($cat['category_id'], $order);
        }
    }
    $cats = getCategoryList(array('type' => 'group'));
}
assign('manage_categories_title', 'Manage group categories');
assign('type', 'group');
$Smarty->assign_by_ref('obj', $cbgroup);
//Assing Category Values
assign('category', $cats);
assign('categories', $cats);
assign('total', $cbgroup->total_categories());
subtitle("Groups Category manager");
template_files('category.html');
display_it();
                                <tr>
                                    <td><label>Description</label></td>
                                    <td><textarea rows="2" name="details" maxlength="500" id="description" cols="40" class="description" style="width:316px;height: 31px;"></textarea></td>
                                    <td><div id="error_description" class="validation-message"></div></td>
                                </tr>
                                <tr>
                                    <td><label>User Name</label></td>
                                    <td><input id="user_name" type="text" name="user_name" value=""/></td>
                                    <td> <span id="error_user" class="validation-message"></span></td>
                                </tr>
                                <tr>
                                    <td><label>Board Category</label></td>
                                    <td>
                                        <select id="category" name="category">
                                            <?php 
$result = getCategoryList();
?>
                                            <?php 
foreach ($result as $key => $value) {
    ?>
                                                <option  value="<?php 
    echo $value->field;
    ?>
"><?php 
    echo $value->name;
    ?>
</option>
                                            <?php 
}
?>
                                        </select>
Example #18
0
<?php

if (!isset($_GET['do'])) {
    return json_encode(array('success' => false, 'errorMessage' => 'invail request'));
}
$action = $_GET['do'];
switch ($action) {
    case 'get-category-list':
        exit(json_encode(getCategoryList()));
        break;
    case 'get-shop-list':
        exit(json_encode(getShopList()));
        break;
    case 'get-shop-detail':
        exit(json_encode(getShopDetail()));
        break;
    case 'get-coupon-list':
        exit(json_encode(getCouponList()));
        break;
    case 'get-coupon-list-by-category':
        exit(json_encode(getCouponListByCategory()));
        break;
    case 'get-coupon-list-by-shop':
        exit(json_encode(getCouponListByShop()));
        break;
    case 'fetch-coupon':
        exit(json_encode(getCouponDetail()));
        break;
    case 'get-coupon-list-by-categories':
        exit(json_encode(getCouponListByCategories()));
        break;