Beispiel #1
0
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     if ($this->getLayout() == 'addvenue') {
         $this->_displayaddvenue($tpl);
         return;
     }
     //Load behavior
     jimport('joomla.html.pane');
     JHTML::_('behavior.tooltip');
     //initialise variables
     $editor =& JFactory::getEditor();
     $db =& JFactory::getDBO();
     $document =& JFactory::getDocument();
     $pane =& JPane::getInstance('sliders');
     $user =& JFactory::getUser();
     $elsettings = ELAdmin::config();
     $nullDate = $db->getNullDate();
     //get vars
     $cid = JRequest::getVar('cid');
     $task = JRequest::getVar('task');
     $url = $app->isAdmin() ? $app->getSiteURL() : JURI::base();
     //add the custom stylesheet and the javascript
     $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
     $document->addScript($url . 'administrator/components/com_eventlist/assets/js/eventscreen.js');
     $document->addScript($url . 'administrator/components/com_eventlist/assets/js/seo.js');
     $document->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $document->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     //build toolbar
     if ($task == 'copy') {
         JToolBarHelper::title(JText::_('COPY EVENT'), 'eventedit');
     } elseif ($cid) {
         JToolBarHelper::title(JText::_('EDIT EVENT'), 'eventedit');
     } else {
         JToolBarHelper::title(JText::_('ADD EVENT'), 'eventedit');
         //set the submenu
         JSubMenuHelper::addEntry(JText::_('EVENTLIST'), 'index.php?option=com_eventlist');
         JSubMenuHelper::addEntry(JText::_('EVENTS'), 'index.php?option=com_eventlist&view=events');
         JSubMenuHelper::addEntry(JText::_('VENUES'), 'index.php?option=com_eventlist&view=venues');
         JSubMenuHelper::addEntry(JText::_('CATEGORIES'), 'index.php?option=com_eventlist&view=categories');
         JSubMenuHelper::addEntry(JText::_('ARCHIVESCREEN'), 'index.php?option=com_eventlist&view=archive');
         JSubMenuHelper::addEntry(JText::_('GROUPS'), 'index.php?option=com_eventlist&view=groups');
         JSubMenuHelper::addEntry(JText::_('HELP'), 'index.php?option=com_eventlist&view=help');
         if ($user->get('gid') > 24) {
             JSubMenuHelper::addEntry(JText::_('SETTINGS'), 'index.php?option=com_eventlist&controller=settings&task=edit');
         }
     }
     JToolBarHelper::apply();
     JToolBarHelper::spacer();
     JToolBarHelper::save();
     JToolBarHelper::spacer();
     JToolBarHelper::cancel();
     JToolBarHelper::spacer();
     JToolBarHelper::help('el.editevents', true);
     //get data from model
     $model =& $this->getModel();
     $row =& $this->get('Data');
     $categories = eventlist_cats::getCategoriesTree(1);
     $selectedcats =& $this->get('Catsselected');
     // fail if checked out not by 'me'
     if ($row->id) {
         if ($model->isCheckedOut($user->get('id'))) {
             JError::raiseWarning('SOME_ERROR_CODE', $row->titel . ' ' . JText::_('EDITED BY ANOTHER ADMIN'));
             $app->redirect('index.php?option=com_eventlist&view=events');
         }
     }
     //make data safe
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     //build selectlists
     $Lists = array();
     $Lists['category'] = eventlist_cats::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8"');
     //build venue select js and load the view
     $js = "\n\t\tfunction elSelectVenue(id, venue) {\n\t\t\tdocument.getElementById('a_id').value = id;\n\t\t\tdocument.getElementById('a_name').value = venue;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
     $linkvsel = 'index.php?option=com_eventlist&view=venueelement&tmpl=component';
     $linkvadd = 'index.php?option=com_eventlist&task=addvenue&tmpl=component';
     $document->addScriptDeclaration($js);
     JHTML::_('behavior.modal', 'a.modal');
     $venueselect = "\n<div style=\"float: left;\"><input style=\"background: #ffffff;\" type=\"text\" id=\"a_name\" value=\"{$row->venue}\" disabled=\"disabled\" /></div>";
     $venueselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('SELECT') . "\" href=\"{$linkvsel}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('SELECT') . "</a></div></div>\n";
     $venueselect .= "\n<input type=\"hidden\" id=\"a_id\" name=\"locid\" value=\"{$row->locid}\" />";
     $venueselect .= "\n&nbsp;<input class=\"inputbox\" type=\"button\" onclick=\"window.open('{$linkvadd}', 'popup', 'width=750,height=400,scrollbars=yes,toolbar=no,status=no,resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')\" value=\"" . JText::_('ADD') . "\" />";
     $venueselect .= "\n&nbsp;<input class=\"inputbox\" type=\"button\" onclick=\"elSelectVenue(0, '" . JText::_('NO VENUE') . "' );\" value=\"" . JText::_('NO VENUE') . "\" onblur=\"seo_switch()\" />";
     //build image select js and load the view
     $js = "\n\t\tfunction elSelectImage(image, imagename) {\n\t\t\tdocument.getElementById('a_image').value = image;\n\t\t\tdocument.getElementById('a_imagename').value = imagename;\n\t\t\tdocument.getElementById('imagelib').src = '../images/eventlist/events/' + image;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}";
     $link = 'index.php?option=com_eventlist&amp;view=imagehandler&amp;layout=uploadimage&amp;task=eventimg&amp;tmpl=component';
     $link2 = 'index.php?option=com_eventlist&amp;view=imagehandler&amp;task=selecteventimg&amp;tmpl=component';
     $document->addScriptDeclaration($js);
     $imageselect = "\n<input style=\"background: #ffffff;\" type=\"text\" id=\"a_imagename\" value=\"{$row->datimage}\" disabled=\"disabled\" onchange=\"javascript:if (document.forms[0].a_imagename.value!='') {document.imagelib.src='../images/eventlist/events/' + document.forms[0].a_imagename.value} else {document.imagelib.src='../images/blank.png'}\"; /><br />";
     $imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('Upload') . "\" href=\"{$link}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('Upload') . "</a></div></div>\n";
     $imageselect .= "<div class=\"button2-left\"><div class=\"blank\"><a class=\"modal\" title=\"" . JText::_('SELECTIMAGE') . "\" href=\"{$link2}\" rel=\"{handler: 'iframe', size: {x: 650, y: 375}}\">" . JText::_('SELECTIMAGE') . "</a></div></div>\n";
     $imageselect .= "\n&nbsp;<input class=\"inputbox\" type=\"button\" onclick=\"elSelectImage('', '" . JText::_('SELECTIMAGE') . "' );\" value=\"" . JText::_('Reset') . "\" />";
     $imageselect .= "\n<input type=\"hidden\" id=\"a_image\" name=\"datimage\" value=\"{$row->datimage}\" />";
     // recurrence type
     $rec_type = array();
     $rec_type[] = JHTML::_('select.option', 0, JText::_('NOTHING'));
     $rec_type[] = JHTML::_('select.option', 1, JText::_('DAYLY'));
     $rec_type[] = JHTML::_('select.option', 2, JText::_('WEEKLY'));
     $rec_type[] = JHTML::_('select.option', 3, JText::_('MONTHLY'));
     $rec_type[] = JHTML::_('select.option', 4, JText::_('WEEKDAY'));
     $Lists['recurrence_type'] = JHTML::_('select.genericlist', $rec_type, 'recurrence_type', '', 'value', 'text', $row->recurrence_type);
     //assign vars to the template
     $this->assignRef('Lists', $Lists);
     $this->assignRef('row', $row);
     $this->assignRef('imageselect', $imageselect);
     $this->assignRef('venueselect', $venueselect);
     $this->assignRef('editor', $editor);
     $this->assignRef('pane', $pane);
     $this->assignRef('task', $task);
     $this->assignRef('nullDate', $nullDate);
     $this->assignRef('elsettings', $elsettings);
     parent::display($tpl);
 }
Beispiel #2
0
 /**
  * Creates the Simple List View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $app->getPathWay();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // get variables
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $limit = $app->getUserStateFromRequest('com_eventlist.search.limit', 'limit', $params->def('display_num', 0), 'int');
     $filter_continent = $app->getUserStateFromRequest('com_eventlist.search.filter_continent', 'filter_continent', '', 'string');
     $filter_country = $app->getUserStateFromRequest('com_eventlist.search.filter_country', 'filter_country', '', 'string');
     $filter_city = $app->getUserStateFromRequest('com_eventlist.search.filter_city', 'filter_city', '', 'string');
     $filter_date_from = $app->getUserStateFromRequest('com_eventlist.search.filter_date_from', 'filter_date_from', '', 'string');
     $filter_date_to = $app->getUserStateFromRequest('com_eventlist.search.filter_date_to', 'filter_date_to', '', 'string');
     $filter_category = $app->getUserStateFromRequest('com_eventlist.search.filter_category', 'filter_category', 0, 'int');
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $total =& $this->get('Total');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //params
     $params->def('page_title', $item->name);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
     }
     //pathway
     $pathway->setItemName(1, $item->name);
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?view=eventlist&task=archive'));
         $print_link = JRoute::_('index.php?view=eventlist&task=archive&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('ARCHIVE');
     } else {
         $print_link = JRoute::_('index.php?view=eventlist&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $app->setPageTitle($pagetitle);
     $app->addMetaTag('title', $pagetitle);
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=eventlist&format=feed';
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     //create select lists
     $lists = $this->_buildSortLists();
     if ($lists['filter']) {
         //$uri->setVar('filter', JRequest::getString('filter'));
         //$filter		= $app->getUserStateFromRequest('com_eventlist.eventlist.filter', 'filter', '', 'string');
         $uri->setVar('filter', $lists['filter']);
         $uri->setVar('filter_type', JRequest::getString('filter_type'));
     } else {
         $uri->delVar('filter');
         $uri->delVar('filter_type');
     }
     //Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('CategoryTree');
     $catoptions = array();
     $catoptions[] = JHTML::_('select.option', '0', JText::_('Select category'));
     $catoptions = array_merge($catoptions, eventlist_cats::getcatselectoptions($categories));
     $selectedcats = $filter_category ? array($filter_category) : array();
     //build selectlists
     $lists['categories'] = JHTML::_('select.genericlist', $catoptions, 'filter_category', 'size="1" class="inputbox"', 'value', 'text', $selectedcats);
     // Create the pagination object
     $pageNav = $this->get('Pagination');
     // date filter
     $lists['date_from'] = JHTML::_('calendar', $filter_date_from, 'filter_date_from', 'filter_date_from', '%Y-%m-%d', 'class="inputbox"');
     $lists['date_to'] = JHTML::_('calendar', $filter_date_to, 'filter_date_to', 'filter_date_to', '%Y-%m-%d', 'class="inputbox"');
     // country filter
     $continents = array();
     $continents[] = JHTML::_('select.option', '', JText::_('Select continent'));
     $continents[] = JHTML::_('select.option', 'AF', JText::_('Africa'));
     $continents[] = JHTML::_('select.option', 'AS', JText::_('Asia'));
     $continents[] = JHTML::_('select.option', 'EU', JText::_('Europe'));
     $continents[] = JHTML::_('select.option', 'NA', JText::_('North America'));
     $continents[] = JHTML::_('select.option', 'SA', JText::_('South America'));
     $continents[] = JHTML::_('select.option', 'OC', JText::_('Oceania'));
     $continents[] = JHTML::_('select.option', 'AN', JText::_('Antartica'));
     $lists['continents'] = JHTML::_('select.genericlist', $continents, 'filter_continent', 'class="inputbox"', 'value', 'text', $filter_continent);
     unset($continents);
     // country filter
     $countries = array();
     $countries[] = JHTML::_('select.option', '', JText::_('Select country'));
     $countries = array_merge($countries, $this->get('CountryOptions'));
     $lists['countries'] = JHTML::_('select.genericlist', $countries, 'filter_country', 'class="inputbox"', 'value', 'text', $filter_country);
     unset($countries);
     // city filter
     if ($filter_country) {
         $cities = array();
         $cities[] = JHTML::_('select.option', '', JText::_('Select city'));
         $cities = array_merge($cities, $this->get('CityOptions'));
         $lists['cities'] = JHTML::_('select.genericlist', $cities, 'filter_city', 'class="inputbox"', 'value', 'text', $filter_city);
         unset($cities);
     }
     $this->assign('lists', $lists);
     $this->assign('total', $total);
     $this->assign('action', $uri->toString());
     $this->assignRef('rows', $rows);
     $this->assignRef('task', $task);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('filter_continent', $filter_continent);
     $this->assignRef('filter_country', $filter_country);
     $this->assignRef('document', $document);
     parent::display($tpl);
 }
Beispiel #3
0
 function getCategories($id)
 {
     $user =& JFactory::getUser();
     $gid = (int) $user->get('aid');
     $query = 'SELECT DISTINCT c.id, c.catname, c.access, c.checked_out AS cchecked_out,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__eventlist_categories AS c' . ' LEFT JOIN #__eventlist_cats_event_relations AS rel ON rel.catid = c.id' . ' WHERE rel.itemid = ' . (int) $id . ' AND c.published = 1' . ' AND c.access  <= ' . $gid;
     $this->_db->setQuery($query);
     $this->_cats = $this->_db->loadObjectList();
     $k = 0;
     $count = count($this->_cats);
     for ($i = 0; $i < $count; $i++) {
         $item =& $this->_cats[$i];
         $cats = new eventlist_cats($item->id);
         $item->parentcats = $cats->getParentlist();
         $k = 1 - $k;
     }
     return $this->_cats;
 }
Beispiel #4
0
 function getCategories($id)
 {
     $query = 'SELECT DISTINCT c.id, c.catname, c.checked_out AS cchecked_out' . ' FROM #__eventlist_categories AS c' . ' LEFT JOIN #__eventlist_cats_event_relations AS rel ON rel.catid = c.id' . ' WHERE rel.itemid = ' . (int) $id;
     $this->_db->setQuery($query);
     $this->_cats = $this->_db->loadObjectList();
     $k = 0;
     $count = count($this->_cats);
     for ($i = 0; $i < $count; $i++) {
         $item =& $this->_cats[$i];
         $cats = new eventlist_cats($item->id);
         $item->parentcats = $cats->getParentlist();
         $k = 1 - $k;
     }
     return $this->_cats;
 }
Beispiel #5
0
 /**
  * Creates the output for event submissions
  *
  * @since 0.4
  *
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $session =& JFactory::getSession();
     $user =& JFactory::getUser();
     if (!$user->id) {
         $app->redirect(JRoute::_($_SERVER["HTTP_REFERER"]), JText::_('Please login to be able to submit events'), 'error');
     }
     if ($this->getLayout() == 'choosevenue') {
         $this->_displaychoosevenue($tpl);
         return;
     }
     // Initialize variables
     $editor =& JFactory::getEditor();
     $doc =& JFactory::getDocument();
     $elsettings =& ELHelper::config();
     //Get Data from the model
     $row = $this->get('Event');
     //Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('Categories');
     //sticky form categorie data
     if ($session->has('eventform', 'com_eventlist')) {
         $eventform = $session->get('eventform', 0, 'com_eventlist');
         $selectedcats = $eventform['cid'];
     } else {
         $selectedcats =& $this->get('Catsselected');
     }
     //build selectlists
     $categories = eventlist_cats::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8 class="inputbox required validate-cid"');
     //Get requests
     $id = JRequest::getInt('id');
     //Clean output
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'datdescription');
     JHTML::_('behavior.formvalidation');
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal');
     //add css file
     $doc->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $doc->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Set page title
     $id ? $title = JText::_('EDIT EVENT') : ($title = JText::_('ADD EVENT'));
     $doc->setTitle($title);
     // Get the menu object of the active menu item
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     //pathway
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     $pathway->addItem($title, '');
     //Has the user access to the editor and the add venue screen
     $editoruser = ELUser::editoruser();
     $delloclink = ELUser::validate_user($elsettings->locdelrec, $elsettings->deliverlocsyes);
     //transform <br /> and <br> back to \r\n for non editorusers
     if (!$editoruser) {
         $row->datdescription = ELHelper::br2break($row->datdescription);
     }
     //Get image information
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     //Set the info image
     $infoimage = JHTML::_('image', 'components/com_eventlist/assets/images/icon-16-hint.png', JText::_('NOTES'));
     //Create the stuff required for the venueselect functionality
     $url = $app->isAdmin() ? $app->getSiteURL() : JURI::base();
     $js = "\n\t\tfunction elSelectVenue(id, venue) {\n\t\t\tdocument.getElementById('a_id').value = id;\n\t\t\tdocument.getElementById('a_name').value = venue;\n\t\t\tdocument.getElementById('sbox-window').close();\n\t\t}\n\t\t\n\t\tfunction closeAdd() {\n\t\t\tdocument.getElementById('sbox-window').close();   \n    \t}\n    \t";
     $doc->addScriptDeclaration($js);
     // include the recurrence script
     $doc->addScript($url . 'components/com_eventlist/assets/js/recurrence.js');
     // include the unlimited script
     $doc->addScript($url . 'components/com_eventlist/assets/js/unlimited.js');
     $lists = array();
     // recurrence type
     $rec_type = array();
     $rec_type[] = JHTML::_('select.option', 0, JText::_('NOTHING'));
     $rec_type[] = JHTML::_('select.option', 1, JText::_('DAYLY'));
     $rec_type[] = JHTML::_('select.option', 2, JText::_('WEEKLY'));
     $rec_type[] = JHTML::_('select.option', 3, JText::_('MONTHLY'));
     $rec_type[] = JHTML::_('select.option', 4, JText::_('WEEKDAY'));
     $lists['recurrence_type'] = JHTML::_('select.genericlist', $rec_type, 'recurrence_type', '', 'value', 'text', $row->recurrence_type);
     //if only owned events are allowed
     if ($elsettings->ownedvenuesonly) {
         $venues =& $this->get('UserVenues');
         //build list
         $venuelist = array();
         $venuelist[] = JHTML::_('select.option', '0', JText::_('NO VENUE'));
         $venuelist = array_merge($venuelist, $venues);
         $lists['venueselect'] = JHTML::_('select.genericlist', $venuelist, 'locid', 'size="1" class="inputbox"', 'value', 'text', $row->locid);
     }
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('editor', $editor);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('infoimage', $infoimage);
     $this->assignRef('delloclink', $delloclink);
     $this->assignRef('editoruser', $editoruser);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('params', $params);
     $this->assignRef('lists', $lists);
     parent::display($tpl);
 }
Beispiel #6
0
 function display($tpl = null)
 {
     //Load pane behavior
     jimport('joomla.html.pane');
     //initialise variables
     $editor =& JFactory::getEditor();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $app =& JFactory::getApplication();
     $pane =& JPane::getInstance('sliders');
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     //get vars
     $cid = JRequest::getVar('cid');
     //add css to document
     $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
     // for color picker
     $document->addStyleSheet('components/com_eventlist/assets/css/picker.css');
     $document->addScript(JURI::base() . '/components/com_eventlist/assets/js/picker.js');
     //create the toolbar
     if ($cid) {
         JToolBarHelper::title(JText::_('EDIT CATEGORY'), 'categoriesedit');
     } else {
         JToolBarHelper::title(JText::_('ADD CATEGORY'), 'categoriesedit');
         //set the submenu
         JSubMenuHelper::addEntry(JText::_('EVENTLIST'), 'index.php?option=com_eventlist');
         JSubMenuHelper::addEntry(JText::_('EVENTS'), 'index.php?option=com_eventlist&view=events');
         JSubMenuHelper::addEntry(JText::_('VENUES'), 'index.php?option=com_eventlist&view=venues');
         JSubMenuHelper::addEntry(JText::_('CATEGORIES'), 'index.php?option=com_eventlist&view=categories');
         JSubMenuHelper::addEntry(JText::_('ARCHIVESCREEN'), 'index.php?option=com_eventlist&view=archive');
         JSubMenuHelper::addEntry(JText::_('GROUPS'), 'index.php?option=com_eventlist&view=groups');
         JSubMenuHelper::addEntry(JText::_('HELP'), 'index.php?option=com_eventlist&view=help');
         if ($user->get('gid') > 24) {
             JSubMenuHelper::addEntry(JText::_('SETTINGS'), 'index.php?option=com_eventlist&controller=settings&task=edit');
         }
     }
     JToolBarHelper::apply();
     JToolBarHelper::spacer();
     JToolBarHelper::save();
     JToolBarHelper::spacer();
     JToolBarHelper::media_manager();
     JToolBarHelper::spacer();
     JToolBarHelper::cancel();
     JToolBarHelper::spacer();
     JToolBarHelper::help('el.editcategories', true);
     //Get data from the model
     $model =& $this->getModel();
     $row =& $this->get('Data');
     $groups =& $this->get('Groups');
     $categories = eventlist_cats::getCategoriesTree(0);
     // fail if checked out not by 'me'
     if ($row->id) {
         if ($model->isCheckedOut($user->get('id'))) {
             JError::raiseWarning('SOME_ERROR_CODE', $row->catname . ' ' . JText::_('EDITED BY ANOTHER ADMIN'));
             $app->redirect('index.php?option=com_eventlist&view=categories');
         }
     }
     //clean data
     JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'catdescription');
     //build selectlists
     $Lists = array();
     $javascript = "onchange=\"javascript:if (document.forms[0].image.options[selectedIndex].value!='') {document.imagelib.src='../images/stories/' + document.forms[0].image.options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\"";
     $Lists['imagelist'] = JHTML::_('list.images', 'image', $row->image, $javascript, '/images/stories/');
     $Lists['access'] = JHTML::_('list.accesslevel', $row);
     $Lists['parent_id'] = eventlist_cats::buildcatselect($categories, 'parent_id', $row->parent_id, 1);
     //build grouplist
     $grouplist = array();
     $grouplist[] = JHTML::_('select.option', '0', JText::_('NO GROUP'));
     $grouplist = array_merge($grouplist, $groups);
     $Lists['groups'] = JHTML::_('select.genericlist', $grouplist, 'groupid', 'size="1" class="inputbox"', 'value', 'text', $row->groupid);
     //assign data to template
     $this->assignRef('Lists', $Lists);
     $this->assignRef('row', $row);
     $this->assignRef('editor', $editor);
     $this->assignRef('pane', $pane);
     parent::display($tpl);
 }
Beispiel #7
0
 /**
  * Creates the Categoryevents View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $menu =& JSite::getMenu();
     $elsettings =& ELHelper::config();
     $item = $menu->getActive();
     $params =& $app->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $app->getPathWay();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // Request variables
     //	$limitstart		= JRequest::getInt('limitstart');
     //	$limit       	= $app->getUserStateFromRequest('com_eventlist.categoryevents.limit', 'limit', $params->def('display_num', 0), 'int');
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $category =& $this->get('Category');
     $categories =& $this->get('Childs');
     //are events available?
     if (!$rows) {
         $noevents = 1;
     } else {
         $noevents = 0;
     }
     //does the category exist
     if ($category->id == 0) {
         return JError::raiseError(404, JText::sprintf('Category #%d not found', $category->id));
     }
     //Set Meta data
     $document->setTitle($item->name . ' - ' . $category->catname);
     $document->setMetadata('keywords', $category->meta_keywords);
     $document->setDescription(strip_tags($category->meta_description));
     //Print function
     $params->def('print', !$app->getCfg('hidePrint'));
     $params->def('icons', $app->getCfg('icons'));
     if ($pop) {
         $params->set('popup', 1);
     }
     //add alternate feed link
     $link = 'index.php?option=com_eventlist&view=categoryevents&format=feed&id=' . $category->id;
     $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
     $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
     $document->addHeadLink(JRoute::_($link . '&type=atom', 'alternate', 'rel'), $attribs);
     //create the pathway
     $cats = new eventlist_cats($category->id);
     $parents = $cats->getParentlist();
     foreach ($parents as $parent) {
         $pathway->addItem($this->escape($parent->catname), JRoute::_('index.php?view=categoryevents&id=' . $parent->categoryslug));
     }
     if ($task == 'archive') {
         $pathway->addItem(JText::_('ARCHIVE'), JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=archive&id=' . $category->slug));
         $link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&task=archive&id=' . $category->slug);
         $print_link = JRoute::_('index.php?option=com_eventlist&view=categoryevents&id=' . $category->id . '&task=archive&pop=1&tmpl=component');
     }
     //Check if the user has access to the form
     $maintainer = ELUser::ismaintainer();
     $genaccess = ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes);
     if ($maintainer || $genaccess) {
         $dellink = 1;
     }
     // Create the pagination object
     $pageNav =& $this->get('Pagination');
     //Generate Categorydescription
     if (empty($category->catdescription)) {
         $catdescription = JText::_('NO DESCRIPTION');
     } else {
         //execute plugins
         $category->text = $category->catdescription;
         $category->title = $category->catname;
         JPluginHelper::importPlugin('content');
         $results = $app->triggerEvent('onPrepareContent', array(&$category, &$params, 0));
         $catdescription = $category->text;
     }
     if ($category->image != '') {
         $category->image = JHTML::image('images/stories/' . $category->image, $category->catname);
     }
     //create select lists
     $lists = $this->_buildSortLists($elsettings);
     $this->assign('lists', $lists);
     $this->assign('action', $uri->toString());
     $this->assignRef('rows', $rows);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('category', $category);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('task', $task);
     $this->assignRef('catdescription', $catdescription);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('categories', $categories);
     if ($this->getLayout() == 'calendar') {
         //add css for calendar
         $document->addStyleSheet('components/com_eventlist/assets/css/eventlistcalendar.css');
         $year = intval(JRequest::getVar('yearID', strftime("%Y")));
         $month = intval(JRequest::getVar('monthID', strftime("%m")));
         $day = intval(JRequest::getVar('dayID', strftime("%d")));
         $this->assignRef('year', $year);
         $this->assignRef('month', $month);
         $this->assignRef('day', $day);
     }
     parent::display($tpl);
 }
Beispiel #8
0
 /**
  * logic to get the categories
  *
  * @access public
  * @return void
  */
 function getCategories()
 {
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $userid = (int) $user->get('id');
     $gid = (int) $user->get('aid');
     $superuser = ELUser::superuser();
     $where = ' WHERE c.published = 1 AND c.access <= ' . $gid;
     //only check for maintainers if we don't have an edit action
     if (!$this->_id) {
         //get the ids of the categories the user maintaines
         $query = 'SELECT g.group_id' . ' FROM #__eventlist_groupmembers AS g' . ' WHERE g.member = ' . $userid;
         $this->_db->setQuery($query);
         $catids = $this->_db->loadResultArray();
         $categories = implode(' OR c.groupid = ', $catids);
         //build ids query
         if ($categories) {
             //check if user is allowed to submit events in general, if yes allow to submit into categories
             //which aren't assigned to a group. Otherwise restrict submission into maintained categories only
             if (ELUser::validate_user($elsettings->evdelrec, $elsettings->delivereventsyes)) {
                 $where .= ' AND c.groupid = 0 OR c.groupid = ' . $categories;
             } else {
                 $where .= ' AND c.groupid = ' . $categories;
             }
         } else {
             $where .= ' AND c.groupid = 0';
         }
     }
     //administrators or superadministrators have access to all categories, also maintained ones
     if ($superuser) {
         $where = ' WHERE c.published = 1';
     }
     //get the maintained categories and the categories whithout any group
     //or just get all if somebody have edit rights
     $query = 'SELECT c.*' . ' FROM #__eventlist_categories AS c' . $where . ' ORDER BY c.ordering';
     $this->_db->setQuery($query);
     //	$this->_category = array();
     //	$this->_category[] = JHTML::_('select.option', '0', JText::_( 'SELECT CATEGORY' ) );
     //	$this->_categories = array_merge( $this->_category, $this->_db->loadObjectList() );
     $rows = $this->_db->loadObjectList();
     //set depth limit
     $levellimit = 10;
     //get children
     $children = array();
     foreach ($rows as $child) {
         $parent = $child->parent_id;
         $list = @$children[$parent] ? $children[$parent] : array();
         array_push($list, $child);
         $children[$parent] = $list;
     }
     //get list of the items
     $this->_categories = eventlist_cats::treerecurse(0, '', array(), $children, true, max(0, $levellimit - 1));
     return $this->_categories;
 }
Beispiel #9
0
 /**
  * Creates the output for the details view
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $dispatcher =& JDispatcher::getInstance();
     $elsettings =& ELHelper::config();
     $row =& $this->get('Details');
     $categories =& $this->get('Categories');
     $registers =& $this->get('Registers');
     $regcheck =& $this->get('Usercheck');
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $app->getParams('com_eventlist');
     //Check if the id exists
     if ($row->did == 0) {
         return JError::raiseError(404, JText::sprintf('Event #%d not found', $row->did));
     }
     //Check if user has access to the details
     if ($elsettings->showdetails == 0) {
         return JError::raiseError(403, JText::_('NO ACCESS'));
     }
     $cid = JRequest::getInt('cid', 0);
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_eventlist/assets/css/eventlist.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     //Print
     $pop = JRequest::getBool('pop');
     $params->def('page_title', JText::_('DETAILS'));
     if ($pop) {
         $params->set('popup', 1);
     }
     $print_link = JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug . '&pop=1&tmpl=component');
     //pathway
     $cats = new eventlist_cats($cid);
     $parents = $cats->getParentlist();
     $pathway =& $app->getPathWay();
     $pathway->setItemName(1, $item->name);
     foreach ($parents as $parent) {
         $pathway->addItem($this->escape($parent->catname), JRoute::_('index.php?view=categoryevents&id=' . $parent->categoryslug));
     }
     $pathway->addItem($this->escape($row->title), JRoute::_('index.php?view=details&cid=' . $cid . '&id=' . $row->slug));
     //Get images
     $dimage = ELImage::flyercreator($row->datimage, 'event');
     $limage = ELImage::flyercreator($row->locimage);
     //Check user if he can edit
     $allowedtoeditevent = ELUser::editaccess($elsettings->eventowner, $row->created_by, $elsettings->eventeditrec, $elsettings->eventedit);
     $allowedtoeditvenue = ELUser::editaccess($elsettings->venueowner, $row->venueowner, $elsettings->venueeditrec, $elsettings->venueedit);
     //Timecheck for registration
     $jetzt = date("Y-m-d");
     $now = strtotime($jetzt);
     $date = strtotime($row->dates);
     $timecheck = $now - $date;
     //let's build the registration handling
     $formhandler = 0;
     //is the user allready registered at the event
     if ($regcheck) {
         $formhandler = 3;
     } else {
         //no, he isn't
         $formhandler = 4;
     }
     //check if it is too late to register and overwrite $formhandler
     if ($timecheck > 0) {
         $formhandler = 1;
     }
     //is the user registered at joomla and overwrite $formhandler if not
     if (!$user->get('id')) {
         $formhandler = 2;
     }
     if ($formhandler >= 3) {
         $js = "function check(checkbox, senden) {\n\t\t\t\tif(checkbox.checked==true){\n\t\t\t\t\tsenden.disabled = false;\n\t\t\t\t} else {\n\t\t\t\t\tsenden.disabled = true;\n\t\t\t\t}}";
         $document->addScriptDeclaration($js);
     }
     //Generate Eventdescription
     if (!$row->datdescription == '' || !$row->datdescription == '<br />') {
         //Execute Plugins
         $row->text = $row->datdescription;
         JPluginHelper::importPlugin('content');
         $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0));
         $row->datdescription = $row->text;
     }
     //Generate Venuedescription
     if (!$row->locdescription == '' || !$row->locdescription == '<br />') {
         //execute plugins
         $row->text = $row->locdescription;
         JPluginHelper::importPlugin('content');
         $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0));
         $row->locdescription = $row->text;
     }
     // generate Metatags
     $meta_keywords_content = "";
     if (!empty($row->meta_keywords)) {
         $keywords = explode(",", $row->meta_keywords);
         foreach ($keywords as $keyword) {
             if ($meta_keywords_content != "") {
                 $meta_keywords_content .= ", ";
             }
             if (preg_match("/[\\/[\\/]/", $keyword)) {
                 $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword)));
                 $buffer = $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate);
                 if ($buffer != "") {
                     $meta_keywords_content .= $buffer;
                 } else {
                     $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2);
                     // remove the comma and the white space
                 }
             } else {
                 $meta_keywords_content .= $keyword;
             }
         }
     }
     if (!empty($row->meta_description)) {
         $description = explode("[", $row->meta_description);
         $description_content = "";
         foreach ($description as $desc) {
             $keyword = substr($desc, 0, strpos($desc, "]", 0));
             if ($keyword != "") {
                 $description_content .= $this->keyword_switcher($keyword, $row, $categories, $elsettings->formattime, $elsettings->formatdate);
                 $description_content .= substr($desc, strpos($desc, "]", 0) + 1);
             } else {
                 $description_content .= $desc;
             }
         }
     } else {
         $description_content = "";
     }
     //set page title and meta stuff
     $document->setTitle($row->title);
     $document->setMetadata('keywords', $meta_keywords_content);
     $document->setDescription(strip_tags($description_content));
     //build the url
     if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") {
         $row->url = 'http://' . $row->url;
     }
     //create flag
     if ($row->country) {
         $row->countryimg = ELOutput::getFlag($row->country);
     }
     // load dispatcher for plugins
     JPluginHelper::importPlugin('eventlist');
     $row->pluginevent = new stdClass();
     $results = $dispatcher->trigger('onEventDetailsEnd', array($row->did, $this->escape($row->title)));
     $row->pluginevent->onEventDetailsEnd = trim(implode("\n", $results));
     //assign vars to jview
     $this->assignRef('row', $row);
     $this->assignRef('categories', $categories);
     $this->assignRef('params', $params);
     $this->assignRef('allowedtoeditevent', $allowedtoeditevent);
     $this->assignRef('allowedtoeditvenue', $allowedtoeditvenue);
     $this->assignRef('dimage', $dimage);
     $this->assignRef('limage', $limage);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('registers', $registers);
     $this->assignRef('formhandler', $formhandler);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('item', $item);
     $this->assignRef('user', $user);
     $this->assignRef('dispatcher', $dispatcher);
     parent::display($tpl);
 }
Beispiel #10
0
 /**
  * Method to build the WHERE clause
  *
  * @access private
  * @return array
  */
 function _buildCategoryWhere()
 {
     $app =& JFactory::getApplication();
     // Get the paramaters of the active menu item
     $params =& $app->getParams();
     $top_category = $params->get('top_category', 0);
     $task = JRequest::getWord('task');
     // First thing we need to do is to select only the published events
     if ($task == 'archive') {
         $where = ' WHERE a.published = -1 ';
     } else {
         $where = ' WHERE a.published = 1 ';
     }
     // only select events within specified dates. (chosen month)
     $monthstart = mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date));
     $monthend = mktime(0, 0, -1, strftime('%m', $this->_date) + 1, 1, strftime('%Y', $this->_date));
     $filter_date_from = $this->_db->Quote(strftime('%Y-%m-%d', $monthstart));
     $where .= ' AND DATEDIFF(IF (a.enddates IS NOT NULL AND a.enddates <> ' . $this->_db->Quote('0000-00-00') . ', a.enddates, a.dates), ' . $filter_date_from . ') >= 0';
     $filter_date_to = $this->_db->Quote(strftime('%Y-%m-%d', $monthend));
     $where .= ' AND DATEDIFF(a.dates, ' . $filter_date_to . ') <= 0';
     if ($top_category) {
         $children = eventlist_cats::getChilds($top_category);
         if (count($children)) {
             $where .= ' AND r.catid IN (' . implode(',', $children) . ')';
         }
     }
     return $where;
 }
Beispiel #11
0
 /**
  * recursive function to build the familly tree
  *
  * @param int category id
  * @param array children indexed by parent id
  * @return array of category descendants
  */
 function _getChildsRecurse($id, $childs)
 {
     $result = array($id);
     if (@$childs[$id]) {
         foreach ($childs[$id] as $c) {
             $result = array_merge($result, eventlist_cats::_getChildsRecurse($c->id, $childs));
         }
     }
     return $result;
 }
Beispiel #12
0
 /**
  * Method to get categories item data
  *
  * @access public
  * @return array
  */
 function getData()
 {
     $app =& JFactory::getApplication();
     static $items;
     if (isset($items)) {
         return $items;
     }
     $limit = $app->getUserStateFromRequest('com_eventlist.limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest('com_eventlist.limitstart', 'limitstart', 0, 'int');
     $filter_order = $app->getUserStateFromRequest('com_eventlist.categories.filter_order', 'filter_order', 'c.ordering', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_eventlist.categories.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_state = $app->getUserStateFromRequest('com_eventlist.categories.filter_state', 'filter_state', '', 'word');
     $search = $app->getUserStateFromRequest('com_eventlist.categories.search', 'search', '', 'string');
     $search = $this->_db->getEscaped(trim(JString::strtolower($search)));
     $filter_order = JFilterInput::clean($filter_order, 'cmd');
     $filter_order_Dir = JFilterInput::clean($filter_order_Dir, 'word');
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', c.ordering';
     $where = array();
     if ($filter_state) {
         if ($filter_state == 'P') {
             $where[] = 'c.published = 1';
         } else {
             if ($filter_state == 'U') {
                 $where[] = 'c.published = 0';
             }
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //select the records
     //note, since this is a tree we have to do the limits code-side
     if ($search) {
         $query = 'SELECT c.id' . ' FROM #__eventlist_categories AS c' . ' WHERE LOWER(c.catname) LIKE ' . $this->_db->Quote('%' . $this->_db->getEscaped($search, true) . '%', false) . $where;
         $this->_db->setQuery($query);
         $search_rows = $this->_db->loadResultArray();
     }
     $query = 'SELECT c.*, c.catname AS name, c.parent_id AS parent, u.name AS editor, g.name AS groupname, gr.name AS catgroup' . ' FROM #__eventlist_categories AS c' . ' LEFT JOIN #__groups AS g ON g.id = c.access' . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . ' LEFT JOIN #__eventlist_groups AS gr ON gr.id = c.groupid' . $where . $orderby;
     $this->_db->setQuery($query);
     $rows = $this->_db->loadObjectList();
     //establish the hierarchy of the categories
     $children = array();
     //set depth limit
     $levellimit = 10;
     //first pass - collect children
     foreach ($rows as $child) {
         $parent = $child->parent_id;
         $list = @$children[$parent] ? $children[$parent] : array();
         array_push($list, $child);
         $children[$parent] = $list;
     }
     //second pass - get an indent list of the items
     $list = eventlist_cats::treerecurse(0, '', array(), $children, false, max(0, $levellimit - 1));
     //eventually only pick out the searched items.
     if ($search) {
         $list1 = array();
         foreach ($search_rows as $sid) {
             foreach ($list as $item) {
                 if ($item->id == $sid) {
                     $list1[] = $item;
                 }
             }
         }
         // replace full list with found items
         $list = $list1;
     }
     $total = count($list);
     jimport('joomla.html.pagination');
     $this->_pagination = new JPagination($total, $limitstart, $limit);
     // slice out elements based on limits
     $list = array_slice($list, $this->_pagination->limitstart, $this->_pagination->limit);
     foreach ($list as $category) {
         $category->assignedevents = $this->_countcatevents($category->id);
     }
     return $list;
 }
Beispiel #13
0
 /**
  * logic to get the categories
  *
  * @access public
  * @return void
  */
 function getCategoryTree()
 {
     $app =& JFactory::getApplication();
     // Get the paramaters of the active menu item
     $params =& $app->getParams('com_eventlist');
     $top_id = $params->get('top_category', 0);
     $user =& JFactory::getUser();
     $elsettings =& ELHelper::config();
     $userid = (int) $user->get('id');
     $gid = (int) $user->get('aid');
     $superuser = ELUser::superuser();
     $where = ' WHERE c.published = 1 AND c.access <= ' . $gid;
     //get the maintained categories and the categories whithout any group
     //or just get all if somebody have edit rights
     $query = 'SELECT c.*' . ' FROM #__eventlist_categories AS c' . $where . ' ORDER BY c.ordering';
     $this->_db->setQuery($query);
     $rows = $this->_db->loadObjectList();
     //set depth limit
     $levellimit = 10;
     //get children
     $children = array();
     foreach ($rows as $child) {
         $parent = $child->parent_id;
         $list = @$children[$parent] ? $children[$parent] : array();
         array_push($list, $child);
         $children[$parent] = $list;
     }
     //get list of the items
     return eventlist_cats::treerecurse($top_id, '', array(), $children, true, max(0, $levellimit - 1));
 }