Ejemplo n.º 1
0
function getRegionSelect($targetId, $ccode, $selected = "")
{
    $rtModel = new RoutesModel();
    if ($targetId == "dep_region") {
        $ApCodeDivId = "dep_apcode";
        $tabindex = 2;
    }
    if ($targetId == "arv_region") {
        $ApCodeDivId = "arv_apcode";
        $tabindex = 5;
    }
    if ($targetId == "home_region") {
        $ApCodeDivId = "home_apcode";
        $tabindex = 6;
    }
    $regions = $rtModel->getRegionByCountry($ccode);
    $options = array();
    $options[] = array("innerValue" => "Select Value ...", "attributeValue" => "invalid");
    foreach ($regions as $region) {
        $options[] = array("innerValue" => $region['ap_place'], "attributeValue" => $region['ap_place']);
    }
    $onChange = "xajax_showAirports('" . $ApCodeDivId . "','" . $ccode . "',this.options[this.selectedIndex].value)";
    $select = makeSelect($targetId . "_select", $targetId . "_select", $onChange, $options, array($selected), $tabindex);
    return $select;
}
Ejemplo n.º 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;
}