|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Extended User Profile |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* This program is distributed in the hope that it will be useful, |
|
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
* |
|
12
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
|
13
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) |
|
14
|
|
|
* @package profile |
|
15
|
|
|
* @since 2.3.0 |
|
16
|
|
|
* @author Jan Pedersen |
|
17
|
|
|
* @author Taiwen Jiang <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
// defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined"); |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @package kernel |
|
24
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
|
25
|
|
|
*/ |
|
26
|
|
|
class YogurtCategory extends XoopsObject |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* |
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->initVar('cat_id', XOBJ_DTYPE_INT, null, true); |
|
34
|
|
|
$this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); |
|
35
|
|
|
$this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); |
|
36
|
|
|
$this->initVar('cat_weight', XOBJ_DTYPE_INT); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Get {@link XoopsThemeForm} for adding/editing categories |
|
41
|
|
|
* |
|
42
|
|
|
* @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] |
|
43
|
|
|
* |
|
44
|
|
|
* @return object |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getForm($action = false) |
|
47
|
|
|
{ |
|
48
|
|
|
if ($action === false) { |
|
49
|
|
|
$action = $_SERVER['REQUEST_URI']; |
|
50
|
|
|
} |
|
51
|
|
|
$title = $this->isNew() ? sprintf(_AM_YOGURT_ADD, _AM_YOGURT_CATEGORY) : sprintf(_AM_YOGURT_EDIT, _AM_YOGURT_CATEGORY); |
|
52
|
|
|
|
|
53
|
|
|
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
54
|
|
|
|
|
55
|
|
|
$form = new XoopsThemeForm($title, 'form', $action, 'post', true); |
|
56
|
|
|
$form->addElement(new XoopsFormText(_AM_YOGURT_TITLE, 'cat_title', 35, 255, $this->getVar('cat_title'))); |
|
|
|
|
|
|
57
|
|
|
if (!$this->isNew()) { |
|
58
|
|
|
//Load groups |
|
59
|
|
|
$form->addElement(new XoopsFormHidden('id', $this->getVar('cat_id'))); |
|
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
$form->addElement(new XoopsFormTextArea(_AM_YOGURT_DESCRIPTION, 'cat_description', $this->getVar('cat_description', 'e'))); |
|
|
|
|
|
|
62
|
|
|
$form->addElement(new XoopsFormText(_AM_YOGURT_WEIGHT, 'cat_weight', 35, 35, $this->getVar('cat_weight', 'e'))); |
|
63
|
|
|
|
|
64
|
|
|
$form->addElement(new XoopsFormHidden('op', 'save')); |
|
65
|
|
|
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
66
|
|
|
|
|
67
|
|
|
return $form; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @package kernel |
|
73
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
|
74
|
|
|
*/ |
|
75
|
|
|
class YogurtCategoryHandler extends XoopsPersistableObjectHandler |
|
76
|
|
|
{ |
|
77
|
|
|
/** |
|
78
|
|
|
* @param null|XoopsDatabase $db |
|
79
|
|
|
*/ |
|
80
|
|
|
public function __construct(XoopsDatabase $db) |
|
81
|
|
|
{ |
|
82
|
|
|
parent::__construct($db, 'yogurt_profile_category', 'Yogurtcategory', 'cat_id', 'cat_title'); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|