ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  protected $ctrl;
40 
44  protected $access;
45 
49  protected $rbacsystem;
50 
54  public function __construct($a_temp_type, $a_parent_obj, $a_parent_cmd, $a_style_obj)
55  {
56  global $DIC;
57 
58  $this->ctrl = $DIC->ctrl();
59  $this->lng = $DIC->language();
60  $this->access = $DIC->access();
61  $this->rbacsystem = $DIC->rbac()->system();
62  $ilCtrl = $DIC->ctrl();
63  $lng = $DIC->language();
64 
65  parent::__construct($a_parent_obj, $a_parent_cmd);
66 
67 
68  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
70 
71  $this->setTitle($lng->txt("sty_templates"));
72  $this->style_obj = $a_style_obj;
73  $this->temp_type = $a_temp_type;
74 
75  $this->addColumn("", "", "1"); // checkbox
76  $this->addColumn($this->lng->txt("sty_template_name"), "");
77  $this->addColumn($this->lng->txt("sty_preview"), "");
78  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
79  $this->setEnableHeader(true);
80  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
81  $this->setRowTemplate("tpl.style_template_row.html", "Services/Style/Content");
82  $this->getItems();
83 
84  // action commands
85  if ($this->parent_obj->checkWrite()) {
86  $this->addMultiCommand("deleteTemplateConfirmation", $lng->txt("delete"));
87  }
88 
89  $this->setEnableTitle(true);
90  }
91 
95  public function getItems()
96  {
97  $this->setData($this->style_obj->getTemplates($this->temp_type));
98  }
99 
103  protected function fillRow($a_set)
104  {
105  $lng = $this->lng;
107 
108  $this->tpl->setVariable(
109  "T_PREVIEW",
110  $this->style_obj->lookupTemplatePreview($a_set["id"])
111  );
112  $this->tpl->setVariable("TID", $a_set["id"]);
113  $this->tpl->setVariable("TEMPLATE_NAME", $a_set["name"]);
114  $ilCtrl->setParameter($this->parent_obj, "t_id", $a_set["id"]);
115 
116  if ($this->parent_obj->checkWrite()) {
117  $this->tpl->setVariable(
118  "LINK_EDIT_TEMPLATE",
119  $ilCtrl->getLinkTarget($this->parent_obj, "editTemplate")
120  );
121  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
122  }
123  }
124 }
global $DIC
Definition: saml.php:7
getItems()
Get items of current folder.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct($a_temp_type, $a_parent_obj, $a_parent_cmd, $a_style_obj)
Constructor.
Class ilTable2GUI.
static addCss()
Add required css.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.