ILIAS  release_8 Revision v8.24
class.ilCopySelfAssQuestionTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
26 protected int $pool_ref_id;
27 protected int $pool_obj_id;
28
29 public function __construct(
30 object $a_parent_obj,
31 string $a_parent_cmd,
32 int $a_pool_ref_id
33 ) {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->access = $DIC->access();
38
39 $this->setId("cont_qpl");
40 $this->pool_ref_id = $a_pool_ref_id;
41 $this->pool_obj_id = ilObject::_lookupObjId($a_pool_ref_id);
42
43 parent::__construct($a_parent_obj, $a_parent_cmd);
44
45 $this->setTitle(ilObject::_lookupTitle($this->pool_obj_id));
46
47 $this->setFormName('sa_quest_browser');
48
49 $this->addColumn($this->lng->txt("title"), 'title', '');
50 $this->addColumn($this->lng->txt("cont_question_type"), 'ttype', '');
51 $this->addColumn($this->lng->txt("actions"), '', '');
52
53
54 $this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage");
55
56 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
57 $this->setDefaultOrderField("title");
58 $this->setDefaultOrderDirection("asc");
59
60 $this->initFilter();
61
62 $this->getQuestions();
63 }
64
65 public function getQuestions(): void
66 {
67 global $DIC;
68
70
72 $all_ids = array();
73 foreach ($all_types as $k => $v) {
74 $all_ids[] = $v["question_type_id"];
75 }
76
77 $questions = array();
78 if ($access->checkAccess("read", "", $this->pool_ref_id)) {
79 $questionList = new ilAssQuestionList(
80 $DIC->database(),
81 $DIC->language(),
82 $DIC['refinery'],
83 $DIC["component.repository"]
84 );
85 $questionList->setParentObjId($this->pool_obj_id);
86 $questionList->load();
87
88 $data = $questionList->getQuestionDataArray();
89
90 $questions = array();
91 foreach ($data as $d) {
92 // list only self assessment question types
93 if (in_array($d["question_type_fi"], $all_ids)) {
94 $questions[] = $d;
95 }
96 }
97 }
98 $this->setData($questions);
99 }
100
101 protected function fillRow(array $a_set): void
102 {
105
106 // action: copy
107 $ctrl->setParameter($this->parent_obj, "q_id", $a_set["question_id"]);
108 $ctrl->setParameter($this->parent_obj, "subCmd", "copyQuestion");
109 $this->tpl->setCurrentBlock("cmd");
110 $this->tpl->setVariable(
111 "HREF_CMD",
112 $ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
113 );
114 $this->tpl->setVariable(
115 "TXT_CMD",
116 $lng->txt("cont_copy_question_into_page")
117 );
118 $this->tpl->parseCurrentBlock();
119 $ctrl->setParameter($this->parent_obj, "subCmd", "listPoolQuestions");
120
121 // properties
122 $this->tpl->setVariable("TITLE", $a_set["title"]);
123 $this->tpl->setVariable(
124 "TYPE",
125 assQuestion::_getQuestionTypeName($a_set["type_tag"])
126 );
127 }
128}
static _getQuestionTypeName($type_tag)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, int $a_pool_ref_id)
fillRow(array $a_set)
Standard Version of Fill Row.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
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)
Get all self assessment question types.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFormName(string $a_name="")
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
ilLanguage $lng
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc