43 $this->
ctrl = $DIC->ctrl();
44 $this->
access = $DIC->access();
45 $this->tpl =
$DIC[
"tpl"];
46 $this->
tabs = $DIC->tabs();
47 $this->
lng = $DIC->language();
48 $this->
user = $DIC->user();
49 $this->tree =
$DIC->repositoryTree();
50 $this->
toolbar = $DIC->toolbar();
51 $ilCtrl =
$DIC->ctrl();
52 $this->scormlmid = $a_pg_obj->parent_id;
54 $ilCtrl->saveParameter($this, array(
"qpool_ref_id"));
67 $next_class = $ilCtrl->getNextClass($this);
69 switch ($next_class) {
72 if ($cmd !=
"insert") {
74 } elseif ($this->sub_command !=
"") {
86 $this->selfassessmentmode = $a_selfassessmentmode;
103 $lng->
txt(
"cont_new_question"),
104 $ilCtrl->getLinkTarget($this,
"insert")
108 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
111 $lng->
txt(
"cont_copy_question_from_pool"),
112 $ilCtrl->getLinkTarget($this,
"insert")
115 $ilTabs->activateSubTab($a_active);
117 $ilCtrl->setParameter($this,
"subCmd",
"");
123 public function insert(
string $a_mode =
"create"): void
138 foreach ($all_types as $k => $v) {
139 $options[$v[
"type_tag"]] = $k;
144 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
145 $this->form_gui->setTitle(
$lng->
txt(
"cont_ed_insert_pcqst"));
149 $qtype_input->setOptions($options);
150 $qtype_input->setRequired(
true);
151 $this->form_gui->addItem($qtype_input);
159 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain'),
162 $option_rte->setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_plain_info'));
163 $ri->addOption($option_rte);
166 $this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE'),
169 $option_ipe->setInfo($this->
lng->txt(
'tst_add_quest_cont_edit_mode_IPE_info'));
170 $ri->addOption($option_ipe);
174 $this->form_gui->addItem($ri);
178 $this->form_gui->addItem($hi);
181 if ($a_mode ==
"edit_empty") {
182 $this->form_gui->addCommandButton(
"edit",
$lng->
txt(
"save"));
184 $this->form_gui->addCommandButton(
"create_pcqst",
$lng->
txt(
"save"));
185 $this->form_gui->addCommandButton(
"cancelCreate",
$lng->
txt(
"cancel"));
188 $this->tpl->setContent($this->form_gui->getHTML());
197 global $ilCtrl, $ilTabs;
199 $ilTabs->setTabActive(
'question');
202 $this->content_obj->create($this->pg_obj, $this->hier_id);
204 $this->updated = $this->pg_obj->update();
206 if ($this->updated) {
207 $this->pg_obj->stripHierIDs();
208 $this->pg_obj->addHierIDs();
209 $ilCtrl->setParameter(
212 $this->request->getString(
"q_type")
214 $ilCtrl->setParameter(
216 "add_quest_cont_edit_mode",
217 $this->request->getString(
"add_quest_cont_edit_mode")
221 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
222 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
224 $ilCtrl->redirect($this,
"edit");
235 if ($a_par[
"new_id"] > 0) {
236 $this->content_obj->setQuestionReference(
"il__qst_" . $a_par[
"new_id"]);
237 $this->pg_obj->update();
253 $q_ref = $this->content_obj->getQuestionReference();
257 if (!($inst_id > 0)) {
262 $q_type = $this->request->getString(
"q_type");
263 $ilCtrl->setParameter($this,
"q_type", $q_type);
265 if ($q_id ==
"" && $q_type ==
"") {
266 $this->
insert(
"edit_empty");
271 if ($q_id < 1 && $q_type) {
275 $add_quest_cont_edit_mode = $this->request->getString(
"add_quest_cont_edit_mode");
277 && $add_quest_cont_edit_mode !=
"") {
278 $addContEditMode = $add_quest_cont_edit_mode;
282 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
285 $q_gui->object->setObjId(0);
286 $q_id = $q_gui->object->createNewQuestion(
true);
287 $this->content_obj->setQuestionReference(
"il__qst_" . $q_id);
288 $this->pg_obj->update();
291 $ilCtrl->setParameterByClass(
"ilQuestionEditGUI",
"q_id", $q_id);
292 $ilCtrl->redirectByClass(array(get_class($this->pg_obj) .
"GUI",
"ilQuestionEditGUI"),
"editQuestion");
296 $this->request->getInt(
"q_id")
298 $this->
ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class($q_gui)),
"editQuestion");
314 $q_ref = $this->content_obj->getQuestionReference();
318 if (!($inst_id > 0)) {
323 $ilCtrl->setCmdClass(
"ilquestioneditgui");
324 $ilCtrl->setCmd(
"feedback");
327 $edit_gui->setQuestionId($q_id);
330 $edit_gui->setSelfAssessmentEditingMode(
true);
332 $ret = $ilCtrl->forwardCommand($edit_gui);
333 $this->tpl->setContent($ret);
346 $qpl->setType(
"qpl");
347 $qpl->setTitle(
$name);
348 $qpl->setDescription(
"");
350 $qpl->createReference();
351 $qpl->putInTree($parent_ref);
352 $qpl->setPermissions($parent_ref);
355 return $qpl->getRefId();
370 if (!is_null($this->content_obj)) {
371 $q_ref = $this->content_obj->getQuestionReference();
376 if (!($inst_id > 0)) {
383 $ilCtrl->getLinkTarget($this,
"edit"),
384 array(
"editQuestion",
"save",
"cancel",
"addSuggestedSolution",
385 "cancelExplorer",
"linkChilds",
"removeSuggestedSolution",
386 "addPair",
"addTerm",
"delete",
"deleteTerms",
"editMode",
"upload",
387 "saveEdit",
"uploadingImage",
"uploadingImagemap",
"addArea",
388 "deletearea",
"saveShape",
"back",
"saveEdit",
"changeGapType",
"createGaps",
"addItem",
"addYesNo",
"addTrueFalse",
389 "toggleGraphicalAnswers",
"setMediaMode"),
400 $ilTabs->addTarget(
'feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(),
'');
415 if ($this->edit_repo->getQuestionPool() > 0 &&
416 $ilAccess->checkAccess(
"write",
"", $this->edit_repo->getQuestionPool())
431 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
435 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"fold",
"crs",
"qpl"));
436 $exp->setClickableTypes(array(
'qpl'));
438 if (!$exp->handleCommand()) {
447 $this->edit_repo->setQuestionPool($this->request->getInt(
"pool_ref_id"));
448 $ilCtrl->
setParameter($this,
"subCmd",
"insertFromPool");
449 $ilCtrl->redirect($this,
"insert");
459 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"cont_cp_question_diff_formats_info"));
461 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
462 $ilToolbar->addButton(
463 $lng->
txt(
"cont_select_other_qpool"),
464 $ilCtrl->getLinkTarget($this,
"insert")
466 $ilCtrl->setParameter($this,
"subCmd",
"");
470 $ilCtrl->setParameter($this,
"subCmd",
"listPoolQuestions");
474 $this->edit_repo->getQuestionPool()
485 $this->content_obj->create(
487 $this->request->getHierId()
490 $this->content_obj->copyPoolQuestionIntoPage(
491 $this->request->getInt(
"q_id"),
492 $this->request->getHierId()
495 $this->updated = $this->pg_obj->update();
497 $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 _getQuestionType(int $question_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
const CMD_SHOW
command constants
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 isAdditionalQuestionContentEditingModePageObjectEnabled()
Returns the fact wether content editing with ilias page editor is enabled for questions or not.
static & _getSelfAssessmentQuestionTypes($all_tags=false)
Get all self assessment question types.
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...
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)
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
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTabActive(string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getParentId(int $a_node_id)
get parent id of given node
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc