/** * Creates the output for venue submissions * * @since 0.5 * @param int $tpl */ function display($tpl = null) { $mainframe =& JFactory::getApplication(); $editor =& JFactory::getEditor(); $document =& JFactory::getDocument(); $elsettings =& redEVENTHelper::config(); $params =& $mainframe->getParams(); $acl = UserAcl::getInstance(); // Get requests $id = JRequest::getInt('id'); if ($id && !$acl->canEditVenue($id)) { echo JText::_('COM_REDEVENT_USER_NOT_ALLOWED_TO_EDIT_THIS_VENUE'); return; } else { if (!$id && !$acl->canAddVenue()) { echo JText::_('COM_REDEVENT_USER_NOT_ALLOWED_TO_ADD_VENUE'); return; } } //Get Data from the model $row = $this->Get('Venue'); JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription'); JHTML::_('behavior.formvalidation'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.mootools'); //add css file if (!$params->get('custom_css')) { $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css'); } else { $document->addStyleSheet($params->get('custom_css')); } $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->'); $document->addScript('components/com_redevent/assets/js/attachments.js'); $document->addScriptDeclaration('var removemsg = "' . JText::_('COM_REDEVENT_ATTACHMENT_CONFIRM_MSG') . '";'); // Get the menu object of the active menu item $menu =& JSite::getMenu(); $item = $menu->getActive(); $params =& $mainframe->getParams('com_redevent'); $id ? $title = JText::_('COM_REDEVENT_EDIT_VENUE') : ($title = JText::_('COM_REDEVENT_ADD_VENUE')); //pathway $pathway =& $mainframe->getPathWay(); $pathway->addItem($title, ''); //Set Title $document->setTitle($title); //editor user // $editoruser = ELUser::editoruser(); $editoruser = true; //transform <br /> and <br> back to \r\n for non editorusers if (!$editoruser) { $row->locdescription = redEVENTHelper::br2break($row->locdescription); } //Get image $limage = redEVENTImage::flyercreator($row->locimage); //Set the info image $infoimage = JHTML::_('image', 'components/com_redevent/assets/images/icon-16-hint.png', JText::_('COM_REDEVENT_NOTES')); $lists = array(); // categories selector $selected = array(); foreach ((array) $row->categories as $cat) { $selected[] = $cat; } $options = (array) $this->get('CategoryOptions'); $lists['categories'] = JHTML::_('select.genericlist', $options, 'categories[]', 'class="inputbox validate-categories" multiple="multiple" size="' . min(3, max(10, count($options))) . '"', 'value', 'text', $selected); // country $options = redEVENTHelperCountries::getCountryOptions('value', 'text', true); $lists['country'] = JHTML::_('select.genericlist', $options, 'country', '', 'value', 'text', $row->country); // published state selector $canpublish = $acl->canPublishVenue($id); $published = array(JHTML::_('select.option', '1', JText::_('COM_REDEVENT_PUBLISHED')), JHTML::_('select.option', '0', JText::_('COM_REDEVENT_UNPUBLISHED'))); $lists['published'] = JHTML::_('select.radiolist', $published, 'published', '', 'value', 'text', $row->published); $this->assignRef('row', $row); $this->assignRef('editor', $editor); $this->assignRef('editoruser', $editoruser); $this->assignRef('limage', $limage); $this->assignRef('infoimage', $infoimage); $this->assignRef('elsettings', $elsettings); $this->assignRef('lists', $lists); $this->assignRef('item', $item); $this->assignRef('params', $params); $this->assignRef('canpublish', $canpublish); $this->assignRef('access', redEVENTHelper::getAccesslevelOptions()); parent::display($tpl); }
/** * Creates the output for event submissions * * @since 0.4 * */ function display($tpl = null) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); if (!$user->get('id')) { echo JText::_('COM_REDEVENT_LOGIN_TO_SUBMIT_EVENT'); return; } if ($this->getLayout() == 'selectvenue') { $this->_displayselectvenue($tpl); return; } else { if ($this->getLayout() == 'eventdate') { $this->_displayEventdate($tpl); return; } } $useracl =& UserAcl::getInstance(); if (!$useracl->canAddEvent()) { echo JText::_('COM_REDEVENT_EDIT_EVENT_NOT_ALLOWED'); return; } // Initialize variables $editor =& JFactory::getEditor(); $document =& JFactory::getDocument(); $elsettings =& redEVENTHelper::config(); $params =& $mainframe->getParams(); //Get Data from the model $row =& $this->get('Event'); $customs =& $this->get('Customfields'); $xcustoms =& $this->get('XrefCustomfields'); $roles =& $this->get('SessionRoles'); $prices =& $this->get('SessionPrices'); //Get requests $id = JRequest::getInt('id'); //Clean output JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription'); JHTML::_('behavior.formvalidation'); JHTML::_('behavior.tooltip'); JHTML::_('behavior.modal', 'a.vmodal'); //add css file if (!$params->get('custom_css')) { $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css'); $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/editevent.css'); } else { $document->addStyleSheet($params->get('custom_css')); } $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->'); $document->addScript('components/com_redevent/assets/js/attachments.js'); $document->addScriptDeclaration('var removemsg = "' . JText::_('COM_REDEVENT_ATTACHMENT_CONFIRM_MSG') . '";'); $document->addScript('components/com_redevent/assets/js/xref_roles.js'); $document->addScriptDeclaration('var txt_remove = "' . JText::_('COM_REDEVENT_REMOVE') . '";'); $document->addScript('components/com_redevent/assets/js/xref_prices.js'); //Set page title $id ? $title = $row->title . ' - ' . JText::_('COM_REDEVENT_EDIT_EVENT') : ($title = JText::_('COM_REDEVENT_ADD_EVENT')); $document->setTitle($title); // Get the menu object of the active menu item $menu =& JSite::getMenu(); $item = $menu->getActive(); $params =& $mainframe->getParams('com_redevent'); //pathway $pathway =& $mainframe->getPathWay(); $pathway->addItem($title, ''); //Has the user access to the editor and the add venue screen $editoruser = $params->get('edit_description_allow_editor', 0) || ELUser::editoruser(); $canpublish = $useracl->canPublishEvent($id); //transform <br /> and <br> back to \r\n for non editorusers if (!$editoruser) { $row->datdescription = redEVENTHelper::br2break($row->datdescription); } //Get image information $dimage = redEVENTImage::flyercreator($row->datimage); //Set the info image $infoimage = JHTML::_('image', 'components/com_redevent/assets/images/icon-16-hint.png', JText::_('COM_REDEVENT_NOTES')); //Create the stuff required for the venueselect functionality $url = JURI::root(); $js = "\n\t\tfunction reSelectVenue(id, venue) {\n\t\t\tdocument.getElementById('a_id').value = id;\n\t\t\tdocument.getElementById('a_name').value = venue;\n\t\t\tSqueezeBox.close();\n\t\t}"; $document->addScriptDeclaration($js); // categories selector $selected = array(); foreach ((array) $row->categories as $cat) { $selected[] = $cat->id; } $catoptions = $this->get('CategoryOptions'); if (!$catoptions) { echo JText::_('COM_REDEVENT_EDITEVENT_FORBIDDEN_NO_CATEGORY_AVAILABLE'); return; } $lists['categories'] = JHTML::_('select.genericlist', $catoptions, 'categories[]', 'class="inputbox required validate-categories" multiple="multiple" size="10"', 'value', 'text', $selected); if ($params->get('edit_recurrence', 0)) { $document->addScript('components/com_redevent/assets/js/xref_recurrence.js'); // Recurrence selector $recur_type = array(JHTML::_('select.option', 'NONE', JText::_('COM_REDEVENT_NO_REPEAT')), JHTML::_('select.option', 'DAILY', JText::_('COM_REDEVENT_DAILY')), JHTML::_('select.option', 'WEEKLY', JText::_('COM_REDEVENT_WEEKLY')), JHTML::_('select.option', 'MONTHLY', JText::_('COM_REDEVENT_MONTHLY')), JHTML::_('select.option', 'YEARLY', JText::_('COM_REDEVENT_YEARLY'))); $lists['recurrence_type'] = JHTML::_('select.radiolist', $recur_type, 'recurrence_type', '', 'value', 'text', $row->rrules->type ? $row->rrules->type : 'NONE'); } // published state selector $published = array(JHTML::_('select.option', '1', JText::_('COM_REDEVENT_PUBLISHED')), JHTML::_('select.option', '0', JText::_('COM_REDEVENT_UNPUBLISHED'))); $lists['published'] = JHTML::_('select.radiolist', $published, 'published', '', 'value', 'text', $row->published); $rolesoptions = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_Select_role'))); $rolesoptions = array_merge($rolesoptions, $this->get('RolesOptions')); $pricegroupsoptions = array(JHTML::_('select.option', 0, JText::_('COM_REDEVENT_PRICEGROUPS_SELECT_PRICEGROUP'))); $pricegroupsoptions = array_merge($pricegroupsoptions, $this->get('PricegroupsOptions')); $this->assignRef('row', $row); $this->assignRef('customs', $customs); $this->assignRef('xcustoms', $xcustoms); $this->assignRef('categories', $categories); $this->assignRef('editor', $editor); $this->assignRef('dimage', $dimage); $this->assignRef('infoimage', $infoimage); $this->assignRef('editoruser', $editoruser); $this->assignRef('elsettings', $elsettings); $this->assignRef('item', $item); $this->assignRef('params', $params); $this->assignRef('lists', $lists); $this->assignRef('canpublish', $canpublish); $this->assignRef('referer', JRequest::getWord('referer')); $this->assign('title', $title); $this->assignRef('access', redEVENTHelper::getAccesslevelOptions()); $this->assignRef('roles', $roles); $this->assignRef('rolesoptions', $rolesoptions); $this->assignRef('prices', $prices); $this->assignRef('pricegroupsoptions', $pricegroupsoptions); parent::display($tpl); }