Ejemplo n.º 1
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $params = JComponentHelper::getParams('com_redevent');
     // Load pane behavior
     jimport('joomla.html.pane');
     JHTML::_('behavior.framework');
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $pane =& JPane::getInstance('sliders');
     $tabs =& JPane::getInstance('tabs');
     $user =& JFactory::getUser();
     $settings = JComponentHelper::getParams('com_redevent');
     //get vars
     $cid = JRequest::getVar('cid');
     $url = JURI::root();
     $document->setTitle(JText::_('COM_REDEVENT_PAGETITLE_EDITVENUE'));
     //add css and js to document
     $document->addScript('../includes/js/joomla/popup.js');
     $document->addStyleSheet('../includes/js/joomla/popup.css');
     $document->addStyleSheet('components/com_redevent/assets/css/redeventbackend.css');
     $document->addScript($url . '/components/com_redevent/assets/js/attachments.js');
     $document->addScriptDeclaration('var removemsg = "' . JText::_('COM_REDEVENT_ATTACHMENT_CONFIRM_MSG') . '";');
     // Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Data');
     // fail if checked out not by 'me'
     if ($row->id) {
         if ($model->isCheckedOut($user->get('id'))) {
             JError::raiseWarning('REDEVENT_GENERIC_ERROR', $row->venue . ' ' . JText::_('COM_REDEVENT_EDITED_BY_ANOTHER_ADMIN'));
             $mainframe->redirect('index.php?option=com_redevent&view=venues');
         }
     }
     $task = JRequest::getVar('task');
     //create the toolbar
     if ($task == 'copy') {
         JToolBarHelper::title(JText::_('COM_REDEVENT_COPY_VENUE'), 'venuesedit');
     } elseif ($cid) {
         JToolBarHelper::title(JText::_('COM_REDEVENT_EDIT_VENUE'), 'venuesedit');
         //makes data safe
         JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'locdescription');
     } else {
         JToolBarHelper::title(JText::_('COM_REDEVENT_ADD_VENUE'), 'venuesedit');
         //set the submenu
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT'), 'index.php?option=com_redevent');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_EVENTS'), 'index.php?option=com_redevent&view=events');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_VENUES'), 'index.php?option=com_redevent&view=venues');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_CATEGORIES'), 'index.php?option=com_redevent&view=categories');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_ARCHIVESCREEN'), 'index.php?option=com_redevent&view=archive');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_GROUPS'), 'index.php?option=com_redevent&view=groups');
         JSubMenuHelper::addEntry(JText::_('COM_REDEVENT_HELP'), 'index.php?option=com_redevent&view=help');
     }
     JToolBarHelper::apply();
     JToolBarHelper::spacer();
     JToolBarHelper::save();
     JToolBarHelper::spacer();
     JToolBarHelper::cancel();
     JToolBarHelper::spacer();
     //JToolBarHelper::help( 'el.editvenues', true );
     $lists = array();
     // categories selector
     $selected = array();
     foreach ((array) $row->categories as $cat) {
         $selected[] = $cat;
     }
     $lists['categories'] = JHTML::_('select.genericlist', (array) $this->get('Categories'), 'categories[]', 'class="inputbox" multiple="multiple" size="10"', 'value', 'text', $selected);
     $countries = array();
     $countries[] = JHTML::_('select.option', '', JText::_('COM_REDEVENT_Select_country'));
     $countries = array_merge($countries, redEVENTHelperCountries::getCountryOptions());
     $lists['countries'] = JHTML::_('select.genericlist', $countries, 'country', 'class="inputbox"', 'value', 'text', $row->country);
     unset($countries);
     $pinpointicon = REOutput::pinpointicon($row);
     if ($task == 'copy') {
         $row->id = null;
         $row->venue .= ' ' . JText::_('COM_REDEVENT_copy');
         $row->alias = '';
     }
     //assign data to template
     $this->assignRef('row', $row);
     $this->assignRef('pane', $pane);
     $this->assignRef('tabs', $tabs);
     $this->assignRef('editor', $editor);
     $this->assignRef('settings', $settings);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     $this->assignRef('imageselect', $imageselect);
     $this->assignRef('pinpointicon', $pinpointicon);
     $this->assignRef('access', redEVENTHelper::getAccesslevelOptions());
     $this->assignRef('form', $this->get('form'));
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }