本文整理汇总了PHP中CMSCategory::hideCMSCategoryPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory::hideCMSCategoryPosition方法的具体用法?PHP CMSCategory::hideCMSCategoryPosition怎么用?PHP CMSCategory::hideCMSCategoryPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSCategory
的用法示例。
在下文中一共展示了CMSCategory::hideCMSCategoryPosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($token = NULL)
{
global $currentIndex, $cookie;
$id_cms_category = (int) Tools::getValue('id_cms_category', 1);
$this->getList((int) $cookie->id_lang, !$cookie->__get($this->table . 'Orderby') ? 'position' : NULL, !$cookie->__get($this->table . 'Orderway') ? 'ASC' : NULL);
echo '<h3>' . (!$this->_listTotal ? $this->l('There are no subcategories') : $this->_listTotal . ' ' . ($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subCMS Category'))) . ' ' . $this->l('in CMS Category') . ' "' . stripslashes(CMSCategory::hideCMSCategoryPosition($this->_CMSCategory->getName())) . '"</h3>';
echo '<a href="' . __PS_BASE_URI__ . substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)) . '?tab=AdminCMSContent&add' . $this->table . '&id_parent=' . Tools::getValue('id_cms_category') . '&token=' . ($token != NULL ? $token : $this->token) . '"><img src="../img/admin/add.gif" border="0" /> ' . $this->l('Add a new sub CMS Category') . '</a>
<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
}
示例2: menuCMSCategory
private function menuCMSCategory($categories, $current, $id_cms_category = 1, $id_selected = 1, $is_html = 0, $pref_value = '')
{
$html = '<option value="' . $pref_value . $id_cms_category . '"' . ($id_selected == $id_cms_category ? ' selected="selected"' : '') . '><div>' . str_repeat(' ', $current['infos']['level_depth'] * 5) . CMSCategory::hideCMSCategoryPosition(stripslashes($current['infos']['name'])) . '</div></option>';
if ($is_html == 0) {
echo $html;
}
if (isset($categories[$id_cms_category])) {
foreach (array_keys($categories[$id_cms_category]) as $key) {
$html .= $this->menuCMSCategory($categories, $categories[$id_cms_category][$key], $key, $id_selected, $is_html, $pref_value);
}
}
return $html;
}
示例3: getPath
/**
* Return path to a product category
*
* @param string $urlBase Start URL
* @param integer $id_category Start category
* @param string $path Current path
* @param string $highlight String to highlight (in XHTML/CSS)
* @param string $type Category type (products/cms)
*/
function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryType = 'catalog')
{
global $cookie;
if ($categoryType == 'catalog') {
$category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright
FROM ' . _DB_PREFIX_ . 'category
WHERE id_category = ' . (int) $id_category);
if (isset($category['id_category'])) {
$categories = Db::getInstance()->ExecuteS('
SELECT c.id_category, cl.name, cl.link_rewrite
FROM ' . _DB_PREFIX_ . 'category c
LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = c.id_category)
WHERE c.nleft <= ' . (int) $category['nleft'] . ' AND c.nright >= ' . (int) $category['nright'] . ' AND cl.id_lang = ' . (int) $cookie->id_lang . '
ORDER BY c.level_depth ASC
LIMIT ' . (int) ($category['level_depth'] + 1));
$fullPath = '';
$n = 1;
$nCategories = (int) sizeof($categories);
foreach ($categories as $category) {
$edit = '<a href="' . $urlBase . '&id_category=' . (int) $category['id_category'] . '&' . ($category['id_category'] == 1 ? 'viewcategory' : 'addcategory') . '&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" title="' . ($category['id_category'] == 1 ? 'Home' : 'Modify') . '"><img src="../img/admin/' . ($category['id_category'] == 1 ? 'home' : 'edit') . '.gif" alt="" /></a> ';
$fullPath .= $edit . ($n < $nCategories ? '<a href="' . $urlBase . '&id_category=' . (int) $category['id_category'] . '&viewcategory&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '" title="' . htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . '">' : '') . (!empty($highlight) ? str_ireplace($highlight, '<span class="highlight">' . htmlentities($highlight, ENT_NOQUOTES, 'UTF-8') . '</span>', $category['name']) : $category['name']) . ($n < $nCategories ? '</a>' : '') . (($n++ != $nCategories or !empty($path)) ? ' > ' : '');
}
return $fullPath . $path;
}
} elseif ($categoryType == 'cms') {
$category = new CMSCategory($id_category, (int) $cookie->id_lang);
if (!$category->id) {
return $path;
}
$name = $highlight != NULL ? str_ireplace($highlight, '<span class="highlight">' . $highlight . '</span>', CMSCategory::hideCMSCategoryPosition($category->name)) : CMSCategory::hideCMSCategoryPosition($category->name);
$edit = '<a href="' . $urlBase . '&id_cms_category=' . $category->id . '&addcategory&token=' . Tools::getAdminToken('AdminCMSContent' . (int) Tab::getIdFromClassName('AdminCMSContent') . (int) $cookie->id_employee) . '">
<img src="../img/admin/edit.gif" alt="Modify" /></a> ';
if ($category->id == 1) {
$edit = '<a href="' . $urlBase . '&id_cms_category=' . $category->id . '&viewcategory&token=' . Tools::getAdminToken('AdminCMSContent' . (int) Tab::getIdFromClassName('AdminCMSContent') . (int) $cookie->id_employee) . '">
<img src="../img/admin/home.gif" alt="Home" /></a> ';
}
$path = $edit . '<a href="' . $urlBase . '&id_cms_category=' . $category->id . '&viewcategory&token=' . Tools::getAdminToken('AdminCMSContent' . (int) Tab::getIdFromClassName('AdminCMSContent') . (int) $cookie->id_employee) . '">
' . $name . '</a> > ' . $path;
if ($category->id == 1) {
return substr($path, 0, strlen($path) - 3);
}
return getPath($urlBase, $category->id_parent, $path, '', 'cms');
}
}
示例4: getPath
/**
* Return path to a product category
*
* @param string $urlBase Start URL
* @param integer $id_category Start category
* @param string $path Current path
* @param string $highlight String to highlight (in XHTML/CSS)
* @param string $type Category type (products/cms)
*/
function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryType = 'catalog', $home = false)
{
$context = Context::getContext();
if ($categoryType == 'catalog') {
$category = Db::getInstance()->getRow('
SELECT id_category, level_depth, nleft, nright
FROM ' . _DB_PREFIX_ . 'category
WHERE id_category = ' . (int) $id_category);
if (isset($category['id_category'])) {
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
FROM ' . _DB_PREFIX_ . 'category c
LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = c.id_category' . Shop::addSqlRestrictionOnLang('cl') . ')
WHERE c.nleft <= ' . (int) $category['nleft'] . '
AND c.nright >= ' . (int) $category['nright'] . '
AND cl.id_lang = ' . (int) $context->language->id . ($home ? ' AND c.id_category=' . $id_category : '') . '
AND c.id_category != ' . (int) Category::getTopCategory()->id . '
GROUP BY c.id_category
ORDER BY c.level_depth ASC
LIMIT ' . (!$home ? (int) ($category['level_depth'] + 1) : 1);
$categories = Db::getInstance()->executeS($sql);
$fullPath = '';
$n = 1;
$nCategories = (int) sizeof($categories);
foreach ($categories as $category) {
$link = Context::getContext()->link->getAdminLink('AdminCategories');
$edit = '<a href="' . $link . '&id_category=' . (int) $category['id_category'] . '&' . ($category['id_category'] == 1 || $home ? 'viewcategory' : 'updatecategory') . '" title="' . ($category['id_category'] == Category::getRootCategory()->id_category ? 'Home' : 'Modify') . '"><i class="icon-' . ($category['id_category'] == Category::getRootCategory()->id_category || $home ? 'home' : 'pencil') . '"></i></a> ';
$fullPath .= $edit . ($n < $nCategories ? '<a href="' . $urlBase . '&id_category=' . (int) $category['id_category'] . '&viewcategory&token=' . Tools::getAdminToken('AdminCategories' . (int) Tab::getIdFromClassName('AdminCategories') . (int) $context->employee->id) . '" title="' . htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . '">' : '') . (!empty($highlight) ? str_ireplace($highlight, '<span class="highlight">' . htmlentities($highlight, ENT_NOQUOTES, 'UTF-8') . '</span>', $category['name']) : $category['name']) . ($n < $nCategories ? '</a>' : '') . ($n++ != $nCategories || !empty($path) ? ' > ' : '');
}
return $fullPath . $path;
}
} elseif ($categoryType == 'cms') {
$category = new CMSCategory($id_category, $context->language->id);
if (!$category->id) {
return $path;
}
$name = $highlight != null ? str_ireplace($highlight, '<span class="highlight">' . $highlight . '</span>', CMSCategory::hideCMSCategoryPosition($category->name)) : CMSCategory::hideCMSCategoryPosition($category->name);
$edit = '<a href="' . $urlBase . '&id_cms_category=' . $category->id . '&addcategory&token=' . Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) $context->employee->id) . '">
<i class="icon-pencil"></i></a> ';
if ($category->id == 1) {
$edit = '<li><a href="' . $urlBase . '&id_cms_category=' . $category->id . '&viewcategory&token=' . Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) $context->employee->id) . '">
<i class="icon-home"></i></a></li> ';
}
$path = $edit . '<li><a href="' . $urlBase . '&id_cms_category=' . $category->id . '&viewcategory&token=' . Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) $context->employee->id) . '">
' . $name . '</a></li> > ' . $path;
if ($category->id == 1) {
return substr($path, 0, strlen($path) - 3);
}
return getPath($urlBase, $category->id_parent, $path, '', 'cms');
}
}
示例5: getChildren
public static function getChildren($id_parent, $id_lang, $active = true)
{
if (!Validate::isBool($active)) {
die(Tools::displayError());
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT c.`id_cms_category`, cl.`name`, cl.`link_rewrite`
FROM `' . _DB_PREFIX_ . 'cms_category` c
LEFT JOIN `' . _DB_PREFIX_ . 'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
WHERE `id_lang` = ' . (int) $id_lang . '
AND c.`id_parent` = ' . (int) $id_parent . '
' . ($active ? 'AND `active` = 1' : '') . '
ORDER BY `name` ASC');
// Modify SQL result
$results_array = array();
foreach ($result as $row) {
$row['name'] = CMSCategory::hideCMSCategoryPosition($row['name']);
$results_array[] = $row;
}
return $results_array;
}
示例6: display
public function display($token = NULL)
{
global $currentIndex, $cookie;
if ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
$currentIndex .= '&id_cms_category=' . $id_cms_category;
}
$this->getList((int) $cookie->id_lang, !$cookie->__get($this->table . 'Orderby') ? 'position' : NULL, !$cookie->__get($this->table . 'Orderway') ? 'ASC' : NULL);
//$this->getList((int)($cookie->id_lang));
if (!$id_cms_category) {
$id_cms_category = 1;
}
echo '<h3>' . (!$this->_listTotal ? $this->l('No pages found') : $this->_listTotal . ' ' . ($this->_listTotal > 1 ? $this->l('pages') : $this->l('page'))) . ' ' . $this->l('in category') . ' "' . stripslashes(CMSCategory::hideCMSCategoryPosition($this->_category->getName())) . '"</h3>';
echo '<a href="' . $currentIndex . '&id_cms_category=' . $id_cms_category . '&add' . $this->table . '&token=' . Tools::getAdminTokenLite('AdminCMSContent') . '"><img src="../img/admin/add.gif" border="0" /> ' . $this->l('Add a new page') . '</a>
<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
}
示例7: getChildren
public static function getChildren($id_parent, $id_lang, $active = true)
{
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT c.`id_cms_category`, cl.`name`, cl.`link_rewrite`
FROM `' . _DB_PREFIX_ . 'cms_category` c
LEFT JOIN `' . _DB_PREFIX_ . 'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
WHERE `id_lang` = ' . (int) $id_lang . ' AND c.`id_parent` = ' . (int) $id_parent . '
' . ($active ? 'AND `active` = 1' : '') . '
ORDER BY `name` ASC');
/* Remove numbers from the titles */
foreach ($results as &$row) {
$row['name'] = CMSCategory::hideCMSCategoryPosition($row['name']);
}
return $results;
}