Current Path :
/
home
/
develito
/
httpdocs
/
components
/
com_dmod
/
views
/
dmod
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/httpdocs/components/com_dmod/views/dmod/view.html.php
<?php /*------------------------------------------------------------------------ # com_dmod - Dmod Module Manager # ------------------------------------------------------------------------ # author Jesus Vargas Garita # copyright Copyright (C) 2010 www.joomlahill.com. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Websites: http://www.joomlahill.com # Technical Support: Forum - http://www.joomlahill.com/forum -------------------------------------------------------------------------*/ defined('_JEXEC') or die; require_once JPATH_COMPONENT.'/models/category.php'; class DmodViewDmod extends JViewLegacy { protected $state; protected $item; function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $dispatcher = JDispatcher::getInstance(); $state = $this->get('State'); $item = $this->get('Item'); $module = $this->get('Module'); $registry = new JRegistry(); $registry->loadArray($module->params); $module->params = $registry->toString(); // Get Category Model data if ($item) { $categoryModel = JModelLegacy::getInstance('Category', 'DmodModel', array('ignore_request' => true)); $categoryModel->setState('category.id', $item->catid); $categoryModel->setState('list.ordering', 'a.name'); $categoryModel->setState('list.direction', 'asc'); $dmods = $categoryModel->getItems(); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // Get the parameters of the active menu item $menus = $app->getMenu(); $menu = $menus->getActive(); $params = $app->getParams(); $params->merge($item->params); // check if access is not public $groups = $user->getAuthorisedViewLevels(); $return = ''; if ((!in_array($item->access, $groups)) || (!in_array($item->category_access, $groups))) { $uri = JFactory::getURI(); $return = (string)$uri; JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); return; } $options['category_id'] = $item->catid; $options['order by'] = 'a.default_con DESC, a.ordering ASC'; if ($params->get('show_author',0) || $params->get('show_email',0) || $params->get('show_version',0) || $params->get('show_created',0) || $params->get('show_compat',0) ) { $params->set('details_check', 1); } else { $params->set('details_check', 0); } if (( $params->get('show_homepage',0)) || ( $item->download_url && $params->get('show_download_url',0) ) || ( $item->review_link && $params->get('show_rate_review',0) ) ) { $params->set('links_check', 1); } else { $params->set('links_check', 0); } switch ($params->get('dmod_icons', 1)) { case 1 : // text $params->set('marker_joomla_pre_version', JText::_('COM_DMOD_COMPAT_PRE_VERSION')); $params->set('marker_joomla_cur_version', JText::_('COM_DMOD_COMPAT_CUR_VERSION')); $params->set('marker_homepage', JText::_('COM_DMOD_HOMEPAGE')); $params->set('marker_download_url', JText::_('COM_DMOD_DOWNLOAD_URL')); $params->set('marker_review', JText::_('COM_DMOD_RATE_REVIEW')); break; case 2 : // none $params->set('marker_joomla_pre_version', ''); $params->set('marker_joomla_cur_version', ''); $params->set('marker_homepage', ''); $params->set('marker_download_url', ''); $params->set('marker_review', ''); break; default : // icons $image1 = '<img src="'.$params->get('icon_joomla_pre_version').'" alt="'.JText::_('COM_DMOD_COMPAT_PRE_VERSION').'">'; $image2 = '<img src="'.$params->get('icon_joomla_cur_version').'" alt="'.JText::_('COM_DMOD_COMPAT_CUR_VERSION').'">'; $image3 = '<img src="'.$params->get('icon_homepage').'" alt="'.JText::_('COM_DMOD_HOMEPAGE').'">'; $image4 = '<img src="'.$params->get('icon_download_url').'" alt="'.JText::_('COM_DMOD_DOWNLOAD_URL').'">'; $image5 = '<img src="'.$params->get('icon_rate_review').'" alt="'.JText::_('COM_DMOD_RATE_REVIEW').'">'; $params->set('marker_joomla_pre_version', $image1); $params->set('marker_joomla_cur_version', $image2); $params->set('marker_homepage', $image3); $params->set('marker_download_url', $image4); $params->set('marker_review', $image5); break; } // Add links to dmods if ($params->get('show_dmod_list',0) && count($dmods) > 1) { foreach($dmods as &$dmod) { $dmod->link = JRoute::_(DmodHelperRoute::getDmodRoute($dmod->slug, $dmod->catid)); } $item->link = JRoute::_(DmodHelperRoute::getDmodRoute($item->slug, $item->catid)); } $data = JInstaller::parseXMLInstallFile(JPATH_SITE . "/modules/$module->module/$module->module.xml"); $item->version = $data['version']; $item->created = $data['creationDate']; $item->author = $data['author']; $item->authoremail = $data['authorEmail']; $item->homepage = $data['authorUrl']; // check for http on homepage if (strlen($item->homepage) > 0 && (!(preg_match('/http:\/\//i', $item->homepage) || (preg_match('/https:\/\//i', $item->homepage)) || (preg_match('/ftp:\/\//i', $item->homepage))))) { $item->homepage = 'http://'.$item->homepage; } if ( $params->get('show_params',1) ) : $modParams = $this->get('ModParams'); endif; //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->assignRef('dmod', $item); $this->assignRef('params', $params); $this->assignRef('return', $return); $this->assignRef('state', $state); $this->assignRef('item', $item); $this->assignRef('user', $user); $this->assignRef('dmods', $dmods); $this->assignRef('module', $module); $this->assignRef('modParams', $modParams); // Override the layout only if this is not the active menu item // If it is the active menu item, then the view and item id will match $active = $app->getMenu()->getActive(); if ((!$active) || ((strpos($active->link, 'view=dmod') === false) || (strpos($active->link, '&id=' . (string) $this->item->id) === false))) { if ($layout = $params->get('dmod_layout')) { $this->setLayout($layout); } } elseif (isset($active->query['layout'])) { // We need to set the layout in case this is an alternative menu item (with an alternative layout) $this->setLayout($active->query['layout']); } $this->_prepareDocument(); parent::display($tpl); } /** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_DMOD_DEFAULT_PAGE_TITLE')); } $title = $this->params->get('page_title', ''); $id = (int) @$menu->query['id']; // if the menu item does not concern this dmod if ($menu && ($menu->query['option'] != 'com_dmod' || $menu->query['view'] != 'dmod' || $id != $this->item->id)) { // If this is not a single dmod menu item, set the page title to the dmod title if ($this->item->name) { $title = $this->item->name; } $path = array(array('title' => $this->dmod->name, 'link' => '')); $category = JCategories::getInstance('Dmod')->get($this->dmod->catid); while ($category && ($menu->query['option'] != 'com_dmod' || $menu->query['view'] == 'dmod' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => DmodHelperRoute::getCategoryRoute($this->dmod->catid)); $category = $category->getParent(); } $path = array_reverse($path); foreach($path as $item) { $pathway->addItem($item['title'], $item['link']); } } if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0)) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } if (empty($title)) { $title = $this->item->name; } $this->document->setTitle($title); if ($this->item->metadesc) { $this->document->setDescription($this->item->metadesc); } if ($this->item->metakey) { $this->document->setMetadata('keywords', $this->item->metakey); } if ($app->getCfg('MetaTitle') == '1') { $this->document->setMetaData('title', $this->item->name); } $mdata = $this->item->metadata->toArray(); foreach ($mdata as $k => $v) { if ($v) { $this->document->setMetadata($k, $v); } } } }