3 //Require once the holidays controller for the is_holiday() function
4 require_once($GLOBALS['incdir'] . "/main/holidays/Holidays_Controller.php");
6 function getIDfromUser($name)
8 $query = "select id from users where username=? limit 1";
9 $rez = sqlStatement($query, array($name));
10 $row = sqlFetchArray($rez);
11 if (!is_numeric($row['id'])) {
18 // returns an array of facility id and names
19 function getUserFacilities($uID)
21 if (!$GLOBALS['restrict_user_facility']) {
23 select id, name, color
25 where service_location != 0
29 select uf.facility_id as id, f.name, f.color
30 from users_facility uf
31 left join facility f on (uf.facility_id = f.id)
32 where uf.tablename='users'
38 while ($row = sqlFetchArray($rez)) {
45 //retrieve the name based on the username
46 function getNameFromUsername($username)
48 $query = "select * from users where username like ? and username != ''";
49 $res = sqlQuery($query, [$username]);
54 * Check if day is weekend day
58 function is_weekend_day($day)
61 if (in_array($day, $GLOBALS['weekend_days'])) {
69 * This function checks if a certain date (YYYY/MM/DD) is a marked as a holiday/closed event in the events table
73 function is_holiday($date)
75 Holidays_Controller::is_holiday($date);