[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/class.history.php, 1.1.2.11
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/class.history.php, 1.1.2.11 |
Date: |
Fri, 21 May 2004 18:55:59 -0000 |
Update of /api
Modified Files:
Branch: proposal-branch
class.history.php
date: 2004/04/25 07:22:23; author: jengo; state: Exp; lines: +61 -1
Log Message:
Added 3 new functions for returning a records creation date and modified date.
Apps won't have to have a seperate field for this, since the API will handle it
=====================================================================
Index: api/class.history.php
diff -u api/class.history.php:1.1.2.10 api/class.history.php:1.1.2.11
--- api/class.history.php:1.1.2.10 Sun Apr 18 08:05:26 2004
+++ api/class.history.php Sun Apr 25 07:22:23 2004
@@ -168,4 +168,64 @@
// execMethod - <app>.<class>.update()
}
+
+ function __get_record($location,$order)
+ {
+ $dbresult = $GLOBALS['phpgw']->db->selectlimit("
+ SELECT
+ history_timestamp,
+ history_owner
+ FROM
+ phpgw_history
+ WHERE
+ history_location='" . $location . "'
+ ORDER BY
+ history_timestamp
+ $order",1);
+
+ if ($dbresult->EOF)
+ {
+ return false;
+ }
+ else
+ {
+ return array(
+ 'timestamp' =>
strftime('%x',$dbresult->unixtimestamp($dbresult->fields['history_timestamp']))
+ . date(' h:i:s
a',$dbresult->unixtimestamp($dbresult->fields['history_timestamp'])),
+ 'owner' =>
$dbresult->fields['history_owner']
+ );
+ }
+ }
+
+ function _record_creation_date()
+ {
+ $args = new safe_args();
+ $args->set('location',REQUIRED,'string');
+ $args = $args->get(func_get_args());
+
+ $result = $this->__get_record($args['location'],'ASC');
+ return $result['timestamp'];
+ }
+
+ function _record_modified_date()
+ {
+ $args = new safe_args();
+ $args->set('location',REQUIRED,'string');
+ $args = $args->get(func_get_args());
+
+ $result = $this->__get_record($args['location'],'DESC');
+ return $result['timestamp'];
+ }
+
+ function _record_modified_user()
+ {
+ $args = new safe_args();
+ $args->set('location',REQUIRED,'string');
+ $args = $args->get(func_get_args());
+
+ $result =
$this->__get_record($args['location'],'DESC');
+ $obj =
createObject('api.accounts',(int)$result['owner']);
+
+ return
$GLOBALS['phpgw']->prefs->_display_account_fullname($obj->data['lid'],$obj->data['firstname'],$obj->data['lastname']);
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/class.history.php, 1.1.2.11,
nomail <=