28 protected \ILIAS\TestQuestionPool\Questions\PublicInterface
$questioninfo;
47 $this->
ctrl = $DIC->ctrl();
48 $this->
access = $DIC->access();
49 $this->tpl =
$DIC[
"tpl"];
50 $this->
tabs = $DIC->tabs();
51 $this->
lng = $DIC->language();
52 $this->
user = $DIC->user();
53 $this->tree =
$DIC->repositoryTree();
54 $this->
toolbar = $DIC->toolbar();
55 $ilCtrl =
$DIC->ctrl();
56 $this->scormlmid = $a_pg_obj->parent_id;
57 $this->questioninfo =
$DIC->testQuestion();
58 $this->ipe_for_questions_enabled = (bool)
$DIC[
'ilSetting']->
get(
'enable_tst_page_edit',
false);
60 $ilCtrl->saveParameter($this, array(
"qpool_ref_id"));
73 $next_class = $ilCtrl->getNextClass($this);
75 switch ($next_class) {
78 if ($cmd !=
"insert") {
80 } elseif ($this->sub_command !=
"") {
84 if ($cmd ===
'create_pcqst') {
96 $this->selfassessmentmode = $a_selfassessmentmode;
113 $lng->
txt(
"cont_new_question"),
114 $ilCtrl->getLinkTarget($this,
"insert")
118 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
121 $lng->
txt(
"cont_copy_question_from_pool"),
122 $ilCtrl->getLinkTarget($this,
"insert")
125 $ilTabs->activateSubTab($a_active);
127 $ilCtrl->setParameter($this,
"subCmd",
"");
133 public function insert(
string $a_mode =
"create"): void
148 foreach ($all_types as $k => $v) {
149 $options[$v[
"type_tag"]] = $k;
154 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
155 $this->form_gui->setTitle(
$lng->
txt(
"cont_ed_insert_pcqst"));
159 $qtype_input->setOptions($options);
160 $qtype_input->setRequired(
true);
161 $this->form_gui->addItem($qtype_input);
165 if ($this->ipe_for_questions_enabled) {
169 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain'),
172 $option_rte->setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain_info'));
173 $ri->addOption($option_rte);
176 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
179 $option_ipe->setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
180 $ri->addOption($option_ipe);
184 $this->form_gui->addItem($ri);
188 $this->form_gui->addItem($hi);
191 if ($a_mode ==
"edit_empty") {
192 $this->form_gui->addCommandButton(
"edit",
$lng->
txt(
"save"));
194 $this->form_gui->addCommandButton(
"create_pcqst",
$lng->
txt(
"save"));
195 $this->form_gui->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
198 $this->tpl->setContent($this->form_gui->getHTML());
207 global $ilCtrl, $ilTabs;
209 $ilTabs->setTabActive(
'question');
212 $this->content_obj->create($this->pg_obj, $this->hier_id);
214 $this->updated = $this->pg_obj->update();
216 if ($this->updated) {
217 $this->pg_obj->stripHierIDs();
218 $this->pg_obj->addHierIDs();
219 $ilCtrl->setParameter(
222 $this->request->getString(
"q_type")
224 $ilCtrl->setParameter(
226 "add_quest_cont_edit_mode",
227 $this->request->getString(
"add_quest_cont_edit_mode")
231 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
232 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
234 $ilCtrl->redirect($this,
"edit");
245 if ($a_par[
"new_id"] > 0) {
246 $this->content_obj->setQuestionReference(
"il__qst_" . $a_par[
"new_id"]);
247 $this->pg_obj->update();
263 $q_ref = $this->content_obj->getQuestionReference();
267 if (!($inst_id > 0)) {
272 $q_type = $this->request->getString(
"q_type");
273 $ilCtrl->setParameter($this,
"q_type", $q_type);
275 if ($q_id ==
"" && $q_type ==
"") {
276 $this->
insert(
"edit_empty");
281 if ($q_id < 1 && $q_type) {
285 $add_quest_cont_edit_mode = $this->request->getString(
"add_quest_cont_edit_mode");
286 if ($this->ipe_for_questions_enabled
287 && $add_quest_cont_edit_mode !=
"") {
288 $addContEditMode = $add_quest_cont_edit_mode;
292 $q_gui->getObject()->setAdditionalContentEditingMode($addContEditMode);
295 $q_gui->getObject()->setObjId(0);
296 $q_id = $q_gui->getObject()->createNewQuestion(
true);
297 $this->content_obj->setQuestionReference(
"il__qst_" . $q_id);
298 $this->pg_obj->update();
301 $ilCtrl->setParameterByClass(
"ilQuestionEditGUI",
"q_id", $q_id);
302 $ilCtrl->redirectByClass(array(get_class($this->pg_obj) .
"GUI",
"ilQuestionEditGUI"),
"editQuestion");
305 $this->
ctrl->redirectByClass($q_gui::class,
'editQuestion');
321 $q_ref = $this->content_obj->getQuestionReference();
325 if (!($inst_id > 0)) {
332 $edit_gui->setQuestionId($q_id);
335 $edit_gui->setSelfAssessmentEditingMode(
true);
337 $ret = $ilCtrl->forwardCommand($edit_gui);
338 $this->tpl->setContent($ret);
351 $qpl->setType(
"qpl");
352 $qpl->setTitle($name);
353 $qpl->setDescription(
"");
355 $qpl->createReference();
356 $qpl->putInTree($parent_ref);
357 $qpl->setPermissions($parent_ref);
360 return $qpl->getRefId();
375 if (!is_null($this->content_obj)) {
376 $q_ref = $this->content_obj->getQuestionReference();
381 if (!($inst_id > 0)) {
388 $ilCtrl->getLinkTarget($this,
"edit"),
389 array(
"editQuestion",
"save",
"cancel",
"addSuggestedSolution",
390 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
391 "addPair",
"addTerm",
"delete",
"deleteTerms",
"editMode",
"upload",
392 "saveEdit",
"uploadingImage",
"uploadingImagemap",
"addArea",
393 "deletearea",
"saveShape",
"back",
"saveEdit",
"changeGapType",
"createGaps",
"addItem",
"addYesNo",
"addTrueFalse",
394 "toggleGraphicalAnswers",
"setMediaMode"),
399 if ($this->questioninfo->getGeneralQuestionProperties($q_id)->getClassName() !=
"assTextQuestion") {
405 $ilTabs->addTarget(
'feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
420 if ($this->edit_repo->getQuestionPool() > 0 &&
421 $ilAccess->checkAccess(
"write",
"", $this->edit_repo->getQuestionPool())
436 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
440 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"fold",
"crs",
"qpl"));
441 $exp->setClickableTypes(array(
'qpl'));
443 if (!$exp->handleCommand()) {
452 $this->edit_repo->setQuestionPool($this->request->getInt(
"pool_ref_id"));
453 $ilCtrl->
setParameter($this,
"subCmd",
"insertFromPool");
454 $ilCtrl->redirect($this,
"insert");
464 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_cp_question_diff_formats_info"));
466 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
467 $ilToolbar->addButton(
468 $lng->
txt(
"cont_select_other_qpool"),
469 $ilCtrl->getLinkTarget($this,
"insert")
471 $ilCtrl->setParameter($this,
"subCmd",
"");
475 $ilCtrl->setParameter($this,
"subCmd",
"listPoolQuestions");
479 $this->edit_repo->getQuestionPool()
490 $this->content_obj->create(
492 $this->request->getHierId()
495 $this->content_obj->copyPoolQuestionIntoPage(
496 $this->request->getInt(
"q_id"),
497 $this->request->getHierId()
500 $this->updated = $this->pg_obj->update();
502 $ilCtrl->returnToParent($this);
static getCommandsFromClassConstants(string $guiClassName, string $cmdConstantNameBegin='CMD_')
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc
static _extractInstOfTarget(string $a_target)
Extract installation id out of target.
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static & _getSelfAssessmentQuestionTypes($all_tags=false)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
ilPropertyFormGUI $form_gui
create()
Create new question.
insertFromPool()
Insert question from ppol.
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
createQuestionPool(string $name="Dummy")
Creates a new questionpool and returns the reference id.
setSelfAssessmentMode(bool $a_selfassessmentmode)
setInsertTabs(string $a_active)
bool $ipe_for_questions_enabled
setNewQuestionId(array $a_par)
Set new question id.
insert(string $a_mode="create")
Insert new question form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
ilGlobalTemplateInterface $tpl
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTabActive(string $a_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getParentId(int $a_node_id)
get parent id of given node
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
setContent(string $a_html)
Sets content for standard template.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc