Exemplo n.º 1
0
function posteazaAnunt($inchiriere = 0)
{
    global $oferta;
    global $apartament;
    global $client;
    global $agent;
    global $subzona;
    global $strada;
    global $fotografii;
    global $fisier;
    global $fh;
    $s = "\t";
    $id = $oferta->id;
    if ($inchiriere) {
        $id += 9000;
    }
    $anunt = $id;
    $anunt .= $s . "102";
    $anunt .= $s . "42";
    $anunt .= $s . "Bucuresti";
    $anunt .= $s . $subzona->Denumire;
    $anunt .= $s . "";
    if ($inchiriere == 1) {
        $anunt .= $s . "inchiriere";
        $tmp = "Inchiriere ";
    } else {
        $tmp = "Vanzare ";
        $anunt .= $s . "vanzare";
    }
    $tmp .= $apartament->NumarCamere > 1 ? "apartament " . $apartament->NumarCamere . " camere " : "garsoniera ";
    if ($apartament->PunctReper != "") {
        $tmp .= " - " . $apartament->PunctReper;
    }
    $anunt .= $s . $tmp;
    $anunt .= $s;
    $anunt .= $subzona->Denumire . ", confort " . $apartament->Confort . ", " . strtolower($apartament->TipApartament) . ", ";
    $anunt .= "etaj " . ($apartament->Etaj > 0 ? $apartament->Etaj : "P") . "/" . $apartament->EtajeBloc . ", ";
    if ($apartament->AnConstructie > 0) {
        $anunt .= "bloc din anul " . $apartament->AnConstructie;
    }
    $anunt .= ", suprafata " . round($apartament->SuprafataConstruita > 0 ? $apartament->SuprafataConstruita : $apartament->SuprafataUtila, 0) . " mp";
    if ($apartament->NrGrupuriSanitare > 1) {
        $anunt .= ", " . $apartament->NrGrupuriSanitare . " bai";
    } elseif ($apartament->NrGrupuriSanitare > 0) {
        $anunt .= ", o baie";
    }
    if ($apartament->NumarBalcoane > 1) {
        $anunt .= ", " . $apartament->NumarBalcoane . " balcoane";
    } elseif ($apartament->NumarBalcoane > 0) {
        $anunt .= ", un balcon";
    }
    $anunt .= scrieDotari("Mobilier", $apartament->id);
    $anunt .= scrieDotari("Electrocasnice", $apartament->id);
    $anunt .= scrieDotari("Finisaje / Dotari", $apartament->id);
    $anunt .= scrieDotari("Sistem de incalzire", $apartament->id);
    $anunt .= scrieDotari("Contorizare", $apartament->id);
    $anunt .= scrieDotari("Spatii utile", $apartament->id);
    $anunt .= scrieDotari("Dotari Imobil", $apartament->id);
    $anunt .= scrieDotari("Utilitati", $apartament->id);
    $anunt .= scrieDotari("Parcare", $apartament->id);
    $tmp = scrieDotari("Vedere", $apartament->id);
    if ($tmp != "") {
        $anunt .= "; Vedere: " . substr($tmp, 2, strlen($tmp));
    }
    $tmp = scrieDotari("Vecinatati", $apartament->id);
    if ($tmp != "") {
        $anunt .= "; Vecinatati: " . substr($tmp, 2, strlen($tmp));
    }
    $anunt .= ". Broker " . $agent->full_name() . ", tel. " . $agent->Telefon . ", " . $agent->Email;
    $anunt .= ", cod SP" . str_pad($id, 5, "0", STR_PAD_LEFT);
    $anunt .= $s . ($inchiriere == 1 ? $oferta->PretChirie : $oferta->Pret);
    $anunt .= $s . date("Y-m-d", strtotime(date("Y-m-d", strtotime(date("Y-m-d"))) . " +30 days"));
    // data expirare
    $site = "http://igor.lanconect.ro/Imob2009/images/";
    $tmp = "";
    foreach ($fotografii as $foto) {
        if ($tmp != "") {
            $tmp .= "," . $site . $foto->NumeFisier;
        } else {
            $tmp = $site . $foto->NumeFisier;
        }
    }
    $anunt .= $s . $tmp;
    $anunt .= "\n";
    fwrite($fh, $anunt);
}
Exemplo n.º 2
0
function posteazaAnunt($inchiriere = 0)
{
    global $oferta;
    global $apartament;
    global $client;
    global $agent;
    global $subzona;
    global $fotografii;
    //sleep(1);
    $id = $oferta->id;
    if ($inchiriere) {
        $id += 9000;
    }
    $fisier = "." . DS . "export" . DS . "pitagora{$id}.xml";
    $fh = fopen($fisier, "w");
    fwrite($fh, "<anunturi>\n");
    fwrite($fh, "<anunt>\n");
    fwrite($fh, "<idanunt>{$id}</idanunt>\n");
    if ($oferta->ExportPitagora < 3 && $oferta->Stare == 'de actualitate') {
        fwrite($fh, "<com>upd</com>\n");
    } else {
        fwrite($fh, "<com>del</com>\n");
    }
    if ($apartament->NumarCamere == 1) {
        $idCategorie = 5 + $inchiriere;
    }
    if ($apartament->NumarCamere == 2) {
        $idCategorie = 8 + $inchiriere;
    }
    if ($apartament->NumarCamere == 3) {
        $idCategorie = 11 + $inchiriere;
    }
    if ($apartament->NumarCamere == 4) {
        $idCategorie = 14 + $inchiriere;
    }
    if ($apartament->NumarCamere > 4) {
        $idCategorie = 17 + $inchiriere;
    }
    fwrite($fh, "<categorieid>{$idCategorie}</categorieid>\n");
    fwrite($fh, "<judetid>1</judetid>\n");
    fwrite($fh, "<localitateid>{$subzona->idPitagora}</localitateid>\n");
    fwrite($fh, "<pret>" . ($inchiriere == 1 ? $oferta->PretChirie : $oferta->Pret) . "</pret>\n");
    fwrite($fh, "<moneda>{$oferta->Moneda}</moneda>\n");
    fwrite($fh, "<anunt>");
    fwrite($fh, $subzona->Denumire . ", " . ($apartament->PunctReper != "" ? $apartament->PunctReper . ", " : ""));
    fwrite($fh, "confort " . $apartament->Confort . ", " . strtolower($apartament->TipApartament));
    if ($apartament->Etaj != "") {
        fwrite($fh, ", etaj " . ($apartament->Etaj > 0 ? $apartament->Etaj : "P"));
    }
    if ($apartament->EtajeBloc != "") {
        fwrite($fh, "/" . $apartament->EtajeBloc);
    }
    if ($apartament->AnConstructie > 0) {
        fwrite($fh, ", bloc din anul " . $apartament->AnConstructie);
    }
    fwrite($fh, ", suprafata " . ($apartament->SuprafataConstruita > 0 ? $apartament->SuprafataConstruita : $apartament->SuprafataUtila) . " mp");
    if ($apartament->NrGrupuriSanitare > 0) {
        fwrite($fh, ", " . ($apartament->NrGrupuriSanitare > 1 ? $apartament->NrGrupuriSanitare . " bai" : "o baie"));
    }
    if ($apartament->NumarBalcoane > 0) {
        fwrite($fh, ", " . ($apartament->NumarBalcoane > 1 ? $apartament->NumarBalcoane . " balcoane" : "un balcon"));
    }
    fwrite($fh, scrieDotari("Mobilier", $apartament->id));
    fwrite($fh, scrieDotari("Electrocasnice", $apartament->id));
    fwrite($fh, scrieDotari("Finisaje / Dotari", $apartament->id));
    fwrite($fh, scrieDotari("Sistem de incalzire", $apartament->id));
    fwrite($fh, scrieDotari("Contorizare", $apartament->id));
    fwrite($fh, scrieDotari("Parcare", $apartament->id));
    fwrite($fh, ", pret negociabil ");
    fwrite($fh, "</anunt>\n");
    fwrite($fh, "<codanunt>SP" . str_pad($oferta->id, 5, "0", STR_PAD_LEFT) . "</codanunt>\n");
    fwrite($fh, "<emailagent>" . $agent->Email . "</emailagent>\n");
    fwrite($fh, "<telagent>" . $agent->Telefon . "</telagent>\n");
    fwrite($fh, "<numeagent>" . $agent->full_name() . "</numeagent>\n");
    fwrite($fh, "<special>0</special>\n");
    if ($apartament->Lat > 0) {
        fwrite($fh, "<harta>http://www.map-imobiliare.ro/harta/?go={$apartament->Lat},{$apartament->Lng}</harta>\n");
    }
    fwrite($fh, "<video></video>\n");
    fwrite($fh, "<an_constructie>{$apartament->AnConstructie}</an_constructie>\n");
    fwrite($fh, "<suprafata>" . ($apartament->SuprafataConstruita > 0 ? $apartament->SuprafataConstruita : $apartament->SuprafataUtila) . "</suprafata>\n");
    fwrite($fh, "<mobilat>1</mobilat>\n");
    if ($oferta->OfertaWeb > 0) {
        fwrite($fh, "<link>http://www.simsparkman.ro/detaliioferta.php?id={$oferta->id}</link>\n");
    }
    fwrite($fh, "<exclusivitate>" . ($oferta->Exclusivitate > 0 ? 1 : 0) . "</exclusivitate>");
    fwrite($fh, "<colaborare>" . ($oferta->Exclusivitate > 0 ? 1 : 0) . "</colaborare>");
    $i = 0;
    if (!empty($fotografii)) {
        foreach ($fotografii as $foto) {
            $i++;
            fwrite($fh, "<poza{$i}>http://igor.lanconect.ro/Imob2009/{$foto->image_path()}</poza{$i}>\n");
        }
    }
    fwrite($fh, "</anunt>\n");
    fwrite($fh, "</anunturi>\n");
    fclose($fh);
    trimiteXML(substr($fisier, 1, strlen($fisier)));
}
Exemplo n.º 3
0
function posteazaAnunt($inchiriere = 0)
{
    global $oferta;
    global $apartament;
    global $client;
    global $agent;
    global $subzona;
    global $cartier;
    global $fotografii;
    $s = "|";
    //0
    if ($inchiriere) {
        if ($apartament->TipProprietate < 2) {
            $linie = "ia";
        }
        if ($apartament->TipProprietate == 2) {
            $linie = "ic";
        }
        if ($apartament->TipProprietate == 4) {
            if ($apartament->TipSpatiu == "birouri") {
                $linie = "ib";
            }
            if ($apartament->TipSpatiu == "comercial") {
                $linie = "es";
            }
            if ($apartament->TipSpatiu == "industrial") {
                $linie = "ii";
            }
        }
        if ($apartament->TipProprietate == 3) {
            $linie = "vt";
        }
    } else {
        if ($apartament->TipProprietate < 2) {
            $linie = "va";
        }
        if ($apartament->TipProprietate == 2) {
            $linie = "vc";
        }
        if ($apartament->TipProprietate == 3) {
            $linie = "vt";
        }
        if ($apartament->TipProprietate == 4) {
            if ($apartament->TipSpatiu == "birouri") {
                $linie = "vb";
            }
            if ($apartament->TipSpatiu == "comercial") {
                $linie = "vs";
            }
            if ($apartament->TipSpatiu == "industrial") {
                $linie = "vi";
            }
            if ($apartament->TipSpatiu == "hotel") {
                $linie = "vs";
            }
        }
    }
    //1
    $linie .= $s . $oferta->id;
    //2
    //$linie.=$s.$subzona->Denumire;
    $linie .= $s . $cartier->Denumire;
    //3
    $linie .= $s . "Bucuresti";
    //4
    $linie .= $s . "Bucuresti";
    //5
    //$linie.=$s.$apartament->PunctReper;
    $linie .= $s . $subzona->Denumire;
    //6
    if ($apartament->TipProprietate < 2) {
        switch ($apartament->TipApartament) {
            case "Decomandat":
                $linie .= $s . "D";
                break;
            case "Semidecomandat":
                $linie .= $s . "SD";
                break;
            default:
                $linie .= $s . "ND";
        }
    }
    if ($apartament->TipProprietate == 2) {
        if ($apartament->Etaje < 2) {
            $linie .= $s . "Casa";
        } else {
            $linie .= $s . "Vila";
        }
    }
    if ($apartament->TipProprietate == 4) {
        if ($apartament->TipSpatiu == "industrial") {
            $linie .= $s . "Hala";
        } else {
            if ($apartament->TipConstructie == "cladire de birouri") {
                $linie .= $s . "cladire birouri";
            }
            if ($apartament->TipConstructie == "centru comercial") {
                $linie .= $s . "complex comercial";
            }
            if ($apartament->TipConstructie == "hala") {
                $linie .= $s . "hala";
            }
            if ($apartament->TipConstructie == "bloc") {
                $linie .= $s . "apartament";
            }
            if ($apartament->TipConstructie == "depozit") {
                $linie .= $s . "hala";
            }
            if ($apartament->TipConstructie == "casa/vila") {
                $linie .= $s . "vila";
            }
            if ($apartament->TipConstructie == "hotel") {
                $linie .= $s . "apartament";
            }
        }
    }
    if ($apartament->TipProprietate == 3) {
        if ($apartament->Clasificare == "extravilan") {
            $linie .= $s . "extravilan";
        } else {
            $linie .= $s . "intravilan";
        }
    }
    //7
    if (!$inchiriere) {
        $linie .= $s . $oferta->Pret;
    } else {
        $linie .= $s . $oferta->PretChirie;
    }
    //8
    $linie .= $s . $oferta->Moneda;
    //9
    $linie .= $s . "";
    //10
    $separator = array("\r\n", "\n", "\r");
    $linie .= $s . str_replace($separator, "<br>", $apartament->Detalii);
    //11
    switch ($client->idUtilizator) {
        case 2:
            $linie .= $s . "2134";
            break;
        case 3:
            $linie .= $s . "2133";
            break;
        case 5:
            $linie .= $s . "2794";
            break;
        case 7:
            $linie .= $s . "3932";
            break;
        default:
            $linie .= $s . "2133";
    }
    //$client->idUtilizator;
    //12-13
    $site = "http://www.simsparkman.ro/foto/";
    $thumb = "http://igor.lanconect.ro/Imob2009/images/small/s";
    $i = 0;
    $tmp = "";
    $thumbs = "";
    foreach ($fotografii as $foto) {
        $i++;
        if ($i > 1) {
            if ($tmp != "") {
                $thumbs .= "++" . $thumb . $foto->NumeFisier;
                $tmp .= "++" . $site . $foto->NumeFisier;
            } else {
                $thumbs = $thumb . $foto->NumeFisier;
                $tmp = $site . $foto->NumeFisier;
            }
        } else {
            $linie .= $s . $thumb . $foto->NumeFisier . $s . $site . $foto->NumeFisier;
        }
    }
    //14-15
    $linie .= $s . $thumbs . $s . $tmp;
    //16
    $linie .= $s . ($apartament->SuprafataConstruita > 0 ? $apartament->SuprafataConstruita : $apartament->SuprafataUtila);
    //17
    if ($apartament->TipProprietate == 2) {
        $linie .= $s . $apartament->SuprafataCurte;
    } else {
        $linie .= $s . "";
    }
    //18
    if ($apartament->TipProprietate < 2 || $apartament->TipProprietate == 4) {
        if ($apartament->Etaj > 0) {
            $linie .= $s . $apartament->Etaj;
        } else {
            $linie .= $s . "P";
        }
    } else {
        $linie .= $s . "";
    }
    //19
    if ($apartament->TipProprietate < 2 || $apartament->TipProprietate == 4) {
        $linie .= $s . $apartament->EtajeBloc;
    } else {
        $linie .= $s . "";
    }
    //20
    if ($apartament->TipProprietate != 3) {
        $linie .= $s . $apartament->NumarCamere;
    } else {
        $linie .= $s . "";
    }
    //21
    $linie .= $s . "";
    //22
    $linie .= $s . "";
    //23
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . $apartament->Deschidere;
    } else {
        $linie .= $s . "";
    }
    //24
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . (are_dotarea("apa curenta", $apartament->id) ? "retea apa-canal" : "fara");
    } else {
        $linie .= $s . "";
    }
    //25
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . (are_dotarea("curent", $apartament->id) ? 1 : 0);
    } else {
        $linie .= $s . "";
    }
    //26
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . (are_dotarea("gaze", $apartament->id) ? 1 : 0);
    } else {
        $linie .= $s . "";
    }
    //27
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . (are_dotarea("canalizare", $apartament->id) ? "retea apa-canal" : "fara");
    } else {
        $linie .= $s . "";
    }
    //28
    if ($apartament->TipProprietate == 3) {
        switch ($apartament->TipTeren) {
            case "constructii":
                $linie .= $s . "constructii case";
                break;
            case "agricol":
                $linie .= $s . "agricultura";
                break;
            case "padure":
                $linie .= $s . "padure";
                break;
            default:
                $linie .= $s . "";
        }
    } else {
        $linie .= $s . "";
    }
    //29 - access
    $linie .= $s . "";
    //30 - inclinatie
    $linie .= $s . "";
    //31
    if ($apartament->TipProprietate == 3) {
        $linie .= $s . ($apartament->ConstructiePeTeren == 1 ? "da" : "nu");
    } else {
        $linie .= $s . "";
    }
    //32 - regim inaltime
    if ($apartament->TipProprietate == 2 || $apartament->TipProprietate == 3) {
        $structura = "";
        if ($apartament->Subsol == 1) {
            $structura .= "+S ";
        }
        if ($apartament->Demisol == 1) {
            $structura .= "+D ";
        }
        if ($apartament->Parter == 1) {
            $structura .= "+P ";
        }
        if ($apartament->Etaje > 0) {
            $structura .= "+" . $apartament->Etaje . " ";
        }
        if ($apartament->Mansarda == 1) {
            $structura .= "+M";
        }
        //if ($apartament->Pod==1) $structura.="+ pod";
        $linie .= $s . substr($structura, 1);
    } else {
        $linie .= $s . "";
    }
    //33
    if ($apartament->TipProprietate < 3) {
        $linie .= $s . $apartament->NrGrupuriSanitare;
    } else {
        $linie .= $s . "";
    }
    //34
    if ($apartament->TipProprietate < 4) {
        $linie .= $s . ($apartament->NrGrupuriSanitare > 0 ? "propriu" : "fara");
    } else {
        $linie .= $s . "";
    }
    //35 - amenajat
    $linie .= $s . "";
    //36
    if ($apartament->TipProprietate != 3) {
        $mobila = "";
        if ($apartament->are_dotarea("nemobilat")) {
            $mobila = "nemobilat";
        }
        if ($apartament->are_dotarea("semimobilat")) {
            $mobila = "partial";
        }
        if ($apartament->are_dotarea("clasic")) {
            $mobila = "complet";
        }
        if ($apartament->are_dotarea("modern")) {
            $mobila = "lux";
        }
        $linie .= $s . $mobila;
    } else {
        $linie .= $s . "";
    }
    //37
    if ($apartament->TipProprietate != 3) {
        $incalzire = "";
        if ($apartament->are_dotarea("centrala de apartament")) {
            $incalzire = "centrala termica";
        }
        if ($apartament->are_dotarea("termoficare")) {
            $incalzire = "termoficare";
        }
        if ($apartament->are_dotarea("debransat")) {
            $incalzire = "fara (debransat)";
        }
        if ($incalzire == "") {
            $incalzire = "alte moduri";
        }
        $linie .= $s . $incalzire;
    } else {
        $linie .= $s . "";
    }
    //38
    if ($apartament->TipProprietate < 3) {
        $linie .= $s . $apartament->AnConstructie;
    } else {
        $linie .= $s . "";
    }
    //39
    if ($apartament->TipProprietate < 2) {
        $structura = "";
        if ($apartament->are_dotarea("beton")) {
            $structura = "beton";
        }
        if ($apartament->are_dotarea("caramida")) {
            $structura = "caramida";
        }
        if ($apartament->are_dotarea("bca")) {
            $structura = "BCA";
        }
        $linie .= $s . $structura;
    } else {
        $linie .= $s . "";
    }
    //40
    $linie .= $s . "absent";
    //41
    $linie .= $s . "";
    // orientare ?????
    //42
    $linie .= $s . "http://www.simsparkman.ro/detaliioferta.php?id=" . $oferta->id;
    //43  utilitati, imbunatatiri
    $dot = "";
    $tmp = scrieDotari("Finisaje / Dotari", $apartament->id);
    if ($tmp != "") {
        $dot .= $tmp;
    }
    $tmp = scrieDotari("Stare interior", $apartament->id);
    if ($tmp != "") {
        $dot .= $tmp;
    }
    // 	$tmp=scrieDotari("Mobilier", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Electrocasnice", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Sistem de incalzire", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Contorizare", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Spatii utile", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Dotari Imobil", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Utilitati", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Parcare", $apartament->id);
    // 	if ($tmp!="") $dot.=$tmp;
    // 	$tmp=scrieDotari("Vedere", $apartament->id);
    // 	if ($tmp!="") $dot.=", Vedere:".substr($tmp, 2, strlen($tmp));
    // 	$tmp=scrieDotari("Vecinatati", $apartament->id);
    // 	if ($tmp!="") $dot.=", Vecinatati:".substr($tmp, 2, strlen($tmp));
    //$dot=alteDotari($apartament->id, $apartament->TipProprietate);
    $linie .= $s . substr($dot, 2, strlen($dot));
    //44
    if ($apartament->TipProprietate < 3) {
        $linie .= $s . $apartament->NumarBalcoane;
    } else {
        $linie .= $s . "";
    }
    //45
    $linie .= $s . $agent->full_name();
    //46
    $linie .= $s . $agent->Telefon;
    //47
    $linie .= $s . "http://igor.lanconect.ro/Imob2009/images/" . $agent->Poza;
    //48
    $linie .= $s . $agent->Email;
    //49
    $linie .= $s . $oferta->DataActualizare;
    echo $linie . "\n";
}
Exemplo n.º 4
0
function posteazaAnunt($inchiriere = 0)
{
    global $oferta;
    global $apartament;
    global $client;
    global $agent;
    global $subzona;
    global $fotografii;
    global $fisier;
    global $fh;
    $id = $oferta->id;
    //if ($inchiriere) { $id+=9000;}
    fwrite($fh, "<RespoAd>\n");
    fwrite($fh, "<User>\n");
    //fwrite($fh, $agent->id."\n");		//  trebuie cerut id-ul de la Roimobile
    fwrite($fh, "58200\n");
    fwrite($fh, "</User>\n");
    fwrite($fh, "<Contact>\n");
    fwrite($fh, "<public>");
    fwrite($fh, "1");
    fwrite($fh, "</public>\n");
    fwrite($fh, "<name>");
    fwrite($fh, $agent->full_name());
    fwrite($fh, "</name>\n");
    fwrite($fh, "<firstname>");
    fwrite($fh, $agent->Prenume);
    fwrite($fh, "</firstname>\n");
    fwrite($fh, "<lastname>");
    fwrite($fh, $agent->Nume);
    fwrite($fh, "</lastname>\n");
    fwrite($fh, "<function>");
    fwrite($fh, "Broker");
    fwrite($fh, "</function>\n");
    fwrite($fh, "<company>");
    fwrite($fh, "Sims Parkman");
    fwrite($fh, "</company>\n");
    fwrite($fh, "<street>");
    fwrite($fh, "Calea Calarasi");
    fwrite($fh, "</street>\n");
    fwrite($fh, "<town>");
    fwrite($fh, "Bucuresti");
    fwrite($fh, "</town>\n");
    fwrite($fh, "<zip>");
    fwrite($fh, "030614");
    fwrite($fh, "</zip>\n");
    fwrite($fh, "<homepage>");
    fwrite($fh, "http://www.simsparkman.ro");
    fwrite($fh, "</homepage>\n");
    fwrite($fh, "<refcountryid>");
    fwrite($fh, "96");
    fwrite($fh, "</refcountryid>\n");
    fwrite($fh, "<telephone>");
    fwrite($fh, "0314.398.268");
    fwrite($fh, "</telephone>\n");
    fwrite($fh, "<mobilephone>");
    fwrite($fh, $agent->Telefon);
    fwrite($fh, "</mobilephone>\n");
    fwrite($fh, "<fax>");
    fwrite($fh, "");
    fwrite($fh, "</fax>\n");
    fwrite($fh, "<externalid>");
    fwrite($fh, "");
    fwrite($fh, "</externalid>\n");
    fwrite($fh, "<userid>");
    fwrite($fh, $agent->id);
    //  dat de Romimo ??
    fwrite($fh, "</userid>\n");
    fwrite($fh, "<email>");
    fwrite($fh, $agent->Email);
    fwrite($fh, "</email>\n");
    fwrite($fh, "<active>");
    fwrite($fh, "1");
    fwrite($fh, "</active>\n");
    fwrite($fh, "</Contact>\n");
    fwrite($fh, "<Ad>");
    fwrite($fh, "<refuserid>");
    fwrite($fh, $agent->id);
    // dat de Romimo
    fwrite($fh, "</refuserid>\n");
    fwrite($fh, "<refclientid>");
    fwrite($fh, "18");
    fwrite($fh, "</refclientid>\n");
    fwrite($fh, "<externalid>");
    fwrite($fh, $id);
    fwrite($fh, "</externalid>\n");
    fwrite($fh, "<refadstateid>");
    fwrite($fh, "1");
    // aici e operatia de stergere ?
    fwrite($fh, "</refadstateid>\n");
    fwrite($fh, "<refadtypeid>");
    fwrite($fh, "3");
    fwrite($fh, "</refadtypeid>\n");
    fwrite($fh, "<refmaincategory>");
    fwrite($fh, "1");
    //  1	Apartamente ;2	Case ; 3	Terenuri; 4	Spatii comerciale
    fwrite($fh, "</refmaincategory>\n");
    fwrite($fh, "<refsubcategory>");
    fwrite($fh, $apartament->NumarCamere > 1 ? $apartament->NumarCamere + 5 : 5);
    fwrite($fh, "</refsubcategory>\n");
    fwrite($fh, "<refcountryid>");
    fwrite($fh, "96");
    fwrite($fh, "</refcountryid>\n");
    fwrite($fh, "<countyname>");
    fwrite($fh, "Bucuresti");
    fwrite($fh, "</countyname>\n");
    fwrite($fh, "<cityname>");
    fwrite($fh, $apartament->Sector > 0 ? "Sector " . $apartament->Sector : "Bucuresti");
    // sau sector
    fwrite($fh, "</cityname>\n");
    fwrite($fh, "<latitude>");
    fwrite($fh, $apartament->Lat);
    fwrite($fh, "</latitude>\n");
    fwrite($fh, "<longitude>");
    fwrite($fh, $apartament->Lng);
    fwrite($fh, "</longitude>\n");
    fwrite($fh, "<dealtype>");
    fwrite($fh, "0");
    fwrite($fh, "</dealtype>\n");
    if ($inchiriere == 0) {
        fwrite($fh, "<forsale>");
        fwrite($fh, "1");
        fwrite($fh, "</forsale>\n");
        fwrite($fh, "<buyprice>");
        fwrite($fh, $oferta->Pret);
        fwrite($fh, "</buyprice>\n");
        fwrite($fh, "<forrent>");
        fwrite($fh, "0");
        fwrite($fh, "</forrent>\n");
        fwrite($fh, "<rentprice>");
        fwrite($fh, "0");
        fwrite($fh, "</rentprice>\n");
    }
    if ($inchiriere == 1) {
        fwrite($fh, "<forrent>");
        fwrite($fh, "1");
        fwrite($fh, "</forrent>\n");
        fwrite($fh, "<rentprice>");
        fwrite($fh, $oferta->PretChirie);
        fwrite($fh, "</rentprice>\n");
        fwrite($fh, "<forsale>");
        fwrite($fh, "0");
        fwrite($fh, "</forsale>\n");
        fwrite($fh, "<buyprice>");
        fwrite($fh, 0);
        fwrite($fh, "</buyprice>\n");
    }
    fwrite($fh, "<refcurrencyid>");
    fwrite($fh, "1");
    fwrite($fh, "</refcurrencyid>\n");
    if ($inchiriere == 1) {
        $tmp = "Inchiriere ";
    } else {
        $tmp = "Vanzare ";
    }
    $tmp .= $apartament->NumarCamere > 1 ? "apartament " . $apartament->NumarCamere . " camere, " : "garsoniera, ";
    $tmp .= $subzona->Denumire;
    if ($apartament->PunctReper != "") {
        $tmp .= " - " . $apartament->PunctReper;
    }
    fwrite($fh, "<title>");
    fwrite($fh, $tmp);
    fwrite($fh, "</title>\n");
    $anunt = $subzona->Denumire . ", confort " . $apartament->Confort . ", " . strtolower($apartament->TipApartament) . ", ";
    $anunt .= "etaj " . ($apartament->Etaj > 0 ? $apartament->Etaj : "P") . "/" . $apartament->EtajeBloc . ", ";
    if ($apartament->AnConstructie > 0) {
        $anunt .= "bloc din anul " . $apartament->AnConstructie;
    }
    $anunt .= ", suprafata " . round($apartament->SuprafataConstruita > 0 ? $apartament->SuprafataConstruita : $apartament->SuprafataUtila, 0) . " mp";
    if ($apartament->NrGrupuriSanitare > 1) {
        $anunt .= ", " . $apartament->NrGrupuriSanitare . " bai";
    } elseif ($apartament->NrGrupuriSanitare > 0) {
        $anunt .= ", o baie";
    }
    if ($apartament->NumarBalcoane > 1) {
        $anunt .= ", " . $apartament->NumarBalcoane . " balcoane";
    } elseif ($apartament->NumarBalcoane > 0) {
        $anunt .= ", un balcon";
    }
    $anunt .= scrieDotari("Mobilier", $apartament->id);
    $anunt .= scrieDotari("Electrocasnice", $apartament->id);
    $anunt .= scrieDotari("Finisaje / Dotari", $apartament->id);
    $anunt .= scrieDotari("Sistem de incalzire", $apartament->id);
    $anunt .= scrieDotari("Contorizare", $apartament->id);
    $anunt .= scrieDotari("Spatii utile", $apartament->id);
    $anunt .= scrieDotari("Dotari Imobil", $apartament->id);
    $anunt .= scrieDotari("Utilitati", $apartament->id);
    $anunt .= scrieDotari("Parcare", $apartament->id);
    $tmp = scrieDotari("Vedere", $apartament->id);
    if ($tmp != "") {
        $anunt .= "; Vedere: " . substr($tmp, 2, strlen($tmp));
    }
    $tmp = scrieDotari("Vecinatati", $apartament->id);
    if ($tmp != "") {
        $anunt .= "; Vecinatati: " . substr($tmp, 2, strlen($tmp));
    }
    $anunt .= "; cod SP" . str_pad($id, 5, "0", STR_PAD_LEFT);
    fwrite($fh, "<text>");
    fwrite($fh, $anunt);
    fwrite($fh, "</text>\n");
    fwrite($fh, "<validfrom>");
    fwrite($fh, date("Y-m-d"));
    fwrite($fh, "</validfrom>\n");
    fwrite($fh, "<validto>");
    fwrite($fh, date("Y-m-d", strtotime(date("Y-m-d", strtotime(date("Y-m-d"))) . " +30 days")));
    fwrite($fh, "</validto>\n");
    //fwrite($fh, "<>");
    //	fwrite($fh, );
    //fwrite($fh, "</>\n");
    fwrite($fh, "</Ad>\n");
    fwrite($fh, "<Pictures>\n");
    fwrite($fh, "<picture refexternaltype=\"1\" externalid=\"{$id}\" originalname=\"http://igor.lanconect.ro/Imob2009/images/logoromimo.jpg\"></picture>\n");
    foreach ($fotografii as $foto) {
        fwrite($fh, "<picture ");
        fwrite($fh, "refexternaltype=\"3\" rank=\"{$foto->Ordin}\" externalid=\"{$id}\" originalname=\"http://igor.lanconect.ro/Imob2009/images/{$foto->NumeFisier}\" description=\"{$foto->Detalii}\"");
        fwrite($fh, "></picture>\n");
    }
    fwrite($fh, "</Pictures>\n");
    fwrite($fh, "</RespoAd>\n");
}