public static
getImageRoute
(mixed $id, mixed $catid = 0, mixed $idAlias = '', mixed $catidAlias = '', mixed $type = 'detail', mixed $suffix = '')
public static function getImageRoute($id, $catid = 0, $idAlias = '', $catidAlias = '', $type = 'detail', $suffix = '')
{
// TEST SOLUTION
$app = Factory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$option = $app->input->get('option', '', 'string');
$activeId = 0;
$notCheckId = 0;
if (isset($active->id)) {
$activeId = $active->id;
}
if ((int) $activeId > 0 && $option == 'com_phocagallery') {
$needles = array('detail' => (int) $id, 'category' => (int) $catid, 'categories' => (int) $activeId);
$notCheckId = 1;
} else {
$needles = array('detail' => (int) $id, 'category' => (int) $catid, 'categories' => '');
$notCheckId = 0;
}
if ($idAlias != '') {
$id = $id . ':' . $idAlias;
}
if ($catidAlias != '') {
$catid = $catid . ':' . $catidAlias;
}
//Create the link
switch ($type) {
case 'detail':
$link = 'index.php?option=com_phocagallery&view=detail&catid=' . $catid . '&id=' . $id;
break;
default:
$link = '';
break;
}
if ($item = PhocaGalleryRoute::_findItem($needles, $notCheckId)) {
if (isset($item->id) && (int) $item->id > 0) {
$link .= '&Itemid=' . $item->id;
}
}
if ($suffix != '') {
$link .= '&' . $suffix;
}
return $link;
}