mambax7 /
smartfaq
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * Module: SmartFAQ |
||||
| 5 | * Author: The SmartFactory <www.smartfactory.ca> |
||||
| 6 | * Licence: GNU |
||||
| 7 | */ |
||||
| 8 | |||||
| 9 | use XoopsModules\Smartfaq; |
||||
| 10 | use XoopsModules\Smartfaq\Constants; |
||||
| 11 | |||||
| 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||
| 13 | |||||
| 14 | /** @var Smartfaq\Helper $helper */ |
||||
| 15 | $helper = Smartfaq\Helper::getInstance(); |
||||
| 16 | |||||
| 17 | global $_POST; |
||||
| 18 | |||||
| 19 | require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
||||
| 20 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
| 21 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
| 22 | //require_once __DIR__ . '/functions.php'; |
||||
| 23 | |||||
| 24 | $mytree = new Smartfaq\Tree($xoopsDB->prefix('smartfaq_categories'), 'categoryid', 'parentid'); |
||||
| 25 | //$form = new \XoopsThemeForm(_MD_SF_SUBMITANSWER, "form", xoops_getenv('PHP_SELF'), 'post', true); |
||||
| 26 | $form = new \XoopsThemeForm(_MD_SF_SUBMITANSWER, 'form', ''); |
||||
| 27 | // faq QUESTION |
||||
| 28 | $form->addElement(new \XoopsFormLabel(_MD_SF_QUESTION, $faqObj->question()), false); |
||||
| 29 | // ANSWER |
||||
| 30 | //$form->addElement(new \XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', 15, 60), true); |
||||
| 31 | |||||
| 32 | $editorTray = new \XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br>'); |
||||
| 33 | if (class_exists('XoopsFormEditor')) { |
||||
| 34 | $options['name'] = 'answer'; |
||||
| 35 | $options['value'] = ''; |
||||
| 36 | $options['rows'] = 5; |
||||
| 37 | $options['cols'] = '100%'; |
||||
| 38 | $options['width'] = '100%'; |
||||
| 39 | $options['height'] = '200px'; |
||||
| 40 | $answerEditor = new \XoopsFormEditor('', $helper->getConfig('form_editorOptionsUser'), $options, $nohtml = false, $onfailure = 'textarea'); |
||||
| 41 | $editorTray->addElement($answerEditor, true); |
||||
| 42 | } else { |
||||
| 43 | $answerEditor = new \XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%'); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
'100%' of type string is incompatible with the type integer expected by parameter $cols of XoopsFormDhtmlTextArea::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 44 | $editorTray->addElement($answerEditor, true); |
||||
| 45 | } |
||||
| 46 | $form->addElement($editorTray); |
||||
| 47 | |||||
| 48 | // NOTIFY ON PUBLISH |
||||
| 49 | if (is_object($xoopsUser)) { |
||||
| 50 | $notify_checkbox = new \XoopsFormCheckBox('', 'notifypub', 1); |
||||
| 51 | $notify_checkbox->addOption(1, _MD_SF_NOTIFY); |
||||
| 52 | $form->addElement($notify_checkbox); |
||||
| 53 | } |
||||
| 54 | |||||
| 55 | if ((Constants::SF_STATUS_PUBLISHED == $faqObj->status()) || (Constants::SF_STATUS_NEW_ANSWER == $faqObj->status())) { |
||||
| 56 | $answerObj = $faqObj->answer(); |
||||
| 57 | $form->addElement(new \XoopsFormLabel(_MD_SF_ORIGINAL_ANSWER, $answerObj->answer()), false); |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | $form->addElement(new \XoopsFormHidden('faqid', $faqObj->faqid())); |
||||
| 61 | |||||
| 62 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||
| 63 | $hidden = new \XoopsFormHidden('op', 'post'); |
||||
| 64 | $buttonTray->addElement($hidden); |
||||
| 65 | |||||
| 66 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||
| 67 | $hidden = new \XoopsFormHidden('op', 'post'); |
||||
| 68 | $buttonTray->addElement($hidden); |
||||
| 69 | $buttonTray->addElement(new \XoopsFormButton('', 'post', _MD_SF_SUBMITANSWER, 'submit')); |
||||
| 70 | $form->addElement($buttonTray); |
||||
| 71 | |||||
| 72 | $form->assign($xoopsTpl); |
||||
| 73 | |||||
| 74 | unset($hidden); |
||||
| 75 |