4 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
37 $ilCtrl = $DIC[
'ilCtrl'];
38 $ilTabs = $DIC[
'ilTabs'];
42 $cmd = $ilCtrl->getCmd(self::CMD_SHOW_FORM);
43 $nextClass = $ilCtrl->getNextClass($this);
46 case 'ilasshintpagegui':
48 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
51 $forwarder->forward();
74 $ilCtrl = $DIC[
'ilCtrl'];
76 $ilToolbar = $DIC[
'ilToolbar'];
78 $ilCtrl = $DIC[
'ilCtrl'];
81 $form->setValuesByPost();
82 } elseif (isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id']) {
85 if (!$questionHint->load((
int) $_GET[
'hint_id'])) {
95 $tpl->setContent($form->getHTML());
108 $ilCtrl = $DIC[
'ilCtrl'];
114 if ($form->checkInput()) {
117 if ((
int) $form->getInput(
'hint_id')) {
118 $questionHint->load((
int) $form->getInput(
'hint_id'));
120 $hintJustCreated =
false;
122 $questionHint->setQuestionId($this->questionOBJ->getId());
124 $questionHint->setIndex(
128 $hintJustCreated =
true;
131 $questionHint->setText($form->getInput(
'hint_text'));
132 $questionHint->setPoints($form->getInput(
'hint_points'));
134 $questionHint->save();
138 $form->getInput(
'hint_id')
141 $pageObject->setParentId($this->questionOBJ->getId());
142 $pageObject->setId($questionHint->getId());
143 $pageObject->createFromXML();
146 ilUtil::sendSuccess(
$lng->txt(
'tst_question_hints_form_saved_msg'),
true);
148 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
149 $this->questionOBJ->updateTimestamp();
152 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
153 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
159 if ($hintJustCreated && $this->questionOBJ->isAdditionalContentEditingModePageObject()) {
160 $ilCtrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $questionHint->getId());
161 $ilCtrl->redirectByClass(
'ilasshintpagegui',
'edit');
180 $ilCtrl = $DIC[
'ilCtrl'];
182 $ilCtrl->redirectByClass(
'ilAssQuestionHintsGUI');
196 $ilCtrl = $DIC[
'ilCtrl'];
199 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
200 require_once
'Services/Form/classes/class.ilTextAreaInputGUI.php';
201 require_once
'Services/Form/classes/class.ilNumberInputGUI.php';
202 require_once
'Services/Form/classes/class.ilHiddenInputGUI.php';
205 $form->setTableWidth(
'100%');
207 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
212 $areaInp->setRows(10);
213 $areaInp->setCols(80);
215 if (!$this->questionOBJ->getPreventRteUsage()) {
216 $areaInp->setUseRte(
true);
219 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
222 $areaInp->setRTESupport($this->questionOBJ->getId(),
'qpl',
'assessment');
224 $areaInp->addPlugin(
"latex");
225 $areaInp->addButton(
"latex");
226 $areaInp->addButton(
"pastelatex");
228 $form->addItem($areaInp);
233 $numInp =
new ilNumberInputGUI(
$lng->txt(
'tst_question_hints_form_label_hint_points'),
'hint_points');
235 $numInp->setRequired(
true);
238 $form->addItem($numInp);
243 $form->setTitle(sprintf(
244 $lng->txt(
'tst_question_hints_form_header_edit'),
245 $questionHint->getIndex(),
246 $this->questionOBJ->getTitle()
252 $form->addItem($hiddenInp);
256 require_once
'Services/Utilities/classes/class.ilUtil.php';
258 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
259 $areaInp->setValue($questionHint->getText());
262 $numInp->setValue($questionHint->getPoints());
264 $hiddenInp->setValue($questionHint->getId());
267 $form->setTitle(sprintf(
268 $lng->txt(
'tst_question_hints_form_header_create'),
269 $this->questionOBJ->getTitle()
273 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
274 if ($questionHint instanceof ilAssQuestionHint) {
275 $saveCmdLabel =
$lng->txt(
'tst_question_hints_form_cmd_save_points');
277 $saveCmdLabel =
$lng->txt(
'tst_question_hints_form_cmd_save_points_and_edit_page');
280 $saveCmdLabel =
$lng->txt(
'tst_question_hints_form_cmd_save');
283 $form->setFormAction($ilCtrl->getFormAction($this));
285 $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel);
286 $form->addCommandButton(self::CMD_CANCEL_FORM,
$lng->txt(
'cancel'));
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
executeCommand()
Execute Command.
const PRESENTATION_MODE_AUTHOR
presentation mode for authoring
cancelFormCmd()
gateway command method to jump back to question hints overview
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
saveFormCmd()
saves the form on successfull validation and redirects to showForm command
const CMD_SHOW_LIST
command constants
static getNextIndexByQuestionId($questionId)
determines the next index to be used for a new hint that is to be added to the list of existing hints...
Assessment hint page object.
buildForm(ilAssQuestionHint $questionHint=null)
builds the questions hints form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CMD_SHOW_FORM
command constants
This class represents a text area property in a property form.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
showFormCmd(ilPropertyFormGUI $form=null)
shows the form for managing a new/existing hint
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.