Code

Added last system login
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Sep 2009 10:29:06 +0000 (10:29 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 3 Sep 2009 10:29:06 +0000 (10:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14203 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/posix/class_posixAccount.inc
gosa-core/plugins/personal/posix/generic.tpl

index 308567239e53ce86c3eb54d2217e405a278b56e3..68866fa5b7dcf2ac980b49b5ffe924203f6903c2 100644 (file)
@@ -67,6 +67,7 @@ class posixAccount extends plugin
   var $activate_shadowExpire= "0";
   var $mustchangepassword= "0";
   var $force_ids= 0;
+  var $gotoLastSystemLogin= "";
   var $group_dialog= FALSE;
   var $show_ws_dialog= FALSE;
   var $secondaryGroups= array();
@@ -92,7 +93,7 @@ class posixAccount extends plugin
 
   var $attributes     = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
       "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange",
-      "shadowExpire", "gosaDefaultPrinter", "uid","accessTo","trustModel");
+      "shadowExpire", "gosaDefaultPrinter", "uid","accessTo","trustModel", "gotoLastSystemLogin");
 
   var $objectclasses= array("posixAccount", "shadowAccount");
 
@@ -112,6 +113,15 @@ class posixAccount extends plugin
     /* Load bases attributes */
     plugin::plugin($config, $dn);
 
+    /*  If gotoLastSystemLogin is available read it from ldap and create a readable
+        date time string, fallback to sambaLogonTime if available.
+     */
+    if(isset($this->attrs['gotoLastSystemLogin'][0]) && preg_match("/^[0-9]*$/",$this->attrs['gotoLastSystemLogin'][0])){
+      $this->gotoLastSystemLogin = date("d.m.Y H:i:s", strtotime($this->attrs['gotoLastSystemLogin'][0]));
+    } else if(isset($this->attrs['sambaLogonTime'][0]) && preg_match("/^[0-9]*$/",$this->attrs['sambaLogonTime'][0])){
+      $this->gotoLastSystemLogin = date("d.m.Y H:i:s", $this->attrs['sambaLogonTime'][0]);
+    }
+
     /* Setting uid to default */
     if(isset($this->attrs['uid'][0])){
       $this->uid = $this->attrs['uid'][0];
@@ -519,6 +529,9 @@ class posixAccount extends plugin
       $smarty->assign("mustchangepasswordACL", $this->getacl("mustchangepassword",$SkipWrite));
     }
 
+    // Set last system login
+    $smarty->assign("gotoLastSystemLogin",$this->gotoLastSystemLogin);
+
     /* Fill calendar */
     /* If this $this->shadowExpire is empty 
         use current date as base for calculating selectbox values.
index a02e385f482f73ee58fceda3b9e34a9bc4a9336e..60584909685130ae0e1362106512c961e535c06d 100644 (file)
      <td>{t}Status{/t}</td>
      <td>{$status}</td>
     </tr>
+{if $gotoLastSystemLogin}
+    <tr>
+     <td>{t}Last logon{/t}</td>
+     <td>{$gotoLastSystemLogin}</td>
+    </tr>
+{/if}
 {/if}
    </table>