public function getInput() { EventgalleryHelpersBackendmedialoader::load(); /** * @var EventgalleryLibraryManagerFoldertype $foldertypeMgr */ $foldertypeMgr = EventgalleryLibraryManagerFoldertype::getInstance(); $foldertypes = $foldertypeMgr->getFolderTypes(true); if ($this->value == null && $foldertypeMgr->getDefaultFolderType(false) != null) { $this->value = $foldertypeMgr->getDefaultFolderType(false)->getId(); } $return = array(); $onchange = "eventgallery.jQuery('.foldertype-input').css('display', 'none'); eventgallery.jQuery('.foldertype-' + this.options[this.selectedIndex].value ).css('display', 'block');"; $return[] = '<select onchange="' . $onchange . '" name=' . $this->name . ' id=' . $this->id . '>'; foreach ($foldertypes as $foldertype) { /** * @var EventgalleryLibraryFoldertype $foldertype */ $this->value == $foldertype->getId() ? $selected = 'selected="selected"' : ($selected = ''); $return[] = '<option ' . $selected . ' value="' . $foldertype->getId() . '">' . $foldertype->getDisplayName() . '</option>'; } $return[] = "</select>"; $return[] = $this->getLocalInput(); $return[] = $this->getPicasaInput(); $currentFolderType = 0; if (isset($this->value)) { $currentFolderType = $this->value; } $return[] = "<script>eventgallery.jQuery('.foldertype-input').css('display', 'none'); eventgallery.jQuery('.foldertype-{$currentFolderType}').css('display', 'block');</script>"; return implode('', $return); }
/** * scans the main dir and adds new folders to the database * Does not add Files! * * @return array with error strings */ public function addNewFolders() { $errors = array(); $folderMgr = EventgalleryLibraryManagerFoldertype::getInstance(); foreach ($folderMgr->getFolderTypes(true) as $folderType) { $folderClass = $folderType->getFolderHandlerClassname(); /** * @var EventgalleryLibraryFolder $folderClass * */ $errors = array_merge($errors, $folderClass::addNewFolders()); } return $errors; }
protected function addToolbar() { JToolbarHelper::title(JText::_('COM_EVENTGALLERY_EVENTS'), 'generic.png'); //JToolbarHelper::deleteList(); JToolbarHelper::addNew('event.add'); JToolbarHelper::editList('event.edit'); JToolbarHelper::publishList('events.publish'); JToolbarHelper::unpublishList('events.unpublish'); JToolbarHelper::publishList('events.cartable', 'COM_EVENTGALLERY_EVENT_CARTABLE'); JToolbarHelper::unpublishList('events.notcartable', 'COM_EVENTGALLERY_EVENT_NOT_CARTABLE'); JToolbarHelper::deleteList('Remove all selected Events?', 'events.delete', 'Remove'); JToolbarHelper::preferences('com_eventgallery', '550'); JToolbarHelper::spacer(100); $bar = JToolbar::getInstance('toolbar'); // Add a trash button. $bar->appendButton('Link', 'trash', 'COM_EVENTGALLERY_SUBMENU_CLEAR_CACHE', JRoute::_('index.php?option=com_eventgallery&view=cache'), false); $bar->appendButton('Link', 'checkin', 'COM_EVENTGALLERY_SUBMENU_SYNC_DATABASE', JRoute::_('index.php?option=com_eventgallery&view=sync'), false); $version = new JVersion(); if ($version->isCompatible('3.0')) { JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); $dhtml = $layout->render(array('title' => $title, 'height' => 200)); $bar->appendButton('Custom', $dhtml, 'batch'); } $options = array(); foreach ($this->foldertags as $key => $value) { $options[] = JHtml::_('select.option', $key, $value); } $options[] = JHtml::_('select.option', '------', 'JNONE'); $options[] = JHtml::_('select.option', '*', 'JALL'); JHtmlSidebar::addFilter(JText::_('COM_EVENTGALLERY_EVENT_FILTER_TAG'), 'filter_tag', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.tag'), true)); /** * @var EventgalleryLibraryManagerFoldertype $folderTypeMgr */ $folderTypeMgr = EventgalleryLibraryManagerFoldertype::getInstance(); $options = array(); /** * @var EventgalleryLibraryFoldertype $folderType */ foreach ($folderTypeMgr->getFolderTypes(true) as $folderType) { $options[] = JHtml::_('select.option', $folderType->getId(), $folderType->getDisplayName()); } $options[] = JHtml::_('select.option', '*', 'JALL'); JHtmlSidebar::addFilter(JText::_('COM_EVENTGALLERY_EVENT_FILTER_TYPE'), 'filter_type', JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.type'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category', JHtml::_('select.options', JHtml::_('category.options', 'com_eventgallery'), 'value', 'text', $this->state->get('filter.category'))); }
/** * returns the folder type for this folder * * @return EventgalleryLibraryFoldertype|null */ public function getFolderType() { /** * @var EventgalleryLibraryManagerFoldertyp $foldertypeMgr * @var EventgalleryLibraryFoldertype $foldertype */ $foldertypeMgr = EventgalleryLibraryManagerFoldertype::getInstance(); $foldertype = $foldertypeMgr->getFolderType($this->_folder->foldertypeid); return $foldertype; }