<?php
/*
 * Copyright (c) 2014-2015 Aimy Extensions, Lingua-Systems Software GmbH
 *
 * http://www.aimy-extensions.com/
 *
 * License: GNU GPLv2, see LICENSE.txt within distribution and/or
 *          http://www.aimy-extensions.com/software-license.html
 */
 defined( '_JEXEC' ) or die(); require_once( JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'rights.php' ); require_once( JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php' ); class AimySitemapViewUrls extends JViewLegacy { protected $items = null; protected $state = null; protected $pagination = null; protected $allow_config = false; protected $allow_edit = false; protected $allow_write = false; protected $ajax_edit = false; public function display( $tpl = null ) { $this->items = $this->get( 'Items' ); $this->state = $this->get( 'State' ); $this->pagination = $this->get( 'Pagination' ); if ( count( $errors = $this->get( 'Errors' ) ) ) { JError::raiseError( 500, implode( "\n", $errors ) ); return false; } $rights = AimySitemapRightsHelper::getRights(); $this->allow_config = $rights->get( 'core.admin' ); $this->allow_edit = $rights->get( 'core.edit' ); $this->allow_write = $rights->get( 'aimysitemap.write' ); $this->ajax_edit = AimySitemapConfigHelper::get_once( 'ajax_edit', true ); if ( $this->ajax_edit && $this->allow_edit ) { JFactory::getDocument()->addScript( JURI::root() . 'administrator/components/' . 'com_aimysitemap/helpers/urls-ajax-edit.js' . '?r=3.15.1' ); } $this->add_toolbar(); parent::display( $tpl ); } protected function add_toolbar() { $bar = JToolBar::getInstance( 'toolbar' ); JToolBarHelper::title( JText::_( 'AIMY_SM_MANAGE_URLS' ), '' ); if ( $this->allow_edit ) { JToolBarHelper::editList( 'url.edit' ); JToolBarHelper::custom( 'urls.activate', 'publish', JText::_( 'AIMY_SM_ACTIVATE_DSC' ), JText::_( 'AIMY_SM_ACTIVATE_LBL' ), true ); JToolBarHelper::custom( 'urls.deactivate', 'unpublish', JText::_( 'AIMY_SM_DEACTIVATE_DSC' ), JText::_( 'AIMY_SM_DEACTIVATE_LBL' ), true ); } if ( $this->allow_write ) { JToolBarHelper::custom( 'urls.write', 'file', JText::_( 'AIMY_SM_WRITE_DSC' ), JText::_( 'AIMY_SM_WRITE_LBL' ), false ); } if ( $this->allow_edit ) { JToolBarHelper::trash( 'urls.reset_index', JText::_( 'AIMY_SM_RESET_INDEX_LBL' ), false ); } if ( $this->allow_config ) { JToolBarHelper::preferences( 'com_aimysitemap' ); } } public function get_state_options() { $active = new StdClass(); $active->value = '1'; $active->text = JText::_( 'AIMY_SM_FILTER_ACTIVATED' ); $deactive = new StdClass(); $deactive->value = '0'; $deactive->text = JText::_( 'AIMY_SM_FILTER_DEACTIVATED' ); $all = new StdClass(); $all->value = '*'; $all->text = JText::_( 'JALL' ); return array( $active, $deactive, $all ); } } 
