"); while (list($index,$value) = each($array)) { echo("\n"); } echo (""); } function check_email($str) { //returns 1 if valid email, 0 if not if(ereg("^.+@.+\\..+$", $str)) return 1; else return 0; } function check_runid($str) { //returns 1 if valid runId, 0 if not if(ereg("^([0-9]{2,4})\.[A-Z]\-([0-9]{4})\(([A-Z])\)", $str, $regs)) { return 1; } else { return 0; } } function display_form($error_array) { $_POST = stripslashes_array($_POST); echo ("

$error_array[main]

La Silla End of Mission Report

Observer


$error_array[observer]
Name:
Institute:
Email:
$error_array[email]

This is the address to which we will reply - please double check it.


Observing Run


$error_array[run] Please submit one report per observing run or telescope/instrument combination.

Telescope / Instrument:"); $arr=array(); include("dha_connect.inc"); // query db to form telescope list $query = "SELECT ltrim(rtrim(Telescope))+' - '+ltrim(rtrim(Instrument)) as telins FROM ARSystem..LSNL2_Instruments WHERE Status=0 AND Instrument NOT LIKE '<%' ORDER BY Telescope"; $q = sybase_query($query,$con); while ($r = sybase_fetch_array($q)) { $telinsvalue = $r["telins"]; $arr["$telinsvalue"]=$telinsvalue; } display_selector($arr, "telinst"); $arr = array("telescope" => "", "instrument" => ""); hidden_form($arr); echo("

Program ID: (look here for the schedule) $error_array[runId]

Observing run from : "); for($i=1;$i<=31;$i++) { $arr_date[$i] = $i; } display_selector($arr_date,"obsFromDy"); $arr_month = array( 1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); display_selector($arr_month,"obsFromMo"); for($i=2004;$i<=2020;$i++) { $arr_year[$i] = $i; } display_selector($arr_year,"obsFromYr"); echo("  to  "); display_selector($arr_date,"obsToDy"); display_selector($arr_month,"obsToMo"); display_selector($arr_year,"obsToYr"); echo("

Percentage of program fulfilled:"); $arr = array("100" => "100%", "75" => "75%", "50" => "50%", "25" => "25%", "0" => "0%"); display_selector($arr,"obsProgFrac"); echo("


Evaluation & Comments


Support at the telescope

Support Astronomers: "); $arr = array("Not Applicable" => "Not Applicable", "Excellent" => "Excellent", "Good" => "Good", "Acceptable" => "Acceptable", "Poor" => "Poor"); display_selector($arr,"supAstron"); echo("
Telescope Operator: "); display_selector($arr,"supTelOp"); echo("
Technical Support: "); display_selector($arr,"supTech"); echo("
Comments:

Computer Facilities

On-line automatic pipeline: "); display_selector($arr,"comAutom"); echo("
User data reduction workstation: "); display_selector($arr,"comData"); echo("
Off-line computer support (camp): "); display_selector($arr,"comCamp"); echo("
Comments:

Communications

Telephone: "); display_selector($arr,"netPhone"); echo("
Data (network): "); display_selector($arr,"netNetwork"); echo("
Comments:

Information

About ESO in general: "); display_selector($arr,"infoEso"); echo("
About La Silla: "); display_selector($arr,"infoLaSilla"); echo("
Telescope/Instrument Manuals: "); display_selector($arr,"infoTech"); echo("
Comments:

Transport

Home to Santiago "); display_selector($arr,"transSantiago"); echo("
To/From La Silla "); display_selector($arr,"transLaSilla"); echo("
Comments:

Food & Lodging

Santiago "); display_selector($arr,"foodSantiago"); echo("
La Silla "); display_selector($arr,"foodLaSilla"); echo("
Comments:

General Comments

Use this space for generic comments. In particular comments on the instrument and telescope you used, comments on the data, on the data processing, comments on the scientific output are most welcome. Please also use this space in case you would like to suggest hardware or software upgrades to the instruments.

   

"); } function hidden_form($array) { foreach ($array as $key => $value) { echo(" "); } } function display_static_form() { $_POST = stripslashes_array($_POST); echo ("

Observer

Name: $_POST[obsName]
Institute: $_POST[obsInst]
Email: $_POST[obsEmail]

Observing Run

Telescope: $_POST[telescope]
Instrument: $_POST[instrument]

Program ID: $_POST[progId]

Observing run from $_POST[obsFromDy]/$_POST[obsFromMo]/$_POST[obsFromYr] to $_POST[obsToDy]/$_POST[obsToMo]/$_POST[obsToYr]

Percentage of program fulfilled: $_POST[obsProgFrac] %


Evaluation & Comments

Support at the telescope

Support Astronomers: $_POST[supAstron]
Telescope Operator: $_POST[supTelOp]
Technical Support: $_POST[supTech]
Comments: $_POST[supComments]

Computer Facilities

On-line automatic pipeline: $_POST[comAutom]
User data reduction workstation: $_POST[comData]
Off-line computer support (camp): $_POST[comCamp]
Comments: $_POST[comComments]

Communications

Telephone: $_POST[netPhone]
Data (network): $_POST[netNetwork]
Comments: $_POST[netComments]

Information

About ESO in general: $_POST[infoEso]
About La Silla: $_POST[infoLaSilla]
Telescope/Instrument Manuals: $_POST[infoTech]
Comments: $_POST[infoComments]

Transport

Home to Santiago $_POST[transSantiago]
To/From La Silla $_POST[transLaSilla]
Comments: $_POST[transComments]

Food & Lodging

Santiago $_POST[foodSantiago]
La Silla $_POST[foodLaSilla]
Comments: $_POST[foodComments]

General Comments

$_POST[generalComments]
"); } function ratingToInt($string) { $arr = array("4" => "Excellent", "3" => "Good", "2" => "Acceptable", "1" => "Poor", "0" => "Not Applicable"); $result = 0; foreach ( $arr as $key => $value ) { if ($string == $value) { // was $key before $result = $value; } } return $result; } function email_body() { $_POST = stripslashes_array($_POST); $text = "The following End-of-Mission report has been submitted: OBSERVER ======== Name: $_POST[obsName] Institute: $_POST[obsInst] Email: $_POST[obsEmail] OBSERVING RUN ============= Telescope: $_POST[telescope] Instrument: $_POST[instrument] Program ID: $_POST[progId] Observing run from $_POST[obsFromDy]/$_POST[obsFromMo]/$_POST[obsFromYr] to $_POST[obsToDy]/$_POST[obsToMo]/$_POST[obsToYr] Percentage of program fulfilled: $_POST[obsProgFrac] % EVALUATION & COMMENTS ===================== 1. Support at the telescope --------------------------- Support Astronomers: $_POST[supAstron] Telescope Operator: $_POST[supTelOp] Technical Support: $_POST[supTech] Comments: $_POST[supComments] 2. Computer Facilities ---------------------- On-line automatic pipeline: $_POST[comAutom] User data reduction workstation: $_POST[comData] Off-line computer support (camp): $_POST[comCamp] Comments: $_POST[comComments] 3. Communications ----------------- Telephone: $_POST[netPhone] Data (network): $_POST[netNetwork] Comments: $_POST[netComments] 4. Information -------------- About ESO in general: $_POST[infoEso] About La Silla: $_POST[infoLaSilla] Telescope/Instrument Manuals: $_POST[infoTech] Comments: $_POST[infoComments] 5. Transport ------------ Home to Santiago: $_POST[transSantiago] To/From La Silla: $_POST[transLaSilla] Comments: $_POST[transComments] 6. Food & Lodging ----------------- Santiago: $_POST[foodSantiago] La Silla: $_POST[foodLaSilla] Comments: $_POST[foodComments] 7. General Comments ------------------- $_POST[generalComments]"; return $text; } function format_remedy_email() { /* here we have to format the new email to send it to remedy */ // Split telescope + Instrument $_POST[telescope] = substr($_POST['telinst'],0,strpos($_POST['telinst'],"-")-1); $_POST[instrument] = substr($_POST['telinst'],strpos($_POST['telinst'],"-")+2); // Transform program ID into integer run ID ereg("^([0-9]{2,4})\.[A-Z]\-([0-9]{4})\(([A-Z])\)", g$_POST[proId], $regs); $regs[1] = sprintf("%03d",$regs[1]); $idx = ord($regs[3]) - 65; $run_id = sprintf("%2d%04d%02d",substr($regs[1],1),$regs[2],$idx); // Compute current date/time (record date of submission) $submit_date = date("M j Y g:iA"); // Format beginning and end of obs. run in datetime format // M/d/yy $_POST[obsBegin] = date("m/d/y", mktime(0,0,0,$_POST[obsFromMo],$_POST[obsFromDy],$_POST[obsFromYr])); $_POST[obsEnd] = date("m/d/y", mktime(0,0,0,$_POST[obsToMo],$_POST[obsToDy],$_POST[obsToYr])); // Convert ratings into numbers: Excellent --> 4, Good --> 3, ... $supAstron = ratingToInt($_POST[supAstron]); $supTelOp = ratingToInt($_POST[supTelOp]); $supTech = ratingToInt($_POST[supTech]); $comAutom = ratingToInt($_POST[comAutom]); $comData = ratingToInt($_POST[comData]); $comCamp = ratingToInt($_POST[comCamp]); $netPhone = ratingToInt($_POST[netPhone]); $netNetwork = ratingToInt($_POST[netNetwork]); $infoEso = ratingToInt($_POST[infoEso]); $infoLaSilla = ratingToInt($_POST[infoLaSilla]); $infoTech = ratingToInt($_POST[infoTech]); $transSantiago = ratingToInt($_POST[transSantiago]); $transLaSilla = ratingToInt($_POST[transLaSilla]); $foodSantiago = ratingToInt($_POST[foodSantiago]); $foodLaSilla = ratingToInt($_POST[foodLaSilla]); $template_format=" # # File exported Tue Dec 6 22:18:47 2005 # Schema: La Silla End Of Mission Report Server: wlsremdy.ls.eso.org Login: eomusr Password: eomusr Action: Submit Format: Short Name ! 2!:$_POST[obsName] Institute ! 8!:$_POST[obsInst] Email !536870917!:$_POST[obsEmail] Telescope !536870918!:$_POST[telescope] Instrument !536870919!:$_POST[instrument] Program ID !536870920!:$_POST[progId] Observing run from: !536870922!:$_POST[obsBegin] to !536870923!:$_POST[obsEnd] Percent of Program Fulfilled ! 7!:$_POST[obsProgFrac] COMMENTS (Support at the telescope) !536870929!:[\$\$ ".$_POST[supComments]." \$\$] Support astronomers ..................................... !536870925!:$supAstron Telescope operator ...................................... !536870927!:$supTelOp Technical Support ........................................ !536870928!:$supTech COMMENTS (Computer Facilities) !536870934!:[\$\$ ".$_POST[comComments]." \$\$] On-Line automatic pipeline ............................ !536870932!:$comAutom Data reduction workstation at the control room !536870965!:$comData Computer support out of the control room ....... !536870933!:$comCamp COMMENTS (Communications) !536870939!:[\$\$ ".$_POST[netComments]." \$\$] Telephone .................................................. !536870937!:$netPhone Data (network) ............................................ !536870938!:$netNetwork COMMENTS (Information) !536870942!:[\$\$ ".$_POST[infoComments]." \$\$] About ESO in general ................................... !536870943!:$infoEso About La Silla ............................................ !536870944!:$infoLaSilla Telescope/Instrument manuals ...................... !536870945!:$infoTech COMMENTS (Transport) !536870948!:[\$\$ ".$_POST[transComments]." \$\$] Home to Santiago ........................................ !536870949!:$transSantiago To/From La Silla ........................................ !536870950!:$transLaSilla COMMENTS (Food & Lodging) !536870953!:[\$\$ ".$_POST[foodComments]." \$\$] Santiago ..................................................... !536870954!:$foodSantiago La Silla ..................................................... !536870956!:$foodLaSilla !536870957!:[\$\$ ".$_POST[generalComments]." \$\$] "; return $template_format; } // Main code starts here... if ( $_POST[formstep] < 1 ) { display_form(""); } else if ( $_POST[formstep] == 1 ) { // ---------------------------- // // retrieve all post variables // added by RSS 2005-11-21 // ---------------------------- // if ($_POST) { foreach ($_POST as $k => $v) { $asign = "\$".$k." = trim (stripslashes (\$v));"; eval($asign); if (is_numeric ($v)) { $asign = "\$".$k." = intval(\$v);"; eval($asign); } } } if ( $obsName == "" || $obsInst == "" || $obsEmail == "" ) { $error_in_form = 1; $error_array[observer] =" Some mandatory parameters are missing in this section. Please fill out all fields.
"; } if (!check_email($obsEmail)) { $error_in_form = 1; $error_array[email] =" This e-mail address does not seem to be valid.
"; } if (!check_runid($progId)) { $error_in_form = 1; $error_array[runId] =" This program ID does not seem to be valid.
"; } if ( $progId == "" || $obsFromDy == "" || $obsFromMo == "" || $obsFromYr == "" || $obsToDy == "" || $obsToMo == "" || $obsToYr == "" ) { $error_in_form = 1; $error_array[run] =" Some mandatory parameters are missing in this section. Please fill out all fields.
"; } if ( $error_in_form == 1 ) { $error_array[main] =" There were errors in your form. Please correct the form below.
"; display_form($error_array); } else { // Send e-mail $mail_subject = "La Silla End-of-Mission report for run $_POST[progId]"; $mail_text = format_remedy_email(); // Send the email $mail = new PHPMailer(); $mail->From = $_POST[obsName]; $mail->FromName = "$_POST[obsEmail]"; $mail->AddAddress("esoarsls@eso.org"); $mail->Subject = $mail_subject; $mail->Body = $mail_text; $result = $mail->Send(); if ($result == FALSE) { echo("We Couldn't process your EoM
"); } else { // Write acknowledgement... echo "

Thank you very much for taking the time to fill out our End-of-Mission report. Your input has been sent. You will receive an email confirmation when your feedback is inserted in our database.

" ; display_static_form(); } } }