本文整理汇总了PHP中ilTextAreaInputGUI::setRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTextAreaInputGUI::setRequired方法的具体用法?PHP ilTextAreaInputGUI::setRequired怎么用?PHP ilTextAreaInputGUI::setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilTextAreaInputGUI
的用法示例。
在下文中一共展示了ilTextAreaInputGUI::setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initForm
function initForm($a_mode)
{
global $ilCtrl, $lng, $ilSetting;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form_gui = new ilPropertyFormGUI();
$form_gui->setFormAction($ilCtrl->getFormAction($this));
$form_gui->setTitle($lng->txt("cont_ed_pglprop"));
// title
$title_input = new ilTextInputGUI($lng->txt("title"), "pgl_title");
$title_input->setSize(50);
$title_input->setMaxLength(128);
$title_input->setValue($this->layout_object->title);
$title_input->setTitle($lng->txt("title"));
$title_input->setRequired(true);
// description
$desc_input = new ilTextAreaInputGUI($lng->txt("description"), "pgl_desc");
$desc_input->setValue($this->layout_object->description);
$desc_input->setRows(3);
$desc_input->setCols(37);
$desc_input->setTitle($lng->txt("description"));
$desc_input->setRequired(false);
// modules
$mods = new ilCheckboxGroupInputGUI($this->lng->txt("modules"), "module");
// $mods->setRequired(true);
$mods->setValue($this->layout_object->getModules());
foreach (ilPageLayout::getAvailableModules() as $mod_id => $mod_caption) {
$mod = new ilCheckboxOption($mod_caption, $mod_id);
$mods->addOption($mod);
}
$form_gui->addItem($title_input);
$form_gui->addItem($desc_input);
$form_gui->addItem($mods);
// style
$fixed_style = $ilSetting->get("fixed_content_style_id");
$style_id = $this->layout_object->getStyleId();
if ($fixed_style > 0) {
$st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
$st->setValue(ilObject::_lookupTitle($fixed_style) . " (" . $this->lng->txt("global_fixed") . ")");
$form_gui->addItem($st);
} else {
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$st_styles = ilObjStyleSheet::_getStandardStyles(true, false);
$st_styles[0] = $this->lng->txt("default");
ksort($st_styles);
$style_sel = new ilSelectInputGUI($lng->txt("obj_sty"), "style_id");
$style_sel->setOptions($st_styles);
$style_sel->setValue($style_id);
$form_gui->addItem($style_sel);
}
$form_gui->addCommandButton("updateProperties", $lng->txt($a_mode));
return $form_gui;
}
示例2: initFormNewsItem
/**
* FORM NewsItem: Init form.
*
* @param int $a_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)
*/
public function initFormNewsItem($a_mode)
{
global $lng, $ilTabs;
$ilTabs->clearTargets();
//$this->setTabs();
$lng->loadLanguageModule("news");
include "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form_gui = new ilPropertyFormGUI();
// Property Title
$text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
$text_input->setInfo("");
$text_input->setRequired(true);
$text_input->setMaxLength(200);
$this->form_gui->addItem($text_input);
// Property Content
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
$text_area->setInfo("");
$text_area->setRequired(false);
$this->form_gui->addItem($text_area);
// Property Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue("users");
$this->form_gui->addItem($radio_group);
// Property ContentLong
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
$text_area->setInfo($lng->txt("news_news_item_content_long_info"));
$text_area->setRequired(false);
$text_area->setCols("40");
$text_area->setRows("8");
$text_area->setUseRte(true);
$this->form_gui->addItem($text_area);
// save and cancel commands
if (in_array($a_mode, array(IL_FORM_CREATE, IL_FORM_RE_CREATE))) {
$this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"));
} else {
$this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"));
}
$this->form_gui->setTitle($lng->txt("news_news_item_head"));
$this->form_gui->setFormAction($this->ctrl->getFormAction($this));
$this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_news.png"));
$news_set = new ilSetting("news");
if (!$news_set->get("enable_rss_for_internal")) {
$this->form_gui->removeItemByPostVar("news_visibility");
} else {
$nv = $this->form_gui->getItemByPostVar("news_visibility");
if (is_object($nv)) {
$nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]));
}
}
}
示例3: InvoiceNumberObject
public function InvoiceNumberObject()
{
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$invObj = new ilUserDefinedInvoiceNumber();
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
$this->tpl->addJavaScript('Services/Mail/js/ilMailComposeFunctions.js');
$form_gui = new ilPropertyFormGUI();
$form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveInvoiceNumber'));
$form_gui->setTitle($this->lng->txt('invoice_number_setting'));
// invoice_type
$radio_group = new ilRadioGroupInputGUI($this->lng->txt('invoice_number'), 'ud_invoice_number');
$radio_option_1 = new ilRadioOption($this->lng->txt('ilias_invoice_number'), '0');
$radio_group->addOption($radio_option_1);
$radio_option_2 = new ilRadioOption($this->lng->txt('userdefined_invoice_number'), '1');
$radio_group->addOption($radio_option_2);
$radio_group->setRequired(true);
$radio_group->setValue($invObj->getUDInvoiceNumberActive(), '0');
$radio_group->setPostVar('ud_invoice_number');
$form_gui->addItem($radio_group);
// incremental current value
$cur_num = new ilNonEditableValueGUI($this->lng->txt('incremental_current_value'), 'inc_current_value');
$cur_num->setValue(ilUserDefinedInvoiceNumber::_getIncCurrentValue(), 1);
$radio_option_2->addSubItem($cur_num);
// incremental start value
$inc_num = new ilNumberInputGUI($this->lng->txt('incremental_start_value'), 'inc_start_value');
$inc_num->setValue($this->error != "" && isset($_POST['incremental_start_value']) ? ilUtil::prepareFormOutput($_POST['incremental_start_value'], true) : ilUtil::prepareFormOutput($invObj->getIncStartValue(), true));
$inc_num->setInfo($this->lng->txt('incremental_start_value_info'));
$radio_option_2->addSubItem($inc_num);
// reset period of current value
$sel_reset = new ilSelectInputGUI($this->lng->txt('invoice_number_reset_period'), 'inc_reset_period');
$sel_reset->setValue($this->error != "" && isset($_POST['inc_reset_period']) ? $_POST['inc_reset_period'] : $invObj->getIncResetPeriod());
$reset_options = array(1 => $this->lng->txt('yearly'), 2 => $this->lng->txt('monthly'));
$sel_reset->setOptions($reset_options);
$radio_option_2->addSubItem($sel_reset);
// invoice_number_text
$inp = new ilTextAreaInputGUI($this->lng->txt('invoice_number_text'), 'invoice_number_text');
$inp->setValue($this->error != "" && isset($_POST['invoice_number_text']) ? ilUtil::prepareFormOutput($_POST['invoice_number_text'], true) : ilUtil::prepareFormOutput($invObj->getInvoiceNumberText(), true));
$inp->setRequired(false);
$inp->setCols(60);
$inp->setRows(3);
$radio_option_2->addSubItem($inp);
// PLACEHOLDERS
$prop = new ilInvoiceNumberPlaceholdersPropertyGUI();
$radio_option_2->addSubItem($prop);
$form_gui->addCommandButton('saveInvoiceNumber', $this->lng->txt('save'));
$this->tpl->setVariable('FORM', $form_gui->getHTML());
}
示例4: feedback
/**
* Creates the output of the feedback page for a single choice question
*
* @access public
*/
function feedback($checkonly = false)
{
$save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt('feedback_answers'));
$form->setTableWidth("98%");
$form->setId("feedback");
$complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
$complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
$complete->setRequired(false);
$complete->setRows(10);
$complete->setCols(80);
if (!$this->getPreventRteUsage()) {
$complete->setUseRte(true);
}
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$complete->addPlugin("latex");
$complete->addButton("latex");
$complete->addButton("pastelatex");
$complete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
$form->addItem($complete);
$incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
$incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
$incomplete->setRequired(false);
$incomplete->setRows(10);
$incomplete->setCols(80);
if (!$this->getPreventRteUsage()) {
$incomplete->setUseRte(true);
}
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$incomplete->addPlugin("latex");
$incomplete->addButton("latex");
$incomplete->addButton("pastelatex");
$incomplete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
$form->addItem($incomplete);
if (!$this->getSelfAssessmentEditingMode()) {
foreach ($this->object->getErrorData() as $index => $answer) {
$caption = $ordinal = $index + 1;
$caption .= '. <br />"' . $answer->text_wrong . '" => ';
$caption .= '"' . $answer->text_correct . '"';
$caption .= '</i>';
$answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption, true), "feedback_answer_{$index}");
$answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index)));
$answerobj->setRequired(false);
$answerobj->setRows(10);
$answerobj->setCols(80);
$answerobj->setUseRte(true);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$answerobj->addPlugin("latex");
$answerobj->addButton("latex");
$answerobj->addButton("pastelatex");
$answerobj->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
$form->addItem($answerobj);
}
}
global $ilAccess;
if ($ilAccess->checkAccess("write", "", $_GET['ref_id']) || $this->getSelfAssessmentEditingMode()) {
$form->addCommandButton("saveFeedback", $this->lng->txt("save"));
}
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
return $errors;
}
示例5: suggestedsolution
/**
* Allows to add suggested solutions for questions
*
* @access public
*/
public function suggestedsolution()
{
global $ilUser;
global $ilAccess;
if ($_POST["deleteSuggestedSolution"] == 1) {
$this->object->deleteSuggestedSolutions();
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "suggestedsolution");
}
$save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE;
$output = "";
$solution_array = $this->object->getSuggestedSolution(0);
$options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText"));
if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) {
$solution_array = array("type" => "file");
} elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) {
$solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE));
}
if ($save && strlen($_POST["filename"])) {
$solution_array["value"]["filename"] = $_POST["filename"];
}
if ($save && strlen($_POST["solutiontext"])) {
$solution_array["value"] = $_POST["solutiontext"];
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
if (count($solution_array)) {
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("solution_hint"));
$form->setMultipart(TRUE);
$form->setTableWidth("100%");
$form->setId("suggestedsolutiondisplay");
// suggested solution output
include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
$title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
$template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool");
if (strlen($solution_array["internal_link"])) {
$href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
$template->setCurrentBlock("preview");
$template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
$template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
$template->parseCurrentBlock();
} elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) {
$href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
$template->setCurrentBlock("preview");
$template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
$template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> ");
$template->parseCurrentBlock();
}
$template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
$template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
$title->setHtml($template->get());
$deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
$deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
$title->addSubItem($deletesolution);
$form->addItem($title);
if (strcmp($solution_array["type"], "file") == 0) {
// file
$file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
$file->setRequired(TRUE);
$file->enableFileNameSelection("filename");
//$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
if ($_FILES["file"]["tmp_name"] && $file->checkInput()) {
if (!file_exists($this->object->getSuggestedSolutionPath())) {
ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
}
$res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
if ($res) {
ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
// remove an old file download
if (is_array($solution_array["value"])) {
@unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
}
$file->setValue($_FILES["file"]["name"]);
$this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
$originalexists = $this->object->_questionExistsInPool($this->object->original_id);
if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
return $this->originalSyncForm("suggestedsolution");
} else {
ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
$this->ctrl->redirect($this, "suggestedsolution");
}
} else {
// BH: $res as info string? wtf? it holds a bool or something else!!?
ilUtil::sendInfo($res);
}
} else {
if (is_array($solution_array["value"])) {
$file->setValue($solution_array["value"]["name"]);
$file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
}
}
$form->addItem($file);
$hidden = new ilHiddenInputGUI("solutiontype");
$hidden->setValue("file");
//.........这里部分代码省略.........
示例6: initAssignmentForm
public function initAssignmentForm($a_mode = "create")
{
global $lng, $ilCtrl, $ilSetting;
// init form
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
$this->form->setTitle($a_mode == "edit" ? $this->txt("edit_assignment") : $this->txt("new_assignment"));
$this->form->setFormAction($ilCtrl->getFormAction($this));
// title
$title = new ilTextInputGUI($this->txt("title"), "title");
$title->setMaxLength(200);
$title->setRequired(true);
$this->form->addItem($title);
// start time y/n
$check_start_time = new ilCheckboxInputGUI($this->txt("start_time"), "start_time_cb");
$this->form->addItem($check_start_time);
// start time
$start_time = new ilDateTimeInputGUI("", "start_time");
$start_time->setShowTime(true);
$check_start_time->addSubItem($start_time);
// Deadline
$deadline = new ilDateTimeInputGUI($this->txt("deadline"), "deadline");
$deadline->setShowTime(true);
$deadline->setRequired(true);
$this->form->addItem($deadline);
// mandatory
$mandatory = new ilCheckboxInputGUI($this->txt("mandatory"), "mandatory");
$mandatory->setInfo($this->txt("mandatory_info"));
$mandatory->setChecked(true);
$this->form->addItem($mandatory);
// Work Instructions
$instruction = new ilTextAreaInputGUI($this->txt("instruction"), "instruction");
$instruction->setCols(39);
$instruction->setRows(4);
$instruction->setRequired(true);
$this->form->addItem($instruction);
// files
if ($a_mode == "create") {
$files = new ilFileWizardInputGUI($this->txt('files'), 'files');
$files->setFilenames(array(0 => ''));
$this->form->addItem($files);
$this->form->addCommandButton("saveAssignment", $lng->txt("save"));
$this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
} else {
$this->form->addCommandButton("updateAssignment", $lng->txt("save"));
$this->form->addCommandButton("listAssignments", $lng->txt("cancel"));
}
}
示例7: certificateEditor
/**
* Shows the certificate editor for ILIAS tests
*/
public function certificateEditor()
{
global $ilAccess;
$form_fields = array();
if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
$form_fields = $this->getFormFieldsFromPOST();
} else {
$form_fields = $this->getFormFieldsFromFO();
}
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setPreventDoubleSubmission(false);
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("certificate_edit"));
$form->setMultipart(TRUE);
$form->setTableWidth("100%");
$form->setId("certificate");
$active = new ilCheckboxInputGUI($this->lng->txt("active"), "active");
$active->setChecked($form_fields["active"]);
$form->addItem($active);
$import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import");
$import->setRequired(FALSE);
$import->setSuffixes(array("zip"));
// handle the certificate import
if (strlen($_FILES["certificate_import"]["tmp_name"])) {
if ($import->checkInput()) {
$result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]);
if ($result == FALSE) {
$import->setAlert($this->lng->txt("certificate_error_import"));
} else {
$this->ctrl->redirect($this, "certificateEditor");
}
}
}
$form->addItem($import);
$pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat");
$pageformats = $this->object->getPageFormats();
$pageformat->setValue($form_fields["pageformat"]);
foreach ($pageformats as $format) {
$option = new ilRadioOption($format["name"], $format["value"]);
if (strcmp($format["value"], "custom") == 0) {
$pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight");
$pageheight->setValue($form_fields["pageheight"]);
$pageheight->setSize(6);
$pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
$pageheight->setInfo($this->lng->txt("certificate_unit_description"));
$pageheight->setRequired(true);
$option->addSubitem($pageheight);
$pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth");
$pagewidth->setValue($form_fields["pagewidth"]);
$pagewidth->setSize(6);
$pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
$pagewidth->setInfo($this->lng->txt("certificate_unit_description"));
$pagewidth->setRequired(true);
$option->addSubitem($pagewidth);
}
$pageformat->addOption($option);
}
$pageformat->setRequired(true);
if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
$pageformat->checkInput();
}
$form->addItem($pageformat);
$bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background");
$bgimage->setRequired(FALSE);
$bgimage->setUseCache(false);
if (count($_POST)) {
// handle the background upload
if (strlen($_FILES["background"]["tmp_name"])) {
if ($bgimage->checkInput()) {
$result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]);
if ($result == FALSE) {
$bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage"));
}
}
}
}
if (!$this->object->hasBackgroundImage()) {
include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php";
if (ilObjCertificateSettingsAccess::hasBackgroundImage()) {
$bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb());
}
} else {
$bgimage->setImage($this->object->getBackgroundImageThumbPathWeb());
}
$form->addItem($bgimage);
$padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top");
$padding_top->setRequired(TRUE);
$padding_top->setValue($form_fields["padding_top"]);
$padding_top->setSize(6);
$padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is");
$padding_top->setInfo($this->lng->txt("certificate_unit_description"));
if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) {
$padding_top->checkInput();
}
$form->addItem($padding_top);
$rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body");
//.........这里部分代码省略.........
示例8: initSmiliesEditForm
/**
* Initializes SmiliesEditForm and returns it.
*
* @global ilCtrl2 $ilCtrl
* @global ilLanguage $lng
* @return ilPropertyFormGUI
*/
public function initSmiliesEditForm($form_data)
{
global $ilCtrl, $lng;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form_gui = new ilPropertyFormGUI();
$this->form_gui->setValuesByArray($form_data);
$table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : "";
$ilCtrl->saveParameter($this->gui, 'smiley_id');
$this->form_gui->setFormAction($ilCtrl->getFormAction($this->gui, 'smiley-updateSmiliesObject') . $table_nav);
$sec_l = new ilFormSectionHeaderGUI();
$sec_l->setTitle($lng->txt('chatroom_edit_smiley'));
$this->form_gui->addItem($sec_l);
include_once "Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php";
$inp = new ilChatroomSmiliesCurrentSmileyFormElement($lng->txt('chatroom_current_smiley_image_path'), 'chatroom_current_smiley_image_path');
$inp->setValue($form_data['chatroom_current_smiley_image_path']);
$this->form_gui->addItem($inp);
$inp = new ilImageFileInputGUI($lng->txt('chatroom_image_path'), 'chatroom_image_path');
$inp->setRequired(false);
$inp->setInfo($lng->txt('chatroom_smiley_image_only_if_changed'));
$this->form_gui->addItem($inp);
$inp = new ilTextAreaInputGUI($lng->txt('chatroom_smiley_keywords'), 'chatroom_smiley_keywords');
$inp->setValue($form_data['chatroom_smiley_keywords']);
$inp->setUseRte(false);
$inp->setRequired(true);
$inp->setInfo($lng->txt('chatroom_smiley_keywords_one_per_line_note'));
$this->form_gui->addItem($inp);
$inp = new ilHiddenInputGUI('chatroom_smiley_id');
$this->form_gui->addItem($inp);
$this->form_gui->addCommandButton('smiley-updateSmiliesObject', $lng->txt('submit'));
$this->form_gui->addCommandButton('smiley', $lng->txt('cancel'));
return $this->form_gui;
}
示例9: showForm
//.........这里部分代码省略.........
$mailData['m_message'] .= chr(13) . chr(10) . chr(13) . chr(10);
}
$mailData['m_message'] .= $_POST["additional_message_text"] . chr(13) . chr(10) . $this->umail->appendSignature();
$_POST["additional_message_text"] = "";
$_SESSION['mail_roles'] = "";
break;
case 'address':
$mailData["rcp_to"] = urldecode($_GET["rcp"]);
break;
default:
// GET DATA FROM POST
$mailData = $_POST;
// strip slashes
foreach ($mailData as $key => $value) {
if (is_string($value)) {
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$mailData[$key] = ilUtil::securePlainString($value);
}
}
break;
}
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form_gui = new ilPropertyFormGUI();
$form_gui->setTitle($this->lng->txt('compose'));
$form_gui->setOpenTag(false);
$this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'sendMessage'));
$this->tpl->setVariable('BUTTON_TO', $lng->txt("search_recipients"));
$this->tpl->setVariable('BUTTON_COURSES_TO', $lng->txt("mail_my_courses"));
$this->tpl->setVariable('BUTTON_GROUPS_TO', $lng->txt("mail_my_groups"));
$this->tpl->setVariable('BUTTON_MAILING_LISTS_TO', $lng->txt("mail_my_mailing_lists"));
$dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true);
// RECIPIENT
$inp = new ilTextInputGUI($this->lng->txt('mail_to'), 'rcp_to');
$inp->setRequired(true);
$inp->setSize(50);
$inp->setValue($mailData["rcp_to"]);
$inp->setDataSource($dsDataLink, ",");
$inp->setMaxLength(null);
$form_gui->addItem($inp);
// CC
$inp = new ilTextInputGUI($this->lng->txt('cc'), 'rcp_cc');
$inp->setSize(50);
$inp->setValue($mailData["rcp_cc"]);
$inp->setDataSource($dsDataLink, ",");
$inp->setMaxLength(null);
$form_gui->addItem($inp);
// BCC
$inp = new ilTextInputGUI($this->lng->txt('bc'), 'rcp_bcc');
$inp->setSize(50);
$inp->setValue($mailData["rcp_bcc"]);
$inp->setDataSource($dsDataLink, ",");
$inp->setMaxLength(null);
$form_gui->addItem($inp);
// SUBJECT
$inp = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
$inp->setSize(50);
$inp->setRequired(true);
$inp->setValue($mailData["m_subject"]);
$form_gui->addItem($inp);
// Attachments
include_once 'Services/Mail/classes/class.ilMailFormAttachmentFormPropertyGUI.php';
$att = new ilMailFormAttachmentPropertyGUI($this->lng->txt($mailData["attachments"] ? 'edit' : 'add'));
if (is_array($mailData["attachments"]) && count($mailData["attachments"])) {
foreach ($mailData["attachments"] as $data) {
if (is_file($this->mfile->getMailPath() . '/' . $ilUser->getId() . "_" . $data)) {
$hidden = new ilHiddenInputGUI('attachments[]');
示例10: initMailRatersForm
function initMailRatersForm($appr_id, array $rec_ids)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, "mailRatersAction"));
$form->setTitle($this->lng->txt('compose'));
$all_data = $this->object->getRatersData($appr_id);
$rec_data = array();
foreach ($rec_ids as $rec_id) {
if (isset($all_data[$rec_id])) {
$rec_data[] = $all_data[$rec_id]["lastname"] . ", " . $all_data[$rec_id]["firstname"] . " (" . $all_data[$rec_id]["email"] . ")";
}
}
sort($rec_data);
$rec = new ilCustomInputGUI($this->lng->txt('recipients'));
$rec->setHTML(implode("<br />", $rec_data));
$form->addItem($rec);
$subject = new ilTextInputGUI($this->lng->txt('subject'), 'subject');
$subject->setSize(50);
$subject->setRequired(true);
$form->addItem($subject);
$existingdata = $this->object->getExternalCodeRecipients();
$existingcolumns = array();
if (count($existingdata)) {
$first = array_shift($existingdata);
foreach ($first as $key => $value) {
if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) {
array_push($existingcolumns, '[' . $key . ']');
}
}
}
$mailmessage_u = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_registered'), 'message_u');
$mailmessage_u->setRequired(true);
$mailmessage_u->setCols(80);
$mailmessage_u->setRows(10);
$form->addItem($mailmessage_u);
$mailmessage_a = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_anonymous'), 'message_a');
$mailmessage_a->setRequired(true);
$mailmessage_a->setCols(80);
$mailmessage_a->setRows(10);
$mailmessage_a->setInfo(sprintf($this->lng->txt('message_content_info'), join($existingcolumns, ', ')));
$form->addItem($mailmessage_a);
$recf = new ilHiddenInputGUI("rtr_id");
$recf->setValue(implode(";", $rec_ids));
$form->addItem($recf);
$form->addCommandButton("mailRatersAction", $this->lng->txt("send"));
$form->addCommandButton("editRaters", $this->lng->txt("cancel"));
$subject->setValue(sprintf($this->lng->txt('survey_360_rater_subject_default'), $this->object->getTitle()));
$mailmessage_u->setValue($this->lng->txt('survey_360_rater_message_content_registered_default'));
$mailmessage_a->setValue($this->lng->txt('survey_360_rater_message_content_anonymous_default'));
return $form;
}
示例11: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(false);
$subtype->setValue($this->object->getSubtype());
$subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
foreach ($subtypes as $idx => $st) {
$subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
}
$form->addItem($subtype);
// obligatory
$shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getObligatory());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_appearance"));
$form->addItem($header);
// column separators
$column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
$column_separators->setValue(1);
$column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
$column_separators->setChecked($this->object->getColumnSeparators());
$column_separators->setRequired(false);
$form->addItem($column_separators);
// row separators
$row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
$row_separators->setValue(1);
$row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
$row_separators->setChecked($this->object->getRowSeparators());
$row_separators->setRequired(false);
$form->addItem($row_separators);
// neutral column separators
$neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
$neutral_column_separator->setValue(1);
$neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
$neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
$neutral_column_separator->setRequired(false);
$form->addItem($neutral_column_separator);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_columns"));
$form->addItem($header);
// Answers
include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
$columns = new ilCategoryWizardInputGUI("", "columns");
$columns->setRequired(false);
$columns->setAllowMove(true);
$columns->setShowWizard(true);
$columns->setShowNeutralCategory(true);
$columns->setDisabledScale(false);
$columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
//.........这里部分代码省略.........
示例12: addBasicQuestionFormProperties
function addBasicQuestionFormProperties($form)
{
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
if (!$this->object->getSelfAssessmentEditingMode()) {
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "comment");
$description->setValue($this->object->getComment());
$description->setRequired(FALSE);
$form->addItem($description);
} else {
// author as hidden field
$hi = new ilHiddenInputGUI("author");
$author = ilUtil::prepareFormOutput($this->object->getAuthor());
if (trim($author) == "") {
$author = "-";
}
$hi->setValue($author);
$form->addItem($hi);
}
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
if (!$this->object->getSelfAssessmentEditingMode()) {
if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "qpl", "assessment");
}
} else {
$question->setRteTags(self::getSelfAssessmentTags());
$question->setUseTagsForRteOnly(false);
}
$form->addItem($question);
$tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
$tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
$tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
$tpl->parseCurrentBlock();
$button = new ilCustomInputGUI(' ', '');
$button->setHtml($tpl->get());
$form->addItem($button);
if (!$this->object->getSelfAssessmentEditingMode()) {
// duration
$duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
$duration->setShowHours(TRUE);
$duration->setShowMinutes(TRUE);
$duration->setShowSeconds(TRUE);
$ewt = $this->object->getEstimatedWorkingTime();
$duration->setHours($ewt["h"]);
$duration->setMinutes($ewt["m"]);
$duration->setSeconds($ewt["s"]);
$duration->setRequired(FALSE);
$form->addItem($duration);
} else {
// number of tries
if (strlen($this->object->getNrOfTries())) {
$nr_tries = $this->object->getNrOfTries();
} else {
$nr_tries = $this->object->getDefaultNrOfTries();
}
/*if ($nr_tries <= 0)
{
$nr_tries = 1;
}*/
if ($nr_tries < 0) {
$nr_tries = 0;
}
$ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
$ni->setValue($nr_tries);
//$ni->setMinValue(1);
$ni->setMinValue(0);
$ni->setSize(5);
$ni->setMaxLength(5);
$ni->setRequired(true);
$form->addItem($ni);
}
}
示例13: addFormElements
/**
* add type specific input fields to a form
*
* @param object form, property or radio option
* @param array (assoc) input values
* @param string configuration level ("type" or "object")
* @param string parent field value
* @param string parent option value
* @param int maximum recursion depth
*/
function addFormElements($a_object, $a_values = array(), $a_level = "object", $a_parentfield = '', $a_parentvalue = '', $a_maxdepth = "3")
{
// recursion end
if ($a_maxdepth == 0) {
return;
}
foreach ($this->getInputFields($a_level, $a_parentfield, $a_parentvalue) as $field) {
$value = $a_values['field_' . $field->field_name];
$value = $value ? $value : $field->default;
switch ($field->field_type) {
case self::FIELDTYPE_HEADER:
$item = new ilFormSectionHeaderGUI();
$item->setTitle($field->title);
break;
case self::FIELDTYPE_DESCRIPTION:
$item = new ilCustomInputGUI($field->title);
$item->setHtml(nl2br($field->description));
break;
case self::FIELDTYPE_TEXT:
$item = new ilTextInputGUI($field->title, 'field_' . $field->field_name);
$item->setInfo($field->description);
$item->setRequired($field->required ? true : false);
$item->setSize($field->size);
$item->setValue($value);
break;
case self::FIELDTYPE_TEXTAREA:
$item = new ilTextAreaInputGUI($field->title, 'field_' . $field->field_name);
$item->setInfo($field->description);
$item->setRequired($field->required ? true : false);
$item->setUseRte($field->richtext ? true : false);
$item->setRows($field->rows);
$item->setCols($field->cols);
$item->setValue($value);
break;
case self::FIELDTYPE_PASSWORD:
$item = new ilPasswordInputGUI($field->title, 'field_' . $field->field_name);
$item->setInfo($field->description);
$item->setRequired($field->required ? true : false);
$item->setValue($value);
break;
case self::FIELDTYPE_CHECKBOX:
$item = new ilCheckboxInputGUI($field->title, 'field_' . $field->field_name);
$item->setInfo($field->description);
if ($value) {
$item->setChecked(true);
}
break;
case self::FIELDTYPE_RADIO:
$item = new ilRadioGroupInputGUI($field->title, 'field_' . $field->field_name);
$item->setInfo($field->description);
$item->setValue($value);
foreach ($field->options as $option) {
$ropt = new ilRadioOption($option->title, $option->value);
$ropt->setInfo($option->description);
// add the sub items to the option
$item->addOption($ropt);
$this->addFormElements($ropt, $a_values, $a_level, $field->field_name, $option->value, $a_maxdepth - 1);
}
break;
default:
continue 2;
}
// add the item to the form or to the parent item
if (is_a($a_object, 'ilPropertyFormGUI')) {
$a_object->addItem($item);
} else {
$a_object->addSubItem($item);
}
// add the sub items to the item
if (is_a($item, 'ilSubEnabledFormPropertyGUI')) {
$this->addFormElements($item, $a_level, $a_values, $field->field_name, '', $a_maxdepth - 1);
}
}
}
示例14: initTopicCreateForm
private function initTopicCreateForm()
{
/**
* @var $ilUser ilObjUser
* @var $rbacsystem ilRbacSystem
* @var $ilias ILIAS
* @var $ilSetting ilSetting
*/
global $ilUser, $rbacsystem, $ilias, $ilSetting;
$this->create_topic_form_gui = new ilPropertyFormGUI();
$this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread'));
$this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
$this->create_topic_form_gui->setTableWidth('100%');
// form action
$this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread'));
if ($this->objProperties->isAnonymized() == 1) {
$alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
$alias_gui->setInfo($this->lng->txt('forums_use_alias'));
$alias_gui->setMaxLength(255);
$alias_gui->setSize(50);
$this->create_topic_form_gui->addItem($alias_gui);
} else {
$alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
$alias_gui->setValue($ilUser->getLogin());
$this->create_topic_form_gui->addItem($alias_gui);
}
// topic
$subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
$subject_gui->setMaxLength(255);
$subject_gui->setSize(50);
$subject_gui->setRequired(true);
$this->create_topic_form_gui->addItem($subject_gui);
// message
$post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
$post_gui->setCols(50);
$post_gui->setRows(15);
$post_gui->setRequired(true);
$post_gui->setUseRte(true);
$post_gui->addPlugin('latex');
$post_gui->addButton('latex');
$post_gui->addButton('pastelatex');
$post_gui->addPlugin('ilfrmquote');
//$post_gui->addPlugin('code');
$post_gui->removePlugin('advlink');
$post_gui->usePurifier(true);
$post_gui->setRTERootBlockElement('');
$post_gui->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
$post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect'));
// purifier
require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
$post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
$this->create_topic_form_gui->addItem($post_gui);
// file
$fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
$fi->setFilenames(array(0 => ''));
$this->create_topic_form_gui->addItem($fi);
include_once 'Services/Mail/classes/class.ilMail.php';
$umail = new ilMail($ilUser->getId());
// catch hack attempts
if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$this->objProperties->isAnonymized()) {
// direct notification
$dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
$dir_notification_gui->setInfo($this->lng->txt('forum_notify_me_directly'));
$dir_notification_gui->setValue(1);
$this->create_topic_form_gui->addItem($dir_notification_gui);
if ($ilias->getSetting('forum_notification') != 0) {
// gen. notification
$gen_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_general_notification'), 'notify_posts');
$gen_notification_gui->setInfo($this->lng->txt('forum_notify_me_generally'));
$gen_notification_gui->setValue(1);
$this->create_topic_form_gui->addItem($gen_notification_gui);
}
}
require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) {
require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
$captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
$captcha->setRequired(true);
$this->create_topic_form_gui->addItem($captcha);
}
$this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create'));
$this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel'));
}
示例15: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("orderinghorizontal");
$this->addBasicQuestionFormProperties($form);
// ordertext
$ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
$ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
$ordertext->setRequired(TRUE);
$ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
$ordertext->setRows(10);
$ordertext->setCols(80);
$form->addItem($ordertext);
// textsize
$textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
$textsize->setValue($this->object->getTextSize());
$textsize->setInfo($this->lng->txt("textsize_info"));
$textsize->setSize(6);
$textsize->setMinValue(10);
$textsize->setRequired(FALSE);
$form->addItem($textsize);
// points
$points = new ilNumberInputGUI($this->lng->txt("points"), "points");
// mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
// This implements a default value of "1" for this question type.
if ($this->object->getPoints() == null) {
$points->setValue("1");
} else {
$points->setValue($this->object->getPoints());
}
$points->setRequired(TRUE);
$points->setSize(3);
$points->setMinValue(0.0);
$points->setMinvalueShouldBeGreater(true);
$form->addItem($points);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}