/** * Init configuration */ protected function initConfiguration() { $Distances = new PluginConfigurationValueArray('distances', __('Distances to predict')); $Distances->setDefaultValue(array(1, 3, 5, 10, 21.1, 42.2)); $Model = new PluginConfigurationValueSelect('model', __('Prediction model')); $Model->setOptions(array('jd' => 'Jack Daniels', 'cpp' => 'Robert Bock (CPP)', 'steffny' => 'Herbert Steffny', 'cameron' => 'David Cameron')); $Model->setDefaultValue('jd'); $BasicEndurance = new PluginConfigurationValueBool('use_be', __('Use basic endurance'), __('Use basic endurance factor to adapt prognosis for long distances (Jack Daniels only).')); $BasicEndurance->setDefaultValue(true); $Configuration = new PluginConfiguration($this->id()); $Configuration->addValue($Distances); $Configuration->addValue($Model); $Configuration->addValue($BasicEndurance); $this->setConfiguration($Configuration); }
/** * Init configuration */ protected function initConfiguration() { $this->AllTypes = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'equipment_type` WHERE `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY `name` ASC')->fetchAll(); $Options = array(); foreach ($this->AllTypes as $data) { $Options[$data['id']] = $data['name']; } $Types = new PluginConfigurationValueSelect('type', __('Equipment type to display')); $Types->setOptions($Options); $Configuration = new PluginConfiguration($this->id()); $Configuration->addValue($Types); if (isset($_GET['type']) && isset($Options[$_GET['type']])) { $Configuration->object('type')->setValue($_GET['type']); $Configuration->update('type'); Cache::delete(PluginConfiguration::CACHE_KEY); } $this->setConfiguration($Configuration); }
/** * Init configuration */ protected function initConfiguration() { $this->AllTags = array(); $AllTags = DB::getInstance()->query('SELECT `id`, `tag` FROM `' . PREFIX . 'tag` WHERE `accountid`="' . SessionAccountHandler::getId() . '" ORDER BY `tag` ASC')->fetchAll(); foreach ($AllTags as $data) { $this->AllTags[$data['id']] = $data['tag']; } $Tags = new PluginConfigurationValueSelect('tag', __('Tag to analyze')); $Tags->setOptions($this->AllTags); $Configuration = new PluginConfiguration($this->id()); $Configuration->addValue($Tags); if (isset($_GET['dat']) && isset($this->AllTags[$_GET['dat']])) { $Configuration->object('tag')->setValue($_GET['dat']); $Configuration->update('tag'); Cache::delete(PluginConfiguration::CACHE_KEY); } $this->setConfiguration($Configuration); $this->TagId = (int) $this->Configuration()->value('tag'); }