ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
17 
25  public function __construct($a_parent_obj, $a_parent_cmd, $a_pool_ref_id)
26  {
27  global $lng, $ilCtrl;
28 
29  $this->setId("cont_qpl");
30  $this->pool_ref_id = $a_pool_ref_id;
31  $this->pool_obj_id = ilObject::_lookupObjId($a_pool_ref_id);
32 
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 
35  $this->setTitle(ilObject::_lookupTitle($this->pool_obj_id));
36 
37 // $qplSetting = new ilSetting("qpl");
38 
39  $this->setFormName('sa_quest_browser');
40 
41 // $this->addColumn('','f','1%');
42  $this->addColumn($this->lng->txt("title"),'title', '');
43  $this->addColumn($this->lng->txt("cont_question_type"),'ttype', '');
44  $this->addColumn($this->lng->txt("actions"),'', '');
45 // $this->setPrefix('q_id');
46 // $this->setSelectAllCheckbox('q_id');
47 
48 
49  $this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage");
50 
51  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
52  $this->setDefaultOrderField("title");
53  $this->setDefaultOrderDirection("asc");
54 
55 // $this->setFilterCommand('filterQuestionBrowser');
56 // $this->setResetCommand('resetQuestionBrowser');
57  $this->initFilter();
58 
59  $this->getQuestions();
60  }
61 
68  function getQuestions()
69  {
70  global $ilAccess, $ilDB, $lng, $ilPluginAdmin;
71 
72  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
74  $all_ids = array();
75  foreach ($all_types as $k => $v)
76  {
77  $all_ids[] = $v["question_type_id"];
78  }
79 
80  $questions = array();
81  if ($ilAccess->checkAccess("read", "", $this->pool_ref_id))
82  {
83  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
84  $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
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  {
93  // list only self assessment question types
94  if (in_array($d["question_type_fi"], $all_ids))
95  {
96  $questions[] = $d;
97  }
98  }
99 
100  }
101  $this->setData($questions);
102  }
103 
104 
108  function initFilter()
109  {
110  global $lng, $rbacreview, $ilUser;
111  }
112 
118  public function fillRow($a_set)
119  {
120  global $ilCtrl, $lng;
121 //var_dump($a_set);
122 
123  // action: copy
124  $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["question_id"]);
125  $ilCtrl->setParameter($this->parent_obj, "subCmd", "copyQuestion");
126  $this->tpl->setCurrentBlock("cmd");
127  $this->tpl->setVariable("HREF_CMD",
128  $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
129  $this->tpl->setVariable("TXT_CMD",
130  $lng->txt("cont_copy_question_into_page"));
131  $this->tpl->parseCurrentBlock();
132  $ilCtrl->setParameter($this->parent_obj, "subCmd", "listPoolQuestions");
133 
134  // properties
135  $this->tpl->setVariable("TITLE", $a_set["title"]);
136  $this->tpl->setVariable("TYPE",
137  assQuestion::_getQuestionTypeName($a_set["type_tag"]));
138 
139  }
140 
141 }
142 ?>
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
for($col=0; $col< 50; $col++) $d
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
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)
Constructor.
setFormName($a_formname="")
Set Form name.
global $lng
Definition: privfeed.php:17
static & _getSelfAssessmentQuestionTypes($all_tags=FALSE)
Get all self assessment question types.
global $ilDB
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.