/** * Construct new input field for: typeid * @param string $name * @param string $label * @param string $value optional, default: loading from $_POST */ public function __construct($name, $label, $value = '') { parent::__construct($name, $label, $value); $this->addOption(0, '---- ' . __('select type'), array('data-sport' => 'all')); foreach (TypeFactory::AllTypes() as $id => $data) { $this->addOption($id, $data['name'], array('data-sport' => $data['sportid'])); } }
/** * Construct new input field for: typeid * @param string $name * @param string $label * @param string $value optional, default: loading from $_POST */ public function __construct($name, $label, $value = '') { parent::__construct($name, $label, $value); $this->addLayoutClass(TrainingFormular::$ONLY_TYPES_CLASS); $this->addOption(0, '---- ' . __('select type'), array('data-sport' => 'all')); foreach (TypeFactory::AllTypes() as $id => $data) { $this->addOption($id, $data['name'], array('data-sport' => $data['sportid'])); } }
/** * Init all types * * IDs will be set as string as indices for correct order */ private static function initAllTypes() { self::$AllTypes = array(); $types = Cache::get('types'); if (is_null($types)) { $types = DB::getInstance()->query('SELECT * FROM `' . PREFIX . 'type` WHERE `accountid` = ' . SessionAccountHandler::getId())->fetchAll(); Cache::set('types', $types, '3600'); } foreach ($types as $data) { self::$AllTypes[(string) $data['id']] = $data; } Configuration::ActivityForm()->orderTypes()->sort(self::$AllTypes); }