Changeset 18208
- Timestamp:
- 06/15/15 00:09:36 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/dch/shiftinfo.php
r17532 r18208 16 16 and <a href='https://www.fact-project.org/logbook/memberlist.php'>FACT logbook<a>) 17 17 18 <!--#!/usr/bin/php--> 18 19 <?php 19 20 20 if (date("H")>8) 21 $today=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y"))); 21 if ($argv) 22 parse_str(implode('&', array_slice($argv, 1)), $_GET); 23 24 if (isset($_GET['date'])) 25 $today=date("Ymd", strtotime($_GET["date"])); 22 26 else 23 $today=date("Ymd",strtotime(date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")))." -1 day")); 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 34 function 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 24 47 25 48 echo "<br> Night: ".$today." (date of sunset) <br>"; 26 $query="SELECT u FROM calendar.Data WHERE CONCAT(y, LPAD(m+1, 2, 0), LPAD(d,2,0))='".$today."' AND x=0 "; 27 //echo $query; 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')"; 28 52 include ("db.php"); 29 53 $db_id = mysql_connect($host, $user, $pw); 30 54 $result = mysql_query($query); 31 echo " Contact Info Shiftcrew: <br>\n <ul>\n"; 55 $numrows=mysql_num_rows($result); 56 if ($numrows==0) 57 send_email($today, "Whoever is on shift, please insert your name to the shift calendar!\n"); 58 else 59 echo " Contact Info Shiftcrew: <br>\n "; 60 echo "<ul>\n"; 32 61 while ($row = mysql_fetch_row($result)) 33 62 { 34 //echo " ".$row[0]." ";35 63 $query2="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='".$row[0]."'"; 36 //echo $query2;37 64 $result2 = mysql_query($query2); 38 65 while ($row2 = mysql_fetch_row($result2)) 39 66 { 40 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!"); 41 70 } 42 71 mysql_free_result($result2); … … 45 74 mysql_free_result($result); 46 75 47 echo " General Contact Info: <br>\n <ul>\n";48 $query3="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='dorner'";76 echo "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"; 49 78 $result3 = mysql_query($query3); 50 79 while ($row3 = mysql_fetch_row($result3)) … … 53 82 } 54 83 mysql_free_result($result3); 84 echo "</ul>\n"; 55 85 86 /* 87 echo "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); 90 while ($row4 = mysql_fetch_row($result4)) 91 { 92 echo "<li>".$row4[0].": ".$row4[1]."</li>\n"; 93 } 94 mysql_free_result($result4); 56 95 echo "</ul>\n"; 96 */ 57 97 58 98 ?>
Note:
See TracChangeset
for help on using the changeset viewer.