本文整理汇总了PHP中OOCategory::getChildrenById方法的典型用法代码示例。如果您正苦于以下问题:PHP OOCategory::getChildrenById方法的具体用法?PHP OOCategory::getChildrenById怎么用?PHP OOCategory::getChildrenById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OOCategory
的用法示例。
在下文中一共展示了OOCategory::getChildrenById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getNavigation
function _getNavigation($category_id, $ignore_offlines = TRUE)
{
static $depth = 0;
if ($category_id < 1) {
$nav_obj = OOCategory::getRootCategories($ignore_offlines);
} else {
$nav_obj = OOCategory::getChildrenById($category_id, $ignore_offlines);
}
$return = "";
if (count($nav_obj) > 0) {
$return .= '<ul class="rex-navi' . ($depth + 1) . '">';
}
foreach ($nav_obj as $nav) {
$liClass = '';
$linkClass = '';
// classes abhaengig vom pfad
if ($nav->getId() == $this->current_category_id) {
$liClass .= ' rex-current';
$linkClass .= ' rex-current';
} elseif (in_array($nav->getId(), $this->path)) {
$liClass .= ' rex-active';
$linkClass .= ' rex-active';
} else {
$liClass .= ' rex-normal';
}
// classes abhaengig vom level
if (isset($this->classes[$depth])) {
$liClass .= ' ' . $this->classes[$depth];
}
if (isset($this->linkclasses[$depth])) {
$linkClass .= ' ' . $this->linkclasses[$depth];
}
$linkClass = $linkClass == '' ? '' : ' class="' . ltrim($linkClass) . '"';
$return .= '<li class="rex-article-' . $nav->getId() . $liClass . '">';
$return .= '<a' . $linkClass . ' href="' . $nav->getUrl() . '">' . htmlspecialchars($nav->getName()) . '</a>';
$depth++;
if (($this->open || $nav->getId() == $this->current_category_id || in_array($nav->getId(), $this->path)) && ($this->depth > $depth || $this->depth < 0)) {
$return .= $this->_getNavigation($nav->getId(), $ignore_offlines);
}
$depth--;
$return .= '</li>';
}
if (count($nav_obj) > 0) {
$return .= '</ul>';
}
return $return;
}
示例2: getChildren
function getChildren($ignore_offlines = false, $clang = false)
{
global $REX;
if ($clang === false) {
$clang = $REX['CUR_CLANG'];
}
return OOCategory::getChildrenById($this->_id, $ignore_offlines, $clang);
}
示例3: _getNavigation
protected function _getNavigation($categoryId)
{
global $REX;
static $depth = 0;
if ($categoryId < 1) {
$cats = OOCategory::getRootCategories($this->ignoreOfflines);
} else {
$cats = OOCategory::getChildrenById($categoryId, $this->ignoreOfflines);
}
$return = '';
$ulIdAttribute = '';
$ulClassAttribute = '';
if (count($cats) > 0) {
if (isset($this->ulId[$depth])) {
$ulIdAttribute = ' id="' . $this->ulId[$depth] . '"';
}
if (isset($this->ulClass[$depth])) {
$ulClassAttribute = ' class="' . $this->ulClass[$depth] . '"';
}
$return .= '<ul' . $ulIdAttribute . $ulClassAttribute . '>';
}
foreach ($cats as $cat) {
if ($this->_checkCallbacks($cat, $depth)) {
$cssClasses = '';
$idAttribute = '';
// default li class
if ($this->liClass != '') {
$cssClasses .= ' ' . $this->liClass;
}
// li class
if (is_array($this->liClassFromCategoryId) && isset($this->liClassFromCategoryId[$cat->getId()])) {
$cssClasses .= ' ' . $this->liClassFromCategoryId[$cat->getId()];
}
if ($this->liClassFromMetaField != '' && $cat->getValue($this->liClassFromMetaField) != '') {
$cssClasses .= ' ' . $cat->getValue($this->liClassFromMetaField);
}
// li id
if (is_array($this->liIdFromCategoryId) && isset($this->liIdFromCategoryId[$cat->getId()])) {
$idAttribute = ' id="' . $this->liIdFromCategoryId[$cat->getId()] . '"';
} elseif ($this->liIdFromMetaField != '' && $cat->getValue($this->liIdFromMetaField) != '') {
$idAttribute = ' id="' . $cat->getValue($this->liIdFromMetaField) . '"';
}
// selected class
if ($cat->getId() == $this->current_category_id) {
// active menuitem
$cssClasses .= ' ' . $this->activeClass;
} elseif (in_array($cat->getId(), $this->path)) {
// current menuitem
$cssClasses .= ' ' . $this->selectedClass;
} else {
// do nothing
}
$trimmedCssClasses = trim($cssClasses);
// build class attribute
if ($trimmedCssClasses != '') {
$classAttribute = ' class="' . $trimmedCssClasses . '"';
} else {
$classAttribute = '';
}
if ($this->hideWebsiteStartArticle && $cat->getId() == $REX['START_ARTICLE_ID'] || in_array($cat->getId(), $this->hideIds)) {
// do nothing
} else {
$depth++;
$urlType = 0;
// default
$return .= '<li' . $idAttribute . $classAttribute . '>';
if ($this->linkFromUserFunc != '') {
$defaultLink = call_user_func($this->linkFromUserFunc, $cat, $depth);
} else {
$defaultLink = '<a href="' . $cat->getUrl() . '">' . htmlspecialchars($cat->getName()) . '</a>';
}
if (!class_exists('seo42')) {
// normal behaviour
$return .= $defaultLink;
} else {
// only with seo42 2.0.0+
$urlData = seo42::getCustomUrlData($cat);
// check if default lang has url clone option (but only if current categoy has no url data set)
if (count($REX['CLANG']) > 1 && !isset($urlData['url_type'])) {
$defaultLangCat = OOCategory::getCategoryById($cat->getId(), $REX['START_CLANG_ID']);
$urlDataDefaultLang = seo42::getCustomUrlData($defaultLangCat);
if (isset($urlDataDefaultLang['url_clone']) && $urlDataDefaultLang['url_clone']) {
// clone url data from default language to current language
$urlData = $urlDataDefaultLang;
}
}
if (isset($urlData['url_type'])) {
switch ($urlData['url_type']) {
case 5:
// SEO42_URL_TYPE_NONE
$return .= htmlspecialchars($cat->getName());
break;
case 4:
// SEO42_URL_TYPE_LANGSWITCH
$newClangId = $urlData['clang_id'];
$newArticleId = $REX['ARTICLE_ID'];
$catNewLang = OOCategory::getCategoryById($newArticleId, $newClangId);
// if category that should be switched is not online, switch to start article of website
if (OOCategory::isValid($catNewLang) && !$catNewLang->isOnline()) {
$newArticleId = $REX['START_ARTICLE_ID'];
//.........这里部分代码省略.........
示例4: getChildren
function getChildren($ignore_offlines = false, $clang = false)
{
if ($clang === false) {
$clang = $this->_clang;
}
return OOCategory::getChildrenById($this->_id, $ignore_offlines, $clang);
}
示例5: _getNavigation
function _getNavigation($category_id, $depth = 1)
{
if ($category_id < 1) {
$nav_obj = OOCategory::getRootCategories();
} else {
$nav_obj = OOCategory::getChildrenById($category_id);
}
$lis = array();
foreach ($nav_obj as $nav) {
$li = array();
$a = array();
$li['class'] = array();
$a['class'] = array();
$a['href'] = array($nav->getUrl());
if ($this->_checkFilter($nav, $depth) && $this->_checkCallbacks($nav, $depth, $li, $a)) {
$li['class'][] = 'rex-article-' . $nav->getId();
// classes abhaengig vom pfad
if ($nav->getId() == $this->current_category_id) {
$li['class'][] = 'rex-current';
$a['class'][] = 'rex-current';
} elseif (in_array($nav->getId(), $this->path)) {
$li['class'][] = 'rex-active';
$a['class'][] = 'rex-active';
} else {
$li['class'][] = 'rex-normal';
}
if (isset($this->linkclasses[$depth - 1])) {
$a['class'][] = $this->linkclasses[$depth - 1];
}
if (isset($this->classes[$depth - 1])) {
$li['class'][] = $this->classes[$depth - 1];
}
$li_attr = array();
foreach ($li as $attr => $v) {
$li_attr[] = $attr . '="' . implode(' ', $v) . '"';
}
$a_attr = array();
foreach ($a as $attr => $v) {
$a_attr[] = $attr . '="' . implode(' ', $v) . '"';
}
$l = '<li ' . implode(' ', $li_attr) . '>';
$l .= '<a ' . implode(' ', $a_attr) . '>' . htmlspecialchars($nav->getName()) . '</a>';
$depth++;
if (($this->open || $nav->getId() == $this->current_category_id || in_array($nav->getId(), $this->path)) && ($this->max_depth >= $depth || $this->max_depth < 0)) {
$l .= $this->_getNavigation($nav->getId(), $depth);
}
$depth--;
$l .= '</li>';
$lis[] = $l;
}
}
if (count($lis) > 0) {
return '<ul class="rex-navi' . $depth . ' rex-navi-depth-' . $depth . ' rex-navi-has-' . count($lis) . '-elements">' . implode('', $lis) . '</ul>';
}
return '';
}
示例6: _getNavigation
function _getNavigation($category_id, $ignore_offlines = TRUE)
{
static $depth = 0;
if ($category_id < 1) {
$nav_obj = OOCategory::getRootCategories($ignore_offlines);
} else {
$nav_obj = OOCategory::getChildrenById($category_id, $ignore_offlines);
}
$nav_real = array();
foreach ($nav_obj as $nav) {
// Filter und Rechte prüfen
if ($this->_check($nav, $depth)) {
$nav_real[] = $nav;
}
}
$counter = 0;
$count = count($nav_real);
// $count = 4;
$return = "";
if (count($nav_real) > 0) {
$return .= '<ul class="navi-lev-' . ($depth + 1) . '">';
}
foreach ($nav_real as $nav) {
$counter++;
$liClass = '';
$linkClass = '';
if ($counter == 1) {
$liClass .= ' first';
}
if ($counter == $count) {
$liClass .= ' last';
}
// classes abhaengig vom pfad
if ($nav->getId() == $this->current_category_id) {
$liClass .= ' current';
$linkClass .= ' current';
} elseif (in_array($nav->getId(), $this->path)) {
$liClass .= ' active';
$linkClass .= ' active';
} else {
$liClass .= ' normal';
}
// classes abhaengig vom level
if (isset($this->classes[$depth])) {
$liClass .= ' ' . $this->classes[$depth];
}
if (isset($this->linkclasses[$depth])) {
$linkClass .= ' ' . $this->linkclasses[$depth];
}
$name = str_replace(' ## ', '<br />', htmlspecialchars($nav->getName()), $str_count);
if ($str_count >= 1) {
$linkClass .= ' manbreak';
}
$linkClass = $linkClass == '' ? '' : ' class="' . ltrim($linkClass) . '"';
if (isset($this->wrap_names[$depth]) && $this->wrap_names[$depth] != "") {
$wrap = explode('|', $this->wrap_names[$depth]);
$name = $wrap[0] . $name . $wrap[1];
}
$link = '<a' . $linkClass . ' href="' . $nav->getUrl() . '">' . $name . '</a>';
if (isset($this->wrap_links[$depth]) && $this->wrap_links[$depth] != "") {
$wrap = explode('|', $this->wrap_links[$depth]);
$link = $wrap[0] . $link . $wrap[1];
}
$return .= '<li class="navi-id-' . $nav->getId() . $liClass . '">' . $link;
$depth++;
if (($this->open || $nav->getId() == $this->current_category_id || in_array($nav->getId(), $this->path)) && ($this->depth > $depth || $this->depth < 0)) {
$return .= $this->_getNavigation($nav->getId(), $ignore_offlines);
}
$depth--;
$return .= '</li>';
}
if (count($nav_real) > 0) {
$return .= '</ul>';
}
return $return;
}