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 <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 <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&view=imagehandler&layout=uploadimage&task=eventimg&tmpl=component'; $link2 = 'index.php?option=com_eventlist&view=imagehandler&task=selecteventimg&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 <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); }
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); }