Beispiel #1
0
 /**
  * Display a listing of the resource.
  * GET /cautas
  *
  * @return Response
  */
 public function index()
 {
     $cartiere = Cartier::all()->toArray();
     $tip_cladiri = TipCladire::all()->toArray();
     $etaje = TipEtaj::all()->toArray();
     $tip_compartimente = TipCompartiment::all()->toArray();
     $finisaje_interioare = TipFinisajeInterne::all()->toArray();
     $imobils = Imobile::with('localitate', 'judet', 'cartier', 'nrcam', 'etajapartament', 'compartiment', 'finint', 'tip_cladire')->get();
     Debugbar::info($imobils->toArray());
     return View::make('cauta.index')->with(compact('cartiere', 'tip_cladiri', 'etaje', 'tip_compartimente', 'finisaje_interioare', 'imobils'));
 }
Beispiel #2
0
    $agent["Adresa2"] = $usr->Adresa2;
    $agent["Oras"] = $usr->Oras;
    $agent["Judet"] = $usr->Judet;
    $agent["Tara"] = $usr->Tara;
    $agent["CNP"] = $usr->CNP;
    $agent["SerieCI"] = $usr->SerieCI;
    $agent["NumarCI"] = $usr->NumarCI;
    $agent["Telefon"] = $usr->Telefon;
    $agent["Email"] = $usr->Email;
    $sql_agent .= "('" . join("', '", array_values($agent)) . "'),";
}
$sql_agent = substr($sql_agent, 0, strlen($sql_agent) - 1);
$result = execute_querry($sql_agent, $conexiune2);
// refresh subzona
$sql = "SELECT * FROM Cartier";
$cartiere = Cartier::find_by_sql($sql);
$sql = "DELETE FROM Subzona";
$result = execute_querry($sql, $conexiune2);
$sql = "ALTER TABLE Subzona AUTO_INCREMENT = 1";
$result = execute_querry($sql, $conexiune2);
$subzona = array();
$sql_subzone = "INSERT INTO Subzona (id,Denumire,idCartier) VALUES ";
foreach ($cartiere as $tmp) {
    $subzona["id"] = $tmp->id;
    $subzona["Denumire"] = $tmp->Denumire;
    $subzona["idCartier"] = $tmp->idZona;
    $sql_subzone .= "('" . join("', '", array_values($subzona)) . "'),";
}
$sql_subzone = substr($sql_subzone, 0, strlen($sql_subzone) - 1);
$result = execute_querry($sql_subzone, $conexiune2);
// refresh CategorieDotari
Beispiel #3
0
    		</tr>
        	<tr>
            	<td class="label">Denumire: </td>
                <td><input type="text" name="Denumire" maxlength="30" value="<?php 
if (isset($Denumire)) {
    echo htmlentities($Denumire);
}
?>
" /></td>
            </tr>
             <tr>
            	<td class="label">Cartier:</td>
            	<td>
            		<select name='idCartier'>
            		<?php 
$cartierList = Cartier::find_all();
foreach ($cartierList as $cartier) {
    $selected = isset($idCartier) && $idCartier == $cartier->id ? " selected " : "";
    echo "<option value='" . $cartier->id . "'" . $selected . ">" . $cartier->Denumire . "</option>";
}
?>
            		</select>
            	</td>
            </tr>
            <tr>
            	<td class="label">ID Pitagora: </td>
                <td><input type="text" name="idPitagora" maxlength="30" value="<?php 
if (isset($idPitagora)) {
    echo htmlentities($idPitagora);
}
?>
Beispiel #4
0
    return $ret;
}
$sql = "SELECT * FROM Oferta WHERE ExportImopedia>0 AND ExportImopedia<4";
// status oferta:
//					0 - nu se exporta
//					1 - creare
//					2 - update
//					3 - delete
//					4 - exportat
$oferte = Oferta::find_by_sql($sql);
if (!empty($oferte)) {
    foreach ($oferte as $oferta) {
        echo $oferta->id;
        $apartament = Apartament::find_by_id($oferta->idApartament);
        $subzona = Subzona::find_by_id($apartament->idSubzona);
        $cartier = Cartier::find_by_id($subzona->idCartier);
        $oras = Zona::find_by_id($cartier->idZona);
        $imopedia = new Imopedia($apartament, $oferta, $subzona, $cartier, $oras);
        if ($oferta->ExportImopedia < 3 && $oferta->Stare == 'de actualitate') {
            $imopedia->syncronize();
            echo " - sincronizat<br />";
        } else {
            $imopedia->deleteOferta();
            echo " - sters<br />";
        }
        $oferta->ExportImopedia = $oferta->ExportImopedia == 3 ? 0 : 4;
        if ($oferta->Stare != 'de actualitate') {
            $oferta->ExportImopedia = 0;
        }
        $oferta->save();
    }
Beispiel #5
0
?>
		</table>
		
	</div>

<script type="text/javascript"> 

<?php 
$zonalist = Zona::find_all();
if (!empty($zonalist)) {
    foreach ($zonalist as $zona) {
        echo "hide(\"cartiereZona" . $zona->id . "\");";
    }
}
$sql = "SELECT * FROM Cartier WHERE Dezactivat='0' ORDER BY Denumire";
$cartierList = Cartier::find_by_sql($sql);
if (!empty($cartierList)) {
    foreach ($cartierList as $cartier) {
        echo "hide(\"zoneCartier" . $cartier->id . "\");";
    }
}
?>
	hide("zoneTree");
//console.log($('#zoneTree table').find('input[type="checkbox"][onClick^="checkZone"]').eq(0));
	$('#zoneTree table').find('input[type="checkbox"][onClick^="checkZone"]').each(function(ii, sel){
		$(sel).attr('onChange', "triggerChangeZone(this);");
		});

	function triggerChangeZone(self){
        var kids = $(self).parent().parent().parent().next().find('div > table').children().find('input[type="checkbox"][onclick^="selectZone"]');
		if($(self).is(':checked')){
Beispiel #6
0
require_once ".././include/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
include_layout_template('admin_header.php');
?>
<script type="text/javascript"> 
<!--

function back(){
	document.location = ("cartier_list.php");
}

//-->
</script> 

<?php 
$cartier = Cartier::find_by_id($_GET['id']);
$cartier->delete();
?>

<h3>Cartierul <?php 
echo $cartier->Denumire;
?>
 a fost sters.</h3>

<div id="butoane" class="butoane">
		<input type="button" name="submit" value="Inapoi" onclick="back()" />
</div>
<?php 
include_layout_template('admin_footer.php');
Beispiel #7
0
function sync_Oferta($id)
{
    global $conexiune2;
    global $ftp_conn;
    $ftp_conn = ftp_connect(FTP_SERVER) or die("Could not connect to ftp location");
    $login_result = ftp_login($ftp_conn, FTP_USER, FTP_PASSWORD);
    $oferta_fields = array("id", "idApartament", "IdAgentVanzare", "idAgentInchiriere", "Pret", "Moneda", "Negociabil", "DataActualizare", "OfertaSpeciala", "Exclusivitate", "Vanzare", "Stare", "ComisionClient", "ComisionCumparatorZero", "Inchiriere", "PretChirie", "Titlu");
    $apartament_fields = array("id", "DataIntrare", "TipProprietate", "NumarCamere", "Confort", "TipApartament", "Duplex", "Etaj", "EtajeBloc", "TipConstructie", "Subsol", "Demisol", "Parter", "Etaje", "Mansarda", "Pod", "Oras", "Zona", "Subzona", "AnConstructie", "AnRenovare", "NrGrupuriSanitare", "Detalii", "SuprafataUtila", "SuprafataConstruita", "SuprafataTerasa", "SuprafataEtaj1", "SuprafataEtaj2", "SuprafataEtaj3", "SuprafataCurte", "AmprentaSol", "Deschidere", "NumarDeschideri", "TipCurte", "TipIntrare", "NumarBalcoane", "NumarBucatarii", "NumarTerase", "NumarParcari", "NumarGaraje", "ProiectNefinalizat", "Lat", "Lng", "LatimeDrumAcces", "POT", "CUT", "Inclinatie", "ConstructiePeTeren", "Destinatie", "TipTeren", "Clasificare", "Localizare", "TipSpatiu", "Inaltime", "Vitrina", "ClasaBirouri", "youtube");
    $oferta = Oferta::find_by_id($id);
    $apartament = Apartament::find_by_id($id);
    // sincronizare dotari
    sync_CategorieDotari();
    sync_Dotari();
    //echo $oferta->OfertaWeb;
    if ($oferta->OfertaWeb == 2 || $oferta->OfertaWeb == 3) {
        $sql = "SELECT NumeFisier FROM fes_Foto WHERE idApartament='{$apartament->id}'";
        $result = execute_querry($sql, $conexiune2);
        while ($row = mysql_fetch_array($result)) {
            ftp_delete($ftp_conn, NEW_FTP_PATH . DS . $row[0]);
        }
        $sql = "DELETE FROM fes_Apartament WHERE id='{$apartament->id}'";
        $result = execute_querry($sql, $conexiune2);
        $sql = "DELETE FROM fes_Oferta WHERE id='{$oferta->id}'";
        $result = execute_querry($sql, $conexiune2);
        $sql = "DELETE FROM fes_DotareApartament WHERE idApartament='{$apartament->id}'";
        $result = execute_querry($sql, $conexiune2);
        $sql = "DELETE FROM fes_Foto WHERE idApartament='{$apartament->id}'";
        $result = execute_querry($sql, $conexiune2);
        if ($oferta->OfertaWeb == 3) {
            $oferta->OfertaWeb = 0;
            $oferta->save();
            return;
        }
    }
    $subzona = Subzona::find_by_id($apartament->idSubzona);
    $cartier = Cartier::find_by_id($subzona->idCartier);
    $oras = Zona::find_by_id($cartier->idZona);
    foreach ($oferta_fields as $field) {
        switch ($field) {
            case "Stare":
                $site_oferta[] = site_stare($oferta->Stare);
                break;
            default:
                $site_oferta[] = $oferta->{$field};
                break;
        }
    }
    foreach ($apartament_fields as $field) {
        switch ($field) {
            case "Oras":
                $site_apartament[] = $oras->Denumire;
                break;
            case "Zona":
                $site_apartament[] = $cartier->Denumire;
                break;
            case "Subzona":
                $site_apartament[] = $subzona->Denumire;
                break;
            default:
                $site_apartament[] = $apartament->{$field};
                break;
        }
    }
    $sql_oferta = "INSERT INTO fes_Oferta ";
    $sql_oferta .= "(" . join(",", array_values($oferta_fields)) . ")";
    $sql_oferta .= " VALUES ('" . join("','", array_values($site_oferta)) . "')";
    $sql_apartament = "INSERT INTO fes_Apartament ";
    $sql_apartament .= "(" . join(",", array_values($apartament_fields)) . ")";
    $sql_apartament .= " VALUES ('" . join("','", array_values($site_apartament)) . "')";
    $result = execute_querry($sql_apartament, $conexiune2);
    $result = execute_querry($sql_oferta, $conexiune2);
    // sincronizare dotari
    $sql = "SELECT * FROM DotareApartament WHERE idApartament='{$apartament->id}'";
    $dotariApartament = Dotareapartament::find_by_sql($sql);
    if (!empty($dotariApartament)) {
        $sql_dotare = "INSERT INTO fes_DotareApartament (idApartament,idDotare) VALUES ";
        foreach ($dotariApartament as $dotareApartament) {
            $da["idApartament"] = $oferta->id;
            $da["idDotare"] = $dotareApartament->idDotare;
            $sql_dotare .= "('" . join("', '", array_values($da)) . "'),";
        }
        $sql_dotare = substr($sql_dotare, 0, strlen($sql_dotare) - 1);
        $result = execute_querry($sql_dotare, $conexiune2);
    }
    //sincronizare poze
    if ($oferta->Vanzare) {
        if ($oferta->Inchiriere) {
            $pozaPrefix = "Vanzare-Inchiriere-";
        } else {
            $pozaPrefix = "Vanzare-";
        }
    } else {
        $pozaPrefix = "Inchiriere-";
    }
    if ($apartament->TipProprietate < 2) {
        $pozaPrefix .= $apartament->NumarCamere > 1 ? ucfirst(tip_proprietate($apartament->TipProprietate)) . " " . $apartament->NumarCamere . " camere " : "Garsoniera ";
    } else {
        if ($apartament->TipProprietate == 2) {
            $pozaPrefix .= ($apartament->Etaje < 1 ? "Casa " : "Vila ") . $apartament->NumarCamere . " camere ";
        } else {
            $pozaPrefix .= ucfirst(tip_proprietate($apartament->TipProprietate)) . " ";
            if ($apartament->TipProprietate == 4) {
                $pozaPrefix .= $apartament->TipSpatiu . " ";
            }
        }
    }
    $zona = Zona::find_by_id($cartier->idZona);
    $pozaPrefix .= $zona->Denumire . "-" . $cartier->Denumire . "-" . $subzona->Denumire;
    $sql = "SELECT * FROM Foto WHERE idApartament='{$apartament->id}'";
    $fotografii = Foto::find_by_sql($sql);
    if (!empty($fotografii)) {
        $sql_foto = "INSERT INTO fes_Foto (idApartament, NumeFisier, Detalii, Ordin, Schita) VALUES ";
        foreach ($fotografii as $foto) {
            $f["idProprietate"] = $oferta->id;
            $f["NumeFisier"] = str_replace(" ", "-", $pozaPrefix) . "-" . $foto->NumeFisier;
            $f["Detalii"] = $foto->Detalii;
            $f["Ordin"] = $foto->Ordin;
            $f["Schita"] = $foto->Schita;
            $sql_foto .= "('" . join("', '", array_values($f)) . "'),";
            $ftp_file[] = $foto->NumeFisier;
            if (!ftp_put($ftp_conn, NEW_FTP_PATH . DS . $f["NumeFisier"], ".." . DS . "images" . DS . $foto->NumeFisier, FTP_BINARY)) {
                echo "Nu am reusit sa transfer foto {$foto->NumeFisier} al proprietatii {$oferta->id}";
            }
        }
        $sql_foto = substr($sql_foto, 0, strlen($sql_foto) - 1);
        $result = execute_querry($sql_foto, $conexiune2);
    }
    //echo $sql_apartament."</br>";
    //echo $sql_oferta."</br";
    //echo $sql_dotare."</br";
    switch ($oferta->OfertaWeb) {
        case 1:
            $oferta->OfertaWeb = 4;
            break;
        case 2:
            $oferta->OfertaWeb = 4;
            break;
        case 3:
            $oferta->OfertaWeb = 0;
            break;
    }
    $oferta->save();
    ftp_close($ftp_conn);
}
Beispiel #8
0
//-->
</script>
<?php 
$message = "";
if (isset($_GET['id'])) {
    $cartier = Cartier::find_by_id($_GET['id']);
    //$zona=Zona::find_by_id();
    $Denumire = $cartier->Denumire;
    $idZona = $cartier->idZona;
    $_SESSION['curentIdCartier'] = $cartier->id;
}
if (isset($_POST['submit'])) {
    $cartier = new Cartier();
    $Denumire = $_POST['Denumire'];
    $idZona = $_POST['idZona'];
    $cartier = Cartier::find_by_id($_SESSION['curentIdCartier']);
    unset($_SESSION['curentIdCartier']);
    $cartier->Denumire = $Denumire;
    $cartier->idZona = $idZona;
    $cartier->Dezactivat = $_POST['Dezactivat'];
    $cartier->save();
    $message = "salvat";
}
?>

<form action="cartier_update.php" method="post">
	<div class="view" align="center" >
		<h3>Modificare cartier<?php 
if ($message != "") {
    echo " - " . $message;
}
Beispiel #9
0
}
include_layout_template('admin_header.php');
?>
<script type="text/javascript"> 
<!--

function back(){
	document.location = ("cartier_list.php");
}

//-->
</script>
<?php 
$message = "";
if (isset($_POST['submit'])) {
    $cartier = new Cartier();
    $Denumire = $_POST['Denumire'];
    $idZona = $_POST['idZona'];
    $sql = "SELECT * FROM Cartier WHERE Denumire='{$Denumire}'";
    $cartierList = Cartier::find_by_sql($sql);
    if (!empty($cartierList)) {
        $message = "Cartier deja exista in baza de date";
    } else {
        $cartier->Denumire = $Denumire;
        $cartier->idZona = $idZona;
        $cartier->save();
        $message = "Adaugat";
    }
}
?>
function posteazaAnunt($inchiriere = 0, $afisare = 1)
{
    global $oferta;
    global $apartament;
    global $client;
    global $agent;
    global $subzona;
    global $fotografii;
    global $s;
    global $session_id;
    global $idImobiliare;
    global $ok;
    $zona = Cartier::find_by_id($subzona->idCartier);
    $oras = Zona::find_by_id($zona->idZona);
    switch ($oras->Denumire) {
        case "Bucuresti":
            $orasImo = 13822;
            break;
        case "Buftea":
            $orasImo = 8116;
            break;
        default:
            $orasImo = 13822;
    }
    $id = $oferta->id;
    if ($inchiriere) {
        $id += 90000;
    }
    $compartimentare = array("Decomandat" => 26, "Semidecomandat" => 27, "Circular" => 29, "Comandat" => 28, "Duplex" => 26);
    $moneda = array("EUR" => 172, "RON" => 173, "LEI" => 173, "USD" => 174);
    $ofertaxml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
	<oferta tip="';
    //."apartament"
    switch ($apartament->TipProprietate) {
        case 0:
            $ofertaxml .= "apartament";
            break;
        case 1:
            $ofertaxml .= "apartament";
            break;
        case 2:
            $ofertaxml .= "casavila";
            break;
        case 3:
            $ofertaxml .= "teren";
            break;
        case 4:
            $ofertaxml .= "spatiu";
            break;
    }
    $ofertaxml .= '" versiune="3">
	<id2>' . $id . '</id2>' . ($inchiriere > 0 ? "<deinchiriat>1</deinchiriat>" : "<devanzare>1</devanzare>") . '
	<tara>1048</tara>
	<judet>10</judet>
	<localitate>' . $orasImo . '</localitate>
	<zona>' . $subzona->idImobiliare . '</zona>
	<siteagentie>0</siteagentie>
	<portal>1</portal>';
    if ($apartament->TipProprietate < 2) {
        $ofertaxml .= '<tiplocuinta>' . ($apartament->NumarCamere > 1 ? "110" : "111") . '</tiplocuinta>';
    }
    if ($apartament->TipProprietate == 4) {
        switch ($apartament->TipSpatiu) {
            case "birouri":
                $ofertaxml .= '<tipspatiu>419</tipspatiu>';
                break;
            case "comercial":
                $ofertaxml .= '<tipspatiu>420</tipspatiu>';
                break;
            case "industrial":
                $ofertaxml .= '<tipspatiu>421</tipspatiu>';
                break;
            case "hotel":
                $ofertaxml .= '<tipspatiu>422</tipspatiu>';
                break;
            default:
                $ofertaxml .= '<tipspatiu>420</tipspatiu>';
        }
    }
    if ($apartament->TipProprietate < 3) {
        $ofertaxml .= '<nrcamere>' . $apartament->NumarCamere . '</nrcamere>';
    }
    if (strpos("014", $apartament->TipProprietate) !== false) {
        $ofertaxml .= '<etaj>' . ($apartament->Etaj + 45) . '</etaj>';
    }
    $ofertaxml .= '<longitudine>' . $apartament->Lng . '</longitudine>
	<latitudine>' . $apartament->Lat . '</latitudine>
	<altitudine>200</altitudine>
	<caroiaj></caroiaj>';
    if ($apartament->SuprafataConstruita > 0) {
        $ofertaxml .= "<suprafataconstruita>{$apartament->SuprafataConstruita}</suprafataconstruita>";
    }
    if ($oferta->Titlu != "") {
        $ofertaxml .= "<titlu><lang id=\"1048\">" . base64_encode($oferta->Titlu) . "</lang></titlu>";
    }
    if (!($inchiriere > 0)) {
        $ofertaxml .= "<pretvanzare>" . ($oferta->Pret + 0) . "</pretvanzare>";
        $ofertaxml .= "<monedavanzare>{$moneda[$oferta->Moneda]}</monedavanzare>";
    } else {
        $ofertaxml .= "<pretinchiriere>{$oferta->PretChirie}</pretinchiriere>";
        $ofertaxml .= "<monedainchiriere>{$moneda[$oferta->Moneda]}</monedainchiriere>";
    }
    if ($oferta->ComisionCumparatorZero == '1') {
        $ofertaxml .= "<comisionzero>1</comisionzero>";
    } else {
        $ofertaxml .= "<comisionzero>2</comisionzero>";
        $ofertaxml .= "<comisioncumparator><lang id=\"1048\">" . base64_encode($oferta->ComisionClient) . "</lang></comisioncumparator>";
    }
    // utilitati
    $tmp = "";
    $x = dotare_imobiliare("gaze", $apartament->id, $apartament->TipProprietate, "2", "123", "307", "357");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("curent", $apartament->id, $apartament->TipProprietate, "32", "98", "308", "352");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("apa curenta", $apartament->id, $apartament->TipProprietate, "90", "120", "305", "354");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("canalizare", $apartament->id, $apartament->TipProprietate, "91", "121", "306", "355");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("curent trifazic", $apartament->id, $apartament->TipProprietate, "", "111", "309", "353");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("termoficare", $apartament->id, $apartament->TipProprietate, "26", "170", "", "340");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("centrala bloc", $apartament->id, $apartament->TipProprietate, "27", "", "", "");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("centrala proprie", $apartament->id, $apartament->TipProprietate, "28", "171", "", "341");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("incalzire cu sobe", $apartament->id, $apartament->TipProprietate, "35", "172", "", "342");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("incalzire pardoseala", $apartament->id, $apartament->TipProprietate, "36", "174", "", "344");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("aer conditionat", $apartament->id, $apartament->TipProprietate, "44", "176", "", "346");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $tmp = substr($tmp, 0, -1);
    $ofertaxml .= "<utilitati>{$tmp}</utilitati>";
    //alte detalii zona
    $tmp = "";
    $x = dotare_imobiliare("asfaltate", $apartament->id, $apartament->TipProprietate, "67", "297", "321", "423");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("betonate", $apartament->id, $apartament->TipProprietate, "72", "299", "323", "425");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("neamenajate", $apartament->id, $apartament->TipProprietate, "74", "301", "325", "427");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("pietruite", $apartament->id, $apartament->TipProprietate, "71", "298", "322", "424");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $x = dotare_imobiliare("de pamant", $apartament->id, $apartament->TipProprietate, "73", "300", "324", "426");
    if ($x != "") {
        $tmp .= $x . " ";
    }
    $tmp = substr($tmp, 0, -1);
    $ofertaxml .= "<altedetaliizona>{$tmp}</altedetaliizona>";
    if ($apartament->TipProprietate != 3) {
        // fara terenuri
        $ofertaxml .= "<suprafatautila>{$apartament->SuprafataUtila}</suprafatautila>";
        $ofertaxml .= "<anconstructie>{$apartament->AnConstructie}</anconstructie>";
        $ofertaxml .= "<nrgaraje>{$apartament->NumarGaraje}</nrgaraje>";
        //dotari
        $tmp = "";
        $x = dotare_imobiliare("bucatarie mobilata", $apartament->id, $apartament->TipProprietate, "88", "233", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("mobilat clasic", $apartament->id, $apartament->TipProprietate, "81", "280", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("mobilat modern", $apartament->id, $apartament->TipProprietate, "82", "281", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("semimobilat", $apartament->id, $apartament->TipProprietate, "83", "282", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("nemobilat", $apartament->id, $apartament->TipProprietate, "481", "482", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("frigider", $apartament->id, $apartament->TipProprietate, "102", "270", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("cuptor cu microunde", $apartament->id, $apartament->TipProprietate, "103", "265", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("aragaz", $apartament->id, $apartament->TipProprietate, "104", "263", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("masina de spalat rufe", $apartament->id, $apartament->TipProprietate, "95", "273", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("masina de spalat vase", $apartament->id, $apartament->TipProprietate, "106", "274", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("televizor", $apartament->id, $apartament->TipProprietate, "112", "278", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("hota", $apartament->id, $apartament->TipProprietate, "105", "272", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("apometre", $apartament->id, $apartament->TipProprietate, "127", "238", "", "395");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("repartitoare", $apartament->id, $apartament->TipProprietate, "128", "239", "", "396");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("contor individual gaze", $apartament->id, $apartament->TipProprietate, "129", "240", "", "397");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("interfon", $apartament->id, $apartament->TipProprietate, "144", "255", "", "408");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("lift", $apartament->id, $apartament->TipProprietate, "145", "256", "", "409");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("uscatorie", $apartament->id, $apartament->TipProprietate, "148", "", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("boxa", $apartament->id, $apartament->TipProprietate, "153", "", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("debara", $apartament->id, $apartament->TipProprietate, "154", "", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("pivnita", $apartament->id, $apartament->TipProprietate, "", "225", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("spatiu depozitare", $apartament->id, $apartament->TipProprietate, "", "227", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("crama", $apartament->id, $apartament->TipProprietate, "", "226", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("anexe", $apartament->id, $apartament->TipProprietate, "", "230", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        if ($apartament->TipCurte != "") {
            $i = 0;
            if ($apartament->TipProprietate == 2) {
                $i = 110;
            }
            if ($apartament->TipCurte == "comuna") {
                $tmp .= 242 + $i . " ";
            } else {
                $tmp .= 241 + $i . " ";
            }
        }
        if ($apartament->TipProprietate < 2 && $apartament->NumarTerase > 0) {
            $tmp .= "151 ";
        }
        if ($apartament->TipProprietate < 2 && $apartament->NrGrupuriSanitare > 1) {
            $tmp .= "152 ";
        }
        if ($apartament->TipProprietate < 2 && $apartament->NrGrupuriSanitare > 1) {
            $tmp .= "229 ";
        }
        $tmp = substr($tmp, 0, -1);
        $ofertaxml .= "<dotari>{$tmp}</dotari>";
        // finisaje
        $tmp = "";
        $x = dotare_imobiliare("stare buna", $apartament->id, $apartament->TipProprietate, "5", "198", "", "381");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("curat", $apartament->id, $apartament->TipProprietate, "5", "198", "", "381");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("nou", $apartament->id, $apartament->TipProprietate, "24", "197", "", "380");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("renovat", $apartament->id, $apartament->TipProprietate, "24", "197", "", "380");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("necesita renovare", $apartament->id, $apartament->TipProprietate, "99", "199", "", "382");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("termopan", $apartament->id, $apartament->TipProprietate, "12", "201", "", "384");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("parchet", $apartament->id, $apartament->TipProprietate, "50", "459", "", "378");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("mocheta", $apartament->id, $apartament->TipProprietate, "57", "461", "", "377");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("gresie", $apartament->id, $apartament->TipProprietate, "55", "460", "", "374");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("faianta", $apartament->id, $apartament->TipProprietate, "62", "189", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("usa metalica", $apartament->id, $apartament->TipProprietate, "160", "214", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("tamplarie interioara", $apartament->id, $apartament->TipProprietate, "165", "219", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("vopsea lavabila", $apartament->id, $apartament->TipProprietate, "60", "190", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("huma", $apartament->id, $apartament->TipProprietate, "65", "194", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("tapet", $apartament->id, $apartament->TipProprietate, "64", "195", "", "");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $tmp = substr($tmp, 0, -1);
        $ofertaxml .= "<finisaje>{$tmp}</finisaje>";
        // structura de rezistenta
        $tmp = "";
        if (are_dotarea("beton", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 136, 368, "", 432);
        }
        if (are_dotarea("caramida", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 137, 366, "", 430);
        }
        if (are_dotarea("bca", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 138, 367, "", 431);
        }
        if (are_dotarea("lemn", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 139, 369, "", 433);
        }
        if (are_dotarea("metal", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 140, 370, "", 435);
        }
        if ($tmp != "") {
            $ofertaxml .= "<structurarezistenta>{$tmp}</structurarezistenta>";
        }
        // stadiu constructie
        $tmp = "";
        if (are_dotarea("nou / finalizat", $apartament->id) || are_dotarea("stare buna", $apartament->id) || are_dotarea("necesita renovare", $apartament->id) || are_dotarea("reabilitat termic", $apartament->id)) {
            if ($apartament->TipProprietate < 2) {
                $tmp = "127";
            }
            if ($apartament->TipProprietate == 2) {
                $tmp = "362";
            }
            if ($apartament->TipProprietate == 4) {
                $tmp = "551";
            }
        }
        if (are_dotarea("nou / nefinalizat", $apartament->id)) {
            if ($apartament->TipProprietate < 2) {
                $tmp = "129";
            }
            if ($apartament->TipProprietate == 2) {
                $tmp = "364";
            }
            if ($apartament->TipProprietate == 4) {
                $tmp = "552";
            }
        }
        if ($tmp != "") {
            $ofertaxml .= "<stadiuconstructie>{$tmp}</stadiuconstructie>";
        }
    }
    if ($apartament->TipProprietate == 0) {
        // apartamente bloc
        $ofertaxml .= "<nrnivele>{$apartament->EtajeBloc}</nrnivele>";
    }
    if ($apartament->TipProprietate == 1 || $apartament->TipProprietate == 2) {
        //apartamente in vila si case
        $ofertaxml .= "<nrnivele>{$apartament->Etaje}</nrnivele>";
        $ofertaxml .= "<demisol>{$apartament->Demisol}</demisol>";
        $ofertaxml .= "<mansarda>{$apartament->Mansarda}</mansarda>";
        $ofertaxml .= "<subsol>{$apartament->Subsol}</subsol>";
    }
    if ($apartament->TipProprietate < 3) {
        // apartamente si case
        $ofertaxml .= "<regimhotelier>0</regimhotelier>";
        //$ofertaxml.="<nrnivele>{$apartament->EtajeBloc}</nrnivele>";
        $ofertaxml .= "<nrbai>{$apartament->NrGrupuriSanitare}</nrbai>";
        $ofertaxml .= "<nrbalcoane>{$apartament->NumarBalcoane}</nrbalcoane>";
        $ofertaxml .= "<nrbucatarii>{$apartament->NumarBucatarii}</nrbucatarii>";
        $ofertaxml .= "<nrlocuriparcare>{$apartament->NumarParcari}</nrlocuriparcare>";
    }
    if ($apartament->TipProprietate < 4) {
        // fara spatii
        $tmp = "";
        if (are_dotarea("birouri", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 468, 456, "", "");
        }
        if (are_dotarea("rezidential", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 466, 454, 471, "");
        }
        if (are_dotarea("comercial", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, 467, 455, 473, "");
        }
        if (are_dotarea("agricol", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, "", "", 474, "");
        }
        if (are_dotarea("industrial", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, "", "", 472, "");
        }
        $ofertaxml .= "<destinatie>{$tmp}</destinatie>";
    }
    if ($apartament->TipProprietate < 2) {
        // doar apartamente
        $ofertaxml .= '<tipcompartimentare>' . $compartimentare[$apartament->TipApartament] . '</tipcompartimentare>';
        $ofertaxml .= "<tipimobil>" . (121 + $apartament->TipProprietate) . "</tipimobil>";
        $ofertaxml .= "<confort>" . ($apartament->Confort + 36) . "</confort>";
        //$ofertaxml.="<dotari>".dotari("Mobilier,Electrocasnice,Contorizare,Spatii utile,Dotari Imobil",$apartament->id)."</dotari>";
        $ofertaxml .= "<finisaje>" . dotari("Finisaje / Dotari", $apartament->id) . (are_dotarea("renovat", $apartament->id) ? "24 " : "") . (are_dotarea("stare buna", $apartament->id) ? "5 " : "") . (are_dotarea("curat", $apartament->id) ? "5 " : "") . (are_dotarea("necesita renovare", $apartament->id) ? "99 " : "") . "</finisaje>";
        //$ofertaxml.="<utilitati>".dotari("Utilitati,Sistem de incalzire",$apartament->id).(are_dotarea("aer conditionat", $apartament->id) ? "44 " : "")."</utilitati>";
    }
    if ($apartament->TipProprietate == 2) {
        // doar case
        $ofertaxml .= "<frontstradal>{$apartament->Deschidere}</frontstradal>";
        $ofertaxml .= "<suprafatateren>{$apartament->SuprafataCurte}</suprafatateren>";
        $ofertaxml .= "<nrterase>{$apartament->NumarTerase}</nrterase>";
        //$ofertaxml.="<demisol>".($apartament->Demisol+0)."</demisol>";
        //$ofertaxml.="<subsol>".($apartament->Subsol+0)."</subsol>";
        //$ofertaxml.="<mansarda>".($apartament->Mansarda+0)."</mansarda>";
        $ofertaxml .= "<nrfronturi>" . $apartament->NumarDeschideri . "</nrfronturi>";
        $ofertaxml .= "<destinatie>" . dotari("Destinatie", $apartament->id) . "</destinatie>";
        $tmp = "";
        if (are_dotarea("tabla", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, "", 2, "", "");
        }
        if (are_dotarea("tigla", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, "", 3, "", "");
        }
        if (are_dotarea("sindrila", $apartament->id)) {
            $tmp = corespondent($apartament->TipProprietate, "", 4, "", "");
        }
        $ofertaxml .= "<invelitoareacoperis>{$tmp}</invelitoareacoperis>";
    }
    if ($apartament->TipProprietate == 3) {
        // doar terenuri
        $ofertaxml .= "<suprafatateren>{$apartament->SuprafataUtila}</suprafatateren>";
        $ofertaxml .= "<frontstradal>{$apartament->Deschidere}</frontstradal>";
        $ofertaxml .= "<umsuprafatateren>382</umsuprafatateren>";
        switch ($apartament->Clasificare) {
            case "intravilan":
                $ofertaxml .= "<clasificareteren>373</clasificareteren>";
                break;
            case "extravilan":
                $ofertaxml .= "<clasificareteren>374</clasificareteren>";
                break;
            default:
                $ofertaxml .= "<clasificareteren>373</clasificareteren>";
                break;
        }
        switch ($apartament->TipTeren) {
            case "constructii":
                $ofertaxml .= "<tipteren>375</tipteren>";
                break;
            case "agricol":
                $ofertaxml .= "<tipteren>376</tipteren>";
                break;
            case "padure":
                $ofertaxml .= "<tipteren>377</tipteren>";
                break;
            default:
                $ofertaxml .= "<tipteren>375</tipteren>";
                break;
        }
        $ofertaxml .= "<nrfronturistradale>{$apartament->NumarDeschideri}</nrfronturistradale>";
        $ofertaxml .= "<inclinatieteren>{$apartament->Inclinatie}</inclinatieteren>";
        $ofertaxml .= "<latimedrumacces>{$apartament->LatimeDrumAcces}</latimedrumacces>";
        //$ofertaxml.="<suprafataconstruita>{$apartament->SuprafataConstruita}</suprafataconstruita>";
        $ofertaxml .= "<constructiepeteren>" . ($apartament->ConstructiePeTeren + 0) . "</constructiepeteren>";
    }
    if ($apartament->TipProprietate == 4) {
        // doar spatii
        $ofertaxml .= "<nrincaperi>{$apartament->NumarCamere}</nrincaperi>";
        $ofertaxml .= "<nrgrupurisanitare>{$apartament->NrGrupuriSanitare}</nrgrupurisanitare>";
        $ofertaxml .= "<destinatierecomandata><lang id=\"1048\">" . base64_encode($apartament->Destinatie) . "</lang></destinatierecomandata>";
        $ofertaxml .= "<disp_prop><lang id=\"1048\">" . base64_encode("imediat") . "</lang></disp_prop>";
        switch ($apartament->ClasaBirouri) {
            case "A":
                $ofertaxml .= '<clasabirouri>554</clasabirouri>';
                break;
            case "B":
                $ofertaxml .= '<clasabirouri>555</clasabirouri>';
                break;
            case "C":
                $ofertaxml .= '<clasabirouri>556</clasabirouri>';
                break;
            default:
                $ofertaxml .= '<clasabirouri></clasabirouri>';
        }
        $tmp = "";
        switch ($apartament->TipConstructie) {
            case "bloc":
                $tmp = 424;
                break;
            case "cladire de birouri":
                $tmp = 425;
                break;
            case "hala":
                $tmp = 426;
                break;
            case "depozit":
                $tmp = 427;
                break;
            case "casa/vila":
                $tmp = 428;
                break;
            case "hotel":
                $tmp = 429;
                break;
            case "centru comercial":
                $tmp = 562;
                break;
        }
        $ofertaxml .= "<tipimobil>{$tmp}</tipimobil>";
        $ofertaxml .= "<inaltimespatiu>{$apartament->Inaltime}</inaltimespatiu>";
        $ofertaxml .= "<nrparcari>{$apartament->NumarParcari}</nrparcari>";
        if ($apartament->Demisol == 1) {
            $ofertaxml .= "<demisol>1</demisol>";
        }
        if ($apartament->Subsol == 1) {
            $ofertaxml .= "<subsol>1</subsol>";
        }
        if ($apartament->Mansarda == 1) {
            $ofertaxml .= "<mansarda>1</mansarda>";
        }
        if ($apartament->Etaje > 0) {
            $ofertaxml .= "<nrnivele>{$apartament->Etaje}</nrnivele>";
        }
        //if ($apartament->SuprafataConstruita>0){
        //	$ofertaxml.="<suprafataconstruita>{$apartament->SuprafataConstruita}</suprafataconstruita>";
        //}
        if ($apartament->SuprafataCurte > 0) {
            $ofertaxml .= "<suprafatateren>{$apartament->SuprafataCurte}</suprafatateren>";
        }
        if ($apartament->SuprafataTerasa > 0) {
            $ofertaxml .= "<suprafataterase>{$apartament->SuprafataTerasa}</suprafataterase>";
        }
        $tmp = "";
        $x = dotare_imobiliare("lift marfa", $apartament->id, $apartament->TipProprietate, "", "", "", "435");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("marfa", $apartament->id, $apartament->TipProprietate, "", "", "", "451");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("CFR", $apartament->id, $apartament->TipProprietate, "", "", "", "448");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("TIR", $apartament->id, $apartament->TipProprietate, "", "", "", "449");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("Rampa TIR", $apartament->id, $apartament->TipProprietate, "", "", "", "450");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("pivnita", $apartament->id, $apartament->TipProprietate, "", "", "", "437");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("spatiu depozitare", $apartament->id, $apartament->TipProprietate, "", "", "", "439");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("crama", $apartament->id, $apartament->TipProprietate, "", "", "", "438");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $x = dotare_imobiliare("anexe", $apartament->id, $apartament->TipProprietate, "", "", "", "440");
        if ($x != "") {
            $tmp .= $x . " ";
        }
        $tmp = substr($tmp, 0, -1);
        $ofertaxml .= "<altecaracteristici>{$tmp}</altecaracteristici>";
    }
    $ofertaxml .= "<agent>{$oferta->IdAgentVanzare}</agent>";
    $ofertaxml .= "<vecinatati><lang id=\"1048\">" . base64_encode(dotari("Vecinatati", $apartament->id)) . "</lang></vecinatati>";
    $ofertaxml .= "<descriere><lang id=\"1048\">" . base64_encode($apartament->Detalii . ", cod oferta SP" . $inchiriere . str_pad($oferta->id, 4, "0", STR_PAD_LEFT)) . "</lang></descriere>";
    $ofertaxml .= "<sector>{$apartament->Sector}</sector>";
    $ofertaxml .= "<alias>SP" . str_pad($oferta->id, 5, "0", STR_PAD_LEFT) . "</alias>";
    if ($oferta->Negociabil > 0) {
        $ofertaxml .= "<pretnegociabil>1</pretnegociabil>";
    }
    if ($oferta->Exclusivitate > 0) {
        $ofertaxml .= "<exclusivitate>1</exclusivitate>";
    }
    if ($oferta->OfertaWeb > 0) {
        $link = "http://www.simsparkman-imobiliare.ro/oferte-imobiliare/";
        $tmp = "";
        if ($oferta->Vanzare == 1) {
            $tmp = "vanzare";
        }
        if ($oferta->Inchiriere == 1) {
            if ($tmp != "") {
                $tmp .= "-";
            }
            $tmp .= "inchiriere";
        }
        switch ($apartament->TipProprietate) {
            case 0:
                $tmp .= "-apartament-in-bloc";
                break;
            case 1:
                $tmp .= "-apartament-in-vila";
                break;
            case 2:
                $tmp .= "-casa-vila";
                break;
            case 3:
                $tmp .= "-teren";
                break;
            case 4:
                $tmp .= "-spatiu-" . $apartament->TipSpatiu;
        }
        if ($apartament->TipProprietate < 3) {
            $tmp .= "-{$apartament->NumarCamere}-camere";
        }
        $tmp .= "-" . $oras->Denumire . "-" . $zona->Denumire . "-" . $subzona->Denumire;
        $tmp .= "--sp" . str_pad($oferta->id, 5, "0", STR_PAD_LEFT) . ".html";
        $lista = array("\\s", " ");
        $link .= str_replace($lista, "-", html_entity_decode($tmp));
        $ofertaxml .= "<linkextern>{$link}</linkextern>";
    }
    // inca nu au fost reanalizate
    // ?? nu mai e inm baza $ofertaxml.="<servicii>".dotari("Servicii???",$apartament->id)."</servicii>";
    //$ofertaxml.="<altedetaliizona>67,302,303</altedetaliizona>";
    $sql = "SELECT COUNT(*) FROM Foto WHERE idApartament={$apartament->id} AND Privat<>'1'";
    $nrimagini = Foto::count_by_sql($sql);
    $nrpoza = 0;
    if ($nrimagini > 0) {
        $ofertaxml .= "<imagini nrimagini=\"{$nrimagini}\">";
        $fotoList = Foto::find_by_sql("SELECT * FROM Foto WHERE idApartament={$apartament->id} AND Privat<>'1' ORDER BY Ordin");
        foreach ($fotoList as $foto) {
            $nrpoza++;
            $ofertaxml .= "<imagine dummy=\"False\" modificata=\"1228840157\" latime=\"800\" inaltime=\"600\" pozitie=\"{$nrpoza}\">";
            $ofertaxml .= "<descriere>" . base64_encode($foto->Detalii) . "</descriere>";
            $ofertaxml .= "<blob>";
            $ofertaxml .= base64_encode(file_get_contents(".." . DS . $foto->image_path()));
            $ofertaxml .= "</blob>";
            $ofertaxml .= "</imagine>";
        }
        $ofertaxml .= "</imagini>";
    }
    if ($oferta->ExportImobiliare < 3 && $oferta->Stare == 'de actualitate') {
        if ($oferta->ExportImobiliare = 1) {
            $operatie = "MOD";
            $ofertaxml .= "<datamodificare>" . time() . "</datamodificare>";
        } else {
            $operatie = "ADD";
            $ofertaxml .= "<dataadaugare>" . time() . "</dataadaugare>";
        }
    } else {
        $operatie = "DEL";
    }
    $ofertaxml .= '</oferta>';
    //echo $ofertaxml;
    // publica oferta
    $ok = 1;
    switch ($apartament->TipProprietate) {
        case 0:
            $oftip = 0;
            break;
        case 1:
            $oftip = 0;
            break;
        case 2:
            $oftip = 1;
            break;
        case 3:
            $oftip = 3;
            break;
        case 4:
            $oftip = 4;
            break;
    }
    try {
        $result = $s->__soapCall('publica_oferta', array('publica_oferta' => array('id_str' => $oftip . ':' . $id, 'sid' => $session_id, 'operatie' => $operatie, 'ofertaxml' => $ofertaxml)));
    } catch (Exception $e) {
        $ok = 0;
        $mesaj = "";
        if ($afisare > 0) {
            $mesaj = 'Eroare Publicare oferta: ' . $e->getMessage();
        }
        die($mesaj);
    }
    if (isset($result->mesaj)) {
        $idImobiliare = array_pop(explode(" ", $result->mesaj));
    }
    if ($afisare > 0) {
        echo '<pre>PUBLICARE OFERTA: ' . print_r($result, true) . '</pre>';
    }
    if ($result->cod == "0") {
        return true;
    }
    return false;
}