public function getInput() { /** * @var EventgalleryLibraryManagerImagetype $imagetypeMgr */ $imagetypeMgr = EventgalleryLibraryManagerImagetype::getInstance(); $imagetypes = $imagetypeMgr->getImageTypes(false); $id = $this->form->getField('id')->value; $imagetypeset = null; if ($id != 0) { $imagetypeset = new EventgalleryLibraryImagetypeset($id); } /** * @var EventgalleryLibraryImagetype $imagetype */ $return = '<select multiple name="' . $this->name . '" id="' . $this->id . '">'; if ($imagetypeset != null) { foreach ($imagetypeset->getImageTypes() as $imagetype) { $return .= '<option selected="selected" value="' . $imagetype->getId() . '">' . $imagetype->getName() . '</option>'; } } foreach ($imagetypes as $imagetype) { if ($imagetypeset != null && $imagetypeset->getImageType($imagetype->getId()) != null) { continue; } $return .= '<option value="' . $imagetype->getId() . '">' . $imagetype->getName() . '</option>'; } $return .= "</select>"; return $return; }
/** * Return all imagetypesets * * @param $publishedOnly * @return array */ public function getImageTypeSets($publishedOnly) { if ($this->_imagetypesets == null) { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('id'); $query->from('#__eventgallery_imagetypeset'); $query->order($db->quoteName('default') . ' DESC'); $query->order('ordering'); $db->setQuery($query); $items = $db->loadObjectList(); $this->_imagetypesets = array(); $this->_imagetypesets_published = array(); foreach ($items as $item) { /** * @var EventgalleryLibraryImagetypeset $itemObject */ $itemObject = new EventgalleryLibraryImagetypeset($item->id); if ($itemObject->isPublished()) { $this->_imagetypesets_published[$itemObject->getId()] = $itemObject; } $this->_imagetypesets[$itemObject->getId()] = $itemObject; } } if ($publishedOnly) { return $this->_imagetypesets_published; } else { return $this->_imagetypesets; } }
public function getInput() { /** * @var EventgalleryLibraryManagerImagetype $imagetypeMgr */ $imagetypeMgr = EventgalleryLibraryManagerImagetype::getInstance(); $imagetypes = $imagetypeMgr->getImageTypes(false); $id = $this->form->getField('id')->value; $imagetypeset = null; if ($id != 0) { $imagetypeset = new EventgalleryLibraryImagetypeset($id); } /** * @var EventgalleryLibraryImagetype $imagetype */ $return = '<select name="' . $this->name . '" id="' . $this->id . '">'; $defaultid = -1; if ($imagetypeset != null && $imagetypeset->getDefaultImageType()) { $defaultid = $imagetypeset->getDefaultImageType()->getId(); } foreach ($imagetypes as $imagetype) { $imagetype->getId() == $defaultid ? $selected = 'selected="selected"' : ($selected = ''); $return .= '<option ' . $selected . ' value="' . $imagetype->getId() . '">' . $imagetype->getName() . '</option>'; } $return .= "</select>"; return $return; }
/** * Load necessary data for this folder object. */ protected function _prepareData() { if ($this->_folder == null) { return; } $this->_ls_description = new EventgalleryLibraryDatabaseLocalizablestring($this->_folder->description); $this->_ls_text = new EventgalleryLibraryDatabaseLocalizablestring($this->_folder->text); /** * @var EventgalleryLibraryManagerImagetypeset $imagetypesetMgr */ $imagetypesetMgr = EventgalleryLibraryManagerImagetypeset::getInstance(); if ($this->_folder->imagetypesetid == null) { $this->_imagetypeset = $imagetypesetMgr->getDefaultImageTypeSet(true); } else { $this->_imagetypeset = $imagetypesetMgr->getImageTypeSet($this->_folder->imagetypesetid); if (!$this->_imagetypeset->isPublished()) { $this->_imagetypeset = $imagetypesetMgr->getDefaultImageTypeSet(true); } } }