-
Notifications
You must be signed in to change notification settings - Fork 2
/
birthday.php
58 lines (49 loc) · 1.7 KB
/
birthday.php
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
<?php
/**
* Copyright Obala d.o.o. (www.obala.si)
*
* See the enclosed file LICENSE for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Duck <[email protected]>
* @package Folks
*/
require_once __DIR__ . '/lib/base.php';
$title = _("Birthday");
$count = $folks_driver->countUsers(array('birthday' => date('-m-d')));
if ($count instanceof PEAR_Error) {
$notification->push($count);
$count = 0;
}
if (($sort_by = Horde_Util::getFormData('sort_by')) !== null) {
$prefs->setValue('sort_by', $sort_by);
} else {
$sort_by = $prefs->getValue('sort_by');
}
if (($sort_dir = Horde_Util::getFormData('sort_dir')) !== null) {
$prefs->setValue('sort_dir', $sort_dir);
} else {
$sort_dir = $prefs->getValue('sort_dir');
}
$page = Horde_Util::getGet('page', 0);
$perpage = $prefs->getValue('per_page');
$criteria = array('birthday' => date('-m-d'), 'sort_by' => $sort_by, 'sort_dir' => $sort_dir);
$users = $folks_driver->getUsers($criteria, $page * $perpage, $perpage);
if ($users instanceof PEAR_Error) {
$notification->push($users);
$users = array();
}
$vars = Horde_Variables::getDefaultVariables();
$pager = new Horde_Core_Ui_Pager('page',
$vars, array('num' => $count,
'url' => 'birthday.php',
'perpage' => $perpage));
$pager->preserve($criteria);
$list_url = Folks::getUrlFor('list', 'birthday');
$page_output->addScriptFile('stripe.js', 'horde');
$page_output->header(array(
'title' => $title
));
$notification->notify(array('listeners' => 'status'));
require FOLKS_TEMPLATES . '/list/list.php';
$page_output->footer();