ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCopySelfAssQuestionTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('./Services/Table/classes/class.ilTable2GUI.php');
5 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
6 
16 {
20  protected $ctrl;
21 
25  protected $access;
26 
30  protected $pool_ref_id;
31 
35  protected $pool_obj_id;
36 
43  public function __construct($a_parent_obj, $a_parent_cmd, $a_pool_ref_id)
44  {
45  global $DIC;
46 
47  $this->ctrl = $DIC->ctrl();
48  $this->access = $DIC->access();
49 
50  $this->setId("cont_qpl");
51  $this->pool_ref_id = $a_pool_ref_id;
52  $this->pool_obj_id = ilObject::_lookupObjId($a_pool_ref_id);
53 
54  parent::__construct($a_parent_obj, $a_parent_cmd);
55 
56  $this->setTitle(ilObject::_lookupTitle($this->pool_obj_id));
57 
58  $this->setFormName('sa_quest_browser');
59 
60  $this->addColumn($this->lng->txt("title"), 'title', '');
61  $this->addColumn($this->lng->txt("cont_question_type"), 'ttype', '');
62  $this->addColumn($this->lng->txt("actions"), '', '');
63 
64 
65  $this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage");
66 
67  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
68  $this->setDefaultOrderField("title");
69  $this->setDefaultOrderDirection("asc");
70 
71  $this->initFilter();
72 
73  $this->getQuestions();
74  }
75 
79  public function getQuestions()
80  {
81  global $DIC;
82 
84 
85  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
87  $all_ids = array();
88  foreach ($all_types as $k => $v) {
89  $all_ids[] = $v["question_type_id"];
90  }
91 
92  $questions = array();
93  if ($access->checkAccess("read", "", $this->pool_ref_id)) {
94  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
95  $questionList = new ilAssQuestionList(
96  $DIC->database(),
97  $DIC->language(),
98  $DIC["ilPluginAdmin"]
99  );
100  $questionList->setParentObjId($this->pool_obj_id);
101  $questionList->load();
102 
103  $data = $questionList->getQuestionDataArray();
104 
105  $questions = array();
106  foreach ($data as $d) {
107  // list only self assessment question types
108  if (in_array($d["question_type_fi"], $all_ids)) {
109  $questions[] = $d;
110  }
111  }
112  }
113  $this->setData($questions);
114  }
115 
121  public function fillRow($a_set)
122  {
123  $lng = $this->lng;
124  $ctrl = $this->ctrl;
125 
126  // action: copy
127  $ctrl->setParameter($this->parent_obj, "q_id", $a_set["question_id"]);
128  $ctrl->setParameter($this->parent_obj, "subCmd", "copyQuestion");
129  $this->tpl->setCurrentBlock("cmd");
130  $this->tpl->setVariable(
131  "HREF_CMD",
132  $ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
133  );
134  $this->tpl->setVariable(
135  "TXT_CMD",
136  $lng->txt("cont_copy_question_into_page")
137  );
138  $this->tpl->parseCurrentBlock();
139  $ctrl->setParameter($this->parent_obj, "subCmd", "listPoolQuestions");
140 
141  // properties
142  $this->tpl->setVariable("TITLE", $a_set["title"]);
143  $this->tpl->setVariable(
144  "TYPE",
145  assQuestion::_getQuestionTypeName($a_set["type_tag"])
146  );
147  }
148 }
initFilter()
Init filter.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _lookupTitle($a_id)
lookup object title
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static & _getSelfAssessmentQuestionTypes($all_tags=false)
Get all self assessment question types.
Class ilTable2GUI.
static _lookupObjId($a_id)
Table to select self assessment questions for copying into learning resources.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd, $a_pool_ref_id)
ilCopySelfAssQuestionTableGUI constructor.
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296