Completed
Branch master (c92e39)
by Michael
02:32
created

include/answer.inc.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Module: SmartFAQ
5
 * Author: The SmartFactory <www.smartfactory.ca>
6
 * Licence: GNU
7
 */
8
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
9
10
global $_POST;
11
12
include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
13
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
14
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
15
//include_once __DIR__ . '/functions.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
16
17
$mytree = new XoopsTree($xoopsDB->prefix('smartfaq_categories'), 'categoryid', 'parentid');
18
//$form = new XoopsThemeForm(_MD_SF_SUBMITANSWER, "form", xoops_getenv('PHP_SELF'));
19
$form = new XoopsThemeForm(_MD_SF_SUBMITANSWER, 'form', '');
20
// faq QUESTION
21
$form->addElement(new XoopsFormLabel(_MD_SF_QUESTION, $faqObj->question()), false);
22
// ANSWER
23
//$form->addElement(new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', 15, 60), true);
24
25
$editorTray = new XoopsFormElementTray(_MD_SF_ANSWER_FAQ, '<br>');
26 View Code Duplication
if (class_exists('XoopsFormEditor')) {
27
    $options['name']   = 'answer';
28
    $options['value']  = '';
29
    $options['rows']   = 5;
30
    $options['cols']   = '100%';
31
    $options['width']  = '100%';
32
    $options['height'] = '200px';
33
    $answerEditor      = new XoopsFormEditor('', $xoopsModuleConfig['form_editorOptionsUser'], $options, $nohtml = false, $onfailure = 'textarea');
34
    $editorTray->addElement($answerEditor, true);
35
} else {
36
    $answerEditor = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', '', '100%', '100%');
37
    $editorTray->addElement($answerEditor, true);
38
}
39
$form->addElement($editorTray);
40
41
// NOTIFY ON PUBLISH
42 View Code Duplication
if (is_object($xoopsUser)) {
43
    $notify_checkbox = new XoopsFormCheckBox('', 'notifypub', 1);
44
    $notify_checkbox->addOption(1, _MD_SF_NOTIFY);
45
    $form->addElement($notify_checkbox);
46
}
47
48
if (($faqObj->status() == _SF_STATUS_PUBLISHED) || ($faqObj->status() == _SF_STATUS_NEW_ANSWER)) {
49
    $answerObj = $faqObj->answer();
50
    $form->addElement(new XoopsFormLabel(_MD_SF_ORIGINAL_ANSWER, $answerObj->answer()), false);
51
}
52
53
$form->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
54
55
$button_tray = new XoopsFormElementTray('', '');
56
$hidden      = new XoopsFormHidden('op', 'post');
57
$button_tray->addElement($hidden);
58
59
$button_tray = new XoopsFormElementTray('', '');
60
$hidden      = new XoopsFormHidden('op', 'post');
61
$button_tray->addElement($hidden);
62
$button_tray->addElement(new XoopsFormButton('', 'post', _MD_SF_SUBMITANSWER, 'submit'));
63
$form->addElement($button_tray);
64
65
$form->assign($xoopsTpl);
66
67
unset($hidden);
68