public function run() { // Create a View (radio) /*$view['radio'] = Viewr::create(array( 'path' => 'public.form.input.radio', )); $view['textarea'] = Viewr::create(array( 'path' => 'public.form.input.textarea', )); $view['text'] = Viewr::create(array( 'path' => 'public.form.input.text', )); $view['password'] = Viewr::create(array( 'path' => 'public.form.input.password', )); $view['hidden'] = Viewr::create(array( 'path' => 'public.form.input.hidden', )); $view['checkbox'] = Viewr::create(array( 'path' => 'public.form.input.checkbox', )); $view['submit'] = Viewr::create(array( 'path' => 'public.form.input.submit', )); $view['select'] = Viewr::create(array( 'path' => 'public.form.input.select', )); $this->command->info('View created => next step');*/ /** * * Title translation * */ // i18n radio title $i18n['title']['radio'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : radio title $translation['title']['radio']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['radio']->id, 'locale_id' => 'fr', 'text' => 'Titre du radion')); // Translation EN : radio title $translation['title']['radio']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['radio']->id, 'locale_id' => 'en', 'text' => 'Radio title')); // i18n textarea title $i18n['title']['textarea'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : textarea title $translation['title']['textarea']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['textarea']->id, 'locale_id' => 'fr', 'text' => 'Titre du Textarea')); // Translation EN : textarea title $translation['title']['textarea']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['textarea']->id, 'locale_id' => 'en', 'text' => 'Textarea title')); // i18n text title $i18n['title']['text'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : text title $translation['title']['text']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['text']->id, 'locale_id' => 'fr', 'text' => 'Titre du text')); // Translation EN : text title $translation['title']['text']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['text']->id, 'locale_id' => 'en', 'text' => 'Text title')); // i18n password title $i18n['title']['password'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : password title $translation['title']['password']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['password']->id, 'locale_id' => 'fr', 'text' => 'Titre du password')); // Translation EN : password title $translation['title']['password']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['password']->id, 'locale_id' => 'en', 'text' => 'PAssword title')); // i18n hidden title $i18n['title']['hidden'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : hidden title $translation['title']['hidden']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['hidden']->id, 'locale_id' => 'fr', 'text' => 'Titre du hidden')); // Translation EN : hidden title $translation['title']['hidden']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['hidden']->id, 'locale_id' => 'en', 'text' => 'hidden title')); // i18n checkbox title $i18n['title']['checkbox'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : checkbox title $translation['title']['checkbox']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['checkbox']->id, 'locale_id' => 'fr', 'text' => 'Titre du checkbox')); // Translation EN : checkbox title $translation['title']['checkbox']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['checkbox']->id, 'locale_id' => 'en', 'text' => 'checkbox title')); // i18n submit title $i18n['title']['submit'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : submit title $translation['title']['submit']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['submit']->id, 'locale_id' => 'fr', 'text' => 'Titre du submit')); // Translation EN : submit title $translation['title']['submit']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['submit']->id, 'locale_id' => 'en', 'text' => 'submit title')); // i18n select title $i18n['title']['select'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : select title $translation['title']['select']['FR'] = Translation::create(array('i18n_id' => $i18n['title']['select']->id, 'locale_id' => 'fr', 'text' => 'Titre du select')); // Translation EN : select title $translation['title']['select']['EN'] = Translation::create(array('i18n_id' => $i18n['title']['select']->id, 'locale_id' => 'en', 'text' => 'select title')); /** * * label translation * */ // i18n radio label $i18n['label']['radio'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : radio label $translation['label']['radio']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['radio']->id, 'locale_id' => 'fr', 'text' => 'Titre du radion')); // Translation EN : radio label $translation['label']['radio']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['radio']->id, 'locale_id' => 'en', 'text' => 'Radio label')); // i18n textarea label $i18n['label']['textarea'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : textarea label $translation['label']['textarea']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['textarea']->id, 'locale_id' => 'fr', 'text' => 'Titre du Textarea')); // Translation EN : textarea label $translation['label']['textarea']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['textarea']->id, 'locale_id' => 'en', 'text' => 'Textarea label')); // i18n text label $i18n['label']['text'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : text label $translation['label']['text']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['text']->id, 'locale_id' => 'fr', 'text' => 'Titre du text')); // Translation EN : text label $translation['label']['text']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['text']->id, 'locale_id' => 'en', 'text' => 'Text label')); // i18n password label $i18n['label']['password'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : password label $translation['label']['password']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['password']->id, 'locale_id' => 'fr', 'text' => 'Titre du password')); // Translation EN : password label $translation['label']['password']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['password']->id, 'locale_id' => 'en', 'text' => 'PAssword label')); // i18n hidden label $i18n['label']['hidden'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : hidden label $translation['label']['hidden']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['hidden']->id, 'locale_id' => 'fr', 'text' => 'Titre du hidden')); // Translation EN : hidden label $translation['label']['hidden']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['hidden']->id, 'locale_id' => 'en', 'text' => 'hidden label')); // i18n checkbox label $i18n['label']['checkbox'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : checkbox label $translation['label']['checkbox']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['checkbox']->id, 'locale_id' => 'fr', 'text' => 'Titre du checkbox')); // Translation EN : checkbox label $translation['label']['checkbox']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['checkbox']->id, 'locale_id' => 'en', 'text' => 'checkbox label')); // i18n submit label $i18n['label']['submit'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : submit label $translation['label']['submit']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['submit']->id, 'locale_id' => 'fr', 'text' => 'Titre du submit')); // Translation EN : submit label $translation['label']['submit']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['submit']->id, 'locale_id' => 'en', 'text' => 'submit label')); // i18n select label $i18n['label']['select'] = I18n::create(array('i18n_type_id' => 2)); // Translation FR : select label $translation['label']['select']['FR'] = Translation::create(array('i18n_id' => $i18n['label']['select']->id, 'locale_id' => 'fr', 'text' => 'Titre du select')); // Translation EN : select label $translation['label']['select']['EN'] = Translation::create(array('i18n_id' => $i18n['label']['select']->id, 'locale_id' => 'en', 'text' => 'select label')); // Input types $InputType['radio'] = InputType::create(array('name' => 'maradio', 'rules' => 'required', 'i18n_title' => $i18n['title']['radio']->id)); $InputType['textarea'] = InputType::create(array('name' => 'monTextarea', 'rules' => 'required', 'i18n_title' => $i18n['title']['textarea']->id)); $InputType['text'] = InputType::create(array('name' => 'blabla', 'rules' => 'required', 'i18n_title' => $i18n['title']['text']->id)); $InputType['password'] = InputType::create(array('name' => 'passwd', 'rules' => 'required', 'i18n_title' => $i18n['title']['password']->id)); $InputType['hidden'] = InputType::create(array('name' => 'testhidden', 'rules' => 'required', 'defaultValue' => 'Je suis une valeur requise', 'i18n_title' => $i18n['title']['hidden']->id)); $InputType['checkbox'] = InputType::create(array('name' => 'test', 'rules' => 'required', 'i18n_title' => $i18n['title']['checkbox']->id)); $InputType['submit'] = InputType::create(array('name' => 'submit', 'rules' => 'required', 'i18n_title' => $i18n['title']['submit']->id)); $InputType['select'] = InputType::create(array('name' => 'aselect', 'rules' => 'required', 'i18n_title' => $i18n['title']['select']->id)); $this->command->info('Input types created => next step'); // i18n : Placeholder 1 $i18n['placeholder'][1] = I18n::create(array('i18n_type_id' => 9)); // i18n : Helper 1 $i18n['helper'][1] = I18n::create(array('i18n_type_id' => 10)); // i18n form title $i18n['title'] = I18n::create(array('i18n_type_id' => 2)); // i18n form description $i18n['description'] = I18n::create(array('i18n_type_id' => 4)); // Translation FR : Placeholder 1 $translation['placeholder']['FR'][1] = Translation::create(array('i18n_id' => $i18n['placeholder'][1]->id, 'locale_id' => 'fr', 'text' => 'Complete moi stp')); // Translation EN : Placeholder 1 $translation['placeholder']['EN'][1] = Translation::create(array('i18n_id' => $i18n['placeholder'][1]->id, 'locale_id' => 'en', 'text' => 'Please complete me')); // Translation FR : Helper 1 $translation['helper']['FR'][1] = Translation::create(array('i18n_id' => $i18n['helper'][1]->id, 'locale_id' => 'fr', 'text' => 'Un impressionnant helper !')); // Translation EN : Helper 1 $translation['helper']['EN'][1] = Translation::create(array('i18n_id' => $i18n['helper'][1]->id, 'locale_id' => 'en', 'text' => 'An awesome helper !')); // Translation FR : Form title $translation['title']['FR'] = Translation::create(array('i18n_id' => $i18n['title']->id, 'locale_id' => 'fr', 'text' => 'My awesome form')); // Translation EN : Form title $translation['title']['EN'] = Translation::create(array('i18n_id' => $i18n['title']->id, 'locale_id' => 'en', 'text' => 'My awesome form')); // Translation FR : Form description $translation['description']['FR'] = Translation::create(array('i18n_id' => $i18n['description']->id, 'locale_id' => 'fr', 'text' => 'Description of a form')); // Translation EN : Form description $translation['description']['EN'] = Translation::create(array('i18n_id' => $i18n['description']->id, 'locale_id' => 'en', 'text' => 'Description of a form')); $this->command->info('Translations created => next step'); // Inputs $input[1] = InputView::create(array('name' => "radio", 'view_id' => 1, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['radio']->id, 'type_id' => $InputType['radio']->id)); $input[2] = InputView::create(array('name' => "textarea", 'view_id' => 2, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['textarea']->id, 'type_id' => $InputType['textarea']->id)); $input[3] = InputView::create(array('name' => "text", 'view_id' => 3, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['text']->id, 'type_id' => $InputType['text']->id)); $input[4] = InputView::create(array('name' => "password", 'view_id' => 4, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['password']->id, 'type_id' => $InputType['password']->id)); $input[5] = InputView::create(array('name' => "hidden", 'view_id' => 5, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['hidden']->id, 'type_id' => $InputType['hidden']->id)); $input[6] = InputView::create(array('name' => "checkbox", 'view_id' => 6, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['checkbox']->id, 'type_id' => $InputType['checkbox']->id)); $input[7] = InputView::create(array('name' => "submit", 'view_id' => 7, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['submit']->id, 'type_id' => $InputType['submit']->id)); $input[8] = InputView::create(array('name' => "select", 'view_id' => 8, 'i18n_placeholder' => $i18n['placeholder'][1]->id, 'i18n_helper' => $i18n['helper'][1]->id, 'i18n_label' => $i18n['label']['select']->id, 'type_id' => $InputType['select']->id)); $this->command->info('Inputs created => next step'); // Form $form = Formr::create(array('finish_on' => 'model', 'type' => 'horizontal', 'i18n_title' => $i18n['title']->id, 'i18n_description' => $i18n['description']->id)); $this->command->info('Form created => next step'); // For maps $formMap[1] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[1]->id, 'order' => 1)); $formMap[2] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[2]->id, 'order' => 2)); $formMap[3] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[3]->id, 'order' => 3)); $formMap[4] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[4]->id, 'order' => 4)); $formMap[5] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[5]->id, 'order' => 5)); $formMap[8] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[8]->id, 'order' => 6)); $formMap[7] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[7]->id, 'order' => 7)); $formMap[6] = FormMap::create(array('form_id' => $form->id, 'input_id' => $input[6]->id, 'order' => 8)); // Text for options // Option 1 $option18n[1]['key'] = I18n::create(array('i18n_type_id' => 6)); $option18n[1]['value'] = I18n::create(array('i18n_type_id' => 6)); // Option 2 $option18n[2]['key'] = I18n::create(array('i18n_type_id' => 6)); $option18n[2]['value'] = I18n::create(array('i18n_type_id' => 6)); // Option 3 $option18n[3]['key'] = I18n::create(array('i18n_type_id' => 6)); $option18n[3]['value'] = I18n::create(array('i18n_type_id' => 6)); // OPTION 1 // Translation FR : option 1 Translation::create(array('i18n_id' => $option18n[1]['key']->id, 'locale_id' => 'fr', 'text' => 'mon option 1')); // Translation EN : option 1 Translation::create(array('i18n_id' => $option18n[1]['key']->id, 'locale_id' => 'en', 'text' => 'my option 1')); // Translation FR : option 1 Translation::create(array('i18n_id' => $option18n[1]['value']->id, 'locale_id' => 'fr', 'text' => 'valeur ici 1')); // Translation EN : option 1 Translation::create(array('i18n_id' => $option18n[1]['value']->id, 'locale_id' => 'en', 'text' => 'value here 1')); // OPTION 2 // Translation FR : option 2 Translation::create(array('i18n_id' => $option18n[2]['key']->id, 'locale_id' => 'fr', 'text' => 'Test de mon option 2')); // Translation EN : option 2 Translation::create(array('i18n_id' => $option18n[2]['key']->id, 'locale_id' => 'en', 'text' => 'Test of my option 2')); // Translation FR : option 2 Translation::create(array('i18n_id' => $option18n[2]['value']->id, 'locale_id' => 'fr', 'text' => 'valeur ici 2')); // Translation EN : option 2 Translation::create(array('i18n_id' => $option18n[2]['value']->id, 'locale_id' => 'en', 'text' => 'value here 2')); // OPTION 3 // Translation FR : option 3 Translation::create(array('i18n_id' => $option18n[3]['key']->id, 'locale_id' => 'fr', 'text' => '3eme option')); // Translation EN : option 3 Translation::create(array('i18n_id' => $option18n[3]['key']->id, 'locale_id' => 'en', 'text' => '3rd option')); // Translation FR : option 3 Translation::create(array('i18n_id' => $option18n[3]['value']->id, 'locale_id' => 'fr', 'text' => 'valeur ici 3')); // Translation EN : option 3 Translation::create(array('i18n_id' => $option18n[3]['value']->id, 'locale_id' => 'en', 'text' => 'value here 3')); // Options of select SelectOption::create(array('input_id' => $input[8]->id, 'i18n_key' => $option18n[1]['key']->id, 'i18n_value' => $option18n[1]['value']->id)); SelectOption::create(array('input_id' => $input[8]->id, 'i18n_key' => $option18n[2]['key']->id, 'i18n_value' => $option18n[2]['value']->id)); SelectOption::create(array('input_id' => $input[8]->id, 'i18n_key' => $option18n[3]['key']->id, 'i18n_value' => $option18n[3]['value']->id)); $this->command->info('Form maps created'); ModelForm::create(array('form_id' => $form->id, 'model' => 'gallery')); $this->command->info('Models form created'); }
/** * Add an `option` to the `optgroup` * * @param string $label Option's label * @param string $value Option's value * @param boolean $selected Set this option as selected by default * @return \ValidFormBuilder\SelectOption */ public function addField($label, $value, $selected = false, $meta = array()) { $objOption = new SelectOption($label, $value, $selected, $meta); $objOption->setMeta("parent", $this, true); $this->__options->addObject($objOption); return $objOption; }
public function setHeader($text) { $optionsHeader = new SelectOption(); $optionsHeader->setText($text); $optionsHeader->setSelected(); $this->addOption($optionsHeader); return $this; }
/** * Import options from array * * @param array $options * @return SelectOptionGroup */ public function importOptions(array $options = []) { foreach ($options as $option) { $value = isset($option['value']) ? $option['value'] : null; $title = isset($option['title']) ? $option['title'] : $option['value']; $selected = isset($option['selected']) ? true : false; $this->addOption(SelectOption::forge()->setOptionParams($value, $title, $selected)); } return $this; }
/** * Formr action * @param Array $inputs */ public static function formAction($dataInput) { //return var_dump($dataInput); if (!isset($dataInput['formParam']) || !isset($dataInput['formParam']['formId'])) { App::abbort(404); } $form = Formr::findOrFail($dataInput['formParam']['formId']); // recuperation de l'ordre pour le nouvel input $lastOrder = self::mapping($form); // Suppression du dernier pipe et surchage de "data['rules']" $dataInput['rules'] = isset($dataInput['rules']) ? self::generateRules($dataInput['rules']) : ""; $view = Viewr::where('name', $dataInput['type'])->firstOrFail(); $dataInput['view'] = $view->id; $dataInput = array_merge($dataInput, self::generateI18n($dataInput)); $inputType = InputType::add($dataInput); $input = self::add($inputType->id, $dataInput); /** * * * * * * A FAIRE : TRAITER LES OPTIONS * * * * * * */ // Add options if the input type is a select if ($input->name = "select") { if (isset($dataInput['options'])) { foreach ($dataInput['options'] as $option) { $option['key'] = i18n::add($option['key'], 'option_key'); $option['value'] = i18n::add($option['value'], 'option_value'); SelectOption::add($input->id, $option); } } } // Add form map FormMap::add($input->id, $form->id, $lastOrder); return Redirect::route('admin.form.show', $form->id); }
/** * Import options from array * * @param array $options * * @return Select */ public function importOptions(array $options = []) { foreach ($options as $option) { if (isset($option['options']) && is_array($option['options'])) { $label = isset($option['label']) ? $option['label'] : null; $groupOptions = !empty($option['options']) ? $option['options'] : []; $this->addGroup(SelectOptionGroup::forge()->setTitle($label)->importOptions($groupOptions)); } else { $value = isset($option['value']) ? $option['value'] : null; $title = isset($option['title']) ? $option['title'] : $option['value']; $selected = isset($option['selected']) ? true : false; $this->addOption(SelectOption::forge()->setOptionParams($value, $title, $selected)); } } return $this; }
/** * Get the data in a serializable format. * * @return array */ public function yamlSerialize() { $option = parent::yamlSerialize(); $option['specific'] = array(); return $option; }
public function generate($data, $pageId, $order) { $form = new self(); $fromObject = false; if (is_object($data)) { $data = $data->formr(); $form->i18n_title = NULL; $form->i18n_description = NULL; $fromObject = true; } $form->finish_on = $data['method']; $form->type = $data['type']; $form->save(); $orderMap = 0; foreach ($data['data'] as $dataInput) { // Increments the order $orderMap++; if ($fromObject) { $dataInput['title'] = NULL; $dataInput['label'] = NULL; $dataInput['placeholder'] = NULL; $dataInput['helper'] = NULL; } else { $dataInput['title'] = i18n::add($dataInput['title'], 'title'); $dataInput['label'] = i18n::add($dataInput['label'], 'label'); $dataInput['placeholder'] = i18n::add($dataInput['placeholder'], 'placeholder'); $dataInput['helper'] = i18n::add($dataInput['helper'], 'helper'); } $inputType = InputType::add($dataInput); $input = InputView::add($inputType->id, $dataInput); // Add options if the input type is a select if ($input->name = "select") { if (isset($dataInput['options'])) { foreach ($dataInput['options'] as $option) { if ($fromObject) { $option['key'] = NULL; $option['value'] = NULL; } else { $option['key'] = i18n::add($option['key'], 'option_key'); $option['value'] = i18n::add($option['value'], 'option_value'); } SelectOption::add($input->id, $option); } } } // Add form map FormMap::add($input->id, $form->id, $orderMap); } // Add a block if the form is not by a model if (!$fromObject) { $block = Block::add($pageId, $order, 'Formr'); BlockResponsive::add($block->id, 12, 3); } if ($fromObject) { // Add form model ModelForm::add($form->id, $data['model']); } // Generate a migrate file if ($form->finish_on == "database") { // Prepare migrate content $contentMigrate = $this->prepareMigrate($data['data']); $bob = new Migrator('form_' . $form->id, $contentMigrate); $bob->generate(); } return $form; }
* (c) 2007-2010 Mandriva, http://www.mandriva.com * * $Id$ * * This file is part of Mandriva Management Console (MMC). * * MMC is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC. If not, see <http://www.gnu.org/licenses/>. */ include_once "modules/admin/includes/configure.inc.php"; $page = new ConfigurationPage("Inventory configuration", "index"); $options = array(); $methodOption = new SelectOption("computers", "method", "Inventory backend", array("glpi", "inventory"), "", true); $options[] = $methodOption; $option = new StringOption("glpi", "dbdriver", "Db Driver", "", true); $methodOption->showOnSelection("inventory", $option); $methodOption->addFunctionBefore("admin.loadInventoryConf", array()); $methodOption->addFunctionAfter("admin.switchInventoryModule", array()); /* $inventory_options[] = $option; */ $page->addOptions('base', $options); /* $page->addOptions('inventory', $inventory_options); */