"); } function hidden_form($array) { foreach ($array as $key => $value) { echo(" "); } } function display_static_form() { $_POST = stripslashes_array($_POST); echo ("
Name: | $_POST[obsName] |
Institute: | $_POST[obsInst] |
Email: | $_POST[obsEmail] |
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] %
Support Astronomers: | $_POST[supAstron] |
Telescope Operator: | $_POST[supTelOp] |
Technical Support: | $_POST[supTech] |
Comments: | $_POST[supComments] |
On-line automatic pipeline: | $_POST[comAutom] |
User data reduction workstation: | $_POST[comData] |
Off-line computer support (camp): | $_POST[comCamp] |
Comments: | $_POST[comComments] |
Telephone: | $_POST[netPhone] |
Data (network): | $_POST[netNetwork] |
Comments: | $_POST[netComments] |
About ESO in general: | $_POST[infoEso] |
About La Silla: | $_POST[infoLaSilla] |
Telescope/Instrument Manuals: | $_POST[infoTech] |
Comments: | $_POST[infoComments] |
Home to Santiago | $_POST[transSantiago] |
To/From La Silla | $_POST[transLaSilla] |
Comments: | $_POST[transComments] |
Santiago | $_POST[foodSantiago] |
La Silla | $_POST[foodLaSilla] |
Comments: | $_POST[foodComments] |
$_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.
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(); } } }