diff options
Diffstat (limited to 'modules-available/locationinfo/inc/locationinfo.inc.php')
-rw-r--r-- | modules-available/locationinfo/inc/locationinfo.inc.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php new file mode 100644 index 00000000..4f26519d --- /dev/null +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -0,0 +1,28 @@ +<?php + +class LocationInfo +{ + //TODO TEST WITH NEWER DB + public function getPcState($logintime, $lastseen) { + /* pcState: + * [0] = IDLE (NOT IN USE) + * [1] = OCCUPIED (IN USE) + * [2] = OFF + * [3] = 10 days offline (BROKEN?) + */ + + $NOW = time(); + + + if ($NOW - $lastseen > 864000) { + return 3; + } elseif ($NOW - $lastseen > 610) { + return 2; + } elseif ($logintime == 0) { + return 0; + } elseif ($logintime > 0) { + return 1; + } + return -1; + } +} |