ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTableTemplatesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 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 {
39  function __construct($a_temp_type, $a_parent_obj, $a_parent_cmd, $a_style_obj)
40  {
41  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44 
45 
46  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
48 
49  $this->setTitle($lng->txt("sty_templates"));
50  $this->style_obj = $a_style_obj;
51  $this->temp_type = $a_temp_type;
52 
53  $this->addColumn("", "", "1"); // checkbox
54  $this->addColumn($this->lng->txt("sty_template_name"), "");
55  $this->addColumn($this->lng->txt("sty_preview"), "");
56  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
57  $this->setEnableHeader(true);
58  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
59  $this->setRowTemplate("tpl.style_template_row.html", "Services/Style");
60  //$this->setSelectAllCheckbox("file");
61  $this->getItems();
62 
63  // action commands
64  if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
65  {
66  $this->addMultiCommand("deleteTemplateConfirmation", $lng->txt("delete"));
67 
68  if ($a_temp_type == "table")
69  {
70  $this->addCommandButton("generateTemplate", $this->lng->txt("sty_generate_template"));
71  }
72  $this->addCommandButton("addTemplate", $this->lng->txt("sty_add_template"));
73  }
74 
75  $this->setEnableTitle(true);
76  }
77 
81  function getItems()
82  {
83  $this->setData($this->style_obj->getTemplates($this->temp_type));
84  }
85 
89  protected function fillRow($a_set)
90  {
91  global $lng, $ilCtrl, $ilAccess, $rbacsystem;
92 
93  $this->tpl->setVariable("T_PREVIEW",
94  $this->style_obj->lookupTemplatePreview($a_set["id"]));
95  $this->tpl->setVariable("TID", $a_set["id"]);
96  $this->tpl->setVariable("TEMPLATE_NAME", $a_set["name"]);
97  $ilCtrl->setParameter($this->parent_obj, "t_id", $a_set["id"]);
98 
99  if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
100  {
101  $this->tpl->setVariable("LINK_EDIT_TEMPLATE",
102  $ilCtrl->getLinkTarget($this->parent_obj, "editTemplate"));
103  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
104  }
105  }
106 }
107 ?>