/** * gets list of subject icon image file names in a certain directory * if directory is not specified, default directory will be searched * * @param string $subDirectory * * @return array */ public static function getSubjectsList($subDirectory = '') { return \Xoops\Core\Lists\SubjectIcon::getList($subDirectory); }
$subject = $myts->htmlSpecialChars($_POST['subject']); $message = $myts->htmlSpecialChars($_POST['message']); } else { if ($send2 == 1) { $form->addElement(new Xoops\Form\Label(XoopsLocale::C_TO, XoopsUser::getUnameFromId($to_userid, false))); $form->addElement(new Xoops\Form\Hidden('to_userid', $to_userid)); } else { $form->addElement(new Xoops\Form\SelectUser(XoopsLocale::C_TO, 'to_userid')); } $subject = ""; $message = ""; } } $form->addElement(new Xoops\Form\Text(XoopsLocale::SUBJECT, 'subject', 4, 100, $subject), true); $icons = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'msg_image', '', true); \Xoops\Core\Lists\SubjectIcon::setOptionsArray($icons); $form->addElement($icons, false); $form->addElement(new Xoops\Form\DhtmlTextArea(XoopsLocale::MESSAGE, 'message', $message, 8, 37), true); $form->addElement(new Xoops\Form\Hidden('op', 'submit')); $buttons = new Xoops\Form\ElementTray(''); $buttons->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); $buttons->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_CLEAR, 'reset')); $cancel_send = new Xoops\Form\Button('', 'cancel', XoopsLocale::CANCEL_SEND, 'button'); $cancel_send->set('onclick', 'javascript:window.close();'); $buttons->addElement($cancel_send); $form->addElement($buttons); $tpl->assign('form', $form->render()); $tpl->display("module:system/system_pmlite.tpl"); } } $xoops->simpleFooter();
/** * @param CommentsComment $obj */ public function __construct(CommentsComment $obj) { $xoops = Xoops::getInstance(); $helper = $xoops->getModuleHelper('comments'); $module = $xoops->getModuleById($obj->getVar('modid')); if (!is_object($module)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $dirname = $module->getVar('dirname'); // create form if ($xoops->isAdminSide) { $url = $helper->url("admin/comment_post.php"); } else { $url = $helper->url("comment_post.php"); } parent::__construct(_MD_COMMENTS_POSTCOMMENT, "commentform", $url, "post", true); switch ($xoops->getModuleConfig('com_rule', $dirname)) { case Comments::APPROVE_ALL: $rule_text = _MD_COMMENTS_COMAPPROVEALL; break; case Comments::APPROVE_USER: $rule_text = _MD_COMMENTS_COMAPPROVEUSER; break; case Comments::APPROVE_ADMIN: default: $rule_text = _MD_COMMENTS_COMAPPROVEADMIN; break; } $this->addElement(new Xoops\Form\Label(_MD_COMMENTS_COMRULES, $rule_text)); $this->addElement(new Xoops\Form\Text(_MD_COMMENTS_TITLE, 'com_title', 50, 255, $obj->getVar('title', 'e')), true); $iconsRadio = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'com_icon', $obj->getVar('icon', 'e')); \Xoops\Core\Lists\SubjectIcon::setOptionsArray($iconsRadio); $this->addElement($iconsRadio); // editor $editor = $helper->getConfig('com_editor'); if (class_exists('Xoops\\Form\\Editor')) { $configs = array('name' => 'com_text', 'value' => $obj->getVar('text', 'e'), 'rows' => 25, 'cols' => 90, 'width' => '100%', 'height' => '400px', 'editor' => $editor); $this->addElement(new Xoops\Form\Editor(_MD_COMMENTS_MESSAGE, 'com_text', $configs, false, $onfailure = 'textarea')); } else { $this->addElement(new Xoops\Form\DhtmlTextArea(_MD_COMMENTS_MESSAGE, 'com_text', $obj->getVar('text', 'e'), 10, 50), true); } $option_tray = new Xoops\Form\ElementTray(XoopsLocale::OPTIONS, '<br />'); $buttonTray = new Xoops\Form\ElementTray('', ' '); if ($xoops->isUser()) { if ($xoops->getModuleConfig('com_anonpost', $dirname)) { $noname = $obj->getVar('noname', 'e') ? 1 : 0; $noname_checkbox = new Xoops\Form\Checkbox('', 'com_noname', $noname); $noname_checkbox->addOption(1, XoopsLocale::POST_ANONYMOUSLY); $option_tray->addElement($noname_checkbox); } if (false != $xoops->user->isAdmin($obj->getVar('modid'))) { // show status change box when editing (comment id is not empty) if ($obj->getVar('id', 'e')) { $status_select = new Xoops\Form\Select(_MD_COMMENTS_STATUS, 'com_status', $obj->getVar('status', 'e')); $status_select->addOptionArray(array(Comments::STATUS_PENDING => _MD_COMMENTS_PENDING, Comments::STATUS_ACTIVE => _MD_COMMENTS_ACTIVE, Comments::STATUS_HIDDEN => _MD_COMMENTS_HIDDEN)); $this->addElement($status_select); $buttonTray->addElement(new Xoops\Form\Button('', 'com_dodelete', XoopsLocale::A_DELETE, 'submit')); } if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { $html_checkbox = new Xoops\Form\Checkbox('', 'com_dohtml', $obj->getVar('dohtml', 'e')); $html_checkbox->addOption(1, _MD_COMMENTS_DOHTML); $option_tray->addElement($html_checkbox); } } } if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { //Yeah, what? } $smiley_checkbox = new Xoops\Form\Checkbox('', 'com_dosmiley', $obj->getVar('domsiley', 'e')); $smiley_checkbox->addOption(1, _MD_COMMENTS_DOSMILEY); $option_tray->addElement($smiley_checkbox); $xcode_checkbox = new Xoops\Form\Checkbox('', 'com_doxcode', $obj->getVar('doxcode', 'e')); $xcode_checkbox->addOption(1, _MD_COMMENTS_DOXCODE); $option_tray->addElement($xcode_checkbox); if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) { $br_checkbox = new Xoops\Form\Checkbox('', 'com_dobr', $obj->getVar('dobr', 'e')); $br_checkbox->addOption(1, _MD_COMMENTS_DOAUTOWRAP); $option_tray->addElement($br_checkbox); } else { $this->addElement(new Xoops\Form\Hidden('com_dohtml', 1)); $this->addElement(new Xoops\Form\Hidden('com_dobr', 0)); } $this->addElement($option_tray); if (!$xoops->isUser()) { $this->addElement(new Xoops\Form\Captcha()); } $this->addElement(new Xoops\Form\Hidden('com_modid', $obj->getVar('modid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_pid', $obj->getVar('pid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_rootid', $obj->getVar('rootid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_id', $obj->getVar('id', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_itemid', $obj->getVar('itemid', 'e'))); $this->addElement(new Xoops\Form\Hidden('com_order', Request::getInt('com_order', $helper->getUserConfig('com_order')))); $this->addElement(new Xoops\Form\Hidden('com_mode', Request::getString('com_mode', $helper->getUserConfig('com_mode')))); // add module specific extra params if (!$xoops->isAdminSide) { /* @var $plugin CommentsPluginInterface */ $plugin = \Xoops\Module\Plugin::getPlugin($dirname, 'comments'); if (is_array($extraParams = $plugin->extraParams())) { foreach ($extraParams as $extra_param) { // This routine is included from forms accessed via both GET and POST if (isset($_POST[$extra_param])) { $hidden_value = $_POST[$extra_param]; } else { if (isset($_GET[$extra_param])) { $hidden_value = $_GET[$extra_param]; } else { $hidden_value = ''; } } $this->addElement(new Xoops\Form\Hidden($extra_param, $hidden_value)); } } } $buttonTray->addElement(new Xoops\Form\Button('', 'com_dopreview', XoopsLocale::A_PREVIEW, 'submit')); $buttonTray->addElement(new Xoops\Form\Button('', 'com_dopost', _MD_COMMENTS_POSTCOMMENT, 'submit')); $this->addElement($buttonTray); return $this; }