本文整理汇总了PHP中ilPropertyFormGUI::setValuesByPost方法的典型用法代码示例。如果您正苦于以下问题:PHP ilPropertyFormGUI::setValuesByPost方法的具体用法?PHP ilPropertyFormGUI::setValuesByPost怎么用?PHP ilPropertyFormGUI::setValuesByPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilPropertyFormGUI
的用法示例。
在下文中一共展示了ilPropertyFormGUI::setValuesByPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* save Field
*
* @param string $a_mode values: create | update
*/
public function save($a_mode = "create")
{
global $ilCtrl, $lng, $tpl;
//check access
if (!$this->table->hasPermissionToFields($this->parent_obj->ref_id)) {
$this->accessDenied();
return;
}
$this->initForm($a_mode == "update" ? "edit" : "create");
if ($this->checkInput($a_mode)) {
$title = $this->form->getInput("title");
if ($a_mode != "create" && $title != $this->field_obj->getTitle()) {
ilUtil::sendInfo($lng->txt("dcl_field_title_change_warning"), true);
}
$this->field_obj->setTitle($title);
$this->field_obj->setDescription($this->form->getInput("description"));
$this->field_obj->setDatatypeId($this->form->getInput("datatype"));
$this->field_obj->setRequired($this->form->getInput("required"));
$this->field_obj->setUnique($this->form->getInput("unique"));
if ($a_mode == "update") {
$this->field_obj->doUpdate();
} else {
$this->field_obj->setVisible(true);
$this->field_obj->setOrder($this->table->getNewOrder());
$this->field_obj->doCreate();
}
// Get possible properties and save them
include_once "./Modules/DataCollection/classes/class.ilDataCollectionFieldProp.php";
foreach (ilDataCollectionDatatype::getProperties($this->field_obj->getDatatypeId()) as $property) {
$fieldprop_obj = new ilDataCollectionFieldProp();
$fieldprop_obj->setDatatypePropertyId($property['id']);
$fieldprop_obj->setFieldId($this->field_obj->getId());
$fieldprop_obj->setValue($this->form->getInput("prop_" . $property['id']));
if ($a_mode == "update") {
$fieldprop_obj->doUpdate();
} else {
$fieldprop_obj->doCreate();
}
}
$ilCtrl->setParameter($this, "field_id", $this->field_obj->getId());
if ($a_mode == "update") {
ilUtil::sendSuccess($lng->txt("dcl_msg_field_modified"), true);
} else {
$this->table->addField($this->field_obj);
$this->table->buildOrderFields();
ilUtil::sendSuccess($lng->txt("msg_field_created"), false);
}
$ilCtrl->redirectByClass(strtolower("ilDataCollectionFieldListGUI"), "listFields");
} else {
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHTML());
}
}
示例2: sendFailure
/**
* @param $message
*/
protected function sendFailure($message)
{
$keep = $this->ctrl->isAsynch() ? false : true;
$this->form->setValuesByPost();
if ($this->ctrl->isAsynch()) {
echo $this->tpl->getMessageHTML($message, 'failure') . $this->form->getHTML();
exit;
} else {
ilUtil::sendFailure($message, $keep);
$this->tpl->setContent($this->form->getHTML());
}
}
示例3: updateProperties
public function updateProperties()
{
$this->initPropertiesForm();
if ($this->form->checkInput()) {
$this->object->setTitle($this->form->getInput('title'));
$this->object->setDescription($this->form->getInput('desc'));
$this->object->update();
ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
$this->ctrl->redirect($this, 'editProperties');
}
$this->form->setValuesByPost();
$this->tpl->setContent($this->form->getHtml());
}
示例4: showFormCmd
/**
* shows the form for managing a new/existing hint
*
* @access private
* @global ilCtrl $ilCtrl
* @global ilTemplate $tpl
*/
private function showFormCmd(ilPropertyFormGUI $form = null)
{
global $ilCtrl, $tpl, $ilToolbar, $lng, $ilCtrl;
if ($form instanceof ilPropertyFormGUI) {
$form->setValuesByPost();
} elseif (isset($_GET['hint_id']) && (int) $_GET['hint_id']) {
$questionHint = new ilAssQuestionHint();
if (!$questionHint->load((int) $_GET['hint_id'])) {
ilUtil::sendFailure('invalid hint id given: ' . (int) $_GET['hint_id'], true);
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
$form = $this->buildForm($questionHint);
} else {
$form = $this->buildForm();
}
$tpl->setContent($form->getHTML());
}
示例5: settings
/**
* @param bool $init_from_database
*/
protected function settings($init_from_database = true)
{
/**
* @var $rbacsystem ilRbacSystem
* @var $ilErr ilErrorHandling
* @var $tpl ilTemplate
*/
global $rbacsystem, $ilErr, $tpl;
if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) {
$ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
}
$this->initSettingsForm();
if ($init_from_database) {
$this->form->setValuesByArray(array('tos_status' => $this->object->getStatus()));
} else {
$this->form->setValuesByPost();
}
$tpl->setContent($this->form->getHtml());
}
示例6: updateNotificationSettingsObject
public function updateNotificationSettingsObject()
{
/**
* @var $ilAccess ilAccessHandler
* @var $ilErr ilErr
*/
global $ilAccess, $ilErr;
if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
}
// instantiate the property form
$this->initNotificationSettingsForm();
// check input
if ($this->notificationSettingsForm->checkInput()) {
if (isset($_POST['notification_type']) && $_POST['notification_type'] == 'all_users') {
// set values and call update
$this->objProperties->setAdminForceNoti(1);
$this->objProperties->setUserToggleNoti((int) $this->notificationSettingsForm->getInput('usr_toggle'));
$this->objProperties->setNotificationType('all_users');
$this->updateUserNotifications(true);
} else {
if ($_POST['notification_type'] == 'per_user') {
$this->objProperties->setNotificationType('per_user');
$this->objProperties->setAdminForceNoti(1);
$this->objProperties->setUserToggleNoti(0);
$this->updateUserNotifications();
} else {
$this->objProperties->setNotificationType('default');
$this->objProperties->setAdminForceNoti(0);
$this->objProperties->setUserToggleNoti(0);
include_once 'Modules/Forum/classes/class.ilForumNotification.php';
$frm_noti = new ilForumNotification($this->object->getRefId());
$frm_noti->deleteNotificationAllUsers();
}
}
$this->objProperties->update();
// print success message
ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
}
$this->notificationSettingsForm->setValuesByPost();
return $this->showMembersObject();
}
示例7: saveCategory
/**
*
*/
protected function saveCategory()
{
if (!$this->isCRUDContext()) {
$this->{$this->getDefaultCommand()}();
return;
}
$category = $this->getCategoryById((int) $_GET['category_id']);
$this->initUnitCategoryForm($category);
if ($this->unit_cat_form->checkInput()) {
try {
$category->setCategory($this->unit_cat_form->getInput('category_name'));
$this->repository->saveCategory($category);
ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
$this->{$this->getUnitCategoryOverviewCommand()}();
return;
} catch (ilException $e) {
$this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage()));
ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
}
}
$this->unit_cat_form->setValuesByPost();
$this->tpl->setContent($this->unit_cat_form->getHtml());
}
示例8: save
/**
* Save form input
*/
public function save()
{
/** @var ilCtrl $ilCtrl */
global $tpl, $ilCtrl;
$this->initConfigurationForm();
if ($this->form->checkInput()) {
// Save Checkbox Values
foreach ($this->checkboxes as $key => $cb) {
if (!is_array($cb)) {
$this->setValue($cb, $this->form->getInput($cb));
} else {
$this->setValue($key, $this->form->getInput($key));
foreach ($cb as $field => $gui) {
$this->setValue($key . '_' . $field, $this->form->getInput($key . '_' . $field));
}
}
}
$ilCtrl->redirect($this, 'configure');
} else {
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}
}
示例9: updateSettings
/**
* Command for saving the updated Test Overview settings.
*
* This command saves the HTML form input into the Test Overview
* currently selected.
*/
protected function updateSettings()
{
/**
* @var $tpl ilTemplate
* @var $lng ilLanguage
* @var $ilCtrl ilCtrl
*/
global $tpl, $lng, $ilCtrl;
$this->initSettingsForm();
if ($this->form->checkInput()) {
/* Form is sent and input validated,
now save settings. */
$this->object->setTitle($this->form->getInput('title'));
$this->object->setDescription($this->form->getInput('desc'));
$this->object->update();
ilUtil::sendSuccess($lng->txt('msg_obj_modified'), true);
/* Back to editSettings */
$ilCtrl->redirect($this, 'editSettings');
}
/* Form is sent but there is an input error.
Fill back the form and render again. */
$this->form->setValuesByPost();
$tpl->setContent($this->renderSettings());
}
示例10: importExternalMailRecipientsObject
function importExternalMailRecipientsObject($checkonly = false, $formindex = -1)
{
global $ilAccess;
$this->handleWriteAccess();
$this->setCodesSubtabs();
$savefields = strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromFile") == 0 || strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromText") == 0 || strcmp($this->ctrl->getCmd(), "importExternalRecipientsFromDataset") == 0 ? TRUE : FALSE;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form_import_file = new ilPropertyFormGUI();
$form_import_file->setFormAction($this->ctrl->getFormAction($this));
$form_import_file->setTableWidth("100%");
$form_import_file->setId("codes_import_file");
$headerfile = new ilFormSectionHeaderGUI();
$headerfile->setTitle($this->lng->txt("import_from_file"));
$form_import_file->addItem($headerfile);
$externalmails = new ilFileInputGUI($this->lng->txt("externalmails"), "externalmails");
$externalmails->setInfo($this->lng->txt('externalmails_info'));
$externalmails->setRequired(true);
$form_import_file->addItem($externalmails);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_file->addCommandButton("importExternalRecipientsFromFile", $this->lng->txt("import"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_file->addCommandButton("codesMail", $this->lng->txt("cancel"));
}
// import text
$form_import_text = new ilPropertyFormGUI();
$form_import_text->setFormAction($this->ctrl->getFormAction($this));
$form_import_text->setTableWidth("100%");
$form_import_text->setId("codes_import_text");
$headertext = new ilFormSectionHeaderGUI();
$headertext->setTitle($this->lng->txt("import_from_text"));
$form_import_text->addItem($headertext);
$inp = new ilTextAreaInputGUI($this->lng->txt('externaltext'), 'externaltext');
if (array_key_exists('externaltext', $_SESSION) && strlen($_SESSION['externaltext'])) {
$inp->setValue($_SESSION['externaltext']);
} else {
$inp->setValue($this->lng->txt('mail_import_example1') . "\n" . $this->lng->txt('mail_import_example2') . "\n" . $this->lng->txt('mail_import_example3') . "\n");
}
$inp->setRequired(true);
$inp->setCols(80);
$inp->setRows(10);
$inp->setInfo($this->lng->txt('externaltext_info'));
$form_import_text->addItem($inp);
unset($_SESSION['externaltext']);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_text->addCommandButton("importExternalRecipientsFromText", $this->lng->txt("import"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_text->addCommandButton("codesMail", $this->lng->txt("cancel"));
}
// import dataset
$form_import_dataset = new ilPropertyFormGUI();
$form_import_dataset->setFormAction($this->ctrl->getFormAction($this));
$form_import_dataset->setTableWidth("100%");
$form_import_dataset->setId("codes_import_dataset");
$headerfile = new ilFormSectionHeaderGUI();
$headerfile->setTitle($this->lng->txt("import_from_dataset"));
$form_import_dataset->addItem($headerfile);
$existingdata = $this->object->getExternalCodeRecipients();
$existingcolumns = array('email');
if (count($existingdata)) {
$first = array_shift($existingdata);
foreach ($first as $key => $value) {
if (strcmp($key, 'email') != 0 && strcmp($key, 'code') != 0 && strcmp($key, 'sent') != 0) {
array_push($existingcolumns, $key);
}
}
}
foreach ($existingcolumns as $column) {
$inp = new ilTextInputGUI($column, $column);
$inp->setSize(50);
if (strcmp($column, 'email') == 0) {
$inp->setRequired(true);
} else {
$inp->setRequired(false);
}
$form_import_dataset->addItem($inp);
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_dataset->addCommandButton("importExternalRecipientsFromDataset", $this->lng->txt("import"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_dataset->addCommandButton("codesMail", $this->lng->txt("cancel"));
}
$errors = false;
if ($savefields) {
switch ($formindex) {
case 0:
$errors = !$form_import_file->checkInput();
$form_import_file->setValuesByPost();
if ($errors) {
$checkonly = false;
}
break;
case 1:
$errors = !$form_import_text->checkInput();
$form_import_text->setValuesByPost();
if ($errors) {
$checkonly = false;
}
//.........这里部分代码省略.........
示例11: 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;
}
示例12: scoringObject
//.........这里部分代码省略.........
if (strlen($this->object->getReportingDate())) {
$reporting_date->setDate(new ilDateTime($this->object->getReportingDate(), IL_CAL_TIMESTAMP));
} else {
$reporting_date->setDate(new ilDateTime(time(), IL_CAL_UNIX));
}
$results_access_date_limitation->addSubItem($reporting_date);
$form->addItem($results_access);
$results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt("tst_results_print_best_solution"), "print_bs_with_res");
$results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
$results_print_best_solution->setValue(1);
$results_print_best_solution->setChecked((bool) $this->object->isBestSolutionPrintedWithResult());
$form->addItem($results_print_best_solution);
// results presentation
$results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt("tst_results_presentation"), "results_presentation");
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_pass_details"), 'pass_details', ''));
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_details"), 'solution_details', ''));
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_printview"), 'solution_printview', ''));
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_compare"), 'solution_compare', ''));
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_feedback"), 'solution_feedback', ''));
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_answers_only"), 'solution_answers_only', ''));
$signatureOption = new ilCheckboxOption($this->lng->txt("tst_show_solution_signature"), 'solution_signature', '');
$results_presentation->addOption($signatureOption);
$results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_suggested"), 'solution_suggested', ''));
$values = array();
if ($this->object->getShowPassDetails()) {
array_push($values, 'pass_details');
}
if ($this->object->getShowSolutionDetails()) {
array_push($values, 'solution_details');
}
if ($this->object->getShowSolutionPrintview()) {
array_push($values, 'solution_printview');
}
if ($this->object->getShowSolutionFeedback()) {
array_push($values, 'solution_feedback');
}
if ($this->object->getShowSolutionAnswersOnly()) {
array_push($values, 'solution_answers_only');
}
if ($this->object->getShowSolutionSignature()) {
array_push($values, 'solution_signature');
}
if ($this->object->getShowSolutionSuggested()) {
array_push($values, 'solution_suggested');
}
if ($this->object->getShowSolutionListComparison()) {
array_push($values, 'solution_compare');
}
$results_presentation->setValue($values);
$results_presentation->setInfo($this->lng->txt("tst_results_presentation_description"));
if ($this->object->getAnonymity()) {
$signatureOption->setDisabled(true);
}
$form->addItem($results_presentation);
// misc properties
$header_misc = new ilFormSectionHeaderGUI();
$header_misc->setTitle($this->lng->txt("misc"));
$form->addItem($header_misc);
// deletion of test results
$passDeletion = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_deletion"), "pass_deletion_allowed");
$passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_not_allowed"), 0, ''));
$passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_allowed"), 1, ''));
$passDeletion->setValue($this->object->isPassDeletionAllowed());
$form->addItem($passDeletion);
// export settings
$export_settings = new ilCheckboxGroupInputGUI($this->lng->txt("tst_export_settings"), "export_settings");
$export_settings->addOption(new ilCheckboxOption($this->lng->txt("tst_exp_sc_short"), 'exp_sc_short', ''));
$values = array();
if ($this->object->getExportSettingsSingleChoiceShort()) {
array_push($values, 'exp_sc_short');
}
$export_settings->setValue($values);
$form->addItem($export_settings);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total == 0) {
$form->addCommandButton("saveScoring", $this->lng->txt("save"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total != 0) {
$form->addCommandButton("confirmScoring", $this->lng->txt("save"));
}
// remove items when using template
if ($template_settings) {
foreach ($template_settings as $id => $item) {
if ($item["hide"]) {
$form->removeItemByPostVar($id);
}
}
}
$errors = false;
if ($save) {
$errors = !$form->checkInput();
$form->setValuesByPost();
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
return $errors;
}
示例13: handleInvalidAddClassForm
/**
* In case the form input for the name of the class was empty an error message and the class
* form with its non erroneous entries will be displayed.
*
* @param ilPropertyFormGUI $a_class_form the class for which the invalid input should be handled
*/
private function handleInvalidAddClassForm($a_class_form)
{
$this->tabs->clearTargets();
$a_class_form->setValuesByPost();
$this->tpl->setContent($a_class_form->getHTML());
}
示例14: randomQuestionsObject
function randomQuestionsObject()
{
global $ilUser;
$total = $this->object->evalTotalPersons();
$save = strcmp($this->ctrl->getCmd(), "saveRandomQuestions") == 0 ? TRUE : FALSE;
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'randomQuestions'));
$form->setTitle($this->lng->txt('random_selection'));
$form->setDescription($this->lng->txt('tst_select_random_questions'));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("randomSelectionForm");
// question selection
$selection_mode = $save ? $_POST['chbQuestionSelectionMode'] : $ilUser->getPref("tst_question_selection_mode_equal");
$question_selection = new ilCheckboxInputGUI($this->lng->txt("tst_question_selection"), "chbQuestionSelectionMode");
$question_selection->setValue(1);
$question_selection->setChecked($selection_mode);
$question_selection->setOptionTitle($this->lng->txt('tst_question_selection_equal'));
$question_selection->setInfo($this->lng->txt('tst_question_selection_description'));
$question_selection->setRequired(false);
$form->addItem($question_selection);
// total amount of questions
$total_questions = new ilNumberInputGUI($this->lng->txt('tst_total_questions'), 'total_questions');
$total_questions->setValue($this->object->getRandomQuestionCount());
$total_questions->setSize(3);
$total_questions->setInfo($this->lng->txt('tst_total_questions_description'));
$total_questions->setRequired(false);
$form->addItem($total_questions);
if ($total == 0) {
$found_qpls = $this->object->getRandomQuestionpoolData();
include_once "./Modules/Test/classes/class.ilRandomTestData.php";
if (count($found_qpls) == 0) {
array_push($found_qpls, new ilRandomTestData());
}
$available_qpl =& $this->object->getAvailableQuestionpools(TRUE, $selection_mode, FALSE, TRUE, TRUE);
include_once './Modules/Test/classes/class.ilRandomTestInputGUI.php';
$source = new ilRandomTestInputGUI($this->lng->txt('tst_random_questionpools'), 'source');
$source->setUseEqualPointsOnly($selection_mode);
$source->setRandomQuestionPools($available_qpl);
$source->setUseQuestionCount(array_key_exists('total_questions', $_POST) ? $_POST['total_questions'] < 1 : $this->object->getRandomQuestionCount() < 1);
$source->setValues($found_qpls);
$form->addItem($source);
} else {
$qpls = $this->object->getUsedRandomQuestionpools();
include_once './Modules/Test/classes/class.ilRandomTestROInputGUI.php';
$source = new ilRandomTestROInputGUI($this->lng->txt('tst_random_questionpools'), 'source');
$source->setValues($qpls);
$form->addItem($source);
}
if ($total == 0) {
$form->addCommandButton("saveRandomQuestions", $this->lng->txt("save"));
}
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
if (!$errors) {
// check total amount of questions
if ($_POST['total_questions'] > 0) {
$totalcount = 0;
foreach ($_POST['source']['qpl'] as $idx => $qpl) {
$totalcount += $available_qpl[$qpl]['count'];
}
if ($_POST['total_questions'] > $totalcount) {
$total_questions->setAlert($this->lng->txt('msg_total_questions_too_high'));
$errors = true;
}
}
}
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}
return $errors;
}
示例15: 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;
}