summaryrefslogblamecommitdiffstats
path: root/modules-available/locationinfo/inc/locationinfo.inc.php
blob: f81d79f655ca29557940e6dec21b8b8f85d7a1a6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13



                  
 







                                                                
 
                              
 










                                                   
 
 
<?php

class LocationInfo
{

	public static 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;
	}

}