WDC
"myXOOPs"-Profi
Gepostet am:13.04.2021 11:29
#1
public function getURL($uid, $num, $pos, $view)
{
$helper = Helper::getInstance();
$moduleDirName = basename(dirname(__DIR__));
/** @var XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
/** @var XoopsConfigHandler $configHandler */
$configHandler = xoops_getHandler('config');
if (!isset($GLOBALS['screenshotsModule'])) {
$GLOBALS['screenshotsModule'] = $moduleHandler->getByDirname($moduleDirName);
}
// if (!isset($GLOBALS['screenshotsModuleConfig'])) {
// $GLOBALS['screenshotsModuleConfig'] = $configHandler->getConfigList($GLOBALS['screenshotsModule']->getVar('mid'));
// }
if ($helper->getConfig('htaccess')) {
return XOOPS_URL . '/' . $helper->getConfig('baseurl') . '/' . str_replace(
[
'_',
' ',
')',
'(',
'&',
'#',
'[/de]',
'[/en]',
'[/fr]',
'[',
']',
'--',
],
'-',
$this->getVar('title')
) . '/cat,' . $this->getVar('cid') . ',' . $uid . ',' . $num . ',' . $pos . ',' . $view . $helper->getConfig('endofurl');
}
return Helper::getInstance()->url() . 'viewcat.php?cid=' . $this->getVar('cid') . '&uid=' . $uid . '&num=' . $num . '&pos=' . $pos . '&view=' . $view;
}
/** @var XoopsModulesWggalleryHelper $helper */
$helper = Helper::getInstance();
$albumsHandler = $helper->getHandler('Category');
$crAlbums = new CriteriaCompo();
$crAlbums->add(new Criteria('cid', $cid));
$crAlbums = new CriteriaCompo();
$crAlbums->add(new Criteria('cid', $cid));
function getParentsOfCategory($cid)
{
$parentsAll = [];
/** @var XoopsModulesWggalleryHelper $helper */
$helper = Helper::getInstance();
$albumsHandler = $helper->getHandler('Category');
$crAlbums = new CriteriaCompo();
$crAlbums->add(new Criteria('cid', $cid));
$albumsCount = $albumsHandler->getCount($crAlbums);
$albumsAll = $albumsHandler->getAll($crAlbums);
// Table view albums
if ($albumsCount > 0) {
foreach (array_keys($albumsAll) as $i) {
$parentsAll[] = ['cid' => $albumsAll[$i]->getVar('cid'), 'title' => $albumsAll[$i]->getVar('title'), 'pid' => $albumsAll[$i]->getVar('pid')];
$parent = getParentsOfCategory($albumsAll[$i]->getVar('pid'));
if ($parent) {
$parentsAll[] = $parent;
}
}
}
return $parentsAll;
}
// Parent Kategorien
$xoBreadcrumbs[] = ['title' => $parentsAll];
foreach ($GLOBALS['cattree']->getAllChild($cid) as $child) {
$cids[$child->getVar('cid')] = $child->getVar('cid');
}
$cids[] = $cid;
$criteria = new CriteriaCompo(new Criteria('status', '0', '>'));
$photo_total_sum = Utility::getTotalCount($cids, $criteria);
if (!empty($cids)) {
foreach ($cids as $index => $child) {
$childcat = $catHandler->get($child);
if (is_object($childcat)) {
$catpath .= "<a href='" . $helper->url() . 'viewcat.php?num=' . (int)$GLOBALS['merchandise_perpage'] . '&cid=' . $childcat->getVar('cid') . "' >" . $childcat->getVar('title') . '</a> ' . ($index < count($cids) ? '>>' : '');
}
}
} else {
$cat = $catHandler->get($cid);
$catpath .= "<a href='" . $helper->url() . 'viewcat.php?num=' . (int)$GLOBALS['merchandise_perpage'] . '&cid=' . $cat->getVar('cid') . "' >" . $cat->getVar('title') . '</a>';
}
/**
* Get all parents of a category
* @param $albPid
* @return string
*/
function getParentsOfCategory($cat)
{
$parentsAll = [];
/** @var XoopsModulesWggalleryHelper $helper */
$helper = XoopsModulesWggalleryHelper::getInstance();
$albumsHandler = $helper->getHandler('Category');
$crAlbums = new CriteriaCompo();
$crAlbums->add(new Criteria('cid', $cid));
$albumsCount = $albumsHandler->getCount($crAlbums);
$albumsAll = $albumsHandler->getAll($crAlbums);
// Table view albums
if ($albumsCount > 0) {
foreach (array_keys($albumsAll) as $i) {
$parentsAll[] = ['cid' => $albumsAll[$i]->getVar('cid'), 'title' => $albumsAll[$i]->getVar('title'), 'pid' => $albumsAll[$i]->getVar('pid')];
$parent = getParentsOfCategory($albumsAll[$i]->getVar('pid'));
if ($parent) {
$parentsAll[] = $parent;
}
}
}
return $parentsAll;
}
Goffy schrieb:
Hi
Zitat:Na das wird ja was
super![]()
den Modulnamen solltest du über$GLOBALS['xoopsModule']->getVar('name');
erhalten
Goffy schrieb:wegen Namen der aktuellen Kategorie:
da musst du mal die Variablen checken, die du auf der Seite verwendest, ob da die übergeordnete Kategorie irgendwo drin ist.
ansonsten müsstest du die Parent-Id zur aktuellen Kategorie abfragen
$xoBreadcrumbs = [];
//Link hinzufügen
$xoBreadcrumbs[] = ['title' => $childcat->getVar('title'), 'link' => "$mod_url/viewcat.php?cid=$cid" ];
// Element ohne Link hinzufügen
$xoBreadcrumbs[] = ['title' => 'Mein Linktitelc 2'];
if (count($xoBreadcrumbs) > 1) {
$GLOBALS['xoopsTpl']->assign('xoBreadcrumbs', $xoBreadcrumbs);
}
Forum | Thema | Antworten | Views | Letzter Beitrag |
---|---|---|---|---|
sonstige Module | wgGallery und wgSitenotice | 0 | 707 | 29.12.2021 21:15 Goffy ![]() |
sonstige Module | wgTeams und wgTimelines | 0 | 713 | 29.12.2021 20:33 Goffy ![]() |
OffOffTopic | Frohe Weihnachten und Prosit 2022 | 0 | 766 | 22.12.2021 11:11 Goffy ![]() |
XOOPS-Themes u. Grafik für XOOPS 2.3 | Publisher New Theme | 1 | 1373 | 30.11.2021 17:27 Goffy ![]() |