public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } JHtml::_('behavior.framework'); JHtml::_('behavior.modal', 'a.modal'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); //initialise variables $document = JFactory::getDocument(); $this->settings = JEMAdmin::config(); $task = JFactory::getApplication()->input->get('task', ''); $this->task = $task; // Load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); JHtml::_('stylesheet', 'com_jem/geostyle.css', array(), true); // Load Scripts JHtml::_('script', 'com_jem/attachments.js', false, true); //$document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places'); $language = JFactory::getLanguage(); $language = $language->getTag(); $language = substr($language, 0,2); $document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&language='.$language); // Noconflict $document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>'); // JQuery scripts $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); JHtml::_('script', 'com_jem/jquery.geocomplete.js', false, true); $access2 = JEMHelper::getAccesslevelOptions(); $this->access = $access2; $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // initialise variables $document = JFactory::getDocument(); $app = JFactory::getApplication(); $jinput = $app->input; $this->settings = JEMAdmin::config(); $this->settings2 = JemHelper::globalattribs(); $task = $jinput->getCmd('task'); $this->task = $task; # load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); # load js //JHtml::_('behavior.framework'); //mootools JHtml::_('script', 'com_jem/attachments.js', false, true); //$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); $this->access = JEMHelper::getAccesslevelOptions(); # retrieve mapType setting $settings = JemHelper::globalattribs(); $mapType = $settings->get('mapType', '0'); switch ($mapType) { case '0': $type = '"roadmap"'; break; case '1': $type = '"satellite"'; break; case '2': $type = '"hybrid"'; break; case '3': $type = '"terrain"'; break; } $this->mapType = $type; //JHtml::_('jquery.framework'); JHtml::_('script', 'com_jem/slider-state.js', false, true); $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { if ($this->getLayout() == 'choosevenue') { $this->_displaychoosevenue($tpl); return; } if ($this->getLayout() == 'choosecontact') { $this->_displaychoosecontact($tpl); return; } // Initialise variables. $jemsettings = JEMHelper::config(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $valguest = JEMUser::validate_guest(); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $url = JUri::root(); $template = $app->getTemplate(); $settings = JemHelper::globalattribs(); $vsettings = JemHelper::viewSettings('veditevent'); $this->vsettings = $vsettings; $this->settings = $settings; $this->valguest = $valguest; // Get model data. $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->params = $this->state->get('params'); // Create a shortcut for $item and params. $item = $this->item; $params = $this->params; $this->form = $this->get('Form'); $this->return_page = $this->get('ReturnPage'); if ($valguest == false) { // check for guest if (!$user || $user->id == 0) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } } if (empty($this->item->id)) { // Check if the user has access to the form $maintainer = JemUser::ismaintainer('add'); $genaccess = JemUser::validate_user($jemsettings->evdelrec, $jemsettings->delivereventsyes); if ($maintainer || $genaccess) { $dellink = true; } else { $dellink = false; } $valguest = JEMUser::validate_guest(); $authorised = $user->authorise('core.create', 'com_jem') || (count($user->getAuthorisedCategories('com_jem', 'core.create')) || $valguest || $dellink); } else { // Check if user can edit $maintainer5 = JemUser::ismaintainer('edit', $this->item->id); $genaccess5 = JemUser::editaccess($jemsettings->eventowner, $this->item->created_by, $jemsettings->eventeditrec, $jemsettings->eventedit); if ($maintainer5 || $genaccess5) { $allowedtoeditevent = true; } else { $allowedtoeditevent = false; } $authorised = $this->item->params->get('access-edit') || $allowedtoeditevent; } if ($authorised !== true) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } // Decide which parameters should take priority $useMenuItemParams = $menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'editevent' && 0 == $item->id; // menu item is always for new event $title = $item->id == 0 ? JText::_('COM_JEM_EDITEVENT_ADD_EVENT') : JText::sprintf('COM_JEM_EDITEVENT_EDIT_EVENT', $item->title); if ($useMenuItemParams) { $pagetitle = $menuitem->title ? $menuitem->title : $title; $params->def('page_title', $pagetitle); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $pagetitle); // Load layout from menu item if one is set else from event if there is one set if (isset($menuitem->query['layout'])) { $this->setLayout($menuitem->query['layout']); } elseif ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $item->params->merge($params); } else { $pagetitle = $title; $params->set('page_title', $pagetitle); $params->set('page_heading', $pagetitle); $params->set('show_page_heading', 1); // ensure page heading is shown $params->set('introtext', ''); // there is definitely no introtext. $params->set('show_introtext', 0); $pathway->addItem($pagetitle, ''); // link not required here so '' is ok // Check for alternative layouts (since we are not in a edit-event menu item) // Load layout from event if one is set if ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $temp = clone $params; $temp->merge($item->params); $item->params = $temp; } if (!empty($this->item) && isset($this->item->id)) { // $this->item->images = json_decode($this->item->images); // $this->item->urls = json_decode($this->item->urls); $tmp = new stdClass(); // check for recurrence if ($this->item->recurrence_type != 0 || $this->item->recurrence_first_id != 0) { $tmp->recurrence_type = 0; $tmp->recurrence_first_id = 0; } // $tmp->images = $this->item->images; // $tmp->urls = $this->item->urls; $this->form->bind($tmp); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $access2 = JEMHelper::getAccesslevelOptions(); $this->access = $access2; // add css file JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); # Load scripts JHtml::_('bootstrap.framework'); if ($vsettings->get('editevent_show_attachmentstab', 1)) { JHtml::_('script', 'com_jem/attachments.js', false, true); } if ($vsettings->get('editevent_show_othertab', 1)) { JHtml::_('script', 'com_jem/other.js', false, true); JHtml::_('script', 'com_jem/recurrence.js', false, true); } JHtml::_('script', 'com_jem/seo.js', false, true); if (JEMUser::validate_guest()) { JHtml::_('script', 'com_jem/antispam.js', false, true); } JHtml::_('behavior.tabstate'); // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->dimage = JemImage::flyercreator($this->item->datimage, 'event'); $this->jemsettings = $jemsettings; $this->infoimage = JHtml::_('image', 'com_jem/icon-16-hint.png', JText::_('COM_JEM_NOTES'), NULL, true); $this->user = $user; if ($params->get('enable_category') == 1) { $this->form->setFieldAttribute('catid', 'default', $params->get('catid', 1)); $this->form->setFieldAttribute('catid', 'readonly', 'true'); } $this->_prepareDocument(); parent::display($tpl); }
/** * Editevent-View */ public function display($tpl = null) { if ($this->getLayout() == 'choosevenue') { $this->_displaychoosevenue($tpl); return; } if ($this->getLayout() == 'choosecontact') { $this->_displaychoosecontact($tpl); return; } // Initialise variables. $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $app = JFactory::getApplication(); $user = JemFactory::getUser(); $userId = $user->get('id'); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $url = JUri::root(); // Get model data. $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->params = $this->state->get('params'); // Create a shortcut for $item and params. $item = $this->item; $params = $this->params; $this->form = $this->get('Form'); $this->return_page = $this->get('ReturnPage'); // check for data error if (empty($item)) { $app->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return false; } // check for guest if ($userId == 0) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } if (empty($item->id)) { $authorised = (bool)$user->can('add', 'event'); } else { $authorised = (bool)$item->params->get('access-edit'); } if ($authorised !== true) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } // Decide which parameters should take priority $useMenuItemParams = ($menuitem && ($menuitem->query['option'] == 'com_jem') && ($menuitem->query['view'] == 'editevent') && (0 == $item->id)); // menu item is always for new event $title = ($item->id == 0) ? JText::_('COM_JEM_EDITEVENT_ADD_EVENT') : JText::sprintf('COM_JEM_EDITEVENT_EDIT_EVENT', $item->title); if ($useMenuItemParams) { $pagetitle = $menuitem->title ? $menuitem->title : $title; $params->def('page_title', $pagetitle); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $pagetitle); // Load layout from menu item if one is set else from event if there is one set if (isset($menuitem->query['layout'])) { $this->setLayout($menuitem->query['layout']); } elseif ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $item->params->merge($params); } else { $pagetitle = $title; $params->set('page_title', $pagetitle); $params->set('page_heading', $pagetitle); $params->set('show_page_heading', 1); // ensure page heading is shown $params->set('introtext', ''); // there is definitely no introtext. $params->set('showintrotext', 0); $pathway->addItem($pagetitle, ''); // link not required here so '' is ok // Check for alternative layouts (since we are not in an edit-event menu item) // Load layout from event if one is set if ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $temp = clone($params); $temp->merge($item->params); $item->params = $temp; } if (!empty($this->item) && isset($this->item->id)) { // $this->item->images = json_decode($this->item->images); // $this->item->urls = json_decode($this->item->urls); $tmp = new stdClass(); // check for recurrence if (($this->item->recurrence_type != 0) || ($this->item->recurrence_first_id != 0)) { $tmp->recurrence_type = 0; $tmp->recurrence_first_id = 0; } // $tmp->images = $this->item->images; // $tmp->urls = $this->item->urls; $this->form->bind($tmp); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $access2 = JEMHelper::getAccesslevelOptions(true); $this->access = $access2; JHtml::_('behavior.formvalidation'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.modal', 'a.flyermodal'); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); // Load scripts JHtml::_('script', 'com_jem/attachments.js', false, true); JHtml::_('script', 'com_jem/recurrence.js', false, true); JHtml::_('script', 'com_jem/seo.js', false, true); JHtml::_('script', 'com_jem/unlimited.js', false, true); JHtml::_('script', 'com_jem/other.js', false, true); // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->dimage = JemImage::flyercreator($this->item->datimage, 'event'); $this->jemsettings = $jemsettings; $this->settings = $settings; $this->infoimage = JHtml::_('image', 'com_jem/icon-16-hint.png', JText::_('COM_JEM_NOTES'), NULL, true); $this->user = $user; $permissions = new stdClass(); $permissions->canAddVenue = $user->can('add', 'venue'); $this->permissions = $permissions; if ($params->get('enable_category') == 1) { $this->form->setFieldAttribute('catid', 'default', $params->get('catid', 1)); $this->form->setFieldAttribute('catid', 'readonly', 'true'); } // disable for non-publishers if (empty($item->params) || !$item->params->get('access-change', false)) { $this->form->setFieldAttribute('published', 'default', 0); $this->form->setFieldAttribute('published', 'readonly', 'true'); } $this->_prepareDocument(); parent::display($tpl); }