4 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
5 include_once
'Modules/Test/classes/class.ilTestExpressPage.php';
29 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
31 $pos = array_search($_REQUEST[
'q_id'], $questions);
34 $next = $questions[$pos + 1];
36 $next = $questions[0];
39 $this->ctrl->setParameter($this,
'q_id', $next);
40 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
48 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
50 $pos = array_search($_REQUEST[
'q_id'], $questions);
53 $next = $questions[$pos - 1];
55 $next = $questions[0];
58 $this->ctrl->setParameter($this,
'q_id', $next);
59 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
66 parent::__construct($a_id, $a_old_nr);
73 $ilTabs = $DIC[
'ilTabs'];
77 $next_class = $this->ctrl->getNextClass($this);
78 $cmd = $this->ctrl->getCmd();
80 switch ($next_class) {
81 case 'ilobjquestionpoolgui':
83 $nodeParts = explode(
':',
$_GET[
'cmdNode']);
86 'ref_id' =>
$_GET[
'ref_id'],
87 'calling_test' =>
$_GET[
'ref_id'],
88 'q_id' =>
$_GET[
'q_id'],
89 'cmd' =>
$_GET[
'cmd'],
90 'cmdClass' =>
$_GET[
'cmdClass'],
91 'baseClass' =>
'ilObjQuestionPoolGUI',
92 'test_express_mode' =>
'1' 97 '?' . http_build_query(
$params, null,
'&'),
98 'cmdNode=' . ($nodeParts[count($nodeParts) - 2] .
':' . $nodeParts[count($nodeParts) - 1])
104 case "ilpageeditorgui":
108 $ilCtrl->redirect($this,
"preview");
112 $page_editor->setLocator($this->locator);
113 $page_editor->setHeader($this->
getHeader());
114 $page_editor->setPageBackTitle($this->page_back_title);
115 $page_editor->setIntLinkReturn($this->int_link_return);
117 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
119 $ret = &$this->ctrl->forwardCommand($page_editor);
124 case 'iltestexpresspageobjectgui':
126 include_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
128 if ($cmd ==
'view') {
135 if ($q_gui->object) {
137 $q_gui->object->setObjId(
$obj->getId());
141 'handleToolbarCommand',
145 'browseForQuestions',
146 'filterAvailableQuestions',
147 'resetfilterAvailableQuestions' 150 if (in_array($cmd, $cmds)) {
151 return $this->$cmd();
152 } elseif ($q_gui->object) {
153 $total = $this->test_object->evalTotalPersons();
158 $link = $DIC->ui()->factory()->link()->standard(
159 $DIC->language()->txt(
"test_has_datasets_warning_page_view_link"),
160 $DIC->ctrl()->getLinkTargetByClass(array(
'ilTestResultsGUI',
'ilParticipantsTestResultsGUI'))
163 $message = $DIC->language()->txt(
"test_has_datasets_warning_page_view");
165 $msgBox = $DIC->ui()->factory()->messageBox()->info(
$message)->withLinks(array($link));
167 $DIC->ui()->mainTemplate()->setCurrentBlock(
'mess');
168 $DIC->ui()->mainTemplate()->setVariable(
170 $DIC->ui()->renderer()->render($msgBox)
172 $DIC->ui()->mainTemplate()->parseCurrentBlock();
175 if ((in_array($cmd, array(
'view',
'showPage')) || $cmd ==
'edit') && $this->test_object->evalTotalPersons()) {
179 return parent::executeCommand();
187 if (!
$_GET[
'q_id']) {
189 $q_gui->setQuestionTabs();
191 $this->ctrl->forwardCommand($q_gui);
195 $this->ctrl->setReturn($this,
"questions");
197 require_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
199 if ($q_gui->object) {
201 $q_gui->object->setObjId(
$obj->getId());
204 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_id');
205 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
207 $q_gui->setQuestionTabs();
208 $this->ctrl->forwardCommand($q_gui);
219 $qtype = $_REQUEST[
'qtype'];
224 $this->ctrl->setReturn($this,
"questions");
226 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
231 $q_gui->object->setObjId(
$obj->getId());
241 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
243 if ($_REQUEST[
'qtype']) {
244 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
246 } elseif ($_REQUEST[
'sel_question_types']) {
247 $questionType = $_REQUEST[
'sel_question_types'];
250 include_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
252 $addContEditMode = $_REQUEST[
'add_quest_cont_edit_mode'];
260 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
262 $q_gui->object->createNewQuestion();
264 $previousQuestionId = $_REQUEST[
'position'];
266 switch ($_REQUEST[
'usage']) {
269 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl', $_REQUEST[
'sel_qpl']);
270 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
271 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
272 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
274 if ($_REQUEST[
'test_express_mode']) {
275 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
278 if (isset($_REQUEST[
'add_quest_cont_edit_mode'])) {
281 'add_quest_cont_edit_mode',
282 $_REQUEST[
'add_quest_cont_edit_mode']
286 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
287 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
289 $link =
$ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
297 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl', $_REQUEST[
'txt_qpl']);
298 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
299 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
300 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
302 if ($_REQUEST[
'test_express_mode']) {
303 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
306 if (isset($_REQUEST[
'add_quest_cont_edit_mode'])) {
309 'add_quest_cont_edit_mode',
310 $_REQUEST[
'add_quest_cont_edit_mode']
314 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
315 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
317 $link =
$ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
338 $ilHelp = $DIC[
'ilHelp'];
340 $subScreenId = array(
'createQuestion');
342 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
344 $ilCtrl->setParameter($this,
'qtype', $_REQUEST[
'qtype']);
348 $ilCtrl->setParameter($this,
'test_express_mode', 1);
350 $form->setFormAction(
$ilCtrl->getFormAction($this,
"handleToolbarCommand"));
351 $form->setTitle(
$lng->txt(
"ass_create_question"));
352 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
355 $questionTypes = $pool->getQuestionTypes(
false,
true,
false);
359 foreach ($questionTypes as $label =>
$data) {
363 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
369 $questions = $this->test_object->getQuestionTitlesAndIndexes();
374 $options[
$key] =
$lng->txt(
'behind') .
' ' .
$title .
' [' . $this->lng->txt(
'question_id_short') .
': ' .
$key .
']';
376 $si->setOptions($options);
377 $si->setValue($_REQUEST[
'q_id']);
383 $subScreenId[] =
'editMode';
388 $lng->txt(
'tst_add_quest_cont_edit_mode_default'),
393 $lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
399 $form->addItem($ri,
true);
403 $form->addItem($hi,
true);
406 if ($this->test_object->getPoolUsage()) {
407 $subScreenId[] =
'poolSelect';
412 $no_pool =
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
413 $usage->addOption($no_pool);
414 $existing_pool =
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
415 $usage->addOption($existing_pool);
416 $new_pool =
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
417 $usage->addOption($new_pool);
418 $form->addItem($usage);
423 $pools_data = array();
424 foreach ($questionpools as
$key => $p) {
425 $pools_data[
$key] = $p[
'title'];
427 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_qpl");
429 $existing_pool->addSubItem($pools);
433 $name->setMaxLength(50);
434 $new_pool->addSubItem(
$name);
437 $form->addCommandButton(
"handleToolbarCommand",
$lng->txt(
"create"));
438 $form->addCommandButton(
"questions",
$lng->txt(
"cancel"));
440 $ilHelp->setSubScreenId(implode(
'_', $subScreenId));
442 return $tpl->setContent(
$form->getHTML());
450 $ilCtrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
452 $ilCtrl->redirectByClass(
'ilobjtestgui',
'showPage');
457 $cmdClass = $questionType .
'GUI';
459 $this->ctrl->setParameterByClass($cmdClass,
'ref_id',
$_GET[
'ref_id']);
460 $this->ctrl->setParameterByClass($cmdClass,
'sel_question_types', $questionType);
461 $this->ctrl->setParameterByClass($cmdClass,
'test_ref_id',
$_GET[
'ref_id']);
462 $this->ctrl->setParameterByClass($cmdClass,
'calling_test',
$_GET[
'ref_id']);
463 $this->ctrl->setParameterByClass($cmdClass,
'q_id', $qid);
464 $this->ctrl->setParameterByClass($cmdClass,
'prev_qid', $prev_qid);
466 if ($_REQUEST[
'test_express_mode']) {
467 $this->ctrl->setParameterByClass($cmdClass,
'test_express_mode', 1);
470 $this->ctrl->redirectByClass(
471 array(
'ilRepositoryGUI',
'ilObjTestGUI', $questionType .
"GUI"),
478 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id', $_REQUEST[
'ref_id']);
479 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
480 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
481 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
482 $redir = $this->ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
489 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
490 if (!count($selected_array)) {
492 $this->ctrl->redirect($this,
"browseForQuestions");
494 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
498 $tree = $DIC[
'tree'];
499 $ilDB = $DIC[
'ilDB'];
500 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
502 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
504 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
506 foreach ($selected_array as
$key => $value) {
507 $last_question_id = $this->test_object->insertQuestion($testQuestionSetConfig, $value);
513 $this->test_object->saveCompleteStatus($testQuestionSetConfig);
517 ilUtil::sendSuccess($this->lng->txt(
"tst_questions_inserted"),
true);
520 $this->ctrl->setParameter($this,
'q_id', $last_question_id);
521 $this->ctrl->redirect($this,
"showPage");
This class represents an option in a radio group.
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
getPageObject()
Get Page Object.
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
static _needsManualScoring($question_id)
static getQuestionTypeByTypeId($type_id)
addPageOfQuestions($type='')
static _lookupObjectId($a_ref_id)
lookup object id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
getEnableEditing()
Get Enable Editing.
This class represents a text property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct($a_id=0, $a_old_nr=0)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
redirectToQuestionEditPage($questionType, $qid, $prev_qid)
static isAdditionalQuestionContentEditingModePageObjectEnabled()
returns the fact wether content editing with ilias page editor is enabled for questions or not ...
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
redirectToQuestionPoolSelectionPage($questionType, $qid, $prev_qid)
static redirect($a_script)
ilTestExpressPageObjectGUI: assMultipleChoiceGUI, assClozeTestGUI, assMatchingQuestionGUI ilTestExpr...
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.