ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSurveyQuestionblockbrowserTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 
35 {
36  protected $editable = true;
37  protected $writeAccess = false;
38  protected $browsercolumns = array();
39 
47  public function __construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access = false)
48  {
49  parent::__construct($a_parent_obj, $a_parent_cmd);
50 
51  global $lng, $ilCtrl;
52 
53  $this->lng = $lng;
54  $this->ctrl = $ilCtrl;
55 
56  $this->setWriteAccess($a_write_access);
57 
58  $this->setFormName('surveyquestionblockbrowser');
59  $this->setStyle('table', 'fullwidth');
60  $this->addColumn('','f','1%');
61  $this->addColumn($this->lng->txt("title"),'title', '');
62  $this->addColumn($this->lng->txt("contains"),'contains', '');
63  $this->addColumn($this->lng->txt("obj_svy"),'svy', '');
64 
65  $this->setPrefix('cb');
66  $this->setSelectAllCheckbox('cb');
67 
68  $this->addMultiCommand('insertQuestionblocks', $this->lng->txt('insert'));
69 
70  $this->setRowTemplate("tpl.il_svy_svy_questionblockbrowser_row.html", "Modules/Survey");
71 
72  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
73  $this->setDefaultOrderField("title");
74  $this->setDefaultOrderDirection("asc");
75 
76  $this->enable('sort');
77  $this->enable('header');
78  $this->enable('select_all');
79  $this->setFilterCommand('filterQuestionblockBrowser');
80  $this->setResetCommand('resetfilterQuestionblockBrowser');
81 
82  $this->initFilter();
83  $this->initData($a_object);
84  }
85 
86  function initData($a_object)
87  {
88  $arrFilter = array();
89  foreach ($this->getFilterItems() as $item)
90  {
91  if ($item->getValue() !== false)
92  {
93  $arrFilter[$item->getPostVar()] = $item->getValue();
94  }
95  }
96  $data = $a_object->getQuestionblocksTable($arrFilter);
97 
98  $this->setData($data);
99  }
100 
104  function initFilter()
105  {
106  global $lng, $rbacreview, $ilUser;
107 
108  // title
109  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
110  $ti = new ilTextInputGUI($lng->txt("title"), "title");
111  $ti->setMaxLength(64);
112  $ti->setSize(20);
113  $ti->setValidationRegexp('/^[^%]+$/is');
114  $this->addFilterItem($ti);
115  $ti->readFromSession();
116  $this->filter["title"] = $ti->getValue();
117  }
118 
126  public function fillRow($data)
127  {
128  global $ilUser,$ilAccess;
129 
130  $this->tpl->setVariable('QUESTIONBLOCK_ID', $data["questionblock_id"]);
131  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data["title"]));
132  $this->tpl->setVariable("CONTAINS", ilUtil::prepareFormOutput($data["contains"]));
133  $this->tpl->setVariable("SVY", ilUtil::prepareFormOutput($data['svy']));
134  }
135 
136  public function setEditable($value)
137  {
138  $this->editable = $value;
139  }
140 
141  public function getEditable()
142  {
143  return $this->editable;
144  }
145 
146  public function setWriteAccess($value)
147  {
148  $this->writeAccess = $value;
149  }
150 
151  public function getWriteAccess()
152  {
153  return $this->writeAccess;
154  }
155 }
156 ?>