本文整理汇总了PHP中PMF_Category::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Category::getChildren方法的具体用法?PHP PMF_Category::getChildren怎么用?PHP PMF_Category::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Category
的用法示例。
在下文中一共展示了PMF_Category::getChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* Build a logic sequence, for a WHERE statement, of those category IDs children of the provided category ID, if any
*
* @param $nCatid
* @param $logicOp
* @param $oCat
* @return string
* @access private
* @since 2005-11-02
* @author Matteo Scaramuccia <matteo@scaramuccia.com>
*/
function _getCatidWhereSequence($nCatid, $logicOp = 'OR', $oCat = null)
{
$sqlWherefilter = '';
if (!isset($oCat)) {
$oCat = new PMF_Category();
}
$aChildren = array_values($oCat->getChildren($nCatid));
foreach ($aChildren as $catid) {
$sqlWherefilter .= " " . $logicOp . " fcr.category_id = " . $catid;
$sqlWherefilter .= $this->_getCatidWhereSequence($catid, 'OR', $oCat);
}
return $sqlWherefilter;
}
示例2: elseif
}
if ($level < $open) {
if ($level - $open == -1) {
print '</li>';
}
print '</ul></li>';
} elseif ($level == $open) {
print '</li>';
}
if ($level > $open) {
printf('<div id="div_%d" style="display: none; filter: inherit;">', $lastCatId);
print '<ul><li>';
} else {
print '<li>';
}
if (count($category->getChildren($cat['id'])) != 0) {
// Show name and icon for expand the sub-categories
printf('<h4 class="category-header" data-category-id="%d">%s</h4> ', $cat['id'], $categoryName);
} else {
// Show just the name
printf("<h4>%s</h4> ", $categoryName);
}
if ($cat["lang"] == $lang) {
// add sub category (if current language)
printf('
<a class="btn btn-info btn-mini" href="?action=addcategory&cat=%s&lang=%s"><span title="%s" class="icon-plus-sign icon-white"></span></a> ', $cat['id'], $cat['lang'], $PMF_LANG['ad_quick_category']);
// rename (sub) category (if current language)
printf('
<a class="btn btn-info btn-mini" href="?action=editcategory&cat=%s"><span title="%s" class="icon-edit icon-white"></a> ', $cat['id'], $PMF_LANG['ad_kateg_rename']);
}
// translate category (always)
示例3: elseif
for ($i = $leveldiff; $i > 1; $i--) {
$templateVars['categoryTree'] .= '</ul></div></li>';
}
}
if ($level < $open) {
if ($level - $open == -1) {
$templateVars['categoryTree'] .= '</li>';
}
$templateVars['categoryTree'] .= '</ul></li>';
} elseif ($level == $open) {
$templateVars['categoryTree'] .= '</li>';
}
if ($level > $open) {
$templateVars['categoryTree'] .= sprintf('<div id="div_%d" style="display: none;">', $lastCatId);
$templateVars['categoryTree'] .= '<ul><li>';
} else {
$templateVars['categoryTree'] .= '<li>';
}
$templateVars['categoryTree'] .= $twig->loadTemplate('category/treeItem.twig')->render(array('PMF_LANG' => $PMF_LANG, 'id' => $cat['id'], 'addButtonUrl' => sprintf('?action=addcategory&cat=%s&lang=%s', $cat['id'], $cat['lang']), 'cutButtonUrl' => sprintf('?action=cutcategory&cat=%s', $cat['id']), 'deleteButtonUrl' => sprintf('?action=deletecategory&cat=%s&catlang=%s', $cat['id'], $cat['lang']), 'moveButtonUrl' => sprintf('?action=movecategory&cat=%s&parent_id=%s', $cat['id'], $cat['parent_id']), 'name' => $categoryName, 'renameButtonUrl' => sprintf('?action=editcategory&cat=%s', $cat['id']), 'renderAddButton' => $cat["lang"] == $lang, 'renderCutButton' => $cat["lang"] == $lang, 'renderDeleteButton' => count($category->getChildren($cat['id'])) == 0 && $cat["lang"] == $lang, 'renderMoveButton' => $cat["lang"] == $lang && $category->numParent($cat['parent_id']) > 1, 'renderRenameButton' => $cat["lang"] == $lang, 'renderToggler' => count($category->getChildren($cat['id'])) != 0, 'translateButtonUrl' => sprintf('?action=translatecategory&cat=%s', $cat['id'])));
$open = $level;
$lastCatId = $cat['id'];
}
if ($open > 0) {
$templateVars['categoryTree'] .= str_repeat("</li>\n\t</ul>\n\t", $open);
}
$templateVars['categoryTree'] .= "</li>\n</ul>";
$twig->loadTemplate('category/main.twig')->display($templateVars);
unset($templateVars, $csrfToken, $open, $level, $category, $id, $cat, $lang, $lastCatId);
} else {
require 'noperm.php';
}