Commit fcdf7ae87f7a0618386bd4f5c92669aa8e7f8243

Authored by Neil Blakey-Milner
1 parent 0481268a

Add last login as another attribute tracked by the user class.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5237 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 17 additions and 0 deletions
lib/users/User.inc
@@ -63,6 +63,7 @@ class User extends KTEntity { @@ -63,6 +63,7 @@ class User extends KTEntity {
63 var $dAuthenticationDetailsDate2 = null; 63 var $dAuthenticationDetailsDate2 = null;
64 var $bAuthenticationDetailsBool1 = null; 64 var $bAuthenticationDetailsBool1 = null;
65 var $bAuthenticationDetailsBool2 = null; 65 var $bAuthenticationDetailsBool2 = null;
  66 + var $dLastLogin = null;
66 67
67 var $_aFieldToSelect = array( 68 var $_aFieldToSelect = array(
68 'iId' => 'id', 69 'iId' => 'id',
@@ -86,6 +87,7 @@ class User extends KTEntity { @@ -86,6 +87,7 @@ class User extends KTEntity {
86 'dAuthenticationDetailsDate2' => 'authentication_details_d2', 87 'dAuthenticationDetailsDate2' => 'authentication_details_d2',
87 'bAuthenticationDetailsBool1' => 'authentication_details_b1', 88 'bAuthenticationDetailsBool1' => 'authentication_details_b1',
88 'bAuthenticationDetailsBool2' => 'authentication_details_b2', 89 'bAuthenticationDetailsBool2' => 'authentication_details_b2',
  90 + 'dLastLogin' => 'last_login',
89 ); 91 );
90 92
91 var $_bUsePearError = true; 93 var $_bUsePearError = true;
@@ -138,6 +140,9 @@ class User extends KTEntity { @@ -138,6 +140,9 @@ class User extends KTEntity {
138 function getAuthenticationDetailsBool2() { return $this->bAuthenticationDetailsBool2; } 140 function getAuthenticationDetailsBool2() { return $this->bAuthenticationDetailsBool2; }
139 function setAuthenticationDetailsBool2($mValue) { $this->bAuthenticationDetailsBool2 = $mValue; } 141 function setAuthenticationDetailsBool2($mValue) { $this->bAuthenticationDetailsBool2 = $mValue; }
140 142
  143 + function getLastLogin() { return $this->dLastLogin; }
  144 + function setLastLogin($mValue) { $this->dLastLogin = $mValue; }
  145 +
141 function &get($iId) { 146 function &get($iId) {
142 return KTEntityUtil::get('User', $iId); 147 return KTEntityUtil::get('User', $iId);
143 } 148 }
@@ -268,4 +273,16 @@ class User extends KTEntity { @@ -268,4 +273,16 @@ class User extends KTEntity {
268 'authentication_details_s1' => $sDetails, 273 'authentication_details_s1' => $sDetails,
269 ), $aOptions); 274 ), $aOptions);
270 } 275 }
  276 +
  277 + function getByLastLoginBefore($dDateTime) {
  278 + return KTEntityUtil::getByDict('User', array(
  279 + 'last_login' => array('type' => 'before', 'value' => $dDateTime),
  280 + ), array('multi' => true));
  281 + }
  282 +
  283 + function getByLastLoginAfter($dDateTime) {
  284 + return KTEntityUtil::getByDict('User', array(
  285 + 'last_login' => array('type' => 'after', 'value' => $dDateTime),
  286 + ), array('multi' => true));
  287 + }
271 } 288 }