ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilDidacticTemplateSettingsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
13{
14
20 public function __construct($a_parent_obj, $a_parent_cmd = "")
21 {
22 parent::__construct($a_parent_obj, $a_parent_cmd);
23 $this->setId('tbl_didactic_tpl_settings');
24 }
25
29 public function init()
30 {
31 global $ilCtrl, $lng, $ilAccess;
32
33 $this->addColumn('','f','1px');
34 $lng->loadLanguageModule('search');
35 $this->addColumn($this->lng->txt('search_title_description'),'title','40%');
36 $this->addColumn($this->lng->txt('didactic_applicable_for'),'applicable','20%');
37 $this->addColumn($this->lng->txt('active'),'active','20%');
38 $this->addColumn($this->lng->txt('actions'),'','20%');
39
40 $this->setTitle($this->lng->txt('didactic_available_templates'));
41
42 if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
43 {
44 $this->addMultiCommand('activateTemplates', $this->lng->txt('activate'));
45 $this->addMultiCommand('deactivateTemplates', $this->lng->txt('deactivate'));
46 $this->addMultiCommand('confirmDelete',$this->lng->txt('delete'));
47
48 $this->setSelectAllCheckbox('tpls');
49 }
50
51
52
53 $this->setRowTemplate('tpl.didactic_template_overview_row.html','Services/DidacticTemplate');
54 $this->setDefaultOrderField('title');
55 $this->setDefaultOrderDirection('asc');
56 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
57 }
58
62 public function parse()
63 {
64 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php';
66 $tpls->readInactive();
67
68 $counter = 0;
69 foreach($tpls->getTemplates() as $tpl)
70 {
71 /* @var $tpl ilDidacticTemplateSetting */
72 $data[$counter]['id'] = $tpl->getId();
73 $data[$counter]['title'] = $tpl->getTitle();
74 $data[$counter]['description'] = $tpl->getDescription();
75 $data[$counter]['info'] = $tpl->getInfo();
76 $data[$counter]['enabled'] = (int) $tpl->isEnabled();
77 $data[$counter]['assignments'] = $tpl->getAssignments();
78
79 ++$counter;
80 }
81
82 $this->setData((array) $data);
83 }
84
89 public function fillRow($set)
90 {
91 global $ilCtrl, $ilAccess;
92
93 // @TODO: Check for system template and hide checkbox
94
95 if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
96 {
97 $this->tpl->setVariable('VAL_ID',$set['id']);
98 }
99
100 $this->tpl->setVariable('VAL_TITLE', $set['title']);
101 $this->tpl->setVariable('VAL_DESC', $set['description']);
102
103 foreach((array) explode("\n", $set['info']) as $info)
104 {
105 $trimmed_info = trim($info);
106 if($trimmed_info)
107 {
108 $this->tpl->setCurrentBlock('info');
109 $this->tpl->setVariable('VAL_INFO',$trimmed_info);
110 $this->tpl->parseCurrentBlock();
111 }
112 }
113
114
115 $this->tpl->setVariable('VAL_IMAGE',
116 $set['enabled'] ?
117 ilUtil::getImagePath('icon_ok.svg') :
118 ilUtil::getImagePath('icon_not_ok.svg')
119 );
120 $this->tpl->setVariable('VAL_ENABLED_TXT',
121 $set['enabled'] ?
122 $this->lng->txt('active') :
123 $this->lng->txt('inactive')
124 );
125
126
127 $atxt = '';
128 foreach((array) $set['assignments'] as $obj_type)
129 {
130 $atxt .= ($this->lng->txt('objs_'.$obj_type).'<br/>');
131 }
132 $this->tpl->setVariable('VAL_APPLICABLE', $atxt);
133
134 $ilCtrl->setParameterByClass(
135 get_class($this->getParentObject()),
136 'tplid',
137 $set['id']
138 );
139
140 if($ilAccess->checkAccess('write','',$_REQUEST["ref_id"]))
141 {
142 // Edit
143 $this->tpl->setCurrentBlock('action_link');
144 $this->tpl->setVariable(
145 'A_LINK',
146 $ilCtrl->getLinkTargetByClass(get_class($this->getParentObject()),'editTemplate')
147 );
148 $this->tpl->setVariable('A_TEXT',$this->lng->txt('edit'));
149 $this->tpl->parseCurrentBlock();
150
151 // Copy
152 $this->tpl->setCurrentBlock('action_link');
153 $this->tpl->setVariable(
154 'A_LINK',
155 $ilCtrl->getLinkTargetByClass(get_class($this->getParentObject()),'copyTemplate')
156 );
157 $this->tpl->setVariable('A_TEXT', $this->lng->txt('copy'));
158 $this->tpl->parseCurrentBlock();
159 }
160 // Export
161 $this->tpl->setCurrentBlock('action_link');
162 $this->tpl->setVariable(
163 'A_LINK',
164 $ilCtrl->getLinkTargetByClass(get_class($this->getParentObject()),'exportTemplate')
165 );
166 $this->tpl->setVariable('A_TEXT', $this->lng->txt('didactic_do_export'));
167 $this->tpl->parseCurrentBlock();
168 }
169}
170?>
global $tpl
Definition: ilias.php:8
Description of ilDidacticTemplateSettingsTableGUI.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
static getInstance()
Get singelton instance.
Class ilTable2GUI.
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.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$info
Definition: example_052.php:80
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7