1 | <?php |
||
33 | * Category |
||
34 | * |
||
35 | * Class used to handle all of the CRUD actions for FAQ categories |
||
36 | * |
||
37 | * @author :: John Neill |
||
38 | * @copyright:: Copyright (c) 2009 |
||
39 | */ |
||
40 | class Category extends \XoopsObject |
||
41 | { |
||
42 | /** |
||
43 | * Constructor |
||
44 | */ |
||
45 | public function __construct() |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Display the category title |
||
55 | * |
||
56 | * @return string display the category title (filtered for display) |
||
57 | */ |
||
58 | public function __toString() |
||
59 | { |
||
60 | return $this->getVar('category_title', 's'); |
||
|
|||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Display the category edit form |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | public function displayForm() |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * Render the category edit form |
||
75 | * |
||
76 | * @return string HTML entities used to edit the catagory object |
||
77 | */ |
||
78 | public function renderForm() |
||
79 | { |
||
80 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
||
81 | $permHelper = new \Xmf\Module\Helper\Permission(); |
||
82 | xoops_load('constants', basename(dirname(__DIR__))); |
||
83 | |||
84 | $caption = ($this->isNew()) ? _AM_XOOPSFAQ_CREATE_NEW : sprintf(_AM_XOOPSFAQ_MODIFY_ITEM, $this->getVar('category_title')); |
||
85 | |||
86 | $form = new \XoopsThemeForm($caption, 'content', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
87 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||
88 | $form->addElement(new \XoopsFormHidden('category_id', $this->getVar('category_id'))); |
||
89 | // title |
||
90 | $category_title = new \XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, $this->getVar('category_title', 'e')); |
||
91 | $category_title->setDescription(_AM_XOOPSFAQ_E_CATEGORY_TITLE_DESC); |
||
92 | $form->addElement($category_title, true); |
||
93 | // order |
||
94 | $category_order = new \XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_ORDER, 'category_order', 5, 5, $this->getVar('category_order', 'e')); |
||
95 | $category_order->setDescription(_AM_XOOPSFAQ_E_CATEGORY_ORDER_DESC); |
||
96 | $form->addElement($category_order, false); |
||
103 |