ILIAS  Release_4_4_x_branch Revision 61816
 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  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, $this->pool_obj_id);
85  $questionList->load();
86 
87  $data = $questionList->getQuestionDataArray();
88 
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 ?>