1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Module: SmartFAQ |
5
|
|
|
* Author: The SmartFactory <www.smartfactory.ca> |
6
|
|
|
* Licence: GNU |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
use XoopsModules\Smartfaq; |
10
|
|
|
|
11
|
|
|
global $_POST; |
12
|
|
|
|
13
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
14
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
15
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
16
|
|
|
|
17
|
|
|
$form = new \XoopsThemeForm(_MD_SF_REQUEST, 'form', xoops_getenv('SCRIPT_NAME'), 'post', true); |
18
|
|
|
// CATEGORY |
19
|
|
|
$mytree = new Smartfaq\Tree($xoopsDB->prefix('smartfaq_categories'), 'categoryid', 'parentid'); |
20
|
|
|
ob_start(); |
21
|
|
|
$form->addElement(new \XoopsFormHidden('categoryid', '')); |
22
|
|
|
$mytree->makeMySelBox('name', 'weight', ''); |
|
|
|
|
23
|
|
|
$category_label = new \XoopsFormLabel(_MD_SF_CATEGORY_QUESTION, ob_get_contents()); |
24
|
|
|
$category_label->setDescription(_MD_SF_CATEGORY_QUESTION_DSC); |
25
|
|
|
$form->addElement($category_label); |
26
|
|
|
ob_end_clean(); |
27
|
|
|
// QUESTION |
28
|
|
|
$form->addElement(new \XoopsFormTextArea(_MD_SF_QUESTION, 'question', '', 10, 38), true); |
29
|
|
|
|
30
|
|
|
$buttonTray = new \XoopsFormElementTray('', ''); |
31
|
|
|
$hidden = new \XoopsFormHidden('op', 'post'); |
32
|
|
|
$buttonTray->addElement($hidden); |
33
|
|
|
$buttonTray->addElement(new \XoopsFormButton('', 'post', _SUBMIT, 'submit')); |
34
|
|
|
$form->addElement($buttonTray); |
35
|
|
|
// NOTIFY ON PUBLISH |
36
|
|
|
if (is_object($xoopsUser)) { |
37
|
|
|
$notify_checkbox = new \XoopsFormCheckBox('', 'notifypub', 1); |
38
|
|
|
$notify_checkbox->addOption(1, _MD_SF_NOTIFY); |
39
|
|
|
$form->addElement($notify_checkbox); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
$form->assign($xoopsTpl); |
43
|
|
|
unset($hidden); |
44
|
|
|
|