ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMailTemplateTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
6require_once 'Services/Mail/classes/class.ilMailTemplateService.php';
7
13{
17 protected $ctrl;
18
22 protected $contexts = array();
23
28 public function __construct($a_parent_obj, $a_parent_cmd)
29 {
33 global $ilCtrl;
34
35 $this->ctrl = $ilCtrl;
36
37 $this->setId('mail_man_tpl');
38 parent::__construct($a_parent_obj, $a_parent_cmd);
39
40 $this->setTitle($this->lng->txt('mail_templates'));
41 $this->setDefaultOrderDirection('ASC');
42 $this->setDefaultOrderField('title');
43
44 $this->addColumn('', '', '1%', true);
45 $this->addColumn($this->lng->txt('title'), 'title', '30%');
46 $this->addColumn($this->lng->txt('mail_template_context'), 'context', '20%');
47 /*$this->addColumn($this->lng->txt('language'), 'lang', '20%');*/
48 $this->addColumn($this->lng->txt('action'), '', '10%');
49
50 $this->setRowTemplate('tpl.mail_template_row.html', 'Services/Mail');
51 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
52
53 $this->setSelectAllCheckbox('tpl_id');
54 $this->addMultiCommand('confirmDeleteTemplate', $this->lng->txt('delete'));
55
57 }
58
64 protected function formatCellValue($column, array $row)
65 {
66 if($column == 'tpl_id')
67 {
68 return ilUtil::formCheckbox(false, 'tpl_id[]', $row[$column]);
69 }
70 else if($column == 'lang')
71 {
72 return $this->lng->txt('meta_l_' . $row[$column]);
73 }
74 else if($column == 'context')
75 {
76 if(isset($this->contexts[$row[$column]]))
77 {
78 return $this->contexts[$row[$column]]->getTitle();
79 }
80 else
81 {
82 return $this->lng->txt('mail_template_orphaned_context');
83 }
84 }
85
86 return $row[$column];
87 }
88
92 protected function fillRow($row)
93 {
94 foreach($row as $column => $value)
95 {
96 $value = $this->formatCellValue($column, $row);
97 $this->tpl->setVariable('VAL_' . strtoupper($column), $value);
98 }
99
100 $this->ctrl->setParameter($this->getParentObject(), 'tpl_id', $row['tpl_id']);
101 $actions = new ilAdvancedSelectionListGUI();
102 $actions->setListTitle($this->lng->txt('actions'));
103 $actions->setId('act_' . $row['tpl_id']);
104 if(count($this->contexts))
105 {
106 $actions->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTarget($this->parent_obj, 'showEditTemplateForm'));
107 }
108 $actions->addItem($this->lng->txt('delete'), '', $this->ctrl->getLinkTarget($this->parent_obj, 'confirmDeleteTemplate'));
109 $this->tpl->setVariable('VAL_ACTION', $actions->getHTML());
110 $this->ctrl->clearParameters($this->getParentObject());
111 }
112}
$column
Definition: 39dropdown.php:62
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getTemplateContexts($a_id=null)
Returns an array of mail template contexts, the key of each entry matches its id.
Class ilMailTemplateTableGUI.
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.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
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 formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
global $ilCtrl
Definition: ilias.php:18