| 1: | <?php
|
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: |
|
| 19: |
|
| 20: |
|
| 21: |
|
| 22: | |
| 23: | |
| 24: | |
| 25: |
|
| 26: | class ProfileCategory extends XoopsObject
|
| 27: | {
|
| 28: | public $cat_id;
|
| 29: | public $cat_title;
|
| 30: | public $cat_description;
|
| 31: | public $cat_weight;
|
| 32: |
|
| 33: | |
| 34: | |
| 35: |
|
| 36: | public function __construct()
|
| 37: | {
|
| 38: | $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true);
|
| 39: | $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX);
|
| 40: | $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA);
|
| 41: | $this->initVar('cat_weight', XOBJ_DTYPE_INT);
|
| 42: | }
|
| 43: |
|
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | |
| 50: |
|
| 51: | public function getForm($action = false)
|
| 52: | {
|
| 53: | if ($action === false) {
|
| 54: | $action = $_SERVER['REQUEST_URI'];
|
| 55: | }
|
| 56: | $title = $this->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_CATEGORY) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_CATEGORY);
|
| 57: |
|
| 58: | include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
|
| 59: |
|
| 60: | $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
|
| 61: | $form->addElement(new XoopsFormText(_PROFILE_AM_TITLE, 'cat_title', 35, 255, $this->getVar('cat_title')));
|
| 62: | if (!$this->isNew()) {
|
| 63: |
|
| 64: | $form->addElement(new XoopsFormHidden('id', $this->getVar('cat_id')));
|
| 65: | }
|
| 66: | $form->addElement(new XoopsFormTextArea(_PROFILE_AM_DESCRIPTION, 'cat_description', $this->getVar('cat_description', 'e')));
|
| 67: | $form->addElement(new XoopsFormText(_PROFILE_AM_WEIGHT, 'cat_weight', 35, 35, $this->getVar('cat_weight', 'e')));
|
| 68: |
|
| 69: | $form->addElement(new XoopsFormHidden('op', 'save'));
|
| 70: | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
|
| 71: |
|
| 72: | return $form;
|
| 73: | }
|
| 74: | }
|
| 75: |
|
| 76: | |
| 77: | |
| 78: | |
| 79: |
|
| 80: | class ProfileCategoryHandler extends XoopsPersistableObjectHandler
|
| 81: | {
|
| 82: | |
| 83: | |
| 84: |
|
| 85: | public function __construct(XoopsDatabase $db)
|
| 86: | {
|
| 87: | parent::__construct($db, 'profile_category', 'profilecategory', 'cat_id', 'cat_title');
|
| 88: | }
|
| 89: | }
|
| 90: | |