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; }
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; }