Your IP : 216.73.216.240


Current Path : /home/juvelize/www/administrator/components/com_zhgooglemap/views/mapadsences/
Upload File :
Current File : /home/juvelize/www/administrator/components/com_zhgooglemap/views/mapadsences/view.html.php

<?php
/*------------------------------------------------------------------------
# com_zhgooglemap - Zh GoogleMap
# ------------------------------------------------------------------------
# author:    Dmitry Zhuk
# copyright: Copyright (C) 2011 zhuk.cc. All Rights Reserved.
# license:   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
# website:   http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

/**
 * View class for the ZhGoogle MapAdSences Component
 */
class ZhGoogleMapViewMapAdSences extends JViewLegacy
{
	protected $state;

	// Overwriting JView display method
	function display($tpl = null) 
	{
		// Get data from the model
		$items = $this->get('Items');
		$pagination = $this->get('Pagination');

		$this->state = $this->get('State');

		ZhGoogleMapHelper::addSubmenu('mapadsences');

 		$mapList = $this->get('mapList');
		$this->assignRef( 'mapList',	$mapList);

                // Check for errors.
                if (count($errors = $this->get('Errors'))) 
                {
                        JError::raiseError(500, implode('<br />', $errors));
                        return false;
                }
                // Assign data to the view
                $this->items = $items;
                $this->pagination = $pagination;
 
                // Set the toolbar
                $this->addToolBar();
 
                // Display the template
                parent::display($tpl);

		// Set the document
		$this->setDocument();

	}

	/**
	 * Setting the toolbar
	 */
	protected function addToolBar() 
	{
		$canDo = ZhGoogleMapHelper::getAdSenceActions();
		JToolBarHelper::title(JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_MANAGER'), 'mapadsence');
		if ($canDo->get('core.create')) 
		{
			JToolBarHelper::addNew('mapadsence.add', 'JTOOLBAR_NEW');
		}
		if ($canDo->get('core.edit')) 
		{
			JToolBarHelper::editList('mapadsence.edit', 'JTOOLBAR_EDIT');
		}
		if ($canDo->get('core.edit.state')) 
		{
				JToolBarHelper::divider();
				JToolBarHelper::publish('mapadsences.publish', 'JTOOLBAR_PUBLISH', true);
				JToolBarHelper::unpublish('mapadsences.unpublish', 'JTOOLBAR_UNPUBLISH', true);
				JToolBarHelper::divider();
		}
		if ($canDo->get('core.delete')) 
		{
			JToolBarHelper::deleteList('', 'mapadsences.delete', 'JTOOLBAR_DELETE');
		}
		if ($canDo->get('core.admin')) 
		{
			JToolBarHelper::divider();
			JToolBarHelper::preferences('com_zhgooglemap');
		}

		JHtmlSidebar::setAction('index.php?option=com_zhgooglemap');

		JHtmlSidebar::addFilter(
			JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_FILTER_MAP'),
			'filter_mapid',
			JHtml::_('select.options', $this->mapList, 'value', 'text', $this->state->get('filter.mapid'))
		);

		JHtmlSidebar::addFilter(
			JText::_('JOPTION_SELECT_PUBLISHED'),
			'filter_published',
			JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
		);
				
				
		JHtmlSidebar::addFilter(
			JText::_('JOPTION_SELECT_CATEGORY'),
			'filter_category_id',
			JHtml::_('select.options', JHtml::_('category.options', 'com_zhgooglemap'), 'value', 'text', $this->state->get('filter.category_id'))
		);

		$this->sidebar = JHtmlSidebar::render();

	}
	/**
	 * Method to set up the document properties
	 *
	 * @return void
	 */
	protected function setDocument() 
	{
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_ADMINISTRATION'));
	}


	/**
	 * Returns an array of fields the table can be sorted by
	 *
	 * @return  array  Array containing the field name to sort by as the key and display text as value
	 *
	 * @since   3.0
	 */
	protected function getSortFields()
	{
		return array(
			//'h.ordering' => JText::_('JGRID_HEADING_ORDERING'),
			//'h.id' => JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_HEADING_ID'),
			'h.title' => JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_HEADING_TITLE'),
			'h.published' => JText::_('COM_ZHGOOGLEMAP_MAPADSENCE_HEADING_PUBLISHED')
		);
	}
	
}