Example #1
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);
 }
Example #2
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);
 }
Example #3
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);
 }