ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
34  $this->pool = new ilObjQuestionPool($a_pool_ref_id);
35 
36  parent::__construct($a_parent_obj, $a_parent_cmd);
37 
38  $this->setTitle(ilObject::_lookupTitle($this->pool_obj_id));
39 
40 // $qplSetting = new ilSetting("qpl");
41 
42  $this->setFormName('sa_quest_browser');
43 
44 // $this->addColumn('','f','1%');
45  $this->addColumn($this->lng->txt("title"),'title', '');
46  $this->addColumn($this->lng->txt("cont_question_type"),'ttype', '');
47  $this->addColumn($this->lng->txt("actions"),'', '');
48 // $this->setPrefix('q_id');
49 // $this->setSelectAllCheckbox('q_id');
50 
51 
52  $this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage");
53 
54  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
55  $this->setDefaultOrderField("title");
56  $this->setDefaultOrderDirection("asc");
57 
58 // $this->setFilterCommand('filterQuestionBrowser');
59 // $this->setResetCommand('resetQuestionBrowser');
60  $this->initFilter();
61 
62  $this->getQuestions();
63  }
64 
71  function getQuestions()
72  {
73  global $ilAccess;
74 
75  $filter = array();
76 
77  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
79  $all_ids = array();
80  foreach ($all_types as $k => $v)
81  {
82  $all_ids[] = $v["question_type_id"];
83  }
84 
85  $questions = array();
86  if ($ilAccess->checkAccess("read", "", $this->pool_ref_id))
87  {
88  $data = $this->pool->getQuestionBrowserData($filter);
89  $questions = array();
90  foreach ($data as $d)
91  {
92  // list only self assessment question types
93  if (in_array($d["question_type_fi"], $all_ids))
94  {
95  $questions[] = $d;
96  }
97  }
98 
99  }
100  $this->setData($questions);
101  }
102 
103 
107  function initFilter()
108  {
109  global $lng, $rbacreview, $ilUser;
110  }
111 
117  public function fillRow($a_set)
118  {
119  global $ilCtrl, $lng;
120 //var_dump($a_set);
121 
122  // action: copy
123  $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["question_id"]);
124  $ilCtrl->setParameter($this->parent_obj, "subCmd", "copyQuestion");
125  $this->tpl->setCurrentBlock("cmd");
126  $this->tpl->setVariable("HREF_CMD",
127  $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
128  $this->tpl->setVariable("TXT_CMD",
129  $lng->txt("cont_copy_question_into_page"));
130  $this->tpl->parseCurrentBlock();
131  $ilCtrl->setParameter($this->parent_obj, "subCmd", "listPoolQuestions");
132 
133  // properties
134  $this->tpl->setVariable("TITLE", $a_set["title"]);
135  $this->tpl->setVariable("TYPE",
136  assQuestion::_getQuestionTypeName($a_set["type_tag"]));
137 
138  }
139 
140 }
141 ?>