Ejemplo n.º 1
0
 protected static function _findLink($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $active = $menus->getActive();
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         self::$sView = array();
         self::$sCatIds = array();
         $component = JComponentHelper::getComponent('com_tz_portfolio');
         $items = $menus->getItems('component_id', $component->id);
         $ccomponent = JComponentHelper::getComponent('com_content');
         if ($cItems = $menus->getItems('component_id', $ccomponent->id)) {
             $items = array_merge($items, $cItems);
         }
         foreach ($items as $item) {
             if (isset($item->query) && isset($item->query['view'])) {
                 $view = $item->query['view'];
                 if (!isset(self::$lookup[$item->component][$view])) {
                     self::$lookup[$item->component][$view] = array();
                 }
                 if (isset($item->query['id'])) {
                     self::$lookup[$item->component][$view][$item->query['id']] = $item->id;
                     self::$sCatIds[] = $item->query['id'];
                 } else {
                     $catids = $item->params->get('tz_catid');
                     self::$sView['view'] = 'portfolio';
                     self::$sView['Itemid'] = $item->id;
                     if ($catids) {
                         $catids = array_filter($catids);
                         $catids = array_reverse($catids);
                         if (is_array($catids)) {
                             if (count($catids)) {
                                 for ($i = 0; $i < count($catids); $i++) {
                                     self::$lookup[$item->component][$view][$catids[$i]] = $item->id;
                                 }
                             }
                         } else {
                             self::$lookup[$item->component][$view][$catids] = $item->id;
                         }
                     }
                 }
                 if ($active && $active->component == 'com_tz_portfolio') {
                     if (isset($active->query) && isset($active->query['view'])) {
                         if (isset($active->query['id'])) {
                             self::$lookup[$item->component][$active->query['view']][$active->query['id']] = $active->id;
                         }
                     }
                 } elseif ($active && $active->component == 'com_content') {
                     if (isset($active->query) && isset($active->query['view'])) {
                         if (isset($active->query['id'])) {
                             self::$lookup[$item->component][$active->query['view']][$active->query['id']] = $active->id;
                         }
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup['com_tz_portfolio']) && isset(self::$lookup['com_tz_portfolio'][$view]) || isset(self::$lookup['com_content']) && isset(self::$lookup['com_content'][$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup['com_tz_portfolio'][$view][(int) $id])) {
                         return 'index.php?option=com_tz_portfolio&view=' . $view . '&id=' . $id . '&Itemid=' . self::$lookup['com_tz_portfolio'][$view][(int) $id];
                     } elseif (isset(self::$lookup['com_content'][$view][(int) $id])) {
                         return 'index.php?option=com_content&view=' . $view . '&id=' . $id . '&Itemid=' . self::$lookup['com_content'][$view][(int) $id];
                     } elseif (self::$sView['view'] == $view && !in_array($id, self::$sCatIds)) {
                         return 'index.php?option=com_tz_portfolio&view=' . $view . '&Itemid=' . self::$sView['Itemid'];
                     }
                 }
             }
         }
     } else {
         if ($active && $active->component == 'com_tz_portfolio') {
             return $active->link . '&Itemid=' . $active->id;
         } elseif ($active && $active->component == 'com_content') {
             return $active->link . '&Itemid=' . $active->id;
         }
     }
     return null;
 }
# copyright Copyright (C) 2012 templaza.com. All Rights Reserved.

# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL

# Websites: http://www.templaza.com

# Technical Support:  Forum - http://templaza.com/Forum

-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die;
// Include the syndicate functions only once
require_once dirname(__FILE__) . '/helper.php';
$document = JFactory::getDocument();
$document->addStyleSheet('modules/mod_tz_portfolio_categories/css/mod_tz_portfolio_categories.css');
$list = modTZ_PortfolioCategoriesHelper::getList($params);
$view = $params->get('views');
$read = $params->get('readmore');
$text = $params->get('readtext');
$title = $params->get('title');
$des = $params->get('des');
$width = $params->get('width');
$sl_width = $params->get('slide_width');
$sl_height = $params->get('slide_height');
$library = $params->get('library');
if ($view == "menu") {
    require_once JModuleHelper::getLayoutPath('mod_tz_portfolio_categories', 'default');
} else {
    require_once JModuleHelper::getLayoutPath('mod_tz_portfolio_categories', 'slider');
}