source: trunk/www/dch/shiftinfo.php@ 18535

Last change on this file since 18535 was 18208, checked in by Daniela Dorner, 9 years ago
added expert-on-call info
File size: 3.2 KB
Line 
1<html>
2<head>
3 <meta name="Author" content="The FACT Group" />
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 <title>FACT Project</title>
6 <link rel="StyleSheet" type="text/css" href="../style.css" />
7</head>
8
9
10<body>
11
12
13<a href='https://www.fact-project.org/smartfact'>Is FACT taking data?</a><br><br>
14Who is on shift?
15(from <a href='https://www.fact-project.org/shift'>FACT shift plan<a>
16and <a href='https://www.fact-project.org/logbook/memberlist.php'>FACT logbook<a>)
17
18<!--#!/usr/bin/php-->
19<?php
20
21if ($argv)
22 parse_str(implode('&', array_slice($argv, 1)), $_GET);
23
24if (isset($_GET['date']))
25 $today=date("Ymd", strtotime($_GET["date"]));
26else
27{
28 if (date("H")>8)
29 $today=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y")));
30 else
31 $today=date("Ymd",strtotime(date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")))." -1 day"));
32}
33
34function send_email($date, $msg_part)
35{
36 //echo "WARNING: no shift crew found -> need to send email.<br>\n";
37 $to = "fact-online@lists.phys.ethz.ch";
38 //$to = "dorner@astro.uni-wuerzburg.de";
39 $subject = $date.": shifter-info missing";
40 $msg = "WARNING: No shifter-info available for ".$date."\n\n";
41 $msg .= $msg_part;
42
43 if (!mail($to, $subject, $msg, 'From:observations@fact-project.org'))
44 echo "Sending warning email failed.<br>\n\n";
45}
46
47
48echo "<br> &nbsp;&nbsp;Night: ".$today." (date of sunset) <br>";
49$query="SELECT u FROM calendar.Data WHERE CONCAT(y, LPAD(m+1, 2, 0), LPAD(d,2,0))='".$today."'";
50//excluding experts and institutes (apart from 'moon')
51$query.=" AND NOT x=1 AND u NOT in('ISDC','ETHZ','TUDO','UNIWUE')";
52include ("db.php");
53$db_id = mysql_connect($host, $user, $pw);
54$result = mysql_query($query);
55$numrows=mysql_num_rows($result);
56if ($numrows==0)
57 send_email($today, "Whoever is on shift, please insert your name to the shift calendar!\n");
58else
59 echo "&nbsp;&nbsp;Contact Info Shiftcrew: <br>\n ";
60echo "<ul>\n";
61while ($row = mysql_fetch_row($result))
62{
63 $query2="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='".$row[0]."'";
64 $result2 = mysql_query($query2);
65 while ($row2 = mysql_fetch_row($result2))
66 {
67 echo "<li>".$row2[0].": ".$row2[1]."</li>\n";
68 if (!$row2[1])
69 send_email($today, "Dear ".$row2[0].", please insert your 'Contact Info' in your logbook user-profile!");
70 }
71 mysql_free_result($result2);
72}
73echo "</ul>\n <br>\n <br>\n ";
74mysql_free_result($result);
75
76echo "Expert-On-Call Contact Info: <br>\n <ul>\n";
77$query3="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) LEFT JOIN memberlist.experts ON (ufid=userid) WHERE now() < stop and now() > start";
78$result3 = mysql_query($query3);
79while ($row3 = mysql_fetch_row($result3))
80{
81 echo "<li>".$row3[0].": ".$row3[1]."</li>\n";
82}
83mysql_free_result($result3);
84echo "</ul>\n";
85
86/*
87echo "General Contact Info: <br>\n <ul>\n";
88$query4="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='dorner'";
89$result4 = mysql_query($query4);
90while ($row4 = mysql_fetch_row($result4))
91{
92 echo "<li>".$row4[0].": ".$row4[1]."</li>\n";
93}
94mysql_free_result($result4);
95echo "</ul>\n";
96*/
97
98?>
99
100</body>
101</html>
Note: See TracBrowser for help on using the repository browser.