|
1
|
|
|
<?php |
|
2
|
|
|
/************************************************************************ |
|
3
|
|
|
* OVIDENTIA http://www.ovidentia.org * |
|
4
|
|
|
************************************************************************ |
|
5
|
|
|
* Copyright (c) 2003 by CANTICO ( http://www.cantico.fr ) * |
|
6
|
|
|
* * |
|
7
|
|
|
* This file is part of Ovidentia. * |
|
8
|
|
|
* * |
|
9
|
|
|
* Ovidentia is free software; you can redistribute it and/or modify * |
|
10
|
|
|
* it under the terms of the GNU General Public License as published by * |
|
11
|
|
|
* the Free Software Foundation; either version 2, or (at your option) * |
|
12
|
|
|
* any later version. * |
|
13
|
|
|
* * |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, but * |
|
15
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of * |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
|
17
|
|
|
* See the GNU General Public License for more details. * |
|
18
|
|
|
* * |
|
19
|
|
|
* You should have received a copy of the GNU General Public License * |
|
20
|
|
|
* along with this program; if not, write to the Free Software * |
|
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,* |
|
22
|
|
|
* USA. * |
|
23
|
|
|
************************************************************************/ |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
require_once dirname(__FILE__).'/xls.class.php'; |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
class absences_AgentXls extends absences_Xls |
|
34
|
|
|
{ |
|
35
|
|
|
/** |
|
36
|
|
|
* |
|
37
|
|
|
* @var absences_Agent |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $agent; |
|
40
|
|
|
|
|
41
|
|
|
public function __construct(absences_Agent $agent) |
|
42
|
|
|
{ |
|
43
|
|
|
parent::__construct($agent->getName()); |
|
44
|
|
|
$this->agent = $agent; |
|
45
|
|
|
|
|
46
|
|
|
$this->addRightsWorksheet(); |
|
47
|
|
|
$this->addRequestsWorksheet(); |
|
48
|
|
|
|
|
49
|
|
|
$this->workbook->close(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function addRightsWorksheet() |
|
57
|
|
|
{ |
|
58
|
|
|
$ee = bab_functionality::get('ExcelExport'); |
|
59
|
|
|
/* @var $ee Func_ExcelExport */ |
|
60
|
|
|
|
|
61
|
|
|
$worksheet = $this->workbook->addWorksheet(absences_translate('Vacation rights')); |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
$col = 0; |
|
64
|
|
|
$worksheet->setColumn($col, $col++, 30); // description |
|
|
|
|
|
|
65
|
|
|
$worksheet->setColumn($col, $col++, 25); // type |
|
|
|
|
|
|
66
|
|
|
$worksheet->setColumn($col, $col++, 15); // quantity |
|
|
|
|
|
|
67
|
|
|
$worksheet->setColumn($col, $col++, 15); // consumed |
|
|
|
|
|
|
68
|
|
|
$worksheet->setColumn($col, $col++, 15); // waiting |
|
|
|
|
|
|
69
|
|
|
$worksheet->setColumn($col, $col++, 15); // balance |
|
|
|
|
|
|
70
|
|
|
$worksheet->setColumn($col, $col++, 15); // begin |
|
|
|
|
|
|
71
|
|
|
$worksheet->setColumn($col, $col++, 15); // end |
|
|
|
|
|
|
72
|
|
|
$worksheet->setColumn($col, $col++, 10); // Accessible |
|
|
|
|
|
|
73
|
|
|
|
|
74
|
|
|
$header = $this->header; |
|
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
|
|
77
|
|
|
$row =0; |
|
78
|
|
|
$col =0; |
|
79
|
|
|
$worksheet->write($row, $col++, $this->agent->getName()); |
|
80
|
|
|
$row++; |
|
81
|
|
|
|
|
82
|
|
|
$col =0; |
|
83
|
|
|
$worksheet->write($row, $col++, absences_translate('Description') , $header); |
|
84
|
|
|
$worksheet->write($row, $col++, absences_translate('Type') , $header); |
|
85
|
|
|
$worksheet->write($row, $col++, absences_translate('Initial quantity') , $header); |
|
86
|
|
|
$worksheet->write($row, $col++, absences_translate('Consumed') , $header); |
|
87
|
|
|
$worksheet->write($row, $col++, absences_translate('Waiting approval') , $header); |
|
88
|
|
|
$worksheet->write($row, $col++, absences_translate('Balance') , $header); |
|
89
|
|
|
$worksheet->write($row, $col++, absences_translate('Begin date') , $header); |
|
90
|
|
|
$worksheet->write($row, $col++, absences_translate('End date') , $header); |
|
91
|
|
|
$worksheet->write($row, $col++, absences_translate('Accessible') , $header); |
|
92
|
|
|
|
|
93
|
|
|
$row++; |
|
94
|
|
|
foreach($this->agent->getAgentRightManagerIterator() as $agentRight) { |
|
95
|
|
|
$col =0; |
|
96
|
|
|
|
|
97
|
|
|
/*@var $agentRight absences_AgentRight */ |
|
98
|
|
|
|
|
99
|
|
|
$right = $agentRight->getRight(); |
|
100
|
|
|
|
|
101
|
|
|
$accessible = $agentRight->isAccessibleByValidityPeriod() |
|
102
|
|
|
&& $agentRight->isAccessibleOnPeriod(time(), time()) |
|
103
|
|
|
&& $agentRight->isAcessibleByDirectoryEntry() |
|
104
|
|
|
&& $right->isAccessibleIfFixed(); |
|
105
|
|
|
|
|
106
|
|
|
$worksheet->writeString($row, $col++, $right->description); |
|
|
|
|
|
|
107
|
|
|
$worksheet->writeString($row, $col++, $right->getType()->name); |
|
|
|
|
|
|
108
|
|
|
$worksheet->writeNumber($row, $col++, $agentRight->getQuantity(), $this->quantity); |
|
|
|
|
|
|
109
|
|
|
$worksheet->writeNumber($row, $col++, $agentRight->getConfirmedQuantity(), $this->quantity); |
|
|
|
|
|
|
110
|
|
|
$worksheet->writeNumber($row, $col++, $agentRight->getWaitingQuantity(), $this->quantity); |
|
|
|
|
|
|
111
|
|
|
$worksheet->writeNumber($row, $col++, $agentRight->getBalance(), $this->quantity); |
|
|
|
|
|
|
112
|
|
|
$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($right->date_begin)), $this->date); |
|
|
|
|
|
|
113
|
|
|
$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($right->date_end)), $this->date); |
|
114
|
|
|
$worksheet->write($row, $col++, $accessible ? '1':'0'); |
|
115
|
|
|
|
|
116
|
|
|
$row++; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
protected function addRequestsWorksheet() |
|
123
|
|
|
{ |
|
124
|
|
|
$ee = bab_functionality::get('ExcelExport'); |
|
125
|
|
|
/*@var $ee Func_ExcelExport */ |
|
126
|
|
|
|
|
127
|
|
|
$worksheet = $this->workbook->addWorksheet(absences_translate('User requests')); |
|
|
|
|
|
|
128
|
|
|
|
|
129
|
|
|
$row =0; |
|
130
|
|
|
$col =0; |
|
131
|
|
|
$worksheet->write($row, $col++, $this->agent->getName()); |
|
132
|
|
|
$row++; |
|
133
|
|
|
|
|
134
|
|
|
$col = 0; |
|
135
|
|
|
$worksheet->setColumn($col, $col++, 20); // createdOn |
|
|
|
|
|
|
136
|
|
|
$worksheet->setColumn($col, $col++, 40); // type |
|
|
|
|
|
|
137
|
|
|
$worksheet->setColumn($col, $col++, 20); // begin |
|
|
|
|
|
|
138
|
|
|
$worksheet->setColumn($col, $col++, 20); // end |
|
|
|
|
|
|
139
|
|
|
$worksheet->setColumn($col, $col++, 50); // status |
|
|
|
|
|
|
140
|
|
|
|
|
141
|
|
|
|
|
142
|
|
|
$header = $this->header; |
|
143
|
|
|
|
|
144
|
|
|
|
|
145
|
|
|
$col =0; |
|
146
|
|
|
$worksheet->write($row, $col++, absences_translate('Created on') , $header); |
|
147
|
|
|
$worksheet->write($row, $col++, absences_translate('Type') , $header); |
|
148
|
|
|
$worksheet->write($row, $col++, absences_translate('Start date') , $header); |
|
149
|
|
|
$worksheet->write($row, $col++, absences_translate('End date') , $header); |
|
150
|
|
|
$worksheet->write($row, $col++, absences_translate('Status') , $header); |
|
151
|
|
|
|
|
152
|
|
|
$row++; |
|
153
|
|
|
foreach($this->agent->getRequestIterator() as $request) { |
|
154
|
|
|
$col =0; |
|
155
|
|
|
|
|
156
|
|
|
/*@var $request absences_Request */ |
|
157
|
|
|
|
|
158
|
|
|
$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->createdOn())), $this->datetime); |
|
|
|
|
|
|
159
|
|
|
$worksheet->writeString($row, $col++, $request->getRequestType()); |
|
|
|
|
|
|
160
|
|
|
|
|
161
|
|
|
if ($request instanceof absences_CetDepositRequest) |
|
162
|
|
|
{ |
|
163
|
|
|
$worksheet->writeString($row, $col++, ''); |
|
|
|
|
|
|
164
|
|
|
$worksheet->writeString($row, $col++, ''); |
|
|
|
|
|
|
165
|
|
|
|
|
166
|
|
|
} else { |
|
167
|
|
|
$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->date_begin)), $this->datetime); |
|
|
|
|
|
|
168
|
|
|
$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->date_end)), $this->datetime); |
|
|
|
|
|
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
|
|
172
|
|
|
$worksheet->writeString($row, $col++, $request->getStatusStr()); |
|
|
|
|
|
|
173
|
|
|
|
|
174
|
|
|
$row++; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
} |
|
178
|
|
|
} |
|
179
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.