forked from extern/egroupware
fixed birthday reminder and made the days, it shows birthdays in advance, configurable
This commit is contained in:
parent
287726dead
commit
2973ed5de1
@ -116,10 +116,17 @@ class contacts_admin_prefs
|
||||
function settings()
|
||||
{
|
||||
$GLOBALS['settings']['mainscreen_showbirthdays'] = array(
|
||||
'type' => 'check',
|
||||
'type' => 'select',
|
||||
'label' => 'Show birthday reminders on main screen',
|
||||
'name' => 'mainscreen_showbirthdays',
|
||||
'help' => 'Displays a remider for birthdays happening today or tomorrow on the startpage (page you get when you enter eGroupWare or click on the homepage icon).',
|
||||
'help' => 'Displays a remider for birthdays on the startpage (page you get when you enter eGroupWare or click on the homepage icon).',
|
||||
'values' => array(
|
||||
0 => lang('No'),
|
||||
1 => lang('Yes, for today and tomorrow'),
|
||||
3 => lang('Yes, for the next three days'),
|
||||
7 => lang('Yes, for the next week'),
|
||||
14=> lang('Yes, for the next two weeks'),
|
||||
),
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
);
|
||||
|
@ -1,45 +1,41 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Addressbook *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or(at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/**
|
||||
* Addressbook - birthday reminder on home-page
|
||||
*
|
||||
* @package addressbook
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
$d1 = strtolower(substr(EGW_APP_INC,0,3));
|
||||
if($d1 == 'htt' || $d1 == 'ftp' )
|
||||
if ($GLOBALS['egw_info']['user']['apps']['addressbook'] &&
|
||||
($days = $GLOBALS['egw_info']['user']['preferences']['addressbook']['mainscreen_showbirthdays']))
|
||||
{
|
||||
echo "\n<!-- Birthday info -->\n";
|
||||
|
||||
if (!(int) $days) $days = 1; // old pref
|
||||
|
||||
include_once(EGW_INCLUDE_ROOT.'/addressbook/inc/class.bocontacts.inc.php');
|
||||
$contacts =& new bocontacts();
|
||||
|
||||
$month_start = date('*-m-*',$contacts->now_su-$days*24*3600);
|
||||
$bdays =& $contacts->search(array('bday' => $month_start),array('id','n_family','n_given','bday'),'n_given,n_family');
|
||||
|
||||
if (($month_end = date('*-m-*',$contacts->now_su)) != $month_start)
|
||||
{
|
||||
echo "Failed attempt to break in via an old Security Hole!<br>\n";
|
||||
$GLOBALS['egw']->common->phpgw_exit();
|
||||
if (($bdays2 =& $contacts->search(array('bday' => $month_start),array('id','n_family','n_given','bday'),'n_given,n_family')))
|
||||
{
|
||||
$bdays = !$bdays ? $bdays2 : array_merge($bdays,$bdays2);
|
||||
}
|
||||
unset($bdays2);
|
||||
}
|
||||
unset($d1);
|
||||
unset($month_start); unset($month_end);
|
||||
|
||||
if($GLOBALS['egw_info']['user']['apps']['addressbook']
|
||||
&& $GLOBALS['egw_info']['user']['preferences']['addressbook']['mainscreen_showbirthdays'])
|
||||
if ($bdays)
|
||||
{
|
||||
echo "\n<!-- Birthday info -->\n";
|
||||
|
||||
$c = CreateObject('phpgwapi.contacts');
|
||||
$qfields = array(
|
||||
'n_given' => 'n_given',
|
||||
'n_family' => 'n_family',
|
||||
'bday' => 'bday'
|
||||
);
|
||||
$now = time() - ((60 * 60) * (int)$GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']);
|
||||
$today = $GLOBALS['egw']->common->show_date($now,'n/d/');
|
||||
|
||||
$bdays = $c->read(0,15,$qfields,$today,'tid=n','','',$GLOBALS['egw_info']['user']['account_id']);
|
||||
|
||||
$title = '<center><font color="#FFFFFF">'.lang('Birthdays').'</font></center>';
|
||||
|
||||
$portalbox = CreateObject('phpgwapi.listbox',
|
||||
Array(
|
||||
'title' => $title,
|
||||
'title' => lang('Birthdays'),
|
||||
'primary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
|
||||
'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
|
||||
'tertiary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
|
||||
@ -50,59 +46,55 @@
|
||||
);
|
||||
$app_id = $GLOBALS['egw']->applications->name2id('addressbook');
|
||||
$GLOBALS['portal_order'][] = $app_id;
|
||||
$var = Array(
|
||||
foreach(Array(
|
||||
'up' => Array('url' => '/set_box.php', 'app' => $app_id),
|
||||
'down' => Array('url' => '/set_box.php', 'app' => $app_id),
|
||||
'close' => Array('url' => '/set_box.php', 'app' => $app_id),
|
||||
'question' => Array('url' => '/set_box.php', 'app' => $app_id),
|
||||
'edit' => Array('url' => '/set_box.php', 'app' => $app_id)
|
||||
);
|
||||
|
||||
while(list($key,$value) = each($var))
|
||||
) as $key => $contactue)
|
||||
{
|
||||
$portalbox->set_controls($key,$value);
|
||||
$portalbox->set_controls($key,$contactue);
|
||||
}
|
||||
|
||||
$portalbox->data = Array();
|
||||
|
||||
while(list($key,$val) = @each($bdays))
|
||||
for($n = 0; $n <= $days; ++$n)
|
||||
{
|
||||
if(substr($val['bday'],0,strlen($today)) == $today)
|
||||
$day = date('-m-d',$contacts->now_su+$n*24*3600);
|
||||
foreach($bdays as $contact)
|
||||
{
|
||||
$portalbox->data[] = array(
|
||||
'text' => lang("Today is %1's birthday!", $val['n_given'] . ' ' . $val['n_family']),
|
||||
'link' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $val['id'])
|
||||
);
|
||||
if(substr($contact['bday'],-6) == $day)
|
||||
{
|
||||
switch($n)
|
||||
{
|
||||
case 0:
|
||||
$text = lang("Today is %1's birthday!", $contact['n_given'].' '.$contact['n_family']);
|
||||
break;
|
||||
case 1:
|
||||
$text = lang("Tomorrow is %1's birthday.", $contact['n_given'].' '.$contact['n_family']);
|
||||
break;
|
||||
default:
|
||||
list($y,$m,$d) = explode('-',$contact['bday']);
|
||||
$text = lang("In %1 days (%2) is %3's birthday.",$n,
|
||||
$GLOBALS['egw']->common->dateformatorder($y,$m,$d,true),
|
||||
$contact['n_given'].' '.$contact['n_family']);
|
||||
break;
|
||||
}
|
||||
$portalbox->data[] = array(
|
||||
'text' => $text,
|
||||
'link' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $contact['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
// $tmp = '<a href="'
|
||||
// . $GLOBALS['egw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
|
||||
// . $val['n_given'] . ' ' . $val['n_family'] . '</a>';
|
||||
// echo '<tr><td align="left">' . lang("Today is %1's birthday!", $tmp) . '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
$tomorrow = $GLOBALS['egw']->common->show_date($now + 86400,'n/d/');
|
||||
|
||||
$bdays = $c->read(0,15,$qfields,$tomorrow,'tid=n','','',$GLOBALS['egw_info']['user']['account_id']);
|
||||
|
||||
while(list($key,$val) = @each($bdays))
|
||||
{
|
||||
if(substr($val['bday'],0,strlen($tomorrow)) == $tomorrow)
|
||||
{
|
||||
$portalbox->data[] = array(
|
||||
'text' => lang("Tomorrow is %1's birthday.",$val['n_given'] . ' ' . $val['n_family']),
|
||||
'link' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id='.$val['id'])
|
||||
);
|
||||
}
|
||||
// $tmp = '<a href="'
|
||||
// . $GLOBALS['egw']->link('/addressbook/view.php','ab_id=' . $val['id']) . '">'
|
||||
// . $val['n_given'] . ' ' . $val["n_family"] . '</a>';
|
||||
// echo '<tr><td align="left">' . lang("Tomorrow is %1's birthday.", $tmp) . '</td></tr>' . "\n";
|
||||
}
|
||||
if(count($portalbox->data))
|
||||
{
|
||||
echo $portalbox->draw();
|
||||
}
|
||||
unset($portalbox);
|
||||
echo "\n<!-- Birthday info -->\n";
|
||||
unset($portalbox);
|
||||
unset($days); unset($day);
|
||||
unset($n); unset($y); unset($m); unset($d);
|
||||
}
|
||||
?>
|
||||
unset($contacts); unset($bdays);
|
||||
|
||||
echo "\n<!-- Birthday info -->\n";
|
||||
}
|
@ -85,7 +85,7 @@ deleted addressbook de gel
|
||||
deletes the photo addressbook de Löscht das Foto
|
||||
department common de Abteilung
|
||||
departments addressbook de Abteilungen
|
||||
displays a remider for birthdays happening today or tomorrow on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook de Zeigt auf der Startseite eine Geburtstags Erinnerung an, falls heute oder morgen jemand Geburtstag hat. Die Startseite ist die Seite die Sie sehen, wenn Sie eGroupWare betreten oder auf das Startseiten Icon (Haus) klicken.
|
||||
displays a remider for birthdays on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook de Zeigt auf der Startseite eine Geburtstags Erinnerung an. Die Startseite ist die Seite die Sie sehen, wenn Sie eGroupWare betreten oder auf das Startseiten Icon (Haus) klicken.
|
||||
do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook? addressbook de Wollen Sie ein privates Adressbuch, dass nicht von Benutzern einsehbar ist, denen Sie Zugriff auf Ihr persönliches Adressbuch gegeben haben?
|
||||
do your really want to delete this contact? addressbook de Wollen sie diesen Kontakt wirklich löschen?
|
||||
doesn't matter addressbook de egal
|
||||
@ -146,6 +146,7 @@ import from outlook addressbook de Aus Outlook importieren
|
||||
import multiple vcard addressbook de Import mehrere VCards
|
||||
import next set addressbook de Nächsten Satz importieren
|
||||
import_instructions addressbook de In Netscape, öffnen Sie das Adressbuch und wählen Sie <b>Exportieren</b> aus dem Datei Menü aus. Die Dateien werden im LDIF Formaz exportiert.<p> In Outlook wählen Sie den Ordner Kontakte aus, wählen Sie <b>Importieren und Exportieren...</p> aus dem <b>Datei</b> Menü aus und Exportieren Sie die Kontakte als eine CSV Datei.<p> In Palm Desktop 4.0 oder größer, öffnen Sie Ihr Adressbuch und wählen Sie <b>Export</b> aus dem Datei-Menü aus. Die Datei wird im VCard-Format exportiert.
|
||||
in %1 days (%2) is %3's birthday. addressbook de In %1 Tagen (%2) ist der Geburtstag von %3.
|
||||
income addressbook de Einkommen
|
||||
international addressbook de International
|
||||
label addressbook de Adressetikett
|
||||
@ -248,6 +249,10 @@ which fields should be exported. all means every field stored in the addressbook
|
||||
whole query addressbook de gesamte Abfrage
|
||||
work phone addressbook de Tel dienstl.
|
||||
write (update or add) a single entry by passing the fields. addressbook de Schreibt (aktualiseren oder zufügen) eines einzelnen Eintrags durch Übergabe der Felder
|
||||
yes, for the next three days addressbook de Ja, für die nächsten drei Tage
|
||||
yes, for the next two weeks addressbook de Ja, für die nächsten zwei Wochen
|
||||
yes, for the next week addressbook de Ja, für die nächste Woche
|
||||
yes, for today and tomorrow addressbook de Ja, für heute und morgen
|
||||
you are not permitted to delete contact %1 addressbook de Sie haben nicht die Berechtigungen um den Kontakt %1 zu löschen
|
||||
you are not permittet to delete this contact addressbook de Sie haben nicht die Berechtigung diesen Kontakt zu löschen
|
||||
you are not permittet to edit this contact addressbook de Sie haben nicht die Berechtigung diesen Kontakt zu bearbeiten
|
||||
|
@ -85,7 +85,7 @@ deleted addressbook en deleted
|
||||
deletes the photo addressbook en Deletes the photo
|
||||
department common en Department
|
||||
departments addressbook en departments
|
||||
displays a remider for birthdays happening today or tomorrow on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook en Displays a remider for birthdays happening today or tomorrow on the startpage (page you get when you enter eGroupWare or click on the homepage icon).
|
||||
displays a remider for birthdays on the startpage (page you get when you enter egroupware or click on the homepage icon). addressbook en Displays a remider for birthdays on the startpage (page you get when you enter eGroupWare or click on the homepage icon).
|
||||
do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook? addressbook en Do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook?
|
||||
do your really want to delete this contact? addressbook en Do your really want to delete this contact?
|
||||
doesn't matter addressbook en doesn't matter
|
||||
@ -146,6 +146,7 @@ import from outlook addressbook en Import from Outlook
|
||||
import multiple vcard addressbook en Import Multiple VCard
|
||||
import next set addressbook en Import next set
|
||||
import_instructions addressbook en In Netscape, open the Addressbook and select <b>Export</b> from the <b>File</b> menu. The file exported will be in LDIF format.<p>Or, in Outlook, select your Contacts folder, select <b>Import and Export...</b> from the <b>File</b> menu and export your contacts into a comma separated text (CSV) file. <p>Or, in Palm Desktop 4.0 or greater, visit your addressbook and select <b>Export</b> from the <b>File</b> menu. The file exported will be in VCard format.
|
||||
in %1 days (%2) is %3's birthday. addressbook en In %1 days (%2) is %3's birthday.
|
||||
income addressbook en Income
|
||||
international addressbook en International
|
||||
label addressbook en Label
|
||||
@ -248,6 +249,10 @@ which fields should be exported. all means every field stored in the addressbook
|
||||
whole query addressbook en whole query
|
||||
work phone addressbook en Work Phone
|
||||
write (update or add) a single entry by passing the fields. addressbook en Write (update or add) a single entry by passing the fields.
|
||||
yes, for the next three days addressbook en Yes, for the next three days
|
||||
yes, for the next two weeks addressbook en Yes, for the next two weeks
|
||||
yes, for the next week addressbook en Yes, for the next week
|
||||
yes, for today and tomorrow addressbook en Yes, for today and tomorrow
|
||||
you are not permitted to delete contact %1 addressbook en You are not permitted to delete contact %1
|
||||
you are not permittet to delete this contact addressbook en You are not permittet to delete this contact
|
||||
you are not permittet to edit this contact addressbook en You are not permittet to edit this contact
|
||||
|
Loading…
Reference in New Issue
Block a user