本文整理汇总了PHP中ilPropertyFormGUI::setMultipart方法的典型用法代码示例。如果您正苦于以下问题:PHP ilPropertyFormGUI::setMultipart方法的具体用法?PHP ilPropertyFormGUI::setMultipart怎么用?PHP ilPropertyFormGUI::setMultipart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilPropertyFormGUI
的用法示例。
在下文中一共展示了ilPropertyFormGUI::setMultipart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editQuestion
/**
* Creates an output of the edit form for the question
* @access public
*/
function editQuestion()
{
global $ilDB, $tpl;
$plugin = $this->object->getPlugin();
$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("assJSMEQuestion");
// Basiseingabefelder: title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
// points
$points = new ilNumberInputGUI($plugin->txt("points"), "points");
$points->setValue($this->object->getPoints());
$points->setRequired(TRUE);
$points->setSize(10);
$points->setMinValue(0.0);
$form->addItem($points);
// optionString for the JSME-Applet
include_once "./Services/Form/classes/class.ilTextInputGUI.php";
$optionString = new ilTextInputGUI($plugin->txt("optionString"), "optionString");
$optionString->setValue($this->object->getOptionString());
$form->addItem($optionString);
// JSME-Applet for sampleSolution
include_once "./Services/Form/classes/class.ilCustomInputGUI.php";
$sampleSolution = new ilCustomInputGUI($plugin->txt("sampleSolution"), "sampleSolution");
$template = $this->getJsmeOutputTemplate("", $this->object->getOptionString(), $this->object->getSampleSolution());
$sampleSolution->setHtml($template->get());
$form->addItem($sampleSolution);
$form->addCommandButton('save', $plugin->txt("save"));
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
示例2: editQuestion
/**
* Creates an output of the edit form for the question
*
* @param bool $checkonly
*
* @return bool
*/
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(TRUE);
$form->setTableWidth("100%");
$form->setId("assnumeric");
$this->addBasicQuestionFormProperties($form);
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$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;
}
示例3: initUploadForm
public function initUploadForm()
{
global $ilCtrl, $lng;
include_once "./Services/Form/classes/class.ilDragDropFileInputGUI.php";
include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
$this->form = new ilPropertyFormGUI();
$this->form->setId("upload");
$this->form->setMultipart(true);
$this->form->setHideLabels();
$file = new ilDragDropFileInputGUI($lng->txt("cld_upload_flies"), "upload_files");
$file->setRequired(true);
$this->form->addItem($file);
$this->form->addCommandButton("uploadFiles", $lng->txt("upload"));
$this->form->addCommandButton("cancelAll", $lng->txt("cancel"));
$this->form->setTableWidth("100%");
$this->form->setTitle($lng->txt("upload_files_title"));
$this->form->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $lng->txt('obj_file'));
$this->form->setTitle($lng->txt("upload_files"));
$this->form->setFormAction($ilCtrl->getFormAction($this, "uploadFiles"));
$this->form->setTarget("cld_blank_target");
}
示例4: editQuestion
/**
* Creates an output of the edit form for the question
*
* @param bool $checkonly
*
* @return bool
*/
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());
$isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
if ($checkonly) {
$isSingleline = $_POST['types'] == 0 ? true : false;
}
if ($isSingleline) {
$form->setMultipart(TRUE);
} else {
$form->setMultipart(FALSE);
}
$form->setTableWidth("100%");
$form->setId("assmultiplechoice");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$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;
}
示例5: _initForm
/**
* Init Social Bookmark edit/create Form
*
* @param ilObjectGUI $formhandlerObject taken as form target
* @param int $mode "create" / "edit"
*/
public static function _initForm($formhandlerObject, $mode = "create", $id = 0)
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setMultipart(true);
// File Title
$in_title = new ilTextInputGUI($lng->txt("title"), "title");
$in_title->setMaxLength(128);
$in_title->setSize(40);
$in_title->setRequired(true);
$form->addItem($in_title);
// Link
$in_link = new ilTextInputGUI($lng->txt("link"), "link");
$in_link->setMaxLength(300);
$in_link->setSize(40);
$in_link->setRequired(true);
$in_link->setInfo($lng->txt('socialbm_link_description'));
$form->addItem($in_link);
// File
$in_file = new ilFileInputGUI($lng->txt("file"), "image_file");
$in_file->setSuffixes(array('bmp', 'gif', 'jpg', 'jpeg', 'png'));
$form->addItem($in_file);
// Activate on submit
$in_activate = new ilCheckboxInputGUI($lng->txt("activate"), "activate");
$in_activate->setValue('1');
$form->addItem($in_activate);
// save and cancel commands
if ($mode == "create") {
$form->addCommandButton("createSocialBookmark", $lng->txt("create"));
$form->addCommandButton("editSocialBookmarks", $lng->txt("cancel"));
$form->setTitle($lng->txt("adm_social_bm_create"));
$in_file->setRequired(true);
} else {
if ($mode == "update") {
$in_hidden = new ilHiddenInputGUI("sbm_id", $id);
$form->addItem($in_hidden);
$form->addCommandButton("updateSocialBookmark", $lng->txt("update"));
$form->addCommandButton("cancel", $lng->txt("cancel"));
$form->setTitle($lng->txt("adm_social_bm_edit"));
$in_file->setRequired(false);
}
}
$form->setTableWidth("60%");
$form->setFormAction($ilCtrl->getFormAction($formhandlerObject));
return $form;
}
示例6: initMultiUploadForm
/**
* Initializes the upload form for multiple files.
*
* @return object The created property form.
*/
public function initMultiUploadForm()
{
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$dnd_form_gui = new ilPropertyFormGUI();
$dnd_form_gui->setMultipart(true);
$dnd_form_gui->setHideLabels();
// file input
include_once "Services/Form/classes/class.ilDragDropFileInputGUI.php";
$dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
$dnd_input->setArchiveSuffixes(array("zip"));
$dnd_input->setCommandButtonNames("uploadFiles", "cancel");
$dnd_form_gui->addItem($dnd_input);
// add commands
$dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
$dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
$dnd_form_gui->setTableWidth("100%");
$dnd_form_gui->setTarget($this->getTargetFrame("save"));
$dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
$dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
$this->ctrl->setParameter($this, "new_type", "file");
$dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
return $dnd_form_gui;
}
示例7: 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("assfileupload");
$this->addBasicQuestionFormProperties($form);
// maxsize
$maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
$maxsize->setValue($this->object->getMaxSize());
$maxsize->setInfo($this->lng->txt("maxsize_info"));
$maxsize->setSize(10);
$maxsize->setMinValue(0);
//mbecker: Quick fix for mantis bug 8595: Change size file
$umf = get_cfg_var("upload_max_filesize");
// get the value for the maximal post data from the php.ini (if available)
$pms = get_cfg_var("post_max_size");
//convert from short-string representation to "real" bytes
$multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
$umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (count($umf_parts) == 2) {
$umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
}
if (count($pms_parts) == 2) {
$pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
}
// use the smaller one as limit
$max_filesize = min($umf, $pms);
if (!$max_filesize) {
$max_filesize = max($umf, $pms);
}
$maxsize->setMaxValue($max_filesize);
// end quick fix
$maxsize->setRequired(FALSE);
$form->addItem($maxsize);
// allowedextensions
$allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
$allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
$allowedextensions->setValue($this->object->getAllowedExtensions());
$allowedextensions->setRequired(FALSE);
$form->addItem($allowedextensions);
// points
$points = new ilNumberInputGUI($this->lng->txt("points"), "points");
$points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : '');
$points->setRequired(TRUE);
$points->setSize(3);
$points->setMinValue(0.0);
$points->setMinvalueShouldBeGreater(false);
$form->addItem($points);
$subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission');
$subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
$subcompl->setValue(1);
$subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
$form->addItem($subcompl);
$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;
}
示例8: 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(TRUE);
$form->setTableWidth("100%");
$form->setId("assimagemap");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
// image
include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php";
$image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image');
$image->setRequired(true);
if (strlen($this->object->getImageFilename())) {
$image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename());
$image->setValue($this->object->getImageFilename());
$image->setAreas($this->object->getAnswers());
$assessmentSetting = new ilSetting("assessment");
$linecolor = strlen($assessmentSetting->get("imap_line_color")) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\"";
$image->setLineColor($linecolor);
$image->setImagePath($this->object->getImagePath());
$image->setImagePathWeb($this->object->getImagePathWeb());
}
$form->addItem($image);
// imagemapfile
$imagemapfile = new ilFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile');
$imagemapfile->setRequired(false);
$form->addItem($imagemapfile);
$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;
}
示例9: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
//$save = ((strcmp($this->ctrl->getCmd(), "save") == 0) || (strcmp($this->ctrl->getCmd(), "saveEdit") == 0)) ? TRUE : 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(TRUE);
$form->setTableWidth("100%");
$form->setId("flash");
$this->addBasicQuestionFormProperties($form);
// flash file
$flash = new ilFlashFileInputGUI($this->lng->txt("flashfile"), "flash");
$flash->setRequired(TRUE);
if (strlen($this->object->getApplet())) {
$flash->setApplet($this->object->getApplet());
$flash->setAppletPathWeb($this->object->getFlashPathWeb());
}
$flash->setWidth($this->object->getWidth());
$flash->setHeight($this->object->getHeight());
$flash->setParameters($this->object->getParameters());
$form->addItem($flash);
if ($this->object->getId()) {
$hidden = new ilHiddenInputGUI("", "ID");
$hidden->setValue($this->object->getId());
$form->addItem($hidden);
}
// points
$points = new ilNumberInputGUI($this->lng->txt("points"), "points");
$points->setValue($this->object->getPoints());
$points->setRequired(TRUE);
$points->setSize(3);
$points->setMinValue(0.0);
$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;
}
示例10: 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);
// errortext
$errortext = new ilTextAreaInputGUI($this->lng->txt("errortext"), "errortext");
$errortext->setValue(ilUtil::prepareFormOutput($this->object->getErrorText()));
$errortext->setRequired(TRUE);
$errortext->setInfo($this->lng->txt("errortext_info"));
$errortext->setRows(10);
$errortext->setCols(80);
$form->addItem($errortext);
if (!$this->getSelfAssessmentEditingMode()) {
// textsize
$textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
$textsize->setValue(strlen($this->object->getTextSize()) ? $this->object->getTextSize() : 100.0);
$textsize->setInfo($this->lng->txt("textsize_errortext_info"));
$textsize->setSize(6);
$textsize->setSuffix("%");
$textsize->setMinValue(10);
$textsize->setRequired(true);
$form->addItem($textsize);
}
if (count($this->object->getErrorData()) || $checkonly) {
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("errors_section"));
$form->addItem($header);
include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php";
$errordata = new ilErrorTextWizardInputGUI($this->lng->txt("errors"), "errordata");
$values = array();
$errordata->setKeyName($this->lng->txt('text_wrong'));
$errordata->setValueName($this->lng->txt('text_correct'));
$errordata->setValues($this->object->getErrorData());
$form->addItem($errordata);
// points for wrong selection
$points_wrong = new ilNumberInputGUI($this->lng->txt("points_wrong"), "points_wrong");
$points_wrong->setValue($this->object->getPointsWrong());
$points_wrong->setInfo($this->lng->txt("points_wrong_info"));
$points_wrong->setSize(6);
$points_wrong->setRequired(true);
$form->addItem($points_wrong);
}
$form->addCommandButton("analyze", $this->lng->txt('analyze_errortext'));
$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;
}
示例11: material
/**
* Material tab of the survey questions
*/
public function material($checkonly = FALSE)
{
global $rbacsystem, $ilTabs;
$ilTabs->activateTab("material");
$add_html = '';
if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) {
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt('add_material'));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("material");
// material
$material = new ilRadioGroupInputGUI($this->lng->txt("material"), "internalLinkType");
$material->setRequired(true);
$material->addOption(new ilRadioOption($this->lng->txt('obj_lm'), "lm"));
$material->addOption(new ilRadioOption($this->lng->txt('obj_st'), "st"));
$material->addOption(new ilRadioOption($this->lng->txt('obj_pg'), "pg"));
$material->addOption(new ilRadioOption($this->lng->txt('glossary_term'), "glo"));
$form->addItem($material);
$form->addCommandButton("addMaterial", $this->lng->txt("add"));
$errors = false;
if ($checkonly) {
$form->setValuesByPost();
$errors = !$form->checkInput();
if ($errors) {
$checkonly = false;
}
}
$add_html = $form->getHTML();
}
$mat_html = "";
if (count($this->object->getMaterial())) {
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyMaterialsTableGUI.php";
$table_gui = new ilSurveyMaterialsTableGUI($this, 'material', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false);
$data = array();
foreach ($this->object->getMaterial() as $material) {
switch ($material->type) {
case 0:
$href = SurveyQuestion::_getInternalLinkHref($material->internal_link, $_GET['ref_id']);
$type = $this->lng->txt('internal_link');
break;
}
$title = strlen($material->title) ? ilUtil::prepareFormOutput($material->title) : $this->lng->txt('material');
array_push($data, array('href' => $href, 'title' => $title, 'type' => $type));
}
$table_gui->setData($data);
$mat_html = $table_gui->getHTML();
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $add_html . $mat_html);
}
return $errors;
}
示例12: propertiesObject
/**
* Questionpool properties
*/
public function propertiesObject()
{
$save = strcmp($this->ctrl->getCmd(), "save") == 0 ? true : false;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'properties'));
$form->setTitle($this->lng->txt("properties"));
$form->setMultipart(false);
$form->setId("properties");
// online
$online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online");
$online->setInfo($this->lng->txt("spl_online_property_description"));
$online->setChecked($this->object->getOnline());
$form->addItem($online);
$form->addCommandButton("saveProperties", $this->lng->txt("save"));
if ($save) {
$form->checkInput();
}
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
示例13: 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());
$isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
if ($checkonly) {
$isSingleline = $_POST['types'] == 0 ? true : false;
}
if ($isSingleline) {
$form->setMultipart(TRUE);
} else {
$form->setMultipart(FALSE);
}
$form->setTableWidth("100%");
$form->setId("asssinglechoice");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
// shuffle
$shuffle = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getShuffle());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
if ($this->object->getId()) {
$hidden = new ilHiddenInputGUI("", "ID");
$hidden->setValue($this->object->getId());
$form->addItem($hidden);
}
if (!$this->getSelfAssessmentEditingMode()) {
// Answer types
$types = new ilSelectInputGUI($this->lng->txt("answer_types"), "types");
$types->setRequired(false);
$types->setValue($isSingleline ? 0 : 1);
$types->setOptions(array(0 => $this->lng->txt('answers_singleline'), 1 => $this->lng->txt('answers_multiline')));
$form->addItem($types);
}
if ($isSingleline) {
// thumb size
$thumb_size = new ilNumberInputGUI($this->lng->txt("thumb_size"), "thumb_size");
$thumb_size->setMinValue(20);
$thumb_size->setDecimals(0);
$thumb_size->setSize(6);
$thumb_size->setInfo($this->lng->txt('thumb_size_info'));
$thumb_size->setValue($this->object->getThumbSize());
$thumb_size->setRequired(false);
$form->addItem($thumb_size);
}
// Choices
include_once "./Modules/TestQuestionPool/classes/class.ilSingleChoiceWizardInputGUI.php";
$choices = new ilSingleChoiceWizardInputGUI($this->lng->txt("answers"), "choice");
$choices->setRequired(true);
$choices->setQuestionObject($this->object);
$choices->setSingleline($isSingleline);
$choices->setAllowMove(false);
if ($this->getSelfAssessmentEditingMode()) {
$choices->setSize(40);
$choices->setMaxLength(800);
}
if ($this->object->getAnswerCount() == 0) {
$this->object->addAnswer("", 0, 0);
}
$choices->setValues($this->object->getAnswers());
$form->addItem($choices);
$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;
}
示例14: 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("assclozetest");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
// Modify "instructive" question textbox... get rid of this crap asap.
$q_item = $form->getItemByPostVar("question");
$q_item->setInfo($this->lng->txt("close_text_hint"));
$q_item->setTitle($this->lng->txt("cloze_text"));
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$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;
}
示例15: initQuestionForm
/**
* Creates an output of the edit form for the question
*
* @param boolean add a new booking to the form
*/
private function initQuestionForm($add_booking = false)
{
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("accqst");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
if ($this->object->getId()) {
$hidden = new ilHiddenInputGUI("", "ID");
$hidden->setValue($this->object->getId());
$form->addItem($hidden);
}
// accounts XML definition
$item = new ilCustomInputGUI($this->plugin->txt('accounts_xml'));
$item->setInfo($this->plugin->txt('accounts_xml_info'));
$tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html');
$tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($this->object->getAccountsXML()));
$tpl->setVariable("NAME", 'accounts_xml');
$item->setHTML($tpl->get());
// upload accounts definition
$subitem = new ilFileInputGUI($this->plugin->txt('accounts_file'), 'accounts_file');
$subitem->setSuffixes(array('xml'));
$item->addSubItem($subitem);
// download accounts definition
if (strlen($this->object->getAccountsXML())) {
$this->ctrl->setParameter($this, 'xmltype', 'accounts');
$tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
$tpl->setCurrentBlock('button');
$tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml'));
$tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_accounts_xml'));
$tpl->ParseCurrentBlock();
$subitem = new ilcustomInputGUI('');
$subitem->setHTML($tpl->get());
$item->addSubItem($subitem);
}
$form->addItem($item);
// add the existing booking parts
$parts = $this->object->getParts();
$i = 1;
foreach ($parts as $part_obj) {
$this->initPartProperties($form, $part_obj, $i++);
if ($part_obj->getPartId() == 0) {
// new booking is already posted
$add_booking = false;
}
}
// add a new booking part
if (count($parts) == 0 or $add_booking == true) {
$this->initPartProperties($form, null, $i);
} else {
$form->addCommandButton('saveAddBooking', $this->plugin->txt('add_booking'));
}
$this->populateTaxonomyFormSection($form);
$this->addQuestionFormCommandButtons($form);
$this->form = $form;
}