Exemple #1
0
 /**
  * Method to get the Venues
  *
  * @access public
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $menu->getParams($item->id);
     $elsettings =& redEVENTHelper::config();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         // Get a reference to the global cache object.
         $cache =& JFactory::getCache('redevent');
         $this->_data = $cache->call(array('RedeventModelVenuesmap', '_getResultList'), $query);
         $k = 0;
         for ($i = 0; $i < count($this->_data); $i++) {
             $venue =& $this->_data[$i];
             //Create image information
             $venue->limage = redEVENTImage::flyercreator($venue->locimage);
             //Generate Venuedescription
             if (!empty($venue->locdescription)) {
                 //execute plugins
                 $venue->locdescription = JHTML::_('content.prepare', $venue->locdescription);
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = REOutput::getFlag($venue->country);
             }
             //create target link
             $venue->targetlink = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug));
             $k = 1 - $k;
         }
     }
     return $this->_data;
 }
Exemple #2
0
 /**
  * Logic to get the venue
  *
  * @return array
  */
 function &getData()
 {
     $mainframe =& JFactory::getApplication();
     if (empty($this->_venue)) {
         if ($this->_id) {
             // Load the Event data
             $query = ' SELECT v.id, v.venue, v.url, v.street, v.plz, v.city, v.state, v.country, v.locdescription, v.locimage, v.latitude, v.longitude, v.company, ' . ' COUNT( a.id ) AS assignedevents,' . ' CASE WHEN CHAR_LENGTH(v.alias) THEN CONCAT_WS(\':\', v.id, v.alias) ELSE v.id END as slug' . ' FROM #__redevent_venues as v' . ' LEFT JOIN #__redevent_event_venue_xref AS a ON a.venueid = v.id AND a.published = 1' . ' WHERE v.id = ' . $this->_db->Quote($this->_id) . ' GROUP BY v.id ';
             $this->_db->setQuery($query);
             $venue = $this->_db->loadObject();
             //Create image information
             $venue->limage = redEVENTImage::flyercreator($venue->locimage);
             //Generate Venuedescription
             if (!empty($venue->locdescription)) {
                 //execute plugins
                 $venue->locdescription = JHTML::_('content.prepare', $venue->locdescription);
             }
             //build the url
             if (!empty($venue->url) && strtolower(substr($venue->url, 0, 7)) != "http://") {
                 $venue->url = 'http://' . $venue->url;
             }
             //prepare the url for output
             if (strlen(htmlspecialchars($venue->url, ENT_QUOTES)) > 35) {
                 $venue->urlclean = substr(htmlspecialchars($venue->url, ENT_QUOTES), 0, 35) . '...';
             } else {
                 $venue->urlclean = htmlspecialchars($venue->url, ENT_QUOTES);
             }
             //create flag
             if ($venue->country) {
                 $venue->countryimg = REOutput::getFlag($venue->country);
             }
             //create target link
             $venue->targetlink = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($venue->slug));
             $venue->categories = $this->_getVenueCategories($this->_id);
             $this->_venue = $venue;
         }
     }
     return $this->_venue;
 }
Exemple #3
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);
 }
Exemple #4
0
 /**
  * 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);
 }