Completed
Push — master ( 520222...50fc26 )
by Paul
03:23
created

absences_SageExportEditor::addButtons()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %
Metric Value
dl 10
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
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
include_once dirname(__FILE__).'/utilit/vacincl.php';
26
include_once dirname(__FILE__).'/functions.php';
27
include_once dirname(__FILE__).'/utilit/agent.class.php';
28
include_once dirname(__FILE__).'/utilit/organization.class.php';
29
include_once dirname(__FILE__).'/utilit/exportentry.class.php';
30
bab_Widgets()->includePhpClass('Widget_Form');
31
32
33
34
35
class absences_exportVacationRequestsCls
36
{
37
    public $datebegintxt;
38
    public $dateendtxt;
39
    public $dateformattxt;
40
    public $statustxt;
41
    public $separatortxt;
42
    public $other;
43
    public $comma;
44
    public $tab;
45
    public $export;
46
    public $sepdectxt;
47
48
    public $t_yes;
49
    public $t_no;
50
    public $additional_fields;
51
    public $t_users_without_requests;
52
    public $t_organization;
53
    public $t_overlap;
54
55
    public $organization;
56
    public $id_organization;
57
58
    private $resOrganization;
59
    private $dirfields;
60
61
    public function __construct()
62
    {
63
        $this->datebegintxt = absences_translate("Begin date");
64
        $this->dateendtxt = absences_translate("End date");
65
        $this->dateformattxt = "( ".absences_translate("dd-mm-yyyy")." )";
66
        $this->statustxt = absences_translate("Status");
67
        $this->separatortxt = absences_translate("Separator");
68
        $this->other = absences_translate("Other");
69
        $this->comma = absences_translate("Comma");
70
        $this->tab = absences_translate("Tab");
71
        $this->export = absences_translate("Export");
72
        $this->sepdectxt = absences_translate("Decimal separator");
73
        $this->t_yes = absences_translate("Yes");
74
        $this->t_no = absences_translate("No");
75
        $this->additional_fields = absences_translate("Additional fields to export:");
76
        $this->t_users_without_requests = absences_translate("Include uers without requests on the period");
77
        $this->t_organization = absences_translate('Organization');
78
79
        $this->t_overlap = absences_translate("Quantities and dates of requests are modified to fit in the export period");
80
81
        $W = bab_Widgets();
82
        $Canvas = $W->HtmlCanvas();
83
84
        $this->widgetdateb = $W->DatePicker()->setName('dateb')->display($Canvas);
0 ignored issues
show
Bug introduced by
The property widgetdateb does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
85
        $this->widgetdatee = $W->DatePicker()->setName('datee')->display($Canvas);
0 ignored issues
show
Bug introduced by
The property widgetdatee does not seem to exist. Did you mean widgetdateb?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
86
87
        $this->statarr = array(absences_translate("Waiting"), absences_translate("Accepted"), absences_translate("Refused"));
0 ignored issues
show
Bug introduced by
The property statarr does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
88
89
        $this->dirfields = bab_getDirEntry(BAB_REGISTERED_GROUP, BAB_DIR_ENTRY_ID_GROUP);
90
91
        unset($this->dirfields['sn']);
92
        unset($this->dirfields['givenname']);
93
        unset($this->dirfields['jpegphoto']);
94
95
        $this->resOrganization = new absences_OrganizationIterator();
96
        $this->useorg = $this->resOrganization->count();
0 ignored issues
show
Bug introduced by
The property useorg does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
97
        $this->resOrganization->rewind();
98
    }
99
100
    public function getnextstatus()
101
    {
102
        static $i = 0;
103
        if( $i < count($this->statarr))
104
        {
105
            $this->statusid = $i;
0 ignored issues
show
Bug introduced by
The property statusid does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
106
            $this->statusname = $this->statarr[$i];
0 ignored issues
show
Bug introduced by
The property statusname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
107
            $i++;
108
            return true;
109
        }
110
        else
111
            return false;
112
    }
113
114
    /**
115
     * template method to list available organization
116
     */
117
    public function getnextorganization()
118
    {
119
        	
120
        if ($this->resOrganization->valid())
121
        {
122
            $organization = $this->resOrganization->current();
123
            $this->organization = bab_toHtml($organization->name);
124
            $this->id_organization = bab_toHtml($organization->id);
125
            $this->resOrganization->next();
126
            return true;
127
        }
128
129
        return false;
130
    }
131
132
133 View Code Duplication
    public function getnextfield()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
134
    {
135
        if (list($name,$arr) = each($this->dirfields))
136
        {
137
            $this->fieldname = bab_toHtml($name);
0 ignored issues
show
Bug introduced by
The property fieldname does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
138
            $this->fieldlabel = bab_toHtml($arr['name']);
0 ignored issues
show
Bug introduced by
The property fieldlabel does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
139
            return true;
140
        }
141
        return false;
142
    }
143
}
144
145
146
147
function exportVacationRequests()
148
{
149
	global $babBody, $babDB;
150
	
151
152
	$temp = new absences_exportVacationRequestsCls();
153
	$babBody->babecho(bab_printTemplate($temp, absences_addon()->getRelativePath()."exportvac.html", "reqexport"));
0 ignored issues
show
Deprecated Code introduced by
The method bab_addonInfos::getRelativePath() has been deprecated with message: Do not use relative path in addons Addons are subject to move out of the core folder in futures version for bab_printTemplate, replace with $addon->printTemplate() for babBody->addStyleSheet use $addon->getStylePath() instead of relative path the addStyleSheet method support full path starting with vendor/ since the 8.1.98 version

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.

Loading history...
154
}
155
156
157
158
159
160
161
162
163
164
165
class absences_SageExportEditor extends Widget_Form
166
{
167
	public function __construct()
168
	{
169
		$W = bab_Widgets();
170
171
		parent::__construct(null, $W->VBoxLayout()->setVerticalSpacing(1,'em'));
172
173
		$this->setName('sage');
174
		$this->addClass('widget-bordered');
175
		$this->addClass('BabLoginMenuBackground');
176
		$this->addClass('widget-centered');
177
		$this->colon();
178
179
		$this->setCanvasOptions($this->Options()->width(70,'em'));
180
181
182
		$this->addFields();
183
		$this->addButtons();
184
		$this->setSelfPageHiddenFields();
185
186
		if (isset($_POST['sage']))
187
		{
188
			$this->setValues(array('sage' => $_POST['sage']));
189
		} else {
190
191
		    $default = array('sage' => array('types' => array()));
192
193
		    // set default values
194
		    global $babDB;
195
196
		    //TRANSLATORS: filter by name for vacation types availables in sage export
197
		    $res = $babDB->db_query("SELECT id FROM absences_types WHERE name LIKE '%".$babDB->db_escape_like(absences_translate('paid'))."%'");
198
		    while($arr = $babDB->db_fetch_assoc($res)) {
199
		        $default['sage']['types'][] = $arr['id'];
200
		    }
201
		    $this->setValues($default);
202
		}
203
	}
204
205
206
	protected function addFields()
207
	{
208
		$W = bab_Widgets();
209
210
		$this->addItem(
211
				$W->LabelledWidget(
212
						absences_translate('Export vacations on period'),
213
						$W->PeriodPicker()->setMandatory(true, absences_translate('The period is mandatory')),
214
						'period'
215
				)
216
		);
217
218
219
		$select = $W->Select();
220
		$fields = bab_getDirEntry(BAB_REGISTERED_GROUP, BAB_DIR_ENTRY_ID_GROUP);
221
		foreach($fields as $name => $arr)
222
		{
223
			$select->addOption($name, $arr['name']);
224
225
			if (false !== mb_strpos(mb_strtolower($arr['name']), 'matricule'))
226
			{
227
				$select->setValue($name);
228
			}
229
		}
230
231
		$this->addItem(
232
				$W->LabelledWidget(
233
						//TRANSLATORS: Matricule Sage directory field
234
						absences_translate('sage user number in'),
235
						$select,
236
						'user_number'
237
				)
238
		);
239
240
		/*
241
		$separator = $W->Frame()
242
			->addItem(
243
					$W->LabelledWidget(
244
							absences_translate('Separator'),
245
							$select_format = $W->Select()
246
							->addOption(';', absences_translate('Semicolon'))
247
							->addOption(',', absences_translate('Comma'))
248
							->addOption('{tab}', absences_translate('Tab')),
249
							'separator'
250
					)
251
			);
252
253
254
		$this->addItem(
255
				$W->LabelledWidget(
256
						absences_translate('Format'),
257
						$W->Select()
258
							->addOption('sage', absences_translate('Sage text'))
259
							->addOption('csv', absences_translate('CSV'))
260
							->setAssociatedDisplayable($separator, array('csv')),
261
						'format'
262
				)
263
		);
264
265
266
		$this->addItem($separator);
267
		*/
268
269
        $this->addItem($this->types());
270
        
271
        if ($org = $this->organization()) {
272
            $this->addItem($org);
273
        }
274
275
        $this->addItem($W->Label(absences_translate("Quantities are modified to fit in the export period according to the selected types (dates are not modified)")));
276
277
	}
278
279
	
280
	protected function organization()
281
	{
282
	    $W = bab_Widgets();
283
	
284
	    $select = $W->Select()->addClass('absences-select');
285
	    $select->addOption('', '');
286
	    
287
	    $res = new absences_OrganizationIterator();
288
	    
289
	    if (0 === $res->count()) {
290
	        return null;
291
	    }
292
	    
293
	    foreach ($res as $organization) {
294
	        $select->addOption($organization->id, $organization->name);
295
	    }
296
	
297
	    return $W->LabelledWidget(
298
	        absences_translate('Organization'),
299
	        $select,
300
	        __FUNCTION__
301
	    );
302
	}
303
304
305 View Code Duplication
	protected function types()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
306
	{
307
	    $W = bab_Widgets();
308
	    global $babDB;
309
310
	    $select = $W->Multiselect();
311
	    $select->setHeadersDisplay();
312
313
	    $res = $babDB->db_query('SELECT * FROM absences_types ORDER BY name');
314
	    while($arr = $babDB->db_fetch_assoc($res)) {
315
	        $select->addOption($arr['id'], $arr['name']);
316
	    }
317
318
	    return $W->LabelledWidget(
319
    	    absences_translate('Vacation type'),
320
    	    $select,
321
	        'types'
322
    	);
323
	}
324
325
326
327
328
329 View Code Duplication
	protected function addButtons()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
330
	{
331
		$W = bab_Widgets();
332
333
		$button = $W->FlowItems(
334
				$W->SubmitButton()->setName('export')->setLabel(absences_translate('Export'))
335
		)->setSpacing(1,'em');
336
337
		$this->addItem($button);
338
	}
339
}
340
341
342
343
344
345
346
class absences_sageExportFile
347
{
348
	const OUTPUT_CHARSET = 'CP1252';
349
350
351
	/**
352
	 * Datetime
353
	 * @var string
354
	 */
355
	public $from;
356
357
	/**
358
	 * Datetime
359
	 * @var string
360
	 */
361
	public $to;
362
363
364
	/**
365
	 * Array of id vacation types
366
	 * @var array
367
	 */
368
	public $types;
369
	
370
	
371
	/**
372
	 * Filter by organization
373
	 * @var int
374
	 */
375
	public $organization;
376
377
378
	/**
379
	 * Directory entry field name
380
	 * @var string
381
	 */
382
	public $user_number_fieldname;
383
384
	/**
385
	 *
386
	 * @var string
387
	 */
388
	public $separator;
389
390
	/**
391
	 *
392
	 * @var unknown_type
393
	 */
394
	private $res;
395
396
	
397
	public function init() {
398
399
	    global $babDB;
400
	    
401
	    $query = '
402
				SELECT
403
					p.id_user,
404
					u.lastname,
405
					u.firstname
406
				FROM
407
					absences_personnel p,
408
					bab_users u
409
				WHERE
410
					u.id=p.id_user
411
		';
412
	    
413
	    if ($this->organization > 0) {
414
	        $query .= ' AND p.id_organization='.$babDB->quote($this->organization);
415
	    }
416
	    
417
	    $query .= ' ORDER BY u.lastname, u.firstname';
418
	    
419
	    $this->res = $babDB->db_query($query);
420
	}
421
422
423
424
	/**
425
	 * @return array
426
	 */
427
	private function getEntries($id_user)
428
	{
429
		require_once dirname(__FILE__).'/utilit/entry.class.php';
430
431
		$I = new absences_EntryIterator();
432
		$I->users = array($id_user);
433
		$I->status = 'Y';
434
		$I->from = $this->from;
435
		$I->to = $this->to;
436
437
		$quantity = 0.0;
438
		$periods = array();
439
		foreach($I as $entry)
440
		{
441
			/*@var $entry absences_Entry */
442
443
		    $eeI = $entry->getElementsIterator();
444
		    $eeI->types = $this->types;
445
446
		    $entry_quantity = 0.0;
447
448
		    foreach($eeI as $element) {
449
			    /* @var $element absences_EntryElem */
450
451
		        $right = $element->getRight();
452
		        if (!isset($right)) {
453
		            continue;
454
		        }
455
456
		        $type = $right->getType();
457
		        if (!isset($type)) {
458
		            continue;
459
		        }
460
461
		        if (!in_array($type->id, $this->types)) {
462
		            continue;
463
		        }
464
465
		        // ici on recupere la quantite de l'element tronque avec les dates
466
		        // de la periode demandee
467
		        $elem_quantity = $element->getPlannedQuantityBetween($this->from, $this->to);
468
469
		        if ('H' === $right->quantity_unit) {
470
		            // l'export sage contient des jours uniqument
471
472
		            $elem_quantity = ($elem_quantity/8);
473
		        }
474
475
    			$entry_quantity += $elem_quantity;
476
    			
477
    			
478
    			// dans la liste des periodes on affiche les periodes des types selectionnes
479
    			// les dates ne peuvent depasser par rapport au mois demande
480
    			
481
    			
482
    			$elem_from = $element->date_begin > $this->from ? $element->date_begin : $this->from;
483
    			$elem_to = $element->date_end < $this->to ? $element->date_end : $this->to;
484
    			
485
    			$periods[] = array(
486
    			    'from' 	=> date('d/m/y', bab_mktime($elem_from)),
487
    			    'to' 	=> date('d/m/y', bab_mktime($elem_to))
488
    			);
489
		    }
490
491
		    if ($entry_quantity > 0.001) {
492
493
    		    // la quantite totale des demandes du mois doit contenir que les conges
494
    		    // payes, uniquement pour le mois demande
495
496
    		    $quantity += $entry_quantity;
497
		    }
498
		}
499
500
501
		return array($quantity, $periods);
502
	}
503
504
505
	public function getnext()
506
	{
507
		global $babDB;
508
509
		if ($arr = $babDB->db_fetch_assoc($this->res))
510
		{
511
			$direntry = bab_admGetDirEntry($arr['id_user'], BAB_DIR_ENTRY_ID_USER);
512
			$arr['user_number'] = $direntry[$this->user_number_fieldname]['value'];
513
514
			list($quantity, $periods) = $this->getEntries($arr['id_user']);
515
516
			$arr['quantity'] = round($quantity, 1);
517
			$arr['periods'] = $periods;
518
519
			return $arr;
520
		}
521
	}
522
523
524
	private function setHeaders($extension, $mime)
525
	{
526
		$filename = mb_substr($this->from, 0, 10).'_'.mb_substr($this->to, 0, 10);
527
528
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
529
		header("Pragma: public");
530
		header('Content-Disposition: attachment; filename="'.$filename.$extension.'"'."\n");
531
		header('Content-Type: '.$mime."\n");
532
		header('Content-transfert-encoding: binary'."\n");
533
	}
534
535
536
	public function downloadSage()
537
	{
538
		$this->setHeaders('.txt', 'text/plain');
539
540
		while($arr = $this->getnext())
541
		{
542
			$p = '';
543
			foreach($arr['periods'] as $dates)
544
			{
545
				$p .= $dates['from'].$dates['to'];
546
			}
547
548
549
			echo str_pad('VB'.$arr['user_number'], 446);
550
			echo str_pad(number_format($arr['quantity'], 1, ',', ''), 50);
551
			echo str_pad('0', 11);
552
			echo str_pad($p, 432);
553
554
			echo "\r\n";
555
		}
556
	}
557
558
559
	private function csvEncode($value)
560
	{
561
		return '"'.str_replace('"', '""', $value).'"';
562
	}
563
564
565
566
	public function downloadCsv()
567
	{
568
		$this->setHeaders('.csv', 'text/csv');
569
570
		while($arr = $this->getnext())
571
		{
572
			$p = '';
573
			foreach($arr['periods'] as $dates)
574
			{
575
				$p .= implode(' ', $dates).'-';
576
			}
577
578
			$row = array(
579
				$this->csvEncode($arr['user_number']),
580
				$this->csvEncode(number_format($arr['quantity'], 1, ',', '')),
581
				$this->csvEncode(bab_convertStringFromDatabase($arr['lastname'].' '.$arr['firstname'], self::OUTPUT_CHARSET)),
582
				$this->csvEncode($p)
583
			);
584
585
			echo implode($this->separator, $row)."\n";
586
		}
587
	}
588
}
589
590
591
592
593
594
595
596
function absences_sageExport()
597
{
598
	$W = bab_Widgets();
599
	$page = $W->BabPage();
600
	
601
	$page->addStyleSheet(absences_addon()->getStylePath().'vacation.css');
602
603
604
	if (isset($_POST['sage']))
605
	{
606
		$values = $_POST['sage'];
607
		$datePicker = $W->DatePicker();
608
609
		$file = new absences_sageExportFile;
610
		$file->from = $datePicker->getISODate($values['period']['from']).' 00:00:00';
611
		$file->to = $datePicker->getISODate($values['period']['to']).' 23:59:59';
612
		$file->user_number_fieldname = $values['user_number'];
613
		$file->separator = isset($values['separator']) ? $values['separator'] : ',';
614
		$file->types = $values['types'];
615
		$file->organization = (int) $values['organization'];
616
		
617
		$file->init();
618
619
		$format = isset($values['format']) ? $values['format'] : 'sage';
620
621
		switch($format)
622
		{
623
			case 'csv':
624
				$file->downloadCsv();
625
				die();
626
627
			case 'sage':
628
			    $file->downloadSage();
629
			    die();
630
		}
631
	}
632
633
634
	$editor = new absences_SageExportEditor();
635
636
	$page->setTitle(absences_translate('Export vacations requests for sage'));
637
	$page->addItem($editor);
638
	$page->displayHtml();
639
}
640
641
642
643
644
645
646
/* main */
647
bab_requireCredential();
648
$agent = absences_Agent::getCurrentUser();
649
if( !$agent->isManager())
650
{
651
	$babBody->msgerror = absences_translate("Access denied");
652
	return;
653
}
654
655
$idx = bab_rp('idx', "reqx");
656
657
658
659
if( isset($_POST['bexport']))
660
{
661
    $W = bab_Widgets();
662
    $datePicker = $W->DatePicker();
663
    $dateb = BAB_DateTime::fromIsoDateTime($datePicker->getISODate($_POST['dateb']).' 00:00:00');
664
    $datee = BAB_DateTime::fromIsoDateTime($datePicker->getISODate($_POST['datee']).' 00:00:00');
665
    $datee->add(1, BAB_DATETIME_DAY);
666
667
	$export = new absences_ExportEntry($dateb, $datee, $_POST['idstatus'], $_POST['wsepar'], $_POST['separ'], $_POST['sepdec'], $_POST['users_without_requests'], bab_pp('dirfields', array()), bab_pp('organization', ''));
668
	$export->output();
669
}
670
671
672
switch($idx)
673
{
674
675
	case 'sage':
676
		absences_sageExport();
677
		$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
678
		$babBody->addItemMenu("sage", absences_translate("Sage"), absences_addon()->getUrl()."exportvac&idx=sage");
679
		break;
680
681
682
	case "reqx":
683
684
		$babBody->setTitle(absences_translate("Export vacations requests"));
685
		exportVacationRequests();
686
		$babBody->addItemMenu("menu", absences_translate("Management"), absences_addon()->getUrl()."vacadm&idx=menu");
687
		$babBody->addItemMenu("reqx", absences_translate("Export"), absences_addon()->getUrl()."exportvac&idx=reqx");
688
		break;
689
}
690
691
$babBody->setCurrentItemMenu($idx);
692
bab_siteMap::setPosition('absences','User');