* @param string $action The action to check for - add, modify, or delete.
* @param integer $timestamp The time to start the search.
* @param string $calendar The calendar to search in.
+ * @param integer $end The optional ending timestamp
*
* @return array An array of UIDs matching the action and time criteria.
*
* @throws Horde_History_Exception
* @throws InvalidArgumentException
*/
- public function listBy($action, $timestamp, $calendar = null)
+ public function listBy($action, $timestamp, $calendar = null, $end = null)
{
if (empty($calendar)) {
$calendar = Kronolith::getDefaultCalendar();
throw new Horde_Exception_PermissionDenied();
}
- $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'kronolith:' . $calendar);
+ $filter = array(array('op' => '=', 'field' => 'action', 'value' => $action));
+ if (!empty($end)) {
+ $filter[] = array('op' => '<', 'field' => 'ts', 'value' => $end);
+ }
+ $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, $filter, 'kronolith:' . $calendar);
// Strip leading kronolith:username:.
return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
* @param string $action The action to check for - add, modify, or delete.
* @param integer $timestamp The time to start the search.
* @param string $notepad The notepad to search in.
+ * @param integer $end The optional ending timestamp.
*
* @return array An array of UIDs matching the action and time criteria.
*/
-function _mnemo_listBy($action, $timestamp, $notepad = null)
+function _mnemo_listBy($action, $timestamp, $notepad = null, $end = null)
{
require_once dirname(__FILE__) . '/base.php';
return PEAR::raiseError(_("Permission Denied"));
}
+ $filter = array(array('op' => '=', 'field' => 'action', 'value' => $action));
+ if (!empty($end)) {
+ $filter[] = array('op' => '<', 'field' => 'ts', 'value' => $end);
+ }
$history = $GLOBALS['injector']->getInstance('Horde_History');
- $histories = $history->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'mnemo:' . $notepad);
+ $histories = $history->getByTimestamp('>', $timestamp, $filter, 'mnemo:' . $notepad);
if (is_a($histories, 'PEAR_Error')) {
return $histories;
}
* @param integer $timestamp The time to start the search.
* @param string $tasklist The tasklist to be used. If 'null', the
* user's default tasklist will be used.
+ * @param integer $end The optional ending timestamp.
*
* @return array An array of UIDs matching the action and time criteria.
*
* @throws Horde_History_Exception
* @throws InvalidArgumentException
*/
- public function listBy($action, $timestamp, $tasklist = null)
+ public function listBy($action, $timestamp, $tasklist = null, $end = null)
{
if ($tasklist === null) {
$tasklist = Nag::getDefaultTasklist(Horde_Perms::READ);
if (!array_key_exists($tasklist,
Nag::listTasklists(false, Horde_Perms::READ))) {
return PEAR::raiseError(_("Permission Denied"));
- }
+ }
- $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, array(array('op' => '=', 'field' => 'action', 'value' => $action)), 'nag:' . $tasklist);
+ $filter = array(array('op' => '=', 'field' => 'action', 'value' => $action));
+ if (!empty($end)) {
+ $filter[] = array('op' => '<', 'field' => 'ts', 'value' => $end);
+ }
+ $histories = $GLOBALS['injector']->getInstance('Horde_History')->getByTimestamp('>', $timestamp, $filter, 'nag:' . $tasklist);
// Strip leading nag:username:.
return preg_replace('/^([^:]*:){2}/', '', array_keys($histories));
* @param integer $timestamp The time to start the search.
* @param string|array $sources The source(s) for which to retrieve the
* history.
+ * @param integer $end The optinal ending timestamp.
*
* @return array An array of UIDs matching the action and time criteria.
*
* @throws Horde_Exception
* @throws InvalidArgumentException
*/
- public function listBy($action, $timestamp, $sources = null)
+ public function listBy($action, $timestamp, $sources = null, $end = null)
{
global $prefs, $cfgSources;
$uids = array();
$history = $GLOBALS['injector']->getInstance('Horde_History');
+ $filter = array(array('op' => '=', 'field' => 'action', 'value' => $action));
+ if (!empty($end)) {
+ $filter[] = array('op' => '<', 'field' => 'ts', 'value' => $end);
+ }
foreach ($sources as $source) {
if (empty($source) || !isset($cfgSources[$source])) {
throw new Horde_Exception(sprintf(_("Invalid address book: %s"), $source));
}
$histories = $history->getByTimestamp(
- '>', $timestamp,
- array(array('op' => '=',
- 'field' => 'action',
- 'value' => $action)),
+ '>', $timestamp, $filter,
'turba:' . $driver->getName());
// Strip leading turba:addressbook:.