/** * Get code * @return string */ private function getCode() { $Code = ' <table class="fullwidth zebra-style c"> <thead> <tr> <th>' . __('Name') . '</th> <th>' . __('Abbreviation') . '</th> <th>' . __('Category') . '</th> <th>' . __('Delete?') . '</th> </tr> </thead> <tbody>'; $Clothes = ClothesFactory::OrderedClothes(); $Clothes[] = array('new' => true, 'name' => '', 'short' => '', 'order' => '', 'id' => -1); foreach ($Clothes as $Data) { $id = $Data['id']; $delete = isset($Data['new']) ? Icon::$ADD_SMALL : '<input type="checkbox" name="clothes[delete][' . $id . ']">'; $Code .= ' <tr class="' . ($delete == '' ? ' unimportant' : '') . '"> <td><input type="text" size="30" name="clothes[name][' . $id . ']" value="' . $Data['name'] . '"></td> <td><input type="text" size="15" name="clothes[short][' . $id . ']" value="' . $Data['short'] . '"></td> <td><input type="text" size="4" name="clothes[order][' . $id . ']" value="' . $Data['order'] . '"></td> <td>' . $delete . '</td> </tr>'; } $Code .= ' </tbody> </table>'; return $Code; }
/** * Construct new input field for: weather * @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); foreach (ClothesFactory::OrderedClothes() as $data) { $this->addCheckbox($data['id'], $data['short']); } $this->setParser(FormularValueParser::$PARSER_ARRAY_CHECKBOXES); }