Beispiel #1
0
function showAirports($targetId, $ap_ccode, $ap_place)
{
    /*
     * After a Airport is chosen in the "region" select, the IATA-Code and the
     * Airport-Name must be displayed in the part of the screen below the
     * routes criteria input fields. Also the select "Airport Code" must be filled
     * with the IATA-Code of the Airport chosen through "region"
     */
    $res = new xajaxResponse();
    $select = getApCodeSelect($targetId, $ap_ccode, $ap_place);
    $res->addAssign($targetId, "innerHTML", $select);
    //show table with results in contentView div
    $rtModel = new RoutesModel();
    $airports = $rtModel->getAirports($ap_ccode, $ap_place);
    $contentView = "<table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"><tbody>\n";
    $contentView .= "<tr><td><strong>IATA Code</strong></td><td><strong>Airport Name</strong></td></tr>\n";
    foreach ($airports as $airportRow) {
        $contentView .= "<tr><td width=\"50%\">" . $airportRow['ap_iatacode'] . "</td>\n\t\t\t\t\t     <td width=\"50%\">" . $airportRow['ap_name'] . "</td></tr>\n";
    }
    $contentView .= "\n</tbody></table>\n";
    $res->addAssign("contentView", "innerHTML", $contentView);
    return $res;
}
Beispiel #2
0
function loadCredentials($mailadress)
{
    $res = new xajaxResponse();
    $pm = new ProfileModel();
    try {
        $profile = $pm->getProfileByEmail($mailadress);
    } catch (Exception $e) {
        die($e->getMessage());
        if ($e->getCode() == 1) {
            //no profile found for given mailadress => reload Mailaddress Drop Down List
            $res->addScriptCall("setModifyMask");
            $res->addAssign("contentView", "innerHTML", "Chosen profile dont't exist. Probably deleted by another user");
            return $res;
        } elseif ($e->getCode() == 6) {
            $res->addAssign("contentView", "innerHTML", $e->getMessage());
        } else {
            throw $e;
        }
    }
    unset($pm);
    $res->addAssign("firstname", "value", html_entity_decode($profile->first, ENT_QUOTES, "UTF-8"));
    $res->addAssign("lastname", "value", html_entity_decode($profile->last, ENT_QUOTES, "UTF-8"));
    $rm = new RoutesModel();
    //Make the country Select and select the entry from the profile by default
    $countrys = $rm->getCountrys();
    $select = "<select tabindex=\"5\" id=\"home_country_select\" name=\"home_country_select\"" . "onChange=\"xajax_fillRegion('home_region',this.options[this.selectedIndex].value)\">\n";
    foreach ($countrys as $country) {
        if ($country['ct_name'] == $profile->country) {
            $select .= "<option value=\"" . $country['ct_code'] . "\" selected>" . $country['ct_name'] . "</option>\n";
        } else {
            $select .= "<option value=\"" . $country['ct_code'] . "\">" . $country['ct_name'] . "</option>\n";
        }
    }
    $res->addAssign("home_country", "innerHTML", $select);
    //Make the region select and select the entry from the profile by default
    $regions = $rm->getRegionByCountry($profile->ccode);
    $regionSelect = "<select tabindex=\"6\" id=\"home_region_select\" name=\"home_region_select\" " . "onChange=\"xajax_showAirports('home_apcode'," . $profile->ccode . "," . $profile->ap_place . ")\">\n";
    foreach ($regions as $region) {
        if ($region['ap_place'] == $profile->ap_place) {
            $regionSelect .= "<option selected>" . $region['ap_place'] . "</option>\n";
        } else {
            $regionSelect .= "<option>" . $region['ap_place'] . "</option>\n";
        }
    }
    $regionSelect .= "</select>\n";
    $res->addAssign("home_region", "innerHTML", $regionSelect);
    //Make the Airport-Code Select and select the entry from the profile by default
    $airports = $rm->getAirports($profile->ccode, $profile->ap_place);
    $apSelect = "<select tabindex=\"7\" id=\"home_apcode_select\" name=\"home_apcode_select\">\n";
    foreach ($airports as $airport) {
        $apSelect .= "<option>" . $airport['ap_iatacode'] . "</option>\n";
    }
    $apSelect .= "</select>\n";
    $res->addAssign("home_apcode", "innerHTML", $apSelect);
    //Show the picture in the contentView diff
    $content = "<br/>\n<table style=\"text-align:left;\" border=\"0\"";
    $content .= " cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n<tbody>\n";
    $content .= "<tr><td class=\"topField\" colspan=\"3\"><h2>Welcome " . $profile->first . "</h2><br/></td></tr>\n<tr valign=\"bottom\">\n<td class=\"leftField\" rowspan=\"2\"";
    if ($profile->image == null) {
        $size = getimagesize("pictures/NoPicture.bmp");
        $content .= "width=\"" . $size[0] . "\"><img src=\"pictures/NoPicture.bmp\">";
    } else {
        /*$path="pictures/".session_id();
        			if(!file_exists($path)) 
        				mkdir($path);
        		
        			$file= $path."/".$profile->email;
        			$handle = fopen($file,"w");
        			fwrite($handle,$profile->image);
        			fclose($handle);
        			$size = getimagesize($file);
        			$content .= "width=\"".$size[0]."\"> ";
        		//	$content .= "<img src=\"".$file."\">";*/
        @session_start();
        $_SESSION['email'] = $profile->email;
        srand(time());
        $content .= "<img src=loadPicture.php?" . rand() . ">";
    }
    $content .= "</td><td style=\"padding-left:20px\">Email Adress</td><td class=\"rightField\"><strong>" . $profile->email . "</strong></td></tr>\n";
    $content .= "<tr valign=\"top\"><td style=\"padding-left:20px;\">Airport Preference</td><td class=\"rightField\"><strong>" . $profile->airport . "</strong></td></tr>";
    $content .= "<tr><td class=\"bottomField\" colspan=\"3\">&nbsp;</td></tr>";
    $content .= "</tbody></table>\n";
    $res->addAssign("contentView", "innerHTML", $content);
    return $res;
}