/** * Display the view * * @param null $tpl template to display * * @return mixed|void */ public function display($tpl = null) { $canDo = MarketplaceHelper::getActions(); if (!$canDo->get('marketplace.findextensions')) { JFactory::getApplication()->redirect('index.php?option=com_marketplace', JText::_('COM_MARKETPLACE_NO_AUTH')); } $return = JFactory::getApplication()->input->getString('return', 'index.php?option=com_marketplace&view=marketplace'); $model = JModelLegacy::getInstance('updater', 'marketplacemodel'); $this->repositories = $model->getRepositories(); if (empty($this->repositories)) { JFactory::getApplication()->redirect('index.php?option=com_marketplace', JText::_('COM_MARKETPLACE_MSG_REPOSITORIES_NEED_PUBLISHED'), 'error'); } $json = json_encode($this->repositories); $version = new JVersion(); $rel_version = $version->RELEASE; $updateScript = <<<ENDSCRIPT var updater_return_url = '{$return}'; var repositories = {$json}; var rel_version = '{$rel_version}'; ENDSCRIPT; // Load our Javascript $document = JFactory::getDocument(); $document->addScript('../media/com_joomlaupdate/json2.js'); $document->addScript('../media/com_marketplace/js/update.js'); JHtml::_('script', 'system/progressbar.js', true, true); JHtml::_('stylesheet', 'media/mediamanager.css', array(), true); $document->addScriptDeclaration($updateScript); $this->addToolbar(); parent::display($tpl); }
/** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { $canDo = MarketplaceHelper::getActions(); JToolBarHelper::title(JText::_('COM_MARKETPLACE_HEADER_' . $this->getName()), 'marketplace'); if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_marketplace'); JToolbarHelper::divider(); } MarketplaceHelper::addSubmenu($this->getName()); }
/** * Build collection list * * @since 3.1 */ public static function collection($selected) { $html = '<div class="btn-group">'; $html .= '<button data-toggle="dropdown" class="btn dropdown-toggle" style="border-radius: 0; border-left: 1px dotted ; border-right: 1px dotted; background: none; color: #555555;">'; $html .= JText::sprintf('COM_MARKETPLACE_TEXT_BROWSE_SELECT', $selected); $html .= '<span class="caret"></span>'; $html .= '</button>'; $html .= '<ul class="dropdown-menu">'; foreach (MarketplaceHelper::getCollections() as $collection) { $html .= '<li>'; $html .= '<a onclick="document.id(\'filter_section\').value=\'' . $collection->value . '\';document.id(\'adminForm\').submit();" href="javascript:void(0);">'; $html .= JText::sprintf('COM_MARKETPLACE_TEXT_BROWSE_SELECT', ucfirst($collection->text)); $html .= '</a>'; $html .= '</li>'; } $html .= '</ul>'; $html .= '</div>'; return $html; }
/** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { JToolBarHelper::title(JText::_('COM_MARKETPLACE_HEADER_' . $this->getName()), 'marketplace'); JToolbarHelper::back(); MarketplaceHelper::addSubmenu($this->getName()); }
/** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { $canDo = MarketplaceHelper::getActions(); $type = $this->state->get('filter.tags'); $section = $this->state->get('filter.section'); $this->section = ucfirst($section); JToolBarHelper::title(JText::sprintf('COM_MARKETPLACE_HEADER_' . $this->getName(), $this->section), 'marketplace'); $repository_id = $this->state->get('filter.marketplace_repository_id'); $countStores = MarketplaceHelper::getExtensionTotalStores(); $stores = MarketplaceHelper::getExtensionStores(); if ($canDo->get('marketplace.findextensions')) { if ($countStores) { JToolBarHelper::custom($this->getName() . '.findextensions', 'refresh', 'refresh', 'COM_MARKETPLACE_TOOLBAR_FIND_EXTENSIONS', false, false); } JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_marketplace'); JToolbarHelper::divider(); } if (!empty($this->nr_extensions)) { JHtmlSidebar::addFilter(JText::_('COM_MARKETPLACE_VALUE_REPOSITORY_SELECT'), 'filter_marketplace_repository_id', JHtml::_('select.options', $stores, 'value', 'text', $repository_id, true)); if ($this->state->get('filter.browse') == '') { JHtmlSidebar::addFilter(JText::_('COM_MARKETPLACE_VALUE_TYPE_SELECT'), 'filter_tag', JHtml::_('select.options', MarketplaceHelper::getExtensionTypes(), 'value', 'text', $this->state->get('filter.tags'), true)); } JHtmlSidebar::addFilter(JText::_('COM_MARKETPLACE_VALUE_CATEGORY_SELECT'), 'filter_category', JHtml::_('select.options', MarketplaceHelper::getExtensionCategories(), 'value', 'text', $this->state->get('filter.category'), true)); JHtmlSidebar::addFilter(JText::_('COM_MARKETPLACE_VALUE_AUTHOR_SELECT'), 'filter_author', JHtml::_('select.options', MarketplaceHelper::getExtensionAuthors(), 'value', 'text', $this->state->get('filter.author'), true)); JHtmlSidebar::addFilter(JText::_('COM_MARKETPLACE_VALUE_PLAN_SELECT'), 'filter_plan', JHtml::_('select.options', MarketplaceHelper::getExtensionPlans(), 'value', 'text', $this->state->get('filter.plan'), true)); } if ($countStores == 0) { JFactory::getApplication()->redirect('index.php?option=com_marketplace&view=repositories', JText::_('COM_MARKETPLACE_MSG_REPOSITORIES_NO_REPOSITORIES'), 'warning'); } MarketplaceHelper::addSubmenu($this->getName()); }
/** * Add the page title and toolbar. * * @return void */ protected function addToolbar() { $this->canDo = MarketplaceHelper::getActions(); if (!$this->canDo->get('repositories.manage')) { JFactory::getApplication()->redirect('index.php?option=com_marketplace', JText::_('COM_MARKETPLACE_NO_AUTH')); } JToolBarHelper::title(JText::_('COM_MARKETPLACE_HEADER_' . $this->getName()), 'marketplace.png'); if ($this->canDo->get('repositories.manage.state') && !empty($this->items)) { JToolbarHelper::custom($this->getName() . '.reset', 'time', 'time', JText::_('COM_MARKETPLACE_BUTTON_RESET_TIMESTAMP')); JToolbarHelper::archiveList($this->getName() . '.archive'); JToolbarHelper::unpublishList($this->getName() . '.unpublish'); JToolbarHelper::publishList($this->getName() . '.publish'); JToolbarHelper::divider(); } if ($this->canDo->get('core.delete') && !empty($this->items)) { JToolbarHelper::deleteList('', $this->getName() . '.delete', 'JTOOLBAR_DELETE'); JToolbarHelper::divider(); } if ($this->canDo->get('core.admin')) { JToolbarHelper::preferences('com_marketplace'); JToolbarHelper::divider(); } MarketplaceHelper::addSubmenu($this->getName()); }