1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17:
18:
19: class ProfileCategoryForm extends Xoops\Form\ThemeForm
20: {
21: 22: 23:
24: public function __construct(ProfileCategory $obj)
25: {
26: $title = $obj->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_CATEGORY) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_CATEGORY);
27:
28: parent::__construct($title, 'form', false, 'post', true);
29: $this->addElement(new Xoops\Form\Text(_PROFILE_AM_TITLE, 'cat_title', 5, 255, $obj->getVar('cat_title')), true);
30: if (!$obj->isNew()) {
31:
32: $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('cat_id')));
33: }
34: $this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DESCRIPTION, 'cat_description', $obj->getVar('cat_description', 'e'), 5, 5));
35: $weight = new Xoops\Form\Text(_PROFILE_AM_WEIGHT, 'cat_weight', 1, 5, $obj->getVar('cat_weight', 'e'), '');
36: $weight->setPattern('^\d+$', _PROFILE_AM_ERROR_WEIGHT);
37: $this->addElement($weight, true);
38:
39: $this->addElement(new Xoops\Form\Hidden('op', 'save'));
40: $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
41: }
42: }
43: