forked from extern/egroupware
new code for email notification - NOT IMPLEMENTED
This commit is contained in:
parent
1be6c501ae
commit
d5a4a0bc7e
@ -126,6 +126,35 @@ class calendar extends calendar_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function send_update($event)
|
||||||
|
{
|
||||||
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
|
$msg = CreateObject('email.send');
|
||||||
|
|
||||||
|
$subject = 'Calendar Event #'.$event->id.': '.$event->start->year.' '.lang(date(mktime($event->start->hour,$event->start->min,$event->start->sec,$event->start->month,$event->start->mday,$event->start->year),'F')).' '.$event->start->mday.' '.$event->start->hour.':'.$event->start->min.':'.$event->start->sec.'Z';
|
||||||
|
$body = 'An event in your calendar @ '.$phpgw_info['server']['site_title'].' has been altered. Please review it now.';
|
||||||
|
$msgtype = 'phpGW-calendar-'.$event->id;
|
||||||
|
|
||||||
|
$to = '';
|
||||||
|
for($i=0;$i<count($event->participants);$i++)
|
||||||
|
{
|
||||||
|
if($event->participants[$i] != $phpgw_info['user']['account_id'])
|
||||||
|
{
|
||||||
|
if($to != '')
|
||||||
|
{
|
||||||
|
$to .= ', ';
|
||||||
|
}
|
||||||
|
$preferences = CreateObject('phpgwapi.preferences',$event->participants[$i]);
|
||||||
|
$part_prefs = $preferences->read_repository();
|
||||||
|
$part_prefs = $phpgw->common->create_emailpreferences($part_prefs,$event->participants[$i]);
|
||||||
|
$to .= $part_prefs['email']['address'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$msg->msg('email',$to,$subject,$body,$msgtype);
|
||||||
|
unset($msg);
|
||||||
|
}
|
||||||
|
|
||||||
function set_filter()
|
function set_filter()
|
||||||
{
|
{
|
||||||
global $phpgw_info, $phpgw, $filter;
|
global $phpgw_info, $phpgw, $filter;
|
||||||
@ -295,21 +324,18 @@ class calendar extends calendar_
|
|||||||
}
|
}
|
||||||
|
|
||||||
$link = Array();
|
$link = Array();
|
||||||
// $date = $this->gmtdate($datetime);
|
|
||||||
$search_date_full = date('Ymd',$datetime);
|
$search_date_full = date('Ymd',$datetime);
|
||||||
$search_date_year = date('Y',$datetime);
|
$search_date_year = date('Y',$datetime);
|
||||||
$search_date_month = date('m',$datetime);
|
$search_date_month = date('m',$datetime);
|
||||||
$search_date_day = date('d',$datetime);
|
$search_date_day = date('d',$datetime);
|
||||||
$search_date_dow = date('w',$datetime);
|
$search_date_dow = date('w',$datetime);
|
||||||
$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
|
$search_beg_day = mktime(0,0,0,$search_date_month,$search_date_day,$search_date_year);
|
||||||
// $date = $this->localdates($datetime);
|
|
||||||
for ($i=0;$i<count($this->repeated_events);$i++)
|
for ($i=0;$i<count($this->repeated_events);$i++)
|
||||||
{
|
{
|
||||||
$rep_events = $this->repeating_events[$i];
|
$rep_events = $this->repeating_events[$i];
|
||||||
$id = $rep_events->id;
|
$id = $rep_events->id;
|
||||||
$event_beg_day = mktime(0,0,0,$rep_events->start->month,$rep_events->start->mday,$rep_events->start->year);
|
$event_beg_day = mktime(0,0,0,$rep_events->start->month,$rep_events->start->mday,$rep_events->start->year);
|
||||||
$event_recur_time = mktime($rep_events->recur_enddate->hour,$rep_events->recur_enddate->min,$rep_events->recur_enddate->sec,$rep_events->recur_enddate->month,$rep_events->recur_enddate->mday,$rep_events->recur_enddate->year);
|
$event_recur_time = mktime($rep_events->recur_enddate->hour,$rep_events->recur_enddate->min,$rep_events->recur_enddate->sec,$rep_events->recur_enddate->month,$rep_events->recur_enddate->mday,$rep_events->recur_enddate->year);
|
||||||
// $start = $this->localdates($rep_events->datetime);
|
|
||||||
if($event_recur_time != 0)
|
if($event_recur_time != 0)
|
||||||
{
|
{
|
||||||
$end_recur_date = date('Ymd',$event_recur_time);
|
$end_recur_date = date('Ymd',$event_recur_time);
|
||||||
|
@ -754,69 +754,74 @@
|
|||||||
|
|
||||||
|
|
||||||
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
// This is not the best place for it, but it needs to be shared bewteen Aeromail and SM
|
||||||
function create_emailpreferences()
|
function create_emailpreferences($prefs,$account_id=0)
|
||||||
{
|
{
|
||||||
global $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
/* Add default preferences info */
|
if($account_id==0)
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["userid"]))
|
|
||||||
{
|
{
|
||||||
if ($phpgw_info["server"]["mail_login_type"] == "vmailmgr")
|
$account_id = $phpgw_info['user']['account_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add default preferences info */
|
||||||
|
if (!isset($prefs['email']['userid']))
|
||||||
|
{
|
||||||
|
if ($phpgw_info['server']['mail_login_type'] == 'vmailmgr')
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["userid"] = $phpgw_info["user"]["userid"]
|
$prefs['email']['userid'] = $phpgw->accounts->id2name($account_id)
|
||||||
. "@" . $phpgw_info[server][mail_suffix];
|
. '@' . $phpgw_info['server']['mail_suffix'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["userid"] = $phpgw_info["user"]["userid"];
|
$prefs['email']['userid'] = $phpgw->accounts->id2name($account_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Set Server Mail Type if not defined */
|
/* Set Server Mail Type if not defined */
|
||||||
if (empty($phpgw_info["server"]["mail_server_type"]))
|
if (empty($phpgw_info['server']['mail_server_type']))
|
||||||
{
|
{
|
||||||
$phpgw_info["server"]["mail_server_type"] = "imap";
|
$phpgw_info['server']['mail_server_type'] = 'imap';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["passwd"]))
|
if (!isset($prefs['email']['passwd']))
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["passwd"] = $phpgw_info["user"]["passwd"];
|
$prefs['email']['passwd'] = $phpgw_info['user']['passwd'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["passwd"] = $this->decrypt($phpgw_info["user"]["preferences"]["email"]["passwd"]);
|
$prefs['email']['passwd'] = $this->decrypt($prefs['email']['passwd']);
|
||||||
}
|
}
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["address"]))
|
if (!isset($prefs['email']['address']))
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["address"] = $phpgw_info["user"]["userid"]
|
$prefs['email']['address'] = $phpgw->accounts->id2name($account_id)
|
||||||
. "@" . $phpgw_info["server"]["mail_suffix"];
|
. '@' . $phpgw_info['server']['mail_suffix'];
|
||||||
}
|
}
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["mail_server"]))
|
if (!isset($prefs['email']['mail_server']))
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["mail_server"] = $phpgw_info["server"]["mail_server"];
|
$prefs['email']['mail_server'] = $phpgw_info['server']['mail_server'];
|
||||||
}
|
}
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["mail_server_type"]))
|
if (!isset($prefs['email']['mail_server_type']))
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["mail_server_type"] = $phpgw_info["server"]["mail_server_type"];
|
$prefs['email']['mail_server_type'] = $phpgw_info['server']['mail_server_type'];
|
||||||
}
|
}
|
||||||
if (!isset($phpgw_info["user"]["preferences"]["email"]["imap_server_type"]))
|
if (!isset($prefs['email']['imap_server_type']))
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["imap_server_type"] = $phpgw_info["server"]["imap_server_type"];
|
$prefs['email']['imap_server_type'] = $phpgw_info['server']['imap_server_type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These sets the mail_port server variable */
|
/* These sets the mail_port server variable */
|
||||||
if ($phpgw_info["user"]["preferences"]["email"]["mail_server_type"]=="imap")
|
if ($prefs['email']['mail_server_type']=='imap')
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["mail_port"] = "143";
|
$prefs['email']['mail_port'] = '143';
|
||||||
}
|
}
|
||||||
elseif ($phpgw_info["user"]["preferences"]["email"]["mail_server_type"]=="pop3")
|
elseif ($prefs['mail']['mail_server_type']=='pop3')
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["mail_port"] = "110";
|
$prefs['email']['mail_port'] = '110';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is going to be used to switch to the nntp class */
|
/* This is going to be used to switch to the nntp class */
|
||||||
if ($phpgw_info["flags"]["newsmode"])
|
if ($phpgw_info['flags']['newsmode'])
|
||||||
{
|
{
|
||||||
$phpgw_info["user"]["preferences"]["email"]["mail_server_type"] = "nntp";
|
$prefs['email']['mail_server_type'] = 'nntp';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user