public function display() { $portal = $this->getModel()->getItem(); header('X-Portal-ID: ' . $portal->id); $doc =& JFactory::getDocument(); if ($portal->title) { $doc->setTitle($portal->title); } if ($portal->meta_keywords) { $doc->setMetaData('Keywords', $portal->meta_keywords); } if ($portal->meta_description) { $doc->setMetaData('Description', $portal->meta_description); } //TODO: Check if itemId $pathway = JFactory::getApplication()->getPathway(); if (!JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_portals&view=portal&id=' . $portal->id, true)) { $category = $this->getService('com://site/portals.model.categories')->id($portal->portals_category_id)->getItem(); if ($category->id) { $item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_portals&view=category&id=' . $category->id, true); if ($item) { $i = 0; foreach (explode('/', $item->route) as $part) { $pathway->addItem(ucfirst($part), 'index.php?Itemid=' . $item->tree[$i]); $i++; } } $pathway->addItem($portal->title); } } return parent::display(); }
function loadMultilangData($prepareElementCallback) { $languages = JLanguageHelper::getLanguages(); $app = JApplication::getInstance('site'); $menu = $app->getMenu(); $config = JFactory::getConfig(); $sef = $config->get('sef', 0); $sefRewrite = $config->get('sef_rewrite', 0); $defaultLangCode = JFactory::getLanguage()->getDefault(); $websites = array(); //$websites['*'] = $menu->getDefault('*'); // TODO add? $languageFilterEnabled = JPluginHelper::isEnabled('system', 'languagefilter'); if (!$languageFilterEnabled || $sef != '1') { // TODO check also if sef is enabled return $websites; } $oldLanguageFilterValue = $app->setLanguageFilter(true); // necessary that $menu->getDefault() works foreach ($languages as $language) { $langCode = $language->lang_code; $default = $menu->getDefault($langCode); if ($default && $default->language == $langCode) { $websites[$langCode] = $prepareElementCallback($language, $langCode, $defaultLangCode, $sefRewrite); } } $app->setLanguageFilter($oldLanguageFilterValue); return $websites; }
/** * Method to add menu's item. * * @return boolean true on success false on failure. */ function addMenuItems() { $db = JFactory::getDBO(); // Get new component id. $component = JComponentHelper::getComponent('com_community'); $component_id = 0; if (is_object($component) && isset($component->id)) { $component_id = $component->id; } $column_name = JOOMLA_MENU_NAME; $column_cid = JOOMLA_MENU_COMPONENT_ID; // Get the default menu type // 2 Joomla bugs occur in /Administrator mode // Bug 1: JFactory::getApplication('site') failed. It always return id = 'administrator'. // Bug 2: JMenu::getDefault('*') failed. JAdministrator::getLanguageFilter() doesn't exist. // If these 2 bugs are fixed, we can call the following syntax: // $defaultMenuType = JFactory::getApplication('sites')->getMenu()->getDefault()->menutype; jimport('joomla.application.application'); $defaultMenuType = JApplication::getInstance('site')->getMenu()->getDefault('workaround_joomla_bug')->menutype; $query = 'SELECT ' . $db->nameQuote('ordering') . ' ' . 'FROM ' . $db->nameQuote('#__menu') . ' ' . 'ORDER BY ' . $db->nameQuote('ordering') . ' DESC LIMIT 1'; $db->setQuery($query); $order = $db->loadResult() + 1; // Update the existing menu items. $row = JTable::getInstance('menu', 'JTable'); $row->menutype = $defaultMenuType; $row->{$column_name} = 'JomSocial'; $row->alias = 'JomSocial'; $row->link = 'index.php?option=com_community&view=frontpage'; $row->type = 'component'; $row->published = '1'; $row->{$column_cid} = $component_id; $row->ordering = $order; $row->id = null; //new item if (!JOOMLA_LEGACY_VERSION) { $row->language = '*'; } $row->check(); if (!$row->store()) { // $row->getError() return false; } //for version 1.6 only. The parent_id is not updated correctly via JTable if (!JOOMLA_LEGACY_VERSION) { $query = 'UPDATE ' . $db->nameQuote('#__menu') . ' SET `parent_id` = ' . $db->quote(1) . ', `level` = ' . $db->quote(1) . ' WHERE `id` = ' . $db->quote($row->id); $db->setQuery($query); $db->query(); if ($db->getErrorNum()) { return false; } } if (!addDefaultToolbarMenus()) { return false; } // update memu items with component id if (!updateMenuItems()) { return false; } return true; }
/** * Create a route for a document * * @param array|KObjectConfig $config * @param bool $fqr * @param bool $escape * @return string Routed URL */ public function document($config = array(), $fqr = false, $escape = true) { $config = new KObjectConfigJson($config); $config->append(array('admin_link' => JFactory::getApplication()->isAdmin())); // Return a generic link for administrator if ($config->admin_link) { return $this->entity($config); } unset($config->admin_link); $document = $config->entity; $query = array('option' => 'com_docman', 'view' => 'document', 'alias' => $document->alias); if ($document->category_slug) { $query['category_slug'] = $document->category_slug; } if (!$config->Itemid) { $menu = JApplication::getInstance('site')->getMenu()->getActive(); if ($menu && $menu->query['view'] === 'userlist') { $query['Itemid'] = $document->itemid; } } $config->append($query); $route = $this->_getRoute($config, $fqr, $escape); $query = $route->getQuery(true); if (isset($query['view']) && $query['view'] === 'download') { unset($query['format']); $route->setQuery($query); } return $route; }
/** * @return mixed */ public function display() { $menu = JFactory::getApplication()->getMenu(); $lang = JFactory::getLanguage(); $category = $this->getModel()->getItem(); $category->layout = end(explode(':', $category->layout)); $this->setLayout($category->layout ? $category->layout : 'default'); header('X-Category-ID: ' . $category->id); $doc =& JFactory::getDocument(); if ($category->title) { $doc->setTitle($category->title); } if ($category->meta_keywords) { $doc->setMetaData('Keywords', $category->meta_keywords); } if ($category->meta_description) { $doc->setMetaData('Description', $category->meta_description); } if ($menu->getActive() == $menu->getDefault($lang->getTag()) || !$menu->getActive()) { $pathway = JFactory::getApplication()->getPathway(); if (!JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_makundi&view=category&id=' . $category->id, true)) { foreach ($category->getAncestors(array('level' => 1)) as $ancestor) { $item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_makundi&view=category&id=' . $ancestor->id, true); if ($item) { $i = 0; foreach (explode('/', $item->route) as $part) { $pathway->addItem(ucfirst($part), 'index.php?Itemid=' . $item->tree[$i]); $i++; } } else { if (!JSite::getMenu()->getActive()->id) { $pathway->addItem($ancestor->title, JRoute::_('index.php?option=com_makundi&view=category&parent_slug_path=' . $ancestor->parent_slug_path . '&slug=' . $ancestor->slug)); } } } $pathway->addItem($category->title); } } $descendants = array(); $descendants[] = $category->id; $config = new KConfig(); if ($params = $menu->getActive()->params) { $config->append($params->toArray()); } if ($config->show_subcategories) { $descendants = array_merge($descendants, $category->getDescendants(array('level' => 1))->getColumn('id')); } $config->append(array('show_description' => 1, 'show_articles' => 1)); // TODO: Set the limit default limit inside $category so we can make this more flexable. $limit = $this->getModel()->getState()->limit; if (!$limit) { $this->getModel()->getState()->limit = $config->limit; } else { $this->getModel()->getState()->limit = 4; } $this->assign('params', $config); $this->assign('parent', $this->getModel()->getItem()->getParent()); $this->assign('descendants', $descendants); return parent::display(); }
/** * Returns an array of component pages. * * Each page includes a children property that contains a list of all categories reachable by the page * * @return array */ protected function _getPages() { if (!self::$_pages) { $component = JComponentHelper::getComponent('com_'.$this->getIdentifier()->package); $items = JApplication::getInstance('site')->getMenu()->getItems('component_id', $component->id); foreach ($items as $item) { $item = clone $item; $item->children = array(); self::$_pages[$item->id] = $item; } foreach (self::$_pages as &$item) { // Assign categories and their children to pages if ($item->query['view'] === 'list') { $item->children = $this->_getCategoryChildren($item->query['slug']); } } unset($item); } return self::$_pages; }
public function display($tpl = null) { Model::addIncludePath(JPATH_BASE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_menus' . DIRECTORY_SEPARATOR . 'models'); $model = Model::getInstance('Menus', 'MenusModel'); $this->menutypes = $model->getItems(); $this->menu = JApplication::getInstance('site')->getMenu(); parent::display($tpl); }
function __construct($txt = null, $path = null) { $this->loadExtension(); if (!$this->_id) { $jApp =& JApplication::getInstance(); $jApp->redirect('index2.php', JText::_('ERR_XMLLOADFAIL'), 'error'); } self::$_instance = $this; }
/** * Get a application object * * Returns the global {@link JApplication} object, only creating it * if it doesn't already exist. * * @param mixed $id A client identifier or name. * @param array $config An optional associative array of configuration settings. * @param string $prefix application prefix * * @return JApplication object */ public static function getApplication($id = null, $config = array(), $prefix = 'J') { if (!self::$application) { jimport('joomla.application.application'); if (!$id) { JError::raiseError(500, 'Application Instantiation Error'); } self::$application = JApplication::getInstance($id, $config, $prefix); } return self::$application; }
/** * Check if guest can access menu item * * @param object $menuItem * @return boolean TRUE if guest can access */ public static function guestCanAccess($menuItem) { $app = JApplication::getInstance('site'); $menu = $app->getMenu('site')->getItem($menuItem->id); $isInternal = JURI::isInternal($menuItem->flink); $canAccess = is_object($menu) ? in_array((int) $menu->access, JFactory::getUser(0)->getAuthorisedViewLevels()) : false; if ($isInternal && $canAccess || ($menuItem->type = 'url')) { return true; } else { return false; } }
/** * Get a application object * * Returns a reference to the global {@link JApplication} object, only creating it * if it doesn't already exist. * * @access public * @param mixed $id A client identifier or name. * @param array $config An optional associative array of configuration settings. * @return object JApplication */ public static function &getApplication($id = null, $config = array(), $prefix = 'J') { static $instance; if (!is_object($instance)) { jimport('joomla.application.application'); if (!$id) { JError::raiseError(500, 'Application Instantiation Error'); } $instance = JApplication::getInstance($id, $config, $prefix); } return $instance; }
/** * Class constructor. * * @param array $options The class options. * * @since 1.5 */ public function __construct($options = array()) { $this->_pathway = array(); $app = JApplication::getInstance('site'); $menu = $app->getMenu(); $lang = JFactory::getLanguage(); if ($item = $menu->getActive()) { $menus = $menu->getMenu(); // Look for the home menu if (JLanguageMultilang::isEnabled()) { $home = $menu->getDefault($lang->getTag()); } else { $home = $menu->getDefault(); } if (is_object($home) && $item->id != $home->id) { foreach ($item->tree as $menupath) { $url = ''; $link = $menu->getItem($menupath); switch ($link->type) { case 'separator': case 'heading': $url = null; break; case 'url': if (strpos($link->link, 'index.php?') === 0 && strpos($link->link, 'Itemid=') === false) { // If this is an internal Joomla link, ensure the Itemid is set. $url = $link->link . '&Itemid=' . $link->id; } else { $url = $link->link; } break; case 'alias': // If this is an alias use the item id stored in the parameters to make the link. $url = 'index.php?Itemid=' . $link->params->get('aliasoptions'); break; default: $router = $app::getRouter(); if ($router->getMode() == JROUTER_MODE_SEF) { $url = 'index.php?Itemid=' . $link->id; } else { $url .= $link->link . '&Itemid=' . $link->id; } break; } $this->addItem($menus[$menupath]->title, $url); } } } }
function repeat_emails_get_article($contentTemplate) { require_once COM_FABRIK_BASE . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'query.php'; JModel::addIncludePath(COM_FABRIK_BASE . 'components' . DS . 'com_content' . DS . 'models'); $articleModel = JModel::getInstance('Article', 'ContentModel'); // $$$ rob when sending from admin we need to alter $mainframe to be the //front end application otherwise com_content errors out trying to create //the article global $mainframe; $origMainframe = $mainframe; jimport('joomla.application.application'); $mainframe = JApplication::getInstance('site', array(), 'J'); $res = $articleModel->getItem($contentTemplate); $mainframe = $origMainframe; return $res->introtext . " " . $res->fulltext; }
/** * Checks an Itemid whether it is related to the gallery view. * If not, an Itemid which is related to the gallery view is * returned, if found. * * @param int $Itemid The Itemid to check * @return int/boolean Found Itemid, false if correct Itemid was not found or passed Itemid is correct * @since 1.5.5 */ public static function checkItemid($Itemid) { $mainframe = JApplication::getInstance('site'); $menu = $mainframe->getMenu(); $menuItem = $menu->getItem($Itemid); if (!isset($menuItem->query['view']) || $menuItem->query['view'] == 'gallery') { return false; } $db = JFactory::getDBO(); $query = $db->getQuery(true)->select('id')->from('#__menu')->where('link LIKE ' . $db->quote('%option=com_joomgallery&view=gallery%')); $db->setQuery($query); $Itemid = intval($db->loadResult()); if ($Itemid) { return $Itemid; } return false; }
/** * Returns an array of component pages. * * Each page includes a children property that contains a list of all categories reachable by the page * * @return array */ protected function _getPages() { if (!self::$_pages) { $component = JComponentHelper::getComponent('com_' . $this->getIdentifier()->package); $attributes = array('component_id'); $values = array($component->id); if ($this->getState()->language !== null) { $attributes[] = 'language'; if ($this->getState()->language === 'all') { $values[] = JFactory::getDbo()->setQuery('SELECT DISTINCT language FROM #__menu')->loadColumn(); } else { $values[] = $this->getState()->language; } } $items = JApplication::getInstance('site')->getMenu()->getItems($attributes, $values); foreach ($items as $item) { $item = clone $item; $item->children = array(); if ($item->language === '*') { $item->language = ''; } self::$_pages[$item->id] = $item; } foreach (self::$_pages as &$item) { // Assign categories and their children to pages if (isset($item->query['view']) && $item->query['view'] === 'list' && isset($item->query['slug'])) { $item->children = $this->_getCategoryChildren($item->query['slug']); } } unset($item); } return self::$_pages; }
/** * @return void */ public function menuitems() { // Check for request forgeries. //JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Get items to remove from the request. $cid = JRequest::getVar('cid', array(), '', 'array'); if (!is_array($cid) || count($cid) < 1) { die(JText::_('COM_STATICCONTENT_NO_MENU_ITEMS_SELECTED')); } else { $site = JApplication::getInstance('site'); $menuItems = array(); foreach ($cid as $mid) { $menuItems[] = $site->getMenu()->getItem($mid); } } $this->export($menuItems); }
function com_k2_get_url(&$article, $isNew) { $url = null; $helperPath = dirname(__FILE__) . "/../../../../../components/com_k2/helpers/route.php"; if (is_file($helperPath)) { require_once $helperPath; $helper = new K2HelperRoute(); $url = $helper->getItemRoute($article->id, $article->catid); $app = JApplication::getInstance('site'); $router =& $app->getRouter(); $uri = $router->build($url); $url = $uri->toString(); if (strpos($url, "/administrator") === 0) { $url = substr($url, strlen("/administrator")); } } return $url; }
function com_content_get_url(&$article, $isNew) { $url = null; if ($article->state == 1) { $slug = $article->alias ? $article->id . ":" . $article->alias : $article->id; $app = JApplication::getInstance('site'); $router =& $app->getRouter(); if (!class_exists('ContentHelperRoute')) { JLoader::import('components.com_content.helpers.route', JPATH_SITE); } $uri = $router->build(ContentHelperRoute::getArticleRoute($slug, $article->catid, $article->sectionid)); $url = $uri->toString(); if (strpos($url, "/administrator") === 0) { $url = substr($url, strlen("/administrator")); } } return $url; }
public function display() { $article = $this->getModel()->getItem(); $layout = end(explode(':', $article->layout)); $this->setLayout($layout ? $layout : 'default'); $menu = JFactory::getApplication()->getMenu(); header('X-Article-ID: ' . $article->id); $doc =& JFactory::getDocument(); if ($article->title) { $doc->setTitle($article->title); } if ($article->meta_keywords) { $doc->setMetaData('Keywords', $article->meta_keywords); } if ($article->meta_description) { $doc->setMetaData('Description', $article->meta_description); } $pathway = JFactory::getApplication()->getPathway(); $itemid = JRequest::getVar('Itemid'); $menu_item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_articles&view=article&id=' . $article->id, true); if (!$itemid) { if (!$menu_item) { if ($article->category instanceof KDatabaseRowDefault) { $category = $article->category; $item = JApplication::getInstance('site')->getMenu()->getItems('link', 'index.php?option=com_makundi&view=category&id=' . $category->id, true); if ($item) { $i = 0; foreach (explode('/', $item->route) as $part) { $pathway->addItem(ucfirst($part), 'index.php?Itemid=' . $item->tree[$i]); $i++; } } else { if (!JSite::getMenu()->getActive()->id) { $pathway->addItem($category->title, JRoute::_('index.php?option=com_makundi&view=category&parent_slug_path=' . $category->parent_slug_path . '&slug=' . $category->slug)); } } $pathway->addItem($article->title); } } } elseif ($itemid != $menu_item->id) { $pathway->addItem($article->title); } return parent::display(); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JApplication::getInstance('administrator'); // Load the filter state. $filter_form_type = $app->getUserStateFromRequest($this->context . '.filter.form_type', 'filter_form_type'); $this->setState('filter.form_type', $filter_form_type); $filter_start_date = $app->getUserStateFromRequest($this->context . '.filter.start_date', 'filter_start_date'); $this->setState('filter.start_date', $filter_start_date); $filter_end_date = $app->getUserStateFromRequest($this->context . '.filter.end_date', 'filter_end_date'); $this->setState('filter.end_date', $filter_end_date); // Load the parameters. $params = JComponentHelper::getParams('com_jem'); $this->setState('params', $params); // List state information. parent::populateState('a.first_name', 'asc'); }
public function getTemplate() { global $mainframe; $session = & JFactory::getSession(); $template = null; if (!$mainframe->isAdmin()) { $app = &JApplication::getInstance('site', array(), 'J'); $template = $app->getTemplate(); } else { if (array_key_exists('cid', $_REQUEST)) { $template = $_REQUEST['cid'][0]; } else { $template = $session->get('humrum-current-template'); } } $session->set('humrum-current-template', $template); return $template; }
/** * Builds a URL from a query object * * @param array $query query object * * @return array */ function TodoBuildRoute(&$query) { $segments = array(); if (!isset($query['Itemid'])) { $component = JComponentHelper::getComponent('com_todo'); $attributes = array('component_id'); $values = array($component->id); $items = JApplication::getInstance('site')->getMenu()->getItems($attributes, $values); if (count($items)) { $query['Itemid'] = $items[0]->id; } } if (isset($query['view'])) { $segments[] = $query['view']; unset($query['view']); } if (isset($query['id'])) { $segments[] = $query['id']; unset($query['id']); } return $segments; }
/** * Method to get the field option groups. * * @return array The field option objects as a nested array in groups. * * @since 1.6 */ protected function getGroups() { $this->filterAttribute = (string) $this->element['filter_attribute']; $this->filterValue = (string) $this->element['filter_value']; $groups = parent::getGroups(); if ($this->filterAttribute && $this->filterValue) { $application = JApplication::getInstance('site'); $menu = $application->getMenu(); $items = $menu->getItems($this->filterAttribute, $this->filterValue); $enabled = array('', '0'); foreach ($items as $item) { $enabled[] = $item->id; } foreach ($groups as $options) { foreach ($options as $option) { if (!in_array($option->value, $enabled)) { $option->disable = true; } } } } return $groups; }
protected function _getURL($url) { // Get the router. $router = JApplication::getInstance('site')->getRouter(); // Make sure that we have our router if (!$router) { return null; } if (strpos($url, '&') !== 0 && strpos($url, 'index.php') !== 0) { return $url; } // Build route. $uri = $router->build($url); $url = $uri->toString(); if (strpos(JPATH_BASE, 'administrator') !== false) { $url = preg_replace('#\\/administrator#', '', $url, 1); } $url_vars = parse_url($url); if (!array_key_exists('scheme', $url_vars) && !array_key_exists('host', $url_vars)) { $prefix = JURI::getInstance()->toString(array('host', 'port')); // Make sure our URL path begins with a slash. if (!preg_match('#^/#', $url)) { $url = '/' . $url; } // Build the URL. $url = 'http://' . $prefix . $url; } return $url; }
/** * Get a application object. * * Returns the global {@link JApplication} object, only creating it if it doesn't already exist. * * @param mixed $id A client identifier or name. * @param array $config An optional associative array of configuration settings. * @param string $prefix Application prefix * * @return JApplication object * * @see JApplication * @since 11.1 * @throws Exception */ public static function getApplication($id = null, array $config = array(), $prefix = 'J') { if (!self::$application) { if (!$id) { throw new Exception('Application Instantiation Error', 500); } self::$application = JApplication::getInstance($id, $config, $prefix); } return self::$application; }
/** * Get menu item by id * * @param string $language The language code. * * @return object The item object * @since 1.5 */ public function getDefault($language = '*') { if (array_key_exists($language, $this->_default) && JApplication::getInstance('site')->getLanguageFilter()) { return $this->_items[$this->_default[$language]]; } elseif (array_key_exists('*', $this->_default)) { return $this->_items[$this->_default['*']]; } else { return 0; } }
/** * Create a uri based on a full or partial url string * * @param string $url The URI * * @return JUri * * @since 3.2 */ protected function createURI($url) { // Create the URI $uri = parent::createURI($url); // Set URI defaults $app = JApplication::getInstance('site'); $menu = $app->getMenu(); // Get the itemid form the URI $itemid = $uri->getVar('Itemid'); if (is_null($itemid)) { if ($option = $uri->getVar('option')) { $item = $menu->getItem($this->getVar('Itemid')); if (isset($item) && $item->component == $option) { $uri->setVar('Itemid', $item->id); } } else { if ($option = $this->getVar('option')) { $uri->setVar('option', $option); } if ($itemid = $this->getVar('Itemid')) { $uri->setVar('Itemid', $itemid); } } } else { if (!$uri->getVar('option')) { if ($item = $menu->getItem($itemid)) { $uri->setVar('option', $item->component); } } } return $uri; }
/** * Loads the menu items * * @return array * * @since 11.1 */ public function load() { // Initialise variables. $db = JFactory::getDbo(); $app = JApplication::getInstance('site'); $query = $db->getQuery(true); $query->select('m.id, m.menutype, m.title, m.alias, m.note, m.path AS route, m.link, m.type, m.level, m.language'); $query->select('m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id'); $query->select('e.element as component'); $query->from('#__menu AS m'); $query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id'); $query->where('m.published = 1'); $query->where('m.parent_id > 0'); $query->where('m.client_id = 0'); $query->order('m.lft'); // Set the query $db->setQuery($query); if (!($this->_items = $db->loadAssocList('id'))) { return false; } foreach ($this->_items as &$item) { // Get parent information. $parent_tree = array(); if (isset($this->_items[$item['parent_id']])) { $parent_tree = $this->_items[$item['parent_id']]['tree']; } // Create tree. $parent_tree[] = $item['id']; $item['tree'] = $parent_tree; // Create the query array. $url = str_replace('index.php?', '', $item['link']); $url = str_replace('&', '&', $url); parse_str($url, $item['query']); } }
<?php // no direct access defined('_JEXEC') or die('Restricted access'); JLoader::register('JHtmlString', JPATH_LIBRARIES . '/joomla/html/html/string.php'); $document = JFactory::getDocument(); $last = count($products) - 1; $customitemid = $params->get('customitemid'); $app = JApplication::getInstance('site'); $sep = $app->getCfg('sef') ? '?' : '&'; $itemid = $customitemid ? $sep . 'Itemid=' . $customitemid : ''; // TODO: add option $showRating = 1; $checkcarouFredSel = false; $header = $document->getHeadData(); foreach ($header['scripts'] as $scriptName => $scriptData) { if (substr_count($scriptName, '/jquery.carouFredSel')) { $checkcarouFredSel = true; } } if (!$checkcarouFredSel) { $document->addScript('modules/mod_hg_vm_products_carousel/assets/jquery.carouFredSel.js'); } $prodCount = count($products); $js = ' ;(function($) { $(document).ready(function(){ var _t = $("#limited_offers' . $module->id . '"); _t.carouFredSel({ responsive: true, scroll: 1,
/** * */ public static function getItems($option = '') { static $items; if (empty($option)) { $com = DSC::getApp(); $option = 'com_' . $com->getName(); } $app = JApplication::getInstance('site'); $menus = $app->getMenu(); if (empty($menus)) { return array(); } if (empty($items)) { $items = array(); } if (empty($items[$option])) { $component = JComponentHelper::getComponent($option); foreach ($menus->getItems('component', $option) as $item) { if (!is_object($item)) { continue; } if ($item->component_id == $component->id || $item->componentid == $component->id || !empty($item->query['option']) && $item->query['option'] == $option) { $items[$option][] = $item; } } } if (empty($items[$option])) { return array(); } return $items[$option]; }