Beispiel #1
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = ZhYandexMapHelper::getPathActions();
     JToolBarHelper::title(JText::_('COM_ZHYANDEXMAP_MAPPATH_MANAGER'), 'mappath');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('mappath.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('mappath.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('mappaths.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('mappaths.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'mappaths.delete', 'JTOOLBAR_DELETE');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_zhyandexmap');
     }
     JHtmlSidebar::setAction('index.php?option=com_zhyandexmap');
     JHtmlSidebar::addFilter(JText::_('COM_ZHYANDEXMAP_MAPMARKER_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_zhyandexmap'), 'value', 'text', $this->state->get('filter.category_id')));
     $this->sidebar = JHtmlSidebar::render();
 }
Beispiel #2
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->id;
     $isNew = $this->item->id == 0;
     $canDo = ZhYandexMapHelper::getPathActions($this->item->id);
     JToolBarHelper::title($isNew ? JText::_('COM_ZHYANDEXMAP_MAPPATH_NEW') : JText::_('COM_ZHYANDEXMAP_MAPPATH_EDIT'), 'mappath');
     // Built the actions for new and existing records.
     if ($isNew) {
         // For new records, check the create permission.
         if ($canDo->get('core.create')) {
             JToolBarHelper::apply('mappath.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('mappath.save', 'JTOOLBAR_SAVE');
             JToolBarHelper::custom('mappath.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
         }
         JToolBarHelper::cancel('mappath.cancel', 'JTOOLBAR_CANCEL');
     } else {
         if ($canDo->get('core.edit')) {
             // We can save the new record
             JToolBarHelper::apply('mappath.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('mappath.save', 'JTOOLBAR_SAVE');
             // We can save this record, but check the create permission to see if we can return to make a new one.
             if ($canDo->get('core.create')) {
                 JToolBarHelper::custom('mappath.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
             }
         }
         if ($canDo->get('core.create')) {
             JToolBarHelper::custom('mappath.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
         }
         JToolBarHelper::cancel('mappath.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Beispiel #3
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = ZhYandexMapHelper::getMarkerActions();
     JToolBarHelper::title(JText::_('COM_ZHYANDEXMAP_MAPMARKER_MANAGER'), 'mapmarker');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('mapmarker.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         JToolBarHelper::editList('mapmarker.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('mapmarkers.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('mapmarkers.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'mapmarkers.delete', 'JTOOLBAR_DELETE');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_zhyandexmap');
     }
     JHtmlSidebar::setAction('index.php?option=com_zhyandexmap');
     JHtmlSidebar::addFilter(JText::_('COM_ZHYANDEXMAP_MAPMARKER_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::_('COM_ZHYANDEXMAP_MAP_USER_IMAGESELECT'), 'filter_icontype', JHtml::_('select.options', $this->iconList, 'value', 'text', $this->state->get('filter.icontype')));
     JHtmlSidebar::addFilter(JText::_('COM_ZHYANDEXMAP_MAPMARKER_FILTER_PLACEMARK_GROUP'), 'filter_markergroup', JHtml::_('select.options', $this->groupList, 'value', 'text', $this->state->get('filter.markergroup')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_zhyandexmap'), 'value', 'text', $this->state->get('filter.category_id')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
     JHtmlSidebar::addFilter(JText::_('COM_ZHYANDEXMAP_MAPMARKER_FILTER_USER'), 'filter_createdbyuser', JHtml::_('select.options', $this->userList, 'value', 'text', $this->state->get('filter.createdbyuser')));
     $this->sidebar = JHtmlSidebar::render();
 }
Beispiel #4
0
 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $canDo = ZhYandexMapHelper::getMarkerActions($recordId);
     $canEdit = $canDo->get('core.edit');
     $isEnabledEditOwn = $canDo->get('core.edit.own');
     if ($canEdit || $canEditOwn) {
     }
     // Check general edit permission first.
     if ($canEdit) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($isEnabledEditOwn) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['createdbyuser']) ? $data['createdbyuser'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->createdbyuser;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Beispiel #5
0
 function display($tpl = null)
 {
     ZhYandexMapHelper::addSubmenu('abouts');
     $this->addToolBar();
     // Display the template
     parent::display($tpl);
     // Set the document
     $this->setDocument();
 }
Beispiel #6
0
 /**
  * display task
  *
  * @return void
  */
 function display($cachable = false, $urlparams = false)
 {
     $vName = JRequest::getCmd('view', 'ZhYandexMaps');
     JRequest::setVar('view', $vName);
     // call parent behavior
     parent::display($cachable, $urlparams);
     // Set the submenu
     ZhYandexMapHelper::addSubmenu($vName);
     return $this;
 }
Beispiel #7
0
 /**
  * Setting the toolbar
  */
 protected function addToolBar()
 {
     $canDo = ZhYandexMapHelper::getMapActions();
     JToolBarHelper::title(JText::_('COM_ZHYANDEXMAP_MANAGER'), 'zhyandexmap');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('zhyandexmap.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('zhyandexmap.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'zhyandexmaps.delete', 'JTOOLBAR_DELETE');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_zhyandexmap');
     }
     JHtmlSidebar::setAction('index.php?option=com_zhyandexmap');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_zhyandexmap'), 'value', 'text', $this->state->get('filter.category_id')));
     $this->sidebar = JHtmlSidebar::render();
 }
Beispiel #8
0
/*------------------------------------------------------------------------
# com_zhyandexmap - Zh YandexMap
# ------------------------------------------------------------------------
# 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
# Websites: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user = JFactory::getUser();
$userId = $user->id;
foreach ($this->items as $i => $item) {
    $canDo = ZhYandexMapHelper::getRouterActions($item->id);
    $canEdit = $canDo->get('core.edit');
    $canEditOwn = $canDo->get('core.edit.own') && 1 == 2;
    //&& $item->createdbyuser == $userId;
    $canChange = $canDo->get('core.edit.state');
    ?>
	<tr class="row<?php 
    echo $i % 2;
    ?>
">
		<td>
			<?php 
    echo JHtml::_('grid.id', $i, $item->id);
    ?>
		</td>
		<td>
Beispiel #9
0
/*------------------------------------------------------------------------
# com_zhyandexmap - Zh YandexMap
# ------------------------------------------------------------------------
# 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
# Websites: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user = JFactory::getUser();
$userId = $user->id;
foreach ($this->items as $i => $item) {
    $canDo = ZhYandexMapHelper::getTypeActions($item->id);
    $canEdit = $canDo->get('core.edit');
    $canEditOwn = $canDo->get('core.edit.own') && 1 == 2;
    //&& $item->createdbyuser == $userId;
    $canChange = $canDo->get('core.edit.state');
    ?>
	<tr class="row<?php 
    echo $i % 2;
    ?>
">
		<td>
			<?php 
    echo $item->id;
    ?>
		</td>
		<td>
Beispiel #10
0
/*------------------------------------------------------------------------
# com_zhyandexmap - Zh YandexMap
# ------------------------------------------------------------------------
# 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
# Websites: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user = JFactory::getUser();
$userId = $user->id;
foreach ($this->items as $i => $item) {
    $canDo = ZhYandexMapHelper::getMarkerGroupActions($item->id);
    $canEdit = $canDo->get('core.edit');
    $canEditOwn = $canDo->get('core.edit.own') && 1 == 2;
    //&& $item->createdbyuser == $userId;
    $canChange = $canDo->get('core.edit.state');
    ?>
	<tr class="row<?php 
    echo $i % 2;
    ?>
">
		<td>
			<?php 
    echo $item->id;
    ?>
		</td>
		<td>
Beispiel #11
0
/*------------------------------------------------------------------------
# com_zhyandexmap - Zh YandexMap
# ------------------------------------------------------------------------
# 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
# Websites: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$user = JFactory::getUser();
$userId = $user->id;
foreach ($this->items as $i => $item) {
    $canDo = ZhYandexMapHelper::getPathActions($item->id);
    $canEdit = $canDo->get('core.edit');
    $canEditOwn = $canDo->get('core.edit.own') && 1 == 2;
    //&& $item->createdbyuser == $userId;
    $canChange = $canDo->get('core.edit.state');
    ?>
	<tr class="row<?php 
    echo $i % 2;
    ?>
">
		<td>
			<?php 
    echo JHtml::_('grid.id', $i, $item->id);
    ?>
		</td>
		<td>