File: week.php

package info (click to toggle)
kronolith2 2.1.4-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 5,560 kB
  • ctags: 2,171
  • sloc: php: 8,755; xml: 1,049; sql: 258; makefile: 65
file content (60 lines) | stat: -rw-r--r-- 2,046 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
 * $Horde: kronolith/week.php,v 1.43.2.7 2006/01/01 21:29:02 jan Exp $
 *
 * Copyright 1999-2006 Charles J. Hagenbuch <chuck@horde.org>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

@define('KRONOLITH_BASE', dirname(__FILE__));
require_once KRONOLITH_BASE . '/lib/base.php';
require_once KRONOLITH_BASE . '/lib/WeekView.php';

$week = (int)Util::getFormData('week');
$year = (int)Util::getFormData('year');
if ($timestamp = (int)Util::getFormData('timestamp')) {
    $date = &new Horde_Date($timestamp);
    $year = $date->year;
    $week = $date->weekOfYear();
    if (!$prefs->getValue('week_start_monday') && $date->dayOfWeek() == HORDE_DATE_SUNDAY) {
        $week++;
    }
    if ($week > 51 && $date->month == 1) {
        $year--;
    }
}

if ($prefs->getValue('week_start_monday')) {
    $weekOb = &new Kronolith_WeekView($week, $year, HORDE_DATE_MONDAY, HORDE_DATE_SUNDAY + 7);
} else {
    $weekOb = &new Kronolith_WeekView($week, $year, HORDE_DATE_SUNDAY, HORDE_DATE_SATURDAY);
}
$title = sprintf(_("Week %d"), $weekOb->week);
$print_view = (bool)Util::getFormData('print');

Horde::addScriptFile('tooltip.js', 'horde', true);
Horde::addScriptFile('stripe.js', 'kronolith', true);
if (!$print_view) {
    Horde::addScriptFile('popup.js', 'horde', true);
}
require KRONOLITH_TEMPLATES . '/common-header.inc';

if ($print_view) {
    require_once $registry->get('templates', 'horde') . '/javascript/print.js';
} else {
    $print_link = Util::addParameter('week.php', array('week' => $week,
                                                       'year' => $year,
                                                       'print' => 'true'));
    $print_link = Horde::url($print_link);
    require KRONOLITH_TEMPLATES . '/menu.inc';
}

echo '<div id="page">';
if (!$print_view) {
    Kronolith::tabs();
}
$weekOb->html(KRONOLITH_TEMPLATES);
echo '</div>';
require $registry->get('templates', 'horde') . '/common-footer.inc';