44 $this->
ctrl = $DIC->ctrl();
45 $this->
access = $DIC->access();
46 $this->tpl = $DIC[
"tpl"];
47 $this->
tabs = $DIC->tabs();
48 $this->
lng = $DIC->language();
49 $this->
user = $DIC->user();
50 $this->tree = $DIC->repositoryTree();
51 $this->
toolbar = $DIC->toolbar();
52 $ilCtrl = $DIC->ctrl();
53 $this->scormlmid = $a_pg_obj->parent_id;
54 $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
56 $ilCtrl->saveParameter($this, array(
"qpool_ref_id"));
69 $next_class = $ilCtrl->getNextClass($this);
71 switch ($next_class) {
74 if ($cmd !=
"insert") {
76 } elseif ($this->sub_command !=
"") {
88 $this->selfassessmentmode = $a_selfassessmentmode;
105 $lng->
txt(
"cont_new_question"),
106 $ilCtrl->getLinkTarget($this,
"insert")
110 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
113 $lng->
txt(
"cont_copy_question_from_pool"),
114 $ilCtrl->getLinkTarget($this,
"insert")
117 $ilTabs->activateSubTab($a_active);
119 $ilCtrl->setParameter($this,
"subCmd",
"");
125 public function insert(
string $a_mode =
"create"): void
140 foreach ($all_types as $k => $v) {
141 $options[$v[
"type_tag"]] = $k;
146 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
147 $this->form_gui->setTitle(
$lng->
txt(
"cont_ed_insert_pcqst"));
152 $qtype_input->setRequired(
true);
153 $this->form_gui->addItem($qtype_input);
161 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain'),
164 $option_rte->
setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain_info'));
165 $ri->addOption($option_rte);
168 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
171 $option_ipe->
setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
172 $ri->addOption($option_ipe);
176 $this->form_gui->addItem($ri);
180 $this->form_gui->addItem($hi);
183 if ($a_mode ==
"edit_empty") {
184 $this->form_gui->addCommandButton(
"edit",
$lng->
txt(
"save"));
186 $this->form_gui->addCommandButton(
"create_pcqst",
$lng->
txt(
"save"));
187 $this->form_gui->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
190 $this->tpl->setContent($this->form_gui->getHTML());
199 global $ilCtrl, $ilTabs;
201 $ilTabs->setTabActive(
'question');
204 $this->content_obj->create($this->pg_obj, $this->hier_id);
206 $this->updated = $this->pg_obj->update();
208 if ($this->updated) {
209 $this->pg_obj->stripHierIDs();
210 $this->pg_obj->addHierIDs();
211 $ilCtrl->setParameter(
214 $this->request->getString(
"q_type")
216 $ilCtrl->setParameter(
218 "add_quest_cont_edit_mode",
219 $this->request->getString(
"add_quest_cont_edit_mode")
223 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
224 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
226 $ilCtrl->redirect($this,
"edit");
237 if ($a_par[
"new_id"] > 0) {
238 $this->content_obj->setQuestionReference(
"il__qst_" . $a_par[
"new_id"]);
239 $this->pg_obj->update();
255 $q_ref = $this->content_obj->getQuestionReference();
259 if (!($inst_id > 0)) {
264 $q_type = $this->request->getString(
"q_type");
265 $ilCtrl->setParameter($this,
"q_type", $q_type);
267 if ($q_id ==
"" && $q_type ==
"") {
268 $this->
insert(
"edit_empty");
273 if ($q_id < 1 && $q_type) {
277 $add_quest_cont_edit_mode = $this->request->getString(
"add_quest_cont_edit_mode");
279 && $add_quest_cont_edit_mode !=
"") {
280 $addContEditMode = $add_quest_cont_edit_mode;
284 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
287 $q_gui->object->setObjId(0);
288 $q_id = $q_gui->object->createNewQuestion(
true);
289 $this->content_obj->setQuestionReference(
"il__qst_" . $q_id);
290 $this->pg_obj->update();
293 $ilCtrl->setParameterByClass(
"ilQuestionEditGUI",
"q_id", $q_id);
294 $ilCtrl->redirectByClass(array(get_class($this->pg_obj) .
"GUI",
"ilQuestionEditGUI"),
"editQuestion");
298 $this->request->getInt(
"q_id")
300 $this->
ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class($q_gui)),
"editQuestion");
316 $q_ref = $this->content_obj->getQuestionReference();
320 if (!($inst_id > 0)) {
325 $ilCtrl->setCmdClass(
"ilquestioneditgui");
326 $ilCtrl->setCmd(
"feedback");
329 $edit_gui->setQuestionId($q_id);
332 $edit_gui->setSelfAssessmentEditingMode(
true);
334 $ret = $ilCtrl->forwardCommand($edit_gui);
335 $this->tpl->setContent($ret);
346 $parent_ref = $tree->
getParentId($this->requested_ref_id);
348 $qpl->setType(
"qpl");
349 $qpl->setTitle($name);
350 $qpl->setDescription(
"");
352 $qpl->createReference();
353 $qpl->putInTree($parent_ref);
354 $qpl->setPermissions($parent_ref);
357 return $qpl->getRefId();
372 if (!is_null($this->content_obj)) {
373 $q_ref = $this->content_obj->getQuestionReference();
378 if (!($inst_id > 0)) {
385 $ilCtrl->getLinkTarget($this,
"edit"),
386 array(
"editQuestion",
"save",
"cancel",
"addSuggestedSolution",
387 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
388 "addPair",
"addTerm",
"delete",
"deleteTerms",
"editMode",
"upload",
389 "saveEdit",
"uploadingImage",
"uploadingImagemap",
"addArea",
390 "deletearea",
"saveShape",
"back",
"saveEdit",
"changeGapType",
"createGaps",
"addItem",
"addYesNo",
"addTrueFalse",
391 "toggleGraphicalAnswers",
"setMediaMode"),
396 if ($this->questioninfo->getQuestionType($q_id) !=
"assTextQuestion") {
402 $ilTabs->addTarget(
'feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
417 if ($this->edit_repo->getQuestionPool() > 0 &&
418 $ilAccess->checkAccess(
"write",
"", $this->edit_repo->getQuestionPool())
433 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
437 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"fold",
"crs",
"qpl"));
438 $exp->setClickableTypes(array(
'qpl'));
440 if (!$exp->handleCommand()) {
449 $this->edit_repo->setQuestionPool($this->request->getInt(
"pool_ref_id"));
450 $ilCtrl->
setParameter($this,
"subCmd",
"insertFromPool");
451 $ilCtrl->redirect($this,
"insert");
461 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_cp_question_diff_formats_info"));
463 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
464 $ilToolbar->addButton(
465 $lng->
txt(
"cont_select_other_qpool"),
466 $ilCtrl->getLinkTarget($this,
"insert")
468 $ilCtrl->setParameter($this,
"subCmd",
"");
472 $ilCtrl->setParameter($this,
"subCmd",
"listPoolQuestions");
476 $this->edit_repo->getQuestionPool()
487 $this->content_obj->create(
489 $this->request->getHierId()
492 $this->content_obj->copyPoolQuestionIntoPage(
493 $this->request->getInt(
"q_id"),
494 $this->request->getHierId()
497 $this->updated = $this->pg_obj->update();
499 $ilCtrl->returnToParent($this);
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInsertTabs(string $a_active)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
createQuestionPool(string $name="Dummy")
Creates a new questionpool and returns the reference id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 _extractObjIdOfTarget(string $a_target)
Extract object id out of target.
setNewQuestionId(array $a_par)
Set new question id.
getCmd(string $fallback_command=null)
create()
Create new question.
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
Content object of ilPageObject (see ILIAS DTD).
const CMD_SHOW
command constants
setTabActive(string $a_id)
static _lookupObjId(int $ref_id)
static _extractInstOfTarget(string $a_target)
Extract installation id out of target.
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSelfAssessmentMode(bool $a_selfassessmentmode)
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
static & _getSelfAssessmentQuestionTypes($all_tags=false)
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
ilGlobalTemplateInterface $tpl
getParentId(int $a_node_id)
get parent id of given node
ILIAS TestQuestionPool QuestionInfoService $questioninfo
Table to select self assessment questions for copying into learning resources.
insertFromPool()
Insert question from ppol.
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not...
insert(string $a_mode="create")
Insert new question form.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
static _lookupType(int $id, bool $reference=false)
ilPropertyFormGUI $form_gui
static getCommandsFromClassConstants(string $guiClassName, string $cmdConstantNameBegin='CMD_')
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)