Your IP : 216.73.216.240
<?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 ZhGoogleMap Component
*/
class ZhGoogleMapViewPlacemarks extends JViewLegacy
{
protected $state;
protected $items;
protected $pagination;
// Overwriting JView display method
function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->form = $this->get('Form');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$mapList = $this->get('mapList');
$this->assignRef( 'mapList', $mapList);
$groupList = $this->get('groupList');
$this->assignRef( 'groupList', $groupList);
$userList = $this->get('userList');
$this->assignRef( 'userList', $userList);
$iconList = $this->get('iconList');
$this->assignRef( 'iconList', $iconList);
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the view
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JHtmlSidebar::setAction('index.php?option=com_zhgooglemap');
if ((int)$this->state->get('map.option_filter_map') == 0
|| (int)$this->state->get('map.option_filter_map') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('COM_ZHGOOGLEMAP_MAPMARKER_FILTER_MAP'),
'filter_mapid',
JHtml::_('select.options', $this->mapList, 'value', 'text', $this->state->get('filter.mapid'))
);
}
if ((int)$this->state->get('map.option_filter_publish') == 0
|| (int)$this->state->get('map.option_filter_publish') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
}
if ((int)$this->state->get('map.option_filter_icon') == 0
|| (int)$this->state->get('map.option_filter_icon') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('COM_ZHGOOGLEMAP_MAP_USER_IMAGESELECT'),
'filter_icontype',
JHtml::_('select.options', $this->iconList, 'value', 'text', $this->state->get('filter.icontype'))
);
}
if ((int)$this->state->get('map.option_filter_group') == 0
|| (int)$this->state->get('map.option_filter_group') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('COM_ZHGOOGLEMAP_MAPMARKER_FILTER_PLACEMARK_GROUP'),
'filter_markergroup',
JHtml::_('select.options', $this->groupList, 'value', 'text', $this->state->get('filter.markergroup'))
);
}
if ((int)$this->state->get('map.option_filter_category') == 0
|| (int)$this->state->get('map.option_filter_category') == 2 )
{
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'))
);
}
if ((int)$this->state->get('map.option_filter_access') == 0
|| (int)$this->state->get('map.option_filter_access') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
}
if ((int)$this->state->get('map.option_filter_user') == 0
|| (int)$this->state->get('map.option_filter_user') == 2 )
{
JHtmlSidebar::addFilter(
JText::_('COM_ZHGOOGLEMAP_MAPMARKER_FILTER_USER'),
'filter_createdbyuser',
JHtml::_('select.options', $this->userList, 'value', 'text', $this->state->get('filter.createdbyuser'))
);
}
$this->sidebar = JHtmlSidebar::render();
}
/**
* 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(
'ordering' => JText::_('COM_ZHGOOGLEMAP_HEADING_ORDERING'),
'h.id' => JText::_('COM_ZHGOOGLEMAP_MAPMARKER_HEADING_ID'),
'h.title' => JText::_('COM_ZHGOOGLEMAP_MAPMARKER_HEADING_TITLE'),
'h.access' => JText::_('JGRID_HEADING_ACCESS'),
'h.published' => JText::_('COM_ZHGOOGLEMAP_MAPMARKER_HEADING_PUBLISHED')
);
}
}