当前位置: 首页>>代码示例>>PHP>>正文


PHP ShopFunctions::categos_list方法代码示例

本文整理汇总了PHP中ShopFunctions::categos_list方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopFunctions::categos_list方法的具体用法?PHP ShopFunctions::categos_list怎么用?PHP ShopFunctions::categos_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShopFunctions的用法示例。


在下文中一共展示了ShopFunctions::categos_list方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: shop_bk_categories_show

function shop_bk_categories_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopcategory.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopfunctions.php';
    $categories = array();
    ShopFunctions::categos_list($categories);
    array_walk($categories, 'shop_dashed');
    RMTemplate::get()->add_style('blocks.css', 'shop');
    return $categories;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:10,代码来源:shop_bk_categories.php

示例2: categos_list

 /**
  * Get all categories from database arranged by parents
  * 
  * @param mixed $categories
  * @param mixed $parent
  * @param mixed $indent
  * @param mixed $include_subs
  * @param mixed $exclude
  * @param mixed $order
  */
 public function categos_list(&$categories, $parent = 0, $indent = 0, $include_subs = true, $exclude = 0, $order = "id_cat DESC")
 {
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     $sql = "SELECT * FROM " . $db->prefix("shop_categories") . " WHERE parent='{$parent}' ORDER BY {$order}";
     $result = $db->query($sql);
     while ($row = $db->fetchArray($result)) {
         if ($row['id_cat'] == $exclude) {
             continue;
         }
         $row['indent'] = $indent;
         $cat = new ShopCategory();
         $cat->assignVars($row);
         $row['link'] = $cat->permalink();
         $categories[] = $row;
         if ($include_subs) {
             ShopFunctions::categos_list($categories, $row['id_cat'], $indent + 1, $include_subs, $exclude);
         }
     }
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:29,代码来源:shopfunctions.php

示例3: shop_bk_products_edit

function shop_bk_products_edit($options)
{
    $form = '</td></tr><tr><th colspan="2">' . __('Block Options', 'shop') . '</th></tr>';
    $form .= '<tr><td class="head"><strong>' . __('Listing type:', 'shop') . '</strong></td><td class="odd">';
    $form .= '<label><input type="radio" name="options[0]" value="0"' . ($options[0] == 0 ? ' checked="checked"' : '') . ' /> ' . __('Recent products', 'shop') . '</label>';
    $form .= '<label><input type="radio" name="options[0]" value="1"' . ($options[0] == 1 ? ' checked="checked"' : '') . ' /> ' . __('Random products', 'shop') . '</label></td></tr>';
    $form .= '<tr><td class="head">' . __('From category:', 'shop') . '</td><td class="odd">';
    $form .= '<select name="options[1]">';
    $form .= '<option value=""' . ($options[1] == '' ? ' selected="selected"' : '') . '>' . __('All categories', 'shop') . '</option>';
    $categories = array();
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopfunctions.php';
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopcategory.class.php';
    ShopFunctions::categos_list($categories);
    foreach ($categories as $cat) {
        $form .= '<option value="' . $cat['id_cat'] . '"' . ($options[1] == $cat['id_cat'] ? ' selected="selected"' : '') . '>' . str_repeat("&#151;", $cat['indent']) . ' ' . $cat['name'] . '</option>';
    }
    $form .= '</select></td></tr>';
    $form .= '<tr><td class="head">' . __('Number of products:', 'shop') . '</td><td class="odd">';
    $form .= '<input type="text" name="options[2]" value="' . $options['2'] . '" size="5" /></td></tr>';
    $form .= '<tr><td class="head" valign="top">' . __('Show images:', 'shop') . '</td><td class="odd">';
    $form .= '<label><input type="radio" name="options[3]" value="1"' . ($options[3] == 1 ? ' checked="checked"' : '') . ' onchange="$(\'#shop-images-options\').slideDown(\'fast\');" /> ' . __('Yes', 'shop') . '</label>';
    $form .= '<label><input type="radio" name="options[3]" value="0"' . ($options[3] == 0 ? ' checked="checked"' : '') . ' onchange="$(\'#shop-images-options\').slideUp(\'fast\');" /> ' . __('No', 'shop') . '</label>';
    $form .= '<div class="even" id="shop-images-options"' . ($options[3] == 0 ? ' style="display: none;"' : '') . '>';
    $form .= '<table border="0" style="width: auto;"><tr class="even"><td><strong>' . __('Image width:', 'shop') . '</strong></td><td>';
    $form .= '<input type="text" size="5" name="options[4]" value="' . $options[4] . '" /></td></tr>';
    $form .= '<tr class="even"><td><strong>' . __('Image height:', 'shop') . '</strong></td><td><input type="text" name="options[5]" size="5" value="' . $options[5] . '" /></tr>';
    $form .= '</table></div></tr></td>';
    $form .= '<tr><td class="head">' . __('Display mode:', 'shop') . '</td><td class="odd">';
    $form .= '<label><input type="radio" name="options[6]" value="1"' . ($options[6] == 1 ? ' checked="checked"' : '') . ' />' . __('Grid', 'shop') . '</label>';
    $form .= '<label><input type="radio" name="options[6]" value="0"' . ($options[6] == 0 ? ' checked="checked"' : '') . ' />' . __('List', 'shop') . '</label></td></tr>';
    $form .= '<tr><td class="head" valign="top">' . __('Data to show:', 'shop') . '</td><td class="odd">';
    $form .= '<label><input type="checkbox" name="options[7]" value="name"' . (in_array('name', $options) ? ' checked="checked"' : '') . ' />' . __('Product name', 'shop') . '</label><br />';
    $form .= '<label><input type="checkbox" name="options[8]" value="price"' . (in_array('price', $options) ? ' checked="checked"' : '') . ' />' . __('Product price', 'shop') . '</label><br />';
    $form .= '<label><input type="checkbox" name="options[9]" value="type"' . (in_array('type', $options) ? ' checked="checked"' : '') . ' />' . __('Product type', 'shop') . '</label><br />';
    $form .= '<label><input type="checkbox" name="options[10]" value="stock"' . (in_array('stock', $options) ? ' checked="checked"' : '') . ' />' . __('Product availability', 'shop') . '</label></td></tr>';
    $form .= '<tr><td colspan="2" style="background: #ccc; font-size: 2px;">&nbsp;';
    return $form;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:38,代码来源:shop_bk_products.php

示例4: show_new_form

/**
 * Presenta un formulario para la creación de una nueva
 * categoría para los artículos
 */
function show_new_form($edit = 1)
{
    global $xoopsModule;
    $id = rmc_server_var($_GET, 'id', 0);
    if ($id <= 0) {
        redirectMsg('categories.php', __('You must specify a valid category', 'shop'), 1);
        die;
    }
    // Cargamos la categoría
    $catego = new ShopCategory($id);
    // Si no existe entonces devolvemos un error
    if ($catego->isNew()) {
        redirectMsg('categories.php', __('Specified category not exists!', 'shop'), 1);
        die;
    }
    ShopFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . __('Edit Category', 'shop'));
    xoops_cp_header();
    $cats = array();
    ShopFunctions::categos_list($cats, 0, 0, true, $id);
    $form = new RMForm($edit ? __('Edit Category', 'shop') : __('New Category', 'shop'), 'frmNew', 'categories.php');
    $form->styles('width: 30%;', 'odd');
    $form->addElement(new RMFormText(__('Category name', 'shop'), 'name', 50, 150, $catego->getVar('name')), true);
    $form->addElement(new RMFormText(__('Category slug', 'shop'), 'shortname', '', '150', $catego->getVar('shortname', 'n')));
    $form->addElement(new RMFormTextArea(__('Category description', 'shop'), 'desc', 5, 45, $catego->getVar('description', 'e')));
    $ele = new RMFormSelect(__('Category Parent', 'shop'), 'parent');
    $ele->addOption(0, _SELECT, $catego->getVar('parent') == 0 ? 1 : 0);
    foreach ($cats as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['indent']) . ' ' . $k['name'], $catego->getVar('parent') == $k['id_cat'] ? 1 : 0);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('action', 'saveedit'));
    $form->addElement(new RMFormHidden('id', $id));
    $ele = new RMFormButtonGroup('', ' ');
    $ele->addButton('sbt', __('Update Category', 'shop'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'shop'), 'button');
    $ele->setExtra('cancel', "onclick='history.go(-1);'");
    $form->addElement($ele);
    $form->display();
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:45,代码来源:categories.php

示例5: ceil

$limit = $xoopsModuleConfig['numxpage'];
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$p = $page > 0 ? $page - 1 : $page;
$start = $num <= 0 ? 0 : $p * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url(ShopFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'page/{PAGE_NUM}/' : '?page={PAGE_NUM}'));
$xoopsTpl->assign('pagenav', $nav->render(false));
$result = $db->query("SELECT * FROM " . $db->prefix("shop_products") . " ORDER BY id_product DESC LIMIT {$start}," . $xoopsModuleConfig['recents']);
$var = 'recents';
include 'include/product-data.php';
$result = $db->query("SELECT * FROM " . $db->prefix("shop_products") . " ORDER BY hits DESC LIMIT {$start}," . $xoopsModuleConfig['populars']);
$var = 'popular';
include 'include/product-data.php';
$result = $db->query("SELECT * FROM " . $db->prefix("shop_products") . " ORDER BY RAND() LIMIT {$start}," . $xoopsModuleConfig['random']);
$var = 'random';
include 'include/product-data.php';
$categories = array();
ShopFunctions::categos_list($categories);
array_walk($categories, 'shop_dashed');
$xoopsTpl->assign('categories_list', $categories);
$xoopsTpl->assign('columns', $xoopsModuleConfig['columns']);
$xoopsTpl->assign('lang_instock', __('In stock', 'shop'));
$xoopsTpl->assign('lang_outstock', __('Out of stock', 'shop'));
$xoopsTpl->assign('lang_selcat', __('Select category...', 'shop'));
$xoopsTpl->assign('lang_popular', __('Most Desired', 'shop'));
$xoopsTpl->assign('lang_recents', __('Recent Products', 'shop'));
$xoopsTpl->assign('lang_random', __('Random Products', 'shop'));
$xoopsTpl->assign('xoops_pagetitle', $xoopsModuleConfig['modtitle']);
RMTemplate::get()->add_style('main.css', 'shop');
include 'footer.php';
开发者ID:laiello,项目名称:bitcero-modules,代码行数:31,代码来源:main.php

示例6: shop_new_product

/**
* Form to create or edit products
*
* @param int Indicates if we are editing an existing product or creating new one
*/
function shop_new_product($edit = 0)
{
    global $xoopsModuleConfig, $xoopsModule, $xoopsConfig, $xoopsSecurity;
    if ($edit) {
        $id = rmc_server_var($_REQUEST, 'id', 0);
        if ($id <= 0) {
            redirectMsg('products.php', __('You must provide a valid product ID!', 'shop'), 1);
            die;
        }
        $product = new ShopProduct($id);
        if ($product->isNew()) {
            redirectMsg('products.php', __('Specified product does not exists!', 'shop'), 1);
            die;
        }
    }
    define('RMCSUBLOCATION', 'new_product');
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? sprintf(__('Editing %s', 'shop'), $product->getVar('name')) : __('Create Product', 'shop')));
    xoops_cp_header();
    ShopFunctions::include_required_files();
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? sprintf(__('Edit "%s"', 'shop'), $product->getVar('name')) : __('Create Product', 'shop'));
    RMTemplate::get()->add_style('admin.css', 'shop');
    RMTemplate::get()->add_local_script('dashboard.js', 'shop');
    $form = new RMForm($edit ? __('Edit Product', 'shop') : __('New Product', 'shop'), 'frmProduct', 'products.php');
    $form->setExtra('enctype="multipart/form-data"');
    $form->addElement(new RMFormText(__('Name', 'shop'), 'name', 50, 200, $edit ? $product->getVar('name') : ''), true);
    $form->addElement(new RMFormEditor(__('Description', 'shop'), 'description', '100%', '250px', $edit ? $product->getVar("description", 'e') : '', $xoopsModuleConfig['editor']), true);
    $form->addElement(new RMFormText(__('Price', 'shop'), 'price', 10, 100, $edit ? $product->getVar('price') : ''));
    $form->addElement(new RMFormText(__('Buy link', 'shop'), 'buy', 50, 255, $edit ? $product->getVar('buy') : 'http://'));
    $categories = array();
    ShopFunctions::categos_list($categories);
    if ($edit) {
        $pcats = $product->get_categos();
    } else {
        $pcats = array();
    }
    $cats = new RMFormCheck('');
    foreach ($categories as $c) {
        $cats->addOption(str_repeat("&#8212;", $c['indent']) . ' ' . $c['name'], 'cats[]', $c['id_cat'], in_array($c['id_cat'], $pcats) ? 1 : 0);
    }
    $form->addElement(new RMFormLabel(__('Categories', 'shop'), '<div class="cats_field">' . $cats->render() . '</div>'));
    $ele = new RMFormRadio(__('Type', 'shop'), 'type', 1);
    $ele->addOption(__('Normal', 'shop'), 0, 1);
    $ele->addOption(__('Digital', 'shop'), 1, 0);
    $form->addElement($ele);
    unset($ele);
    $form->addElement(new RMFormYesNo(__('Available', 'shop'), 'available', 1));
    $form->addElement(new RMFormFile(__('Default image', 'shop'), 'image'));
    if ($edit && $product->getVar('image') != '') {
        $form->addElement(new RMFormLabel(__('Current Image', 'shop'), '<img src="' . XOOPS_UPLOAD_URL . '/minishop/ths/' . $product->getVar('image') . '" />'));
    }
    $metas = $edit ? $product->get_meta() : array();
    ob_start();
    include RMTemplate::get()->get_template('admin/shop_products_form.php', 'module', 'shop');
    $metas_tpl = ob_get_clean();
    $form->addElement(new RMFormLabel(__('Custom Fields', 'shop'), $metas_tpl));
    $buts = new RMFormButtonGroup('');
    $buts->addButton('cancel', __('Cancel', 'shop'), 'button', 'onclick="window.location.href=\'products.php\'"');
    $buts->addButton('sbt', $edit ? __('Save Changes', 'shop') : __('Create Product', 'shop'), 'submit');
    $form->addElement($buts);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $product->id()));
    }
    $form->display();
    xoops_cp_footer();
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:71,代码来源:products.php


注:本文中的ShopFunctions::categos_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。