ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTermsOfServiceAgreementByLanguageTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceTableGUI.php';
5require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
6require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
7
13{
17 protected $ctrl;
18
23 public function __construct(ilObjectGUI $a_parent_obj, $a_parent_cmd)
24 {
28 global $DIC;
29
30 $this->ctrl = $DIC['ilCtrl'];
31
32 $this->setId('tos_agreement_by_lng');
33
34 $this->setDefaultOrderDirection('ASC');
35 $this->setDefaultOrderField('language');
36 $this->setExternalSorting(false);
37 $this->setExternalSegmentation(false);
38
39 parent::__construct($a_parent_obj, $a_parent_cmd);
40
41 $this->setTitle($this->lng->txt('tos_agreement_by_lng'));
42
43 $this->addColumn($this->lng->txt('language'), 'language');
44 $this->addColumn($this->lng->txt('tos_agreement'), 'agreement');
45 $this->addColumn($this->lng->txt('tos_agreement_document'), 'agreement_document');
46 $this->optionalColumns = (array)$this->getSelectableColumns();
47 $this->visibleOptionalColumns = (array)$this->getSelectedColumns();
48 foreach($this->visibleOptionalColumns as $column)
49 {
50 $this->addColumn($this->optionalColumns[$column]['txt'], $column);
51 }
52
53 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyAgreementByLanguageFilter'));
54
55 $this->setRowTemplate('tpl.tos_agreement_by_lng_table_row.html', 'Services/TermsOfService');
56
57 $this->setShowRowsSelector(true);
58
59 require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
60 require_once 'Services/YUI/classes/class.ilYuiUtil.php';
64
65 $this->initFilter();
66 $this->setFilterCommand('applyAgreementByLanguageFilter');
67 $this->setResetCommand('resetAgreementByLanguageFilter');
68 }
69
73 public function getSelectableColumns()
74 {
75 $cols = array('agreement_document_modification_ts' => array('txt' => $this->lng->txt('tos_last_modified'), 'default' => true));
76
77 return $cols;
78 }
79
84 protected function prepareData(array &$data)
85 {
86 foreach($data['items'] as &$row)
87 {
88 $row['language'] = $this->lng->txt('meta_l_' . $row['language']);
89 }
90 }
91
96 protected function prepareRow(array &$row)
97 {
98 if(is_string($row['agreement_document']) && strlen($row['agreement_document']))
99 {
100 $unique_id = md5($row['language']);
101
102 $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', rawurlencode($row['agreement_document']));
103 $row['content_link'] = $this->ctrl->getLinkTarget($this->getParentObject(), 'getAgreementTextByFilenameAsynch', '', true, false);
104 $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', '');
105 $row['img_down'] = ilGlyphGUI::get(ilGlyphGUI::SEARCH);
106 $row['id'] = $unique_id;
107
108 $modal = ilModalGUI::getInstance();
109 $modal->setHeading($this->lng->txt('tos_agreement_document'));
110 $modal->setType(ilModalGUI::TYPE_LARGE);
111 $modal->setId('tos_' . $unique_id);
112 $modal->setBody('');
113 $row['modal'] = $modal->getHTML();
114 }
115 else
116 {
117 $row['missing_agreement_css_class'] = 'warning';
118 }
119 }
120
124 protected function getStaticData()
125 {
126 return array('modal', 'id', 'language', 'agreement', 'missing_agreement_css_class', 'agreement_document', 'content_link', 'img_down', 'language_key');
127 }
128
134 protected function formatCellValue($column, array $row)
135 {
136 if($column == 'agreement_document')
137 {
138 if(!is_string($row[$column]) || !strlen($row[$column]))
139 {
140 return $this->lng->txt('tos_agreement_document_missing');
141 }
142 }
143 else if($column == 'agreement')
144 {
145 if($row[$column])
146 {
147 return $this->lng->txt('tos_agreement_exists');
148 }
149 else
150 {
151 return $this->lng->txt('tos_agreement_missing');
152 }
153 }
154 else if($column == 'agreement_document_modification_ts')
155 {
157 }
158
159 return $row[$column];
160 }
161
166 public function numericOrdering($column)
167 {
168 if('agreement_document_modification_ts' == $column)
169 {
170 return true;
171 }
172
173 return false;
174 }
175}
$column
Definition: 39dropdown.php:62
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static get($a_glyph, $a_text="")
Get glyph html.
static getInstance()
Get instance.
Class ilObjectGUI Basic methods of all Output classes.
getSelectedColumns()
Get selected columns.
setExternalSorting($a_val)
Set external sorting.
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
initFilter()
Init filter.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
static initPanel($a_resize=false)
Init yui panel.
static initOverlay()
Init YUI Overlay module.
static initjQuery($a_tpl=null)
Init jQuery.
global $DIC