ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $this->addColumn($this->optionalColumns[$column]['txt'], $column);
50 }
51
52 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyAgreementByLanguageFilter'));
53
54 $this->setRowTemplate('tpl.tos_agreement_by_lng_table_row.html', 'Services/TermsOfService');
55
56 $this->setShowRowsSelector(true);
57
58 require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
59 require_once 'Services/YUI/classes/class.ilYuiUtil.php';
63
64 $this->initFilter();
65 $this->setFilterCommand('applyAgreementByLanguageFilter');
66 $this->setResetCommand('resetAgreementByLanguageFilter');
67 }
68
72 public function getSelectableColumns()
73 {
74 $cols = array('agreement_document_modification_ts' => array('txt' => $this->lng->txt('tos_last_modified'), 'default' => true));
75
76 return $cols;
77 }
78
83 protected function prepareData(array &$data)
84 {
85 foreach ($data['items'] as &$row) {
86 $row['language'] = $this->lng->txt('meta_l_' . $row['language']);
87 }
88 }
89
94 protected function prepareRow(array &$row)
95 {
96 if (is_string($row['agreement_document']) && strlen($row['agreement_document'])) {
97 $unique_id = md5($row['language']);
98
99 $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', rawurlencode($row['agreement_document']));
100 $row['content_link'] = $this->ctrl->getLinkTarget($this->getParentObject(), 'getAgreementTextByFilenameAsynch', '', true, false);
101 $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', '');
102 $row['img_down'] = ilGlyphGUI::get(ilGlyphGUI::SEARCH);
103 $row['id'] = $unique_id;
104
105 $modal = ilModalGUI::getInstance();
106 $modal->setHeading($this->lng->txt('tos_agreement_document'));
107 $modal->setType(ilModalGUI::TYPE_LARGE);
108 $modal->setId('tos_' . $unique_id);
109 $modal->setBody('');
110 $row['modal'] = $modal->getHTML();
111 } else {
112 $row['missing_agreement_css_class'] = 'warning';
113 }
114 }
115
119 protected function getStaticData()
120 {
121 return array('modal', 'id', 'language', 'agreement', 'missing_agreement_css_class', 'agreement_document', 'content_link', 'img_down', 'language_key');
122 }
123
129 protected function formatCellValue($column, array $row)
130 {
131 if ($column == 'agreement_document') {
132 if (!is_string($row[$column]) || !strlen($row[$column])) {
133 return $this->lng->txt('tos_agreement_document_missing');
134 }
135 } elseif ($column == 'agreement') {
136 if ($row[$column]) {
137 return $this->lng->txt('tos_agreement_exists');
138 } else {
139 return $this->lng->txt('tos_agreement_missing');
140 }
141 } elseif ($column == 'agreement_document_modification_ts') {
143 }
144
145 return $row[$column];
146 }
147
152 public function numericOrdering($column)
153 {
154 if ('agreement_document_modification_ts' == $column) {
155 return true;
156 }
157
158 return false;
159 }
160}
$column
Definition: 39dropdown.php:62
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
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.
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="")
ilTable2GUI constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
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, ilTemplate $a_main_tpl=null)
Init yui panel.
static initOverlay(ilTemplate $a_main_tpl=null)
Init YUI Overlay module.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
global $DIC
Definition: saml.php:7
$cols
Definition: xhr_table.php:11