mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 07:44:05 +02:00
DataTypeDatalist: Implement getEntries()
This commit is contained in:
parent
f58cc3e22c
commit
f7a2425b97
@ -9,11 +9,26 @@ class DataTypeDatalist extends DataTypeHook
|
||||
{
|
||||
public function getFormElement($name, QuickForm $form)
|
||||
{
|
||||
$element = $form->createElement('select', $name);
|
||||
$element = $form->createElement('select', $name, array(
|
||||
'multiOptions' => array(null => '- please choose -') +
|
||||
$this->getEntries($form),
|
||||
));
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function getEntries($form)
|
||||
{
|
||||
$db = $form->getDb()->getDbAdapter();
|
||||
|
||||
$select = $db->select()
|
||||
->from('director_datalist_entry', array('entry_name', 'entry_value'))
|
||||
->where('list_id = ?', $this->settings['datalist_id'])
|
||||
->order('entry_value ASC');
|
||||
|
||||
return $db->fetchPairs($select);
|
||||
}
|
||||
|
||||
public static function addSettingsFormFields(QuickForm $form)
|
||||
{
|
||||
$db = $form->getDb();
|
||||
|
Loading…
x
Reference in New Issue
Block a user