Esempio n. 1
0
        foreach ($DAList as $dotAP) {
            $dotAP->delete();
        }
    }
    if (!empty($dotariList)) {
        foreach ($dotariList as $dotare) {
            $dotAp = new Dotareapartament();
            $dotAp->idApartament = $apartament->id;
            $dotAp->idDotare = $dotare;
            $dotAp->save();
        }
    }
    redirect_to("oferta_view.php?id=" . $oferta->id);
} else {
    $xOfertaId = $_GET['id'];
    $oferta = Oferta::find_by_id($xOfertaId);
    $apartament = Apartament::find_by_id($oferta->idApartament);
    $client = Client::find_by_id($apartament->idClient);
    $agent = User::find_by_id($client->idUtilizator);
    $agentIntroducere = User::find_by_id($oferta->idAgentIntroducere);
    $agentVizionare = User::find_by_id($oferta->idAgentInchiriere);
    $agentLucreaza = User::find_by_id($oferta->IdAgentVanzare);
    $strada = Strada::find_by_id($apartament->idStrada);
    $stradaClient = Strada::find_by_id($client->idStrada);
    $subzona = Subzona::find_by_id($apartament->idSubzona);
    $sursa = Sursa::find_by_id($apartament->idSursa);
    switch ($apartament->TipProprietate) {
        case 0:
            $tipprop = "xa";
            break;
        case 1:
Esempio n. 2
0
                 if ($foto->save()) {
                     $message .= "";
                 } else {
                     foreach ($foto->errors as $error) {
                         $message .= $error . "(" . $file['name'] . ");";
                     }
                 }
             } else {
                 foreach ($foto->errors as $error) {
                     $message .= $error . "(" . $file['name'] . ");";
                 }
             }
         }
     }
 }
 $oferta = Oferta::find_by_id($idOferta);
 $syncList = array('ExportPitagora', 'ExportImobiliare', 'ExportCI', 'ExportRoImobile', 'ExportRomimo', 'ExportNorc', 'ExportMC');
 foreach ($syncList as $sync) {
     if ($oferta->{$sync} == 4) {
         $oferta->{$sync} = 2;
     }
 }
 if ($oferta->OfertaWeb == 4) {
     $oferta->OfertaWeb = 2;
 }
 $oferta->save();
 // sincronizare site
 if ($oferta->OfertaWeb > 0 && SyncSite::modalitate("SimsParkman") == "automat") {
     $conexiune2 = mysql_connect(NEW_SITE_SERVER, NEW_SITE_USER, NEW_SITE_PASSWORD, TRUE);
     $dbselect2 = mysql_select_db(NEW_SITE_DB, $conexiune2);
     sync_Agenti();
Esempio n. 3
0
<?php

ini_set('display_errors', 1);
require_once ".././include/initialize.php";
$oferta = Oferta::find_by_id($_GET['id']);
$apartament = Apartament::find_by_id($oferta->idApartament);
$client = Client::find_by_id($apartament->idClient);
$agent = User::find_by_id($client->idUtilizator);
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetMargins(15, 15);
//descriere proprietate
$pdf->Image(PDF_PATH . DS . 'bara1.png', 15, 45, 130.5);
$pdf->SetFont("Times", "", 14);
$pdf->SetXY(25, 42.5);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(15, 11, 'PROPRIETATE ', 0, 1);
$pdf->SetXY(15.35, 51);
$pdf->SetDrawColor(175, 37, 28);
$pdf->SetLineWidth(0.5);
$pdf->Cell(130, 18, "", 1);
// descriere proprietate
$pdf->SetXY(18, 53);
$pdf->SetTextColor(0);
$pdf->Cell(130, 7, $oferta->Titlu);
//$pdf->SetXY(18, 60);
//$pdf->Cell(130,7,$proprietate->Descriere);
//pret
$pdf->Image(PDF_PATH . DS . 'bara2.png', 155, 45, 42);
$pdf->SetFont("Times", "", 14);
$pdf->SetXY(165, 42.5);
Esempio n. 4
0
<?php

require_once ".././include/initialize.php";
//if (!$session->is_logged_in()) {
//	redirect_to("login.php");
//}
ini_set('display_errors', 1);
$url = "http://cauta-imobiliare.ro/feed_sims.php";
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
$content = curl_exec($curl_handle);
curl_close($curl_handle);
$cilist = explode("\n", $content);
if (!empty($cilist)) {
    foreach ($cilist as $cirow) {
        $rec = explode("|", $cirow);
        if (isset($rec[2])) {
            $oferta = Oferta::find_by_id($rec[2]);
            if (!empty($oferta)) {
                $oferta->LinkCI = $rec[1];
                $oferta->save();
                echo "salvat {$oferta->id}\n";
            }
        }
    }
}
Esempio n. 5
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);
}
Esempio n. 6
0
require_once ".././include/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
$message = "";
require_once "sync_site_lib.php";
if (isset($_GET['id'])) {
    $idApartament = $_GET['id'];
    $idOferta = $_GET['idOferta'];
    $apartament = Apartament::find_by_id($idApartament);
    $oferta = Oferta::find_by_id($idOferta);
}
if (isset($_POST['submit'])) {
    $apartament = Apartament::find_by_id($_POST['idApartament']);
    $oferta = Oferta::find_by_id($_POST['idOferta']);
    $apartament->youtube = $_POST['youtube'];
    $apartament->save();
    $syncList = array('ExportPitagora', 'ExportImobiliare', 'ExportCI', 'ExportRoImobile', 'ExportRomimo', 'ExportNorc', 'ExportMC');
    foreach ($syncList as $sync) {
        if ($oferta->{$sync} == 4) {
            $oferta->{$sync} = 2;
        }
    }
    if ($oferta->OfertaWeb == 4) {
        $oferta->OfertaWeb = 2;
    }
    $oferta->save();
    // sincronizare site
    if ($oferta->OfertaWeb > 0) {
        $conexiune2 = mysql_connect(NEW_SITE_SERVER, NEW_SITE_USER, NEW_SITE_PASSWORD, TRUE);
Esempio n. 7
0
<?php

require_once ".././include/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
ini_set('display_errors', 1);
$oferta = new Oferta();
$oferta = Oferta::find_by_id(1706);
$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);
//$imopedia->syncronize();
$imopedia->deleteOferta();
//