mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
support SINCE, BEFORE, BETWEEN and ON as (range) date filters; use it in mail_zpush and add example usage to get_rows
This commit is contained in:
parent
e5c4182ed0
commit
78d2bc33a9
@ -1308,11 +1308,15 @@ class mail_ui
|
|||||||
emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]=true;
|
emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//$cutoffdate = egw_time::to('now','ts')-(3600*24*3);//SINCE, enddate
|
||||||
|
//$cutoffdate2 = egw_time::to('now','ts');//-(3600*24*2);//BEFORE, startdate
|
||||||
$filter = array(
|
$filter = array(
|
||||||
'filterName' => (emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')),
|
'filterName' => (emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]?lang('quicksearch'):lang('subject')),
|
||||||
'type' => ($query['cat_id']?$query['cat_id']:(emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')),
|
'type' => ($query['cat_id']?$query['cat_id']:(emailadmin_imapbase::$supportsORinQuery[$mail_ui->mail_bo->profileID]?'quick':'subject')),
|
||||||
'string' => $query['search'],
|
'string' => $query['search'],
|
||||||
'status' => 'any');
|
'status' => 'any',
|
||||||
|
//'range'=>"BETWEEN",'since'=> date("d-M-Y", $cutoffdate),'before'=> date("d-M-Y", $cutoffdate2)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1330,6 +1334,13 @@ class mail_ui
|
|||||||
$GLOBALS['egw']->preferences->save_repository(true);
|
$GLOBALS['egw']->preferences->save_repository(true);
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__.__LINE__.' maxMessages:'.$maxMessages.' Offset:'.$offset.' Filter:'.array2string($mail_ui->sessionData['messageFilter']));
|
//error_log(__METHOD__.__LINE__.' maxMessages:'.$maxMessages.' Offset:'.$offset.' Filter:'.array2string($mail_ui->sessionData['messageFilter']));
|
||||||
|
/*
|
||||||
|
$cutoffdate = egw_time::to('now','ts')-(3600*24*6);//SINCE, enddate
|
||||||
|
$cutoffdate2 = egw_time::to('now','ts')-(3600*24*3);//BEFORE, startdate
|
||||||
|
$filter['range'] = "BETWEEN";// we support SINCE, BEFORE, BETWEEN and ON
|
||||||
|
$filter['since'] = date("d-M-Y", $cutoffdate);
|
||||||
|
$filter['before']= date("d-M-Y", $cutoffdate2);
|
||||||
|
*/
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ($maxMessages > 75)
|
if ($maxMessages > 75)
|
||||||
|
@ -255,7 +255,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
*/
|
*/
|
||||||
private function _disconnect()
|
private function _disconnect()
|
||||||
{
|
{
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__);
|
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__);
|
||||||
if ($this->mail) $this->mail->closeConnection();
|
if ($this->mail) $this->mail->closeConnection();
|
||||||
|
|
||||||
unset($this->mail);
|
unset($this->mail);
|
||||||
@ -271,24 +271,24 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
public function GetFolderList()
|
public function GetFolderList()
|
||||||
{
|
{
|
||||||
$folderlist = array();
|
$folderlist = array();
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__);
|
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__);
|
||||||
/*foreach($available_accounts as $account)*/ $account = 0;
|
/*foreach($available_accounts as $account)*/ $account = 0;
|
||||||
{
|
{
|
||||||
$this->_connect($account);
|
$this->_connect($account);
|
||||||
if (!isset($this->folders)) $this->folders = $this->mail->getFolderObjects(true,false,$_alwaysGetDefaultFolders=true);
|
if (!isset($this->folders)) $this->folders = $this->mail->getFolderObjects(true,false,$_alwaysGetDefaultFolders=true);
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.array2string($this->folders));
|
if ($this->debugLevel>1) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.array2string($this->folders));
|
||||||
|
|
||||||
foreach ($this->folders as $folder => $folderObj) {
|
foreach ($this->folders as $folder => $folderObj) {
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' folder='.$folder);
|
if ($this->debugLevel>1) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' folder='.$folder);
|
||||||
$folderlist[] = $f = array(
|
$folderlist[] = $f = array(
|
||||||
'id' => $this->createID($account,$folder),
|
'id' => $this->createID($account,$folder),
|
||||||
'mod' => $folderObj->shortDisplayName,
|
'mod' => $folderObj->shortDisplayName,
|
||||||
'parent' => $this->getParentID($account,$folder),
|
'parent' => $this->getParentID($account,$folder),
|
||||||
);
|
);
|
||||||
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."() returning ".array2string($f));
|
if ($this->debugLevel>1) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."() returning ".array2string($f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."() returning ".array2string($folderlist));
|
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."() returning ".array2string($folderlist));
|
||||||
|
|
||||||
return $folderlist;
|
return $folderlist;
|
||||||
}
|
}
|
||||||
@ -1067,6 +1067,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
//mail AND meeting. we dont want this. accepting meeting requests with the mobile does nothing
|
//mail AND meeting. we dont want this. accepting meeting requests with the mobile does nothing
|
||||||
$output->meetingrequest->globalobjid = activesync_backend::uid2globalObjId($id);
|
$output->meetingrequest->globalobjid = activesync_backend::uid2globalObjId($id);
|
||||||
$output->messageclass = "IPM.Schedule.Meeting.Request";
|
$output->messageclass = "IPM.Schedule.Meeting.Request";
|
||||||
|
//$output->messageclass = "IPM.Schedule.Meeting";
|
||||||
unset($attachment);
|
unset($attachment);
|
||||||
continue; // do NOT add attachment as attachment
|
continue; // do NOT add attachment as attachment
|
||||||
}
|
}
|
||||||
@ -1364,7 +1365,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
}
|
}
|
||||||
$messagelist = $_filter = array();
|
$messagelist = $_filter = array();
|
||||||
// if not connected, any further action must fail
|
// if not connected, any further action must fail
|
||||||
if (!empty($cutoffdate)) $_filter = array('status'=>array('UNDELETED'),'type'=>"SINCE",'string'=> date("d-M-Y", $cutoffdate));
|
if (!empty($cutoffdate)) $_filter = array('status'=>array('UNDELETED'),'range'=>"SINCE",'date'=> date("d-M-Y", $cutoffdate));
|
||||||
if ($this->debugLevel>1) $starttime = microtime (true);
|
if ($this->debugLevel>1) $starttime = microtime (true);
|
||||||
$account = $_folderName = $id = null;
|
$account = $_folderName = $id = null;
|
||||||
$this->splitID($folderid,$account,$_folderName,$id);
|
$this->splitID($folderid,$account,$_folderName,$id);
|
||||||
|
Loading…
Reference in New Issue
Block a user