| Joomla! | PHP Cross Reference | Web Portals |
1 <?php 2 /** 3 * @package Joomla.Administrator 4 * @subpackage com_weblinks 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 defined('_JEXEC') or die; 11 12 /** 13 * View class for a list of weblinks. 14 * 15 * @package Joomla.Administrator 16 * @subpackage com_weblinks 17 * @since 1.5 18 */ 19 class WeblinksViewWeblinks extends JViewLegacy 20 { 21 protected $items; 22 23 protected $pagination; 24 25 protected $state; 26 27 /** 28 * Display the view 29 */ 30 public function display($tpl = null) 31 { 32 $this->state = $this->get('State'); 33 $this->items = $this->get('Items'); 34 $this->pagination = $this->get('Pagination'); 35 36 WeblinksHelper::addSubmenu('weblinks'); 37 38 // Check for errors. 39 if (count($errors = $this->get('Errors'))) { 40 JError::raiseError(500, implode("\n", $errors)); 41 return false; 42 } 43 44 $this->addToolbar(); 45 $this->sidebar = JHtmlSidebar::render(); 46 parent::display($tpl); 47 } 48 49 /** 50 * Add the page title and toolbar. 51 * 52 * @since 1.6 53 */ 54 protected function addToolbar() 55 { 56 require_once JPATH_COMPONENT.'/helpers/weblinks.php'; 57 58 $state = $this->get('State'); 59 $canDo = WeblinksHelper::getActions($state->get('filter.category_id')); 60 $user = JFactory::getUser(); 61 // Get the toolbar object instance 62 $bar = JToolBar::getInstance('toolbar'); 63 64 JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'weblinks.png'); 65 if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0) { 66 JToolbarHelper::addNew('weblink.add'); 67 } 68 if ($canDo->get('core.edit')) { 69 JToolbarHelper::editList('weblink.edit'); 70 } 71 if ($canDo->get('core.edit.state')) { 72 73 JToolbarHelper::publish('weblinks.publish', 'JTOOLBAR_PUBLISH', true); 74 JToolbarHelper::unpublish('weblinks.unpublish', 'JTOOLBAR_UNPUBLISH', true); 75 76 JToolbarHelper::archiveList('weblinks.archive'); 77 JToolbarHelper::checkin('weblinks.checkin'); 78 } 79 if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { 80 JToolbarHelper::deleteList('', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH'); 81 } elseif ($canDo->get('core.edit.state')) { 82 JToolbarHelper::trash('weblinks.trash'); 83 } 84 // Add a batch button 85 if ($canDo->get('core.edit')) 86 { 87 JHtml::_('bootstrap.modal', 'collapseModal'); 88 $title = JText::_('JTOOLBAR_BATCH'); 89 $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\"> 90 <i class=\"icon-checkbox-partial\" title=\"$title\"></i> 91 $title</button>"; 92 $bar->appendButton('Custom', $dhtml, 'batch'); 93 } 94 if ($canDo->get('core.admin')) { 95 JToolbarHelper::preferences('com_weblinks'); 96 } 97 98 JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS'); 99 100 JHtmlSidebar::setAction('index.php?option=com_weblinks&view=weblinks'); 101 102 JHtmlSidebar::addFilter( 103 JText::_('JOPTION_SELECT_PUBLISHED'), 104 'filter_state', 105 JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true) 106 ); 107 108 JHtmlSidebar::addFilter( 109 JText::_('JOPTION_SELECT_CATEGORY'), 110 'filter_category_id', 111 JHtml::_('select.options', JHtml::_('category.options', 'com_weblinks'), 'value', 'text', $this->state->get('filter.category_id')) 112 ); 113 114 JHtmlSidebar::addFilter( 115 JText::_('JOPTION_SELECT_ACCESS'), 116 'filter_access', 117 JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) 118 ); 119 120 JHtmlSidebar::addFilter( 121 JText::_('JOPTION_SELECT_LANGUAGE'), 122 'filter_language', 123 JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')) 124 ); 125 } 126 127 /** 128 * Returns an array of fields the table can be sorted by 129 * 130 * @return array Array containing the field name to sort by as the key and display text as value 131 * 132 * @since 3.0 133 */ 134 protected function getSortFields() 135 { 136 return array( 137 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 138 'a.state' => JText::_('JSTATUS'), 139 'a.title' => JText::_('JGLOBAL_TITLE'), 140 'a.access' => JText::_('JGRID_HEADING_ACCESS'), 141 'a.hits' => JText::_('JGLOBAL_HITS'), 142 'a.language' => JText::_('JGRID_HEADING_LANGUAGE'), 143 'a.id' => JText::_('JGRID_HEADING_ID') 144 ); 145 } 146 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title