Thank you for your reply,
This is the content of the route.php file. If we requested it, is it possible we could pay you to write a plugin for us that sh404 would support to do what we wanted?
This isn't very widely used software so doubt there would be much demand for it from other customers but we are willing to pay if it can be done?
Kind Regards
Martin
-------------
defined('_JEXEC') or die('Restricted access');
// Stupid but idiot
jimport('joomla.application.component.helper');
$Tapp = JFactory::getApplication();
/**
* Dutch Component Route Helper
*
* @static
* @package Dutch Factory
* @subpackage Router
*/
class DutchFactoryHelperRoute
{
/**
* getSEFCatString
*
* @param $id
*
* @return mixed
*/
public static function getSEFCatString($id)
{
$catOb = DutchFactoryHelperTools::getCategoryModel();
return $catOb->getCategoryPathString($id);
}
/**
* getMenuItemByTaskName
*
* Get the Parameter Task ItemID
* if more than one menu items of same task, returns the first
*
* @param string $task_name
*
* @return int
*/
public static function getMenuItemByTaskName($task_name)
{
$database = JFactory::getDBO();
$database->setQuery("SELECT `id` FROM `#__menu` WHERE `link` LIKE '%task=$task_name%' ORDER BY `id` DESC LIMIT 0 , 1 ");
return $database->loadResult();
}
/**
* getMenuItemId
*
* Finds The Menu Item Of the Component
* by the needles as params
*
* needle example: 'view' => 'category'
*
*
* @param $needles
*
* @return null
* @internal param array $needle
*
* @since 1.5.0
*/
public static function getMenuItemId($needles)
{
$component = JComponentHelper::getComponent('com_dutchfactory');
$app = JFactory::getApplication();
$menus = $app->getMenu('site', array());
$items = $menus->getItems('component_id', $component->id);
$match = NULL;
foreach ($items as $item) {
$ok = TRUE;
foreach ($needles as $needle => $id) {
if (@$item->query[$needle] != $id) {
$ok = FALSE;
break;
}
}
if ($ok == TRUE) {
$match = $item;
break;
}
}
if (isset($match)) {
return $match->id;
} else
return NULL;
}
/**
* getItemid
*
* @param null $needles
*
* @return string
*/
public static function getItemid($needles = NULL)
{
require_once('tools.php');
$Itemid = JFactory::getApplication()->input->getInt('Itemid');
if (!$Itemid) $Itemid = DutchFactoryHelperTools::getMenuItemId($needles);
if ($Itemid) return "&Itemid=" . $Itemid;
return "";
}
/**
* getItemidByTask
*
* @param string|null $task
*
* @return bool|mixed
*/
public static function getItemidByTask($task = NULL)
{
if (!$task) {
return NULL;
}
$db = JFactory::getDbo();
$query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%{$task}%' AND `client_id` = 0";
$db->setQuery($query);
if ($db->loadResult()) {
return "&Itemid=" . $db->loadResult();
}
return "&Itemid=0";
}
/**
* getAuctionListRoute
*
* @param string|null $filters
* @param bool $xhtml
*
* @return null|string
*/
public static function getAuctionListRoute($filters = NULL, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=listauctions";
if (is_array($filters)) {
foreach ($filters as $k => $v)
$link .= "&$k=$v";
} elseif ($filters) $link .= $filters;
$link .= self::getItemid(array('task' => 'listauctions'));
return JRoute::_($link, $xhtml);
}
/**
* getUserdetailsRoute
*
* @param int|null $userid
* @param bool $xhtml
* @param string $fragment Url fragment
*
* @return null|string
*/
public static function getUserdetailsRoute($userid = NULL, $xhtml = TRUE, $fragment = '')
{
$link = "index.php?option=com_dutchfactory&task=userdetails" . ($userid ? '&id=' . $userid : '') . '#' . $fragment;
return JRoute::_($link, $xhtml);
}
/**
* getAddFundsRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getAddFundsRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=balance.addfunds" . self::getItemid(array('task' => 'userdetails'));
return JRoute::_($link, $xhtml);
}
/**
* getPaymentsHistoryRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getPaymentsHistoryRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=payments.history" . self::getItemid(array('task' => 'userdetails'));
return JRoute::_($link, $xhtml);
}
/**
* getCheckoutRoute
*
* @param int $orderid
* @param bool $xhtml
*
* @return null|string
*/
public static function getCheckoutRoute($orderid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=orderprocessor.checkout&orderid=$orderid" . self::getItemid(array('task' => 'form', 'task' => 'editauction', 'task' => 'new'));
return JRoute::_($link, $xhtml);
}
/**
* getFeaturedRoute
*
* @param int $auctionid
* @param bool $xhtml
*
* @return null|string
*/
public static function getFeaturedRoute($auctionid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=setfeatured&id=" . $auctionid . self::getItemid(array('task' => 'viewbids', 'task' => 'details'));
return JRoute::_($link, $xhtml);
}
/**
* getAuctionDetailRoute
*
* @param object $auction JTableDutchAuction
* @param bool $xhtml
*
* @return mixed
*/
public static function getAuctionDetailRoute($auction, $xhtml = TRUE)
{
return JHtml::_('auctiondetails.auctionDetailsURL', $auction, $xhtml);
}
/**
* getNewAuctionRoute
*
* @param bool $xhtml
*
* @return null|string
*/
public static function getNewAuctionRoute($xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=newauction" . self::getItemid(array('task' => 'form'));
return JRoute::_($link, $xhtml);
}
/**
* getCategoriesRoute
*
* @param int|null $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getCategoriesRoute($catid = NULL, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=listcats" . self::getItemid(array("task" => "listcats"), array("task" => "listauctions"));
if ($catid) $link .= "&cat={$catid}";
return JRoute::_($link, $xhtml);
}
/**
* getAddToCatWatchlist
*
* @param int $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getAddToCatWatchlist($catid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=addwatchcat&cat={$catid}" . self::getItemid(array('task' => 'listcats'));
return JRoute::_($link, $xhtml);
}
/**
* getDelToCatWatchlist
*
* @param int $catid
* @param bool $xhtml
*
* @return null|string
*/
public static function getDelToCatWatchlist($catid, $xhtml = TRUE)
{
$link = "index.php?option=com_dutchfactory&task=delwatchcat&cat={$catid}" . self::getItemid(array('task' => 'listcats'));
return JRoute::_($link, $xhtml);
}
/**
* getCategoryRoute
*
* @param int|null $catid
* @param string $task
* @param string|null $catslug
* @param bool $xhtml
* @param string|null $filterLetter
*
* @return null|string
*/
public static function getCategoryRoute($catid = NULL, $task = 'categories', $catslug = NULL, $xhtml = TRUE, $filterLetter = NULL)
{
$link = "index.php?option=com_dutchfactory&task={$task}" . (($catid) ? ("&cat={$catid}") : ("")) . $catslug . ($filterLetter ? '&filter_letter=' . $filterLetter : '');
return JRoute::_($link, $xhtml);
}
/**
* getUserRatingsRoute
*
* @static
*
* @param int|null $userid
*
* @return string
*/
public static function getUserRatingsRoute($userid = NULL)
{
if ($userid)
$link = "index.php?option=" . APP_EXTENSION . "&task=userratings&id={$userid}" . self::getItemid(array('task' => 'UserProfile'));
else
$link = "index.php?option=" . APP_EXTENSION . "&task=myratings" . self::getItemid(array('task' => 'userdetails'));
return JRoute::_($link);
}
}