public function display($cachable = false, $urlparams = false) { $view = $this->input->get('view', $this->default_view); $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); if ($view == 'urls' && $layout == 'edit' && !$this->checkEditId('com_aimysitemap.edit.urls', $id)) { $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=urls', false)); return false; } if (!AimySitemapConfigHelper::get_once('default_priority', 0)) { JFactory::getApplication()->enqueueMessage(JText::sprintf('AIMY_SM_MSG_NOT_CONFIGURED', JRoute::_('index.php?option=com_config&' . 'view=component&' . 'component=com_aimysitemap')), 'warning'); } JFactory::getDocument()->addStylesheet('components/com_aimysitemap/helpers/backend.css?r=3.16.0'); parent::display(); return $this; }
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.16.0'); } $this->add_toolbar(); parent::display($tpl); }
public function toggle_state_ajax() { JSession::checkToken() or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('core.edit') || !AimySitemapConfigHelper::get_once('ajax_edit', true)) { jexit(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } header('Content-Type: application/json; charset=UTF-8'); $jinput = JFactory::getApplication()->input; $id = $jinput->get('id', null, 'uint'); if (!is_null($id) && $id !== 0) { if ($this->getModel()->toggle_state($id)) { echo json_encode(array('ok' => 1)); } } JFactory::getApplication()->close(); }