/** * 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; }
/** * 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; }
function _getTag_venue_thumb() { $venueimage = redEVENTImage::modalimage($this->getEvent()->getData()->locimage, $this->getEvent()->getData()->venue); return $venueimage; }
/** * Method to store the venue * * @access public * @return id * @since 0.9 */ function store($data, $file) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $elsettings =& redEVENTHelper::config(); //Get mailinformation $SiteName = $mainframe->getCfg('sitename'); $MailFrom = $mainframe->getCfg('mailfrom'); $FromName = $mainframe->getCfg('fromname'); $tzoffset = $mainframe->getCfg('offset'); $params = $mainframe->getParams('com_redevent'); $row =& JTable::getInstance('redevent_venues', ''); //bind it to the table if (!$row->bind($data)) { RedeventError::raiseError(500, $this->_db->stderr()); return false; } //Are we saving from an item edit? if ($row->id) { $row->modified = gmdate('Y-m-d H:i:s'); $row->modified_by = $user->get('id'); } else { //get IP, time and userid $row->created = gmdate('Y-m-d H:i:s'); $row->author_ip = $elsettings->get('storeip', '1') ? getenv('REMOTE_ADDR') : 'DISABLED'; $row->created_by = $user->get('id'); } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $params->get('edit_image', 1) == 2) { $this->setError(JText::_('COM_REDEVENT_IMAGE_EMPTY')); return false; } if (($params->get('edit_image', 1) == 2 || $params->get('edit_image', 1) == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); if ($params->get('default_image_path', 'redevent')) { $reldirpath = $params->get('default_image_path', 'redevent') . DS . 'venues' . DS; } else { $reldirpath = ''; } $base_Dir = JPATH_SITE . DS . 'images' . DS . $reldirpath; //check the image $check = redEVENTImage::check($file, $elsettings); if ($check === false) { $mainframe->redirect($_SERVER['HTTP_REFERER']); } //sanitize the image filename $filename = redEVENTImage::sanitize($base_Dir, $file['name']); $filepath = $base_Dir . $filename; if (!JFile::upload($file['tmp_name'], $filepath)) { $this->setError(JText::_('COM_REDEVENT_UPLOAD_FAILED')); return false; } else { $row->locimage = 'images' . DS . $reldirpath . $filename; } } else { //keep image if edited and left blank $row->locimage = $row->curimage; } //end image upload if //Check description $editoruser = ELUser::editoruser(); if (!$editoruser) { //check description --> wipe out code $row->locdescription = strip_tags($row->locdescription, '<br><br/>'); //convert the linux \n (Mac \r, Win \r\n) to <br /> linebreaks $row->locdescription = str_replace(array("\r\n", "\r", "\n"), "<br />", $row->locdescription); //cut too long words $row->locdescription = wordwrap($row->locdescription, 75, " ", 1); //check length $length = JString::strlen($row->locdescription); if ($length > $params->get('max_description', 1000)) { // if required shorten it $row->locdescription = JString::substr($row->locdescription, 0, $params->get('max_description', 1000)); //if shortened add ... $row->locdescription = $row->locdescription . '...'; } } $row->venue = trim(JFilterOutput::ampReplace($row->venue)); //Make sure the data is valid if (!$row->check($elsettings)) { $this->setError($row->getError()); return false; } //is this an edited venue or not? //after store we allways have an id $edited = $row->id ? $row->id : false; //store it in the db if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // update the event category xref // first, delete current rows for this event $query = ' DELETE FROM #__redevent_venue_category_xref WHERE venue_id = ' . $this->_db->Quote($row->id); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } // insert new ref foreach ((array) $data['categories'] as $cat_id) { $query = ' INSERT INTO #__redevent_venue_category_xref (venue_id, category_id) VALUES (' . $this->_db->Quote($row->id) . ', ' . $this->_db->Quote($cat_id) . ')'; $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } } // attachments if ($params->get('allow_attachments', 1)) { REAttach::store('venue' . $row->id); } jimport('joomla.utilities.mail'); $link = JRoute::_(JURI::base() . RedeventHelperRoute::getVenueEventsRoute($row->id), false); //create mail if ($params->get('mailinform') == 2 || $params->get('mailinform') == 3) { $mail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('COM_REDEVENT_MAIL_VENUE_PUBLISHED', $link) : JText::_('COM_REDEVENT_MAIL_VENUE_UNPUBLISHED'); if ($edited) { $modified_ip = getenv('REMOTE_ADDR'); $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_MAIL_EDIT_VENUE', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $mail->setSubject($SiteName . JText::_('COM_REDEVENT_EDIT_VENUE_MAIL')); } else { $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_MAIL_NEW_VENUE', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $mail->setSubject($SiteName . JText::_('COM_REDEVENT_NEW_VENUE_MAIL')); } $receivers = explode(',', trim($params->get('mailinformrec'))); $mail->addRecipient($receivers); $mail->setSender(array($MailFrom, $FromName)); $mail->setBody($mailbody); if (!$mail->Send()) { RedeventHelperLog::simpleLog('Error sending created/edited venue notification to site owner'); } } //create the mail for the user if ($params->get('mailinformuser') == 2 || $params->get('mailinformuser') == 3) { $usermail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('COM_REDEVENT_USER_MAIL_VENUE_PUBLISHED', $link) : JText::_('COM_REDEVENT_USER_MAIL_VENUE_UNPUBLISHED'); if ($edited) { $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_USER_MAIL_EDIT_VENUE', $user->name, $user->username, $edited, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $usermail->setSubject($SiteName . JText::_('COM_REDEVENT_EDIT_USER_VENUE_MAIL')); } else { $created = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_USER_MAIL_NEW_VENUE', $user->name, $user->username, $created, $row->venue, $row->url, $row->street, $row->plz, $row->city, $row->country, $row->locdescription, $state); $usermail->setSubject($SiteName . JText::_('COM_REDEVENT_NEW_USER_VENUE_MAIL')); } $usermail->addRecipient($user->email); $usermail->setSender(array($MailFrom, $FromName)); $usermail->setBody($mailbody); if (!$usermail->Send()) { RedeventHelperLog::simpleLog('Error sending created/edited venue notification to venue owner'); } } //update item order $row->reorder(); return $row->id; }
$cats = array(); foreach ($row->categories as $cat) { $cats[] = $this->escape($cat->catname); } echo implode("<br/>", $cats); ?> </td> <?php break; ?> <?php case 'picture': ?> <td class="re_places"><?php echo JHTML::image(redEVENTImage::getThumbUrl('events', $row->datimage, intval($this->params->get('lists_picture_size', 30))), $row->title); ?> </td> <?php break; ?> <?php case 'places': ?> <td class="re_places"><?php echo redEVENTHelper::getRemainingPlaces($row); ?> </td> <?php break;
"> <?php echo $this->escape($row->catname); ?> </h2> <?php if (!empty($row->image) || $this->params->get('use_default_picture', 1)) { ?> <div class="catimg"> <?php if (!empty($row->image)) { ?> <span> <?php $img = JHTML::image(redEVENTImage::getThumbUrl($row->image), $row->catname); echo JHTML::_('link', JRoute::_($row->linktarget), $img); ?> </span> <?php } ?> <?php echo JText::_('COM_REDEVENT_EVENTS') . ': '; echo JHTML::_('link', JRoute::_($row->linktarget), $row->assignedevents); ?> </div> <?php } ?>
echo $this->loadTemplate('session'); echo $pane->endPanel(); ?> <?php } ?> <?php if ($this->params->get('edit_image', 1) == 2 || $this->params->get('edit_image', 1) == 1) { echo $pane->startPanel(JText::_('COM_REDEVENT_IMAGE'), 'ev-image'); ?> <div class="editevent-image"> <?php if ($this->row->datimage) { echo redEVENTImage::modalimage($this->row->datimage, $this->row->title); } else { echo JHTML::_('image', 'components/com_redevent/assets/images/noimage.png', JText::_('COM_REDEVENT_NO_IMAGE'), array('class' => 'modal')); } ?> <label for="userfile"><?php echo JText::_('COM_REDEVENT_IMAGE'); ?> </label> <input class="inputbox <?php echo $this->params->get('edit_image', 1) == 2 ? 'required' : ''; ?> " name="userfile" id="userfile" type="file" /> <small class="editlinktip hasTip" title="<?php echo JText::_('COM_REDEVENT_NOTES'); ?>
<?php echo $this->task == 'archive' ? $this->escape($this->category->name . ' - ' . JText::_('COM_REDEVENT_ARCHIVE')) : $this->escape($this->category->name); ?> </h1> <?php } ?> <div class="floattext"> <div class="catimg"> <?php if ($this->category->image) { ?> <?php echo redEVENTImage::modalimage($this->category->image, $this->category->name); ?> <?php } else { ?> <?php echo JHTML::image('components/com_redevent/assets/images/noimage.png', $this->category->name); ?> <?php } ?> </div> <div class="catdescription"> <?php echo $this->description;
/** * 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); }
/** * logic for uploading an image * * @access public * @return void * @since 0.9 */ function uploadimage() { $mainframe =& JFactory::getApplication(); // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); $elsettings = JComponentHelper::getParams('com_redevent'); $file = JRequest::getVar('userfile', '', 'files', 'array'); $task = JRequest::getVar('task'); // Set FTP credentials, if given jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); //$ftp = JClientHelper::getCredentials('ftp'); //set the target directory switch ($task) { case 'venueimgup': $base_Dir = JPATH_SITE . DS . 'images' . DS . 'redevent' . DS . 'venues' . DS; break; case 'eventimgup': $base_Dir = JPATH_SITE . DS . 'images' . DS . 'redevent' . DS . 'events' . DS; break; case 'categoryimgup': $base_Dir = JPATH_SITE . DS . 'images' . DS . 'redevent' . DS . 'categories' . DS; break; } //do we have an upload? if (empty($file['name'])) { echo "<script> alert('" . JText::_('COM_REDEVENT_IMAGE_EMPTY') . "'); window.history.go(-1); </script>\n"; $mainframe->close(); } //check the image $check = redEVENTImage::check($file, $elsettings); if ($check === false) { $mainframe->redirect($_SERVER['HTTP_REFERER']); } //sanitize the image filename $filename = redEVENTImage::sanitize($base_Dir, $file['name']); $filepath = $base_Dir . $filename; //upload the image if (!JFile::upload($file['tmp_name'], $filepath)) { echo "<script> alert('" . JText::_('COM_REDEVENT_UPLOAD_FAILED') . "'); window.history.go(-1); </script>\n"; $mainframe->close(); } else { // create thumbnail redEVENTImage::thumb($filepath, dirname($filepath) . DS . 'small' . DS . $filename, $elsettings->get('imagewidth'), $elsettings->get('imageheight', 100)); echo "<script> alert('" . JText::_('COM_REDEVENT_UPLOAD_COMPLETE') . "'); window.history.go(-1); window.parent.elSelectImage('{$filename}', '{$filename}'); </script>\n"; $mainframe->close(); } }
/** * 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); }
/** * return full url to thumbnail * * @param string image path, relative to joomla images folder * @return url or false if it doesn't exists */ public static function getThumbUrl($path, $maxdim = null) { jimport('joomla.filesystem.file'); $app =& JFactory::getApplication(); $settings = redEVENTHelper::config(); if ($maxdim) { $width = $maxdim; $height = $maxdim; } else { $width = $settings->get('imagewidth', 100); $height = $settings->get('imageheight', 100); } $base = JURI::root(); $thumb_name = md5(basename($path)) . $width . '_' . $height . '.png'; if (dirname($path) != '.') { $thumb_path = JPATH_SITE . DS . dirname($path) . DS . 're_thumb' . DS . $thumb_name; $thumb_uri = $base . str_replace("\"", "/", dirname($path)) . '/re_thumb/' . $thumb_name; } else { JError::raisewarning(0, JText::sprintf('COM_REDEVENT_THUMBNAILS_WRONG_BASE_PATH', dirname($thumb_path))); } if (JFile::exists($thumb_path)) { return $thumb_uri; } else { if (JFile::exists(JPATH_SITE . DS . $path)) { //try to generate the thumb if (!JFolder::exists(dirname($thumb_path)) && !JFolder::create(dirname($thumb_path))) { RedeventHelperLog::simpleLog(sprintf('Can\'t create path for thumbnail: %s', dirname($thumb_path))); return false; } if (redEVENTImage::thumb(JPATH_SITE . DS . $path, $thumb_path, $width, $height)) { return $thumb_uri; } } } return false; }
echo $this->escape($category->catname); ?> </h2> <div class="cat<?php echo $category->id; ?> floattext"> <?php if (!empty($category->image) || $this->params->get('use_default_picture', 1)) { ?> <div class="catimg"> <?php if ($category->image) { $img = JHTML::image(redEVENTImage::getThumbUrl($category->image), $category->catname); } else { $img = JHTML::image('components/com_redevent/assets/images/noimage.png', $category->catname); } echo JHTML::_('link', JRoute::_($category->linktarget), $img); ?> <p> <?php echo JText::_('COM_REDEVENT_EVENTS') . ': '; echo JHTML::_('link', JRoute::_($category->linktarget), $category->assignedevents); ?> </p> </div> <?php } ?>
* redEVENT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with redEVENT; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ defined('_JEXEC') or die('Restricted access'); ?> <ul class="rf_thumbevents vcalendar"> <?php foreach ($this->rows as $row) { ?> <?php $img = redEVENTImage::getThumbUrl($row->datimage); $img = $img ? JHTML::image($img, $row->full_title) : false; $detaillink = JRoute::_(RedeventHelperRoute::getDetailsRoute($row->slug, $row->xslug)); $venuelink = JRoute::_(RedeventHelperRoute::getVenueEventsRoute($row->venueslug)); ?> <li class="rf_thumbevent vevent<?php echo $row->featured ? ' featured' : ''; ?> "> <?php if ($img) { ?> <?php echo JHTML::_('link', JRoute::_($detaillink), $img, array('class' => 'rf_img')); ?> <?php
<?php foreach ($this->rows as $row) { ?> <h2 class="eventlist"> <a href="<?php echo $row->targetlink; ?> "><?php echo $this->escape($row->venue); ?> </a> </h2> <?php echo redEVENTImage::modalimage($row->locimage, $row->venue); echo REOutput::mapicon($row, array('class' => 'map')); ?> <dl class="location floattext"> <?php if (!empty($row->url)) { ?> <dt class="venue_website"><?php echo JText::_('COM_REDEVENT_WEBSITE') . ':'; ?> </dt> <dd class="venue_website"> <a href="<?php echo $row->url; ?>
} else { $cats[] = $this->escape($cat->catname); } } echo implode("<br/>", $cats); ?> </td> <?php break; ?> <?php case 'picture': ?> <td class="re_places" itemprop="image"><?php echo redEVENTImage::modalimage($row->datimage, $row->title, intval($this->params->get('lists_picture_size', 30))); ?> </td> <?php break; ?> <?php case 'places': ?> <td class="re_places"><?php echo redEVENTHelper::getRemainingPlaces($row); ?> </td> <?php break;
/** * Method to store the event * * @access public * @return id * @since 0.9 */ function store($data, $file) { $mainframe =& JFactory::getApplication(); $user =& JFactory::getUser(); $elsettings =& redEVENTHelper::config(); $params = $mainframe->getParams(); $acl = UserAcl::getInstance(); //Get mailinformation $SiteName = $mainframe->getCfg('sitename'); $MailFrom = $mainframe->getCfg('mailfrom'); $FromName = $mainframe->getCfg('fromname'); $tzoffset = $mainframe->getCfg('offset'); $row =& JTable::getInstance('redevent_events', ''); if ($data['id']) { $row->load((int) $data['id']); } else { $category_ids = isset($data['categories']) ? $data['categories'] : array(); $template_event = $this->_getEventTemplate($category_ids); $template_event = $template_event ? $template_event : $params->get('event_template', 0); if ($template_event) { $row->load($template_event); $row->id = null; $row->alias = null; $row->checked_out = null; $row->checked_out_time = null; } else { JError::raiseWarning(0, JText::_('COM_REDEVENT_MISSING_FRONTEND_SUBMISSION_EVENT_TEMPLATE')); return false; } } //Sanitize $data['datdescription'] = JRequest::getVar('datdescription', $row->datdescription, 'post', 'string', JREQUEST_ALLOWRAW); $curimage = JRequest::getVar('curimage', '', 'post', 'string'); // published state if (!$acl->canPublishEvent($this->_id)) { // use default state $row->published = $params->get('default_submit_published_state', 0); } //bind it to the table if (!$row->bind($data)) { RedeventError::raiseError(500, $this->_db->stderr()); return false; } //Are we saving from an item edit? if ($row->id) { //check if user is allowed to edit events if (!$acl->canEditEvent($this->_id)) { JError::raiseError(403, JText::_('COM_REDEVENT_NO_ACCESS')); } $row->modified = gmdate('Y-m-d H:i:s'); $row->modified_by = $user->get('id'); } else { //check if user is allowed to submit new events if (!$acl->canAddEvent()) { JError::raiseError(403, JText::_('COM_REDEVENT_NO_ACCESS')); } //get IP, time and userid $row->created = gmdate('Y-m-d H:i:s'); $row->author_ip = $elsettings->get('storeip', '1') ? getenv('REMOTE_ADDR') : 'DISABLED'; $row->created_by = $user->get('id'); } //Image upload //If image upload is required we will stop here if no file was attached if (empty($file['name']) && $params->get('edit_image', 1) == 2) { $this->setError(JText::_('COM_REDEVENT_IMAGE_EMPTY')); return false; } if (($params->get('edit_image', 1) == 2 || $params->get('edit_image', 1) == 1) && !empty($file['name'])) { jimport('joomla.filesystem.file'); $base_Dir = JPATH_SITE . '/images/redevent/events/'; //check the image $check = redEVENTImage::check($file, $elsettings); if ($check === false) { JError::raiseWarning(0, JText::_('COM_REDEVENT_EDITEVENT_IMAGE_CHECKFAILED')); } else { //sanitize the image filename $filename = redEVENTImage::sanitize($base_Dir, $file['name']); $filepath = $base_Dir . $filename; if (!JFile::upload($file['tmp_name'], $filepath)) { JError::raiseWarning(0, JText::_('COM_REDEVENT_UPLOAD_FAILED')); } else { $row->datimage = '/images/redevent/events/' . $filename; } } } else { //keep image if edited and left blank $row->datimage = $curimage; } //end image if //Make sure the table is valid if (!$row->check($elsettings)) { $this->setError($row->getError()); return false; } //is this an edited event or not? //after store we allways have an id $edited = $row->id ? $row->id : false; //store it in the db if (!$row->store(true)) { JError::raiseError(500, $this->_db->stderr()); return false; } // update the event category xref if (isset($data['categories'])) { // first, delete current rows for this event $query = ' DELETE FROM #__redevent_event_category_xref WHERE event_id = ' . $this->_db->Quote($row->id); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } // insert new ref foreach ((array) $data['categories'] as $cat_id) { $query = ' INSERT INTO #__redevent_event_category_xref (event_id, category_id) VALUES (' . $this->_db->Quote($row->id) . ', ' . $this->_db->Quote($cat_id) . ')'; $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } } } else { if (!$edited) { // copy category from template event $query = ' INSERT INTO #__redevent_event_category_xref (event_id, category_id) ' . ' SELECT ' . $this->_db->Quote($row->id) . ', category_id ' . ' FROM #__redevent_event_category_xref ' . ' WHERE event_id = ' . $this->_db->Quote($template_event); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); JError::raiseWarning(0, JText::_('COM_REDEVENT_copying_categories_failed') . ': ' . $xref->getError()); } } } // is there a date ? if (isset($data['dates']) && strlen($data['dates'])) { $xref =& JTable::getInstance('redevent_eventvenuexref', ''); if (isset($data['xref'])) { $xref->load($data['xref']); } $xref->bind($data); $xref->id = isset($data['xref']) ? $data['xref'] : null; $xref->eventid = $row->id; $xref->published = $row->published; if (isset($data['session_title'])) { $xref->title = $data['session_title']; } if (!($xref->check() && $xref->store())) { JError::raiseWarning(0, JText::_('COM_REDEVENT_Saving_event_session_failed') . ': ' . $xref->getError()); } $row->xref = $xref->id; if ($params->get('edit_roles', 0)) { /** roles **/ // first remove current rows $query = ' DELETE FROM #__redevent_sessions_roles ' . ' WHERE xref = ' . $this->_db->Quote($xref->id); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } // then recreate them if any foreach ((array) $data['rrole'] as $k => $r) { if (!($data['rrole'][$k] && $data['urole'][$k])) { continue; } $new =& JTable::getInstance('RedEvent_sessions_roles', ''); $new->set('xref', $xref->id); $new->set('role_id', $r); $new->set('user_id', $data['urole'][$k]); if (!($new->check() && $new->store())) { $this->setError($recurrence->getError()); return false; } } } /** prices **/ if ($params->get('edit_price', 0)) { // first remove current rows $query = ' DELETE FROM #__redevent_sessions_pricegroups ' . ' WHERE xref = ' . $this->_db->Quote($xref->id); $this->_db->setQuery($query); if (!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } // then recreate them if any foreach ((array) $data['pricegroup'] as $k => $r) { if (!$data['pricegroup'][$k]) { continue; } $new =& JTable::getInstance('RedEvent_sessions_pricegroups', ''); $new->set('xref', $xref->id); $new->set('pricegroup_id', $r); $new->set('price', $data['price'][$k]); if (!($new->check() && $new->store())) { $this->setError($new->getError()); return false; } } } /** prices END **/ // we need to save the recurrence too $recurrence =& JTable::getInstance('RedEvent_recurrences', ''); if (!isset($data['recurrenceid']) || !$data['recurrenceid']) { $rrule = RedeventHelperRecurrence::parsePost($data); if (!empty($rrule)) { // new recurrence $recurrence->rrule = $rrule; if (!$recurrence->store()) { $this->setError($recurrence->getError()); return false; } // add repeat record $repeat =& JTable::getInstance('RedEvent_repeats', ''); $repeat->set('xref_id', $xref->id); $repeat->set('recurrence_id', $recurrence->id); $repeat->set('count', 0); if (!$repeat->store()) { $this->setError($repeat->getError()); return false; } } } else { if ($data['repeat'] == 0) { $recurrence->load($data['recurrenceid']); // reset the status $recurrence->ended = 0; // TODO: maybe add a check to have a choice between updating rrule or not... $rrule = RedeventHelperRecurrence::parsePost($data); $recurrence->rrule = $rrule; if (!$recurrence->store()) { $this->setError($recurrence->getError()); return false; } } } if ($recurrence->id) { redEVENTHelper::generaterecurrences($recurrence->id); } } /** session end **/ // attachments if ($params->get('allow_attachments', 1)) { REAttach::store('event' . $row->id); } // MAIL HANDLING $this->_db->setQuery('SELECT * FROM #__redevent_venues AS v LEFT JOIN #__redevent_event_venue_xref AS x ON x.venueid = v.id WHERE x.eventid = ' . (int) $row->id); $rowloc = $this->_db->loadObject(); jimport('joomla.utilities.mail'); $link = JRoute::_(JURI::base() . RedeventHelperRoute::getDetailsRoute($row->id), isset($xref) ? $xref->id : false); //create the mail for the site owner if ($params->get('mailinform') == 1 || $params->get('mailinform') == 3) { $receivers = explode(',', trim($params->get('mailinformrec'))); if (!count($receivers) || !JMailHelper::isEmailAddress($receivers[0])) { $mainframe->enqueueMessage(JText::_('COM_REDEVENT_EDIT_EVENT_NOTIFICATION_MISSING_RECIPIENT'), 'notice'); } else { $mail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('COM_REDEVENT_MAIL_EVENT_PUBLISHED', $link) : JText::_('COM_REDEVENT_MAIL_EVENT_UNPUBLISHED'); if ($edited) { $modified_ip = getenv('REMOTE_ADDR'); $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_MAIL_EDIT_EVENT', $user->name, $user->username, $user->email, $modified_ip, $edited, $row->title, $xref->dates, $xref->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $mail->setSubject($SiteName . JText::_('COM_REDEVENT_EDIT_EVENT_MAIL')); } else { $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_MAIL_NEW_EVENT', $user->name, $user->username, $user->email, $row->author_ip, $created, $row->title, $xref->dates, $xref->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $mail->setSubject($SiteName . JText::_('COM_REDEVENT_NEW_EVENT_MAIL')); } $mail->addRecipient($receivers); $mail->setSender(array($MailFrom, $FromName)); $mail->setBody($mailbody); $sent = $mail->Send(); if (!$sent) { RedeventHelperLog::simpleLog('Error sending created/edited event notification to site owner'); } } } //mail end //create the mail for the user if ($params->get('mailinformuser') == 1 || $params->get('mailinformuser') == 3) { $usermail = JFactory::getMailer(); $state = $row->published ? JText::sprintf('COM_REDEVENT_USER_MAIL_EVENT_PUBLISHED', $link) : JText::_('COM_REDEVENT_USER_MAIL_EVENT_UNPUBLISHED'); if ($edited) { $edited = JHTML::Date($row->modified, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_USER_MAIL_EDIT_EVENT', $user->name, $user->username, $edited, $row->title, $xref->dates, $xref->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $usermail->setSubject($SiteName . JText::_('COM_REDEVENT_EDIT_USER_EVENT_MAIL')); } else { $created = JHTML::Date($row->created, JText::_('DATE_FORMAT_LC2')); $mailbody = JText::sprintf('COM_REDEVENT_USER_MAIL_NEW_EVENT', $user->name, $user->username, $created, $row->title, $xref->dates, $xref->times, $rowloc->venue, $rowloc->city, $row->datdescription, $state); $usermail->setSubject($SiteName . JText::_('COM_REDEVENT_NEW_USER_EVENT_MAIL')); } $usermail->addRecipient($user->email); $usermail->setSender(array($MailFrom, $FromName)); $usermail->setBody($mailbody); $sent = $usermail->Send(); if (!$sent) { RedeventHelperLog::simpleLog('Error sending created/edited event notification to event owner'); } } return $row; }
<!-- Venue --> <?php if ($this->row->venueid != 0) { ?> <h2 class="location"> <?php echo JText::_('COM_REDEVENT_VENUE'); ?> </h2> <?php //flyer echo redEVENTImage::modalimage($this->row->locimage, $this->row->venue); echo REOutput::mapicon($this->row, array('class' => 'event-map')); ?> <dl class="location floattext"> <dt class="venue"><?php echo JText::_('COM_REDEVENT_VENUE') . ':'; ?> </dt> <dd class="venue"> <?php echo JHTML::link($venuelink, $this->escape($this->row->venue)); ?> <?php if (!empty($this->row->url)) { ?>
} else { $venue = ''; } //generate the output $content .= $colorpic; if ($this->params->get('show_start_time', 0)) { $content .= REOutput::formattime($row->dates, $row->times) . ' '; } // Text to display in calendar if ($this->params->get('session_display', 0) == 0 || !$row->datimage) { $text = $row->full_title; } elseif ($this->params->get('session_display', 0) == 1) { $img = redEVENTImage::getThumbUrl($row->datimage, $this->params->get('pic_size', 20)); $text = '<span class="session-image">' . JHTML::image($img, $row->full_title) . '</span>'; } else { $img = redEVENTImage::getThumbUrl($row->datimage, $this->params->get('pic_size', 20)); $text = '<span class="session-image">' . JHTML::image($img, $row->full_title) . '</span>'; $text .= $row->full_title; } $content .= $this->caltooltip($catname . $eventname . $timehtml . $venue, $eventdate, $text, $detaillink, 'eventTip'); $content .= $contentend; // add the event to the calendar $this->cal->setEventContent($year, $month, $day, $content); } ?> <div id="redevent" class="jlcalendar"> <?php if ($this->params->def('show_page_title', 1)) { ?> <h1 class="componentheading"> <?php