]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttUser.class.php
Implemented locking feature as an optionally enabled plugin.
[timetracker.git] / WEB-INF / lib / ttUser.class.php
index 78fee50dd32b7d1169ade48626df0336c9c1e4dc..a14f7cddd50c1f264f3389830a9943b96b06bad1 100644 (file)
@@ -172,4 +172,20 @@ class ttUser {
     }
     return $result;
   }
+
+  // isDateLocked checks whether a specifc date is locked for modifications.
+  function isDateLocked($date)
+  {
+    if ($this->isPluginEnabled('lk')) {
+      // Determine lock date. Entries earlier than lock date cannot be created or modified.
+      $lockdate = 0;
+      if ($this->lock_interval > 0) {
+        $lockdate = new DateAndTime();
+        $lockdate->decDay($this->lock_interval);
+      }
+      if($lockdate && $date->before($lockdate))
+        return true;
+    }
+    return false;
+  }
 }