Пример #1
0
 public function getIndex()
 {
     if (!$this->checkLoggedUsuario()) {
         return $this->redirect;
     }
     $id = Session::get('id_usuario');
     $usuario = new Usuario();
     $usuario = $usuario->find($id);
     $oferta = new Oferta();
     if (!($ofertas = $oferta->ofertasUsuario($usuario))) {
         return View::make('usuario/panelhome');
     }
     foreach ($ofertas as $oferta_a) {
         foreach ($oferta_a as $oferta_s) {
             $ofertas_array[] = $oferta_s;
             if ($oferta_s->salario < 1) {
                 $salarios[] = "< 10.000€";
             } else {
                 if ($oferta_s->salario > 11) {
                     $salarios[] = "> 65.000€";
                 } else {
                     $salario_min = ($oferta_s->salario - 1) * 5000 + 10000;
                     $salario_max = ($oferta_s->salario - 1) * 5000 + 15000;
                     $salarios[] = trans('forms.salarios', array('menor' => number_format($salario_min, 0, '', '.') . '€', 'mayor' => number_format($salario_max, 0, '', '.') . '€'));
                 }
             }
             $municipios[] = $this->nombreMunicipio($oferta_s->municipio);
         }
     }
     return View::make('usuario/panelhome', array('ofertas' => $ofertas_array, 'salarios' => $salarios, 'municipios' => $municipios));
 }
Пример #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // var_dump(Input::All());
     // die;
     //
     // 'categorias_id' => 'exists:rubros,id'
     $rules = ['clasificados_id' => 'required', 'oferta' => 'required'];
     if (!Oferta::isValid(Input::all(), $rules)) {
         return Redirect::back()->withInput()->withErrors(Oferta::$errors);
     }
     $oferta = new Oferta();
     $oferta->users_id = Sentry::getUser()->id;
     $oferta->clasificados_id = Input::get('clasificados_id');
     $oferta->oferta = Input::get('oferta', 0);
     $oferta->save();
     return Redirect::to('/clasificados/' . $oferta->clasificados_id);
 }
Пример #3
0
 function ofertasByUsuario(Request $request, Response $response)
 {
     $response = $response->withHeader('Content-type', 'application/json');
     $id = $request->getAttribute('id');
     $data = Oferta::where("idUsuario", "=", $id)->get();
     if (count($data) == 0) {
         $response = $response->withStatus(404);
     }
     $response->getBody()->write($data);
     return $response;
 }
Пример #4
0
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    <h1>Pizzeria Peachepe</h1>
    <a href="nuevo.php">Nueva oferta</a>
    <hr>
    <?php 
require_once 'Oferta.php';
$ofertas = Oferta::getOfertas();
foreach ($ofertas as $oferta) {
    ?>
        <h3><?php 
    echo $oferta->getTitulo();
    ?>
</h3>
        <img src="imagenes/<?php 
    echo $oferta->getImagen();
    ?>
" width="400"><br>
        <p><?php 
    echo $oferta->getDescripcion();
    ?>
</p><br>
        <a href="borrar.php?id=<?php 
    echo $oferta->getId();
    ?>
">Borrar</a>
Пример #5
0
 public function postular(Oferta $oferta)
 {
     $mailOferta = $oferta->getEmail();
     $firma = ucwords(strtolower($this->_nombre)) . ' ' . ucwords(strtolower($this->_apellido));
     $asunto = "CV " . $firma . '| ' . $oferta->getTitulo();
     if ($this->_preferencias["salario"]) {
         $remuneracion = '$' . $this->_preferencias["salario"] . ' netos';
     }
     if (!empty($remuneracion)) {
         $remuneracion = "&nbsp;&nbsp;&nbsp;&nbsp;<strong>Remuneracion pretendida:" . $remuneracion . "</strong><br /><br />\r\n";
     } else {
         $remuneracion = "";
     }
     $hash = sha1($this->_id . $oferta->getId() . $oferta->getTitulo() . $oferta->getEmail());
     $body = "<p>Ante quien corresponda:<br /><br />\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Espero tenga a bien contemplar mi curriculum vitae.\r\n<br /><br />\n\t\t\t\t{$remuneracion}\n\t\t\t\t&nbsp;&nbsp;&nbsp;Desde ya muchas gracias.<br /><br />\n\t\t\t\t<img src=\"http://tebuscolaburo.no-ip.org/oferta/reply/hash/{$hash}\" />;\n\t\t\t\t{$firma}\r\n</p>";
     try {
         $mail = \Mail\Factory::getInstance($this->_email, $this->_email, $this->_preferencias["clave"]);
         $mail->Subject = $asunto;
         $mail->addAddress($oferta->getEmail(), "");
         $mail->setFrom($this->_email, ucwords($this->_nombre) . ' ' . ucwords($this->_apellido));
         $mail->MsgHTML($body);
         $mail->AddAttachment("files/" . $this->_cvFile);
         $mail->Send();
         //Si el mail se envia correctamente, entonces inserto
         $table = new \apf\db\mysql5\Table("usuarios_postulaciones");
         $replace = new \apf\db\mysql5\Replace($table);
         $replace->id_usuario = $this->_id;
         $replace->id_oferta = $oferta->getId();
         $replace->momento_postulacion = array("value" => "NOW()", "quote" => FALSE);
         //Con este hash luego podemos comprobar si a la persona/entidad a la cual le enviamos el mail
         //Lo recibio o no, siempre y cuando acepte imagenes en su correo.
         $replace->hash = $hash;
         $replace->execute();
     } catch (Exception $e) {
         echo $e->getMessage() . "\n";
         //Boring error messages from anything else!
     }
 }
<?php

require_once '../Model/Oferta.php';
// Obtiene todas las ofertas
$data['ofertas'] = Oferta::getOfertas();
// Carga la vista de listado
include '../View/listado.php';
Пример #7
0
    $record["Descriere"] = $tmp->Descriere;
    $record["idCategorieDotari"] = $tmp->idCategorieDotari;
    $record["Implicit"] = $tmp->Implicit;
    $sql .= "('" . join("', '", array_values($record)) . "'),";
}
$sql = substr($sql, 0, strlen($sql) - 1);
$result = execute_querry($sql, $conexiune2);
$ftp_file = array();
$sql_proprietate = "INSERT INTO Proprietate (id,idSubzona,idAgent,TipProprietate,Titlu,Descriere,Vanzare,";
$sql_proprietate .= "Inchiriere,Pret,PretChirie,Moneda,NumarCamere,Confort,TipApartament,Etaj,EtajeBloc,";
$sql_proprietate .= "TipConstructie,NrGrupuriSanitare,NumarBalcoane,SuprafataTerasa,CodBazaDate,AnConstructie,";
$sql_proprietate .= "DataActualizare,SuprafataUtila,SuprafataConstruita,OfertaSpeciala) VALUES ";
$sql_dotare = "INSERT INTO DotareApartament (idApartament,idDotare) VALUES ";
$sql_foto = "INSERT INTO Foto (idProprietate, NumeFisier, Tip, Marime, Detalii, Ordin, Schita) VALUES ";
$sql = "SELECT * FROM Oferta WHERE (Exportat<>1 OR Exportat=NULL)";
$oferte = Oferta::find_by_sql($sql);
//$oferta=array_shift($oferte);
$td = 0;
$ti = 0;
$tu = 0;
$sync = 0;
$insert = 0;
foreach ($oferte as $oferta) {
    $sync++;
    $apartament = Apartament::find_by_id($oferta->id);
    $client = Client::find_by_id($apartament->idClient);
    $agent = User::find_by_id($client->idUtilizator);
    $sql = "SELECT * FROM Proprietate WHERE CodBazaDate={$oferta->id}";
    $update = 0;
    $result = mysql_query($sql, $conexiune2);
    if ($row = mysql_fetch_array($result)) {
Пример #8
0
		</tr>
	</table>
</div>

<script type="text/javascript"> 
<!--
	//hide("zoneTree");
	hide("filtreExtra");
	//hide("zonaCollapse");
//-->
</script> 

</form>
<?php 
if (isset($_POST['submit'])) {
    $oferta = new Oferta();
    $sql = "SELECT A.NumarCamere, A.Confort, O.id, O.Pret, O.PretChirie, O.Moneda, O.idApartament ";
    //$sql=$sql."FROM Oferta as O INNER JOIN Apartament as A ON O.idApartament=A.id ";
    $sql .= "FROM Utilizator as U INNER JOIN (Strada as S INNER JOIN ((Client as C INNER JOIN Apartament as A ON C.id = A.idClient) INNER JOIN Oferta as O ON A.id = O.idApartament) ON S.id = A.idStrada) ON U.id = C.idUtilizator ";
    $sql = $sql . "WHERE 1 ";
    //if (($NumarCamere==0)&&($NumarCamere==0)&&($TipApartament==0)) {$sql=$sql."1";}
    if (isset($NumarCamere)) {
        $sql = $sql . "AND (" . build_query($NumarCamere, "NumarCamere") . ") ";
    }
    if (isset($Confort)) {
        $sql = $sql . "AND (" . build_query($Confort, "Confort") . ") ";
    }
    if (isset($TipApartament)) {
        $sql = $sql . "AND (" . build_query($TipApartament, "TipApartament") . ") ";
    }
    if (isset($Pozitie)) {
Пример #9
0
					<h3 onclick="showHide('listaOferte')" onmouseover="this.style.cursor='pointer'">Oferte ale clientului</h3>
					<table width="100%" id="listaOferte">
						<tr >
							<td class="header" width="5%" align="center">Cod</td>
							<td class="header" width="10%" align="center">Camere</td>
							<td class="header" width="70%">Detalii</td>
							<td class="header" width="10%" align="center">Pret</td>
							<td class="header" width="5%" align="center">Foto</td>
						</tr>
						<?php 
                $i = 0;
                foreach ($apList as $apartament) {
                    $sql = "SELECT * FROM Foto WHERE idApartament={$apartament->id} ORDER BY Ordin LIMIT 1";
                    $fotos = Foto::find_by_sql($sql);
                    $sql = "SELECT * FROM Oferta WHERE idApartament='{$apartament->id}'";
                    $ofertaList = Oferta::find_by_sql($sql);
                    $strada = Strada::find_by_id($apartament->idStrada);
                    if (!empty($ofertaList)) {
                        foreach ($ofertaList as $oferta) {
                            $i++;
                            $class = $i % 2 ? "impar" : "par";
                            ?>
						<tr id="<?php 
                            echo $oferta->id;
                            ?>
" class="<?php 
                            echo $class;
                            ?>
" style="font-weight: bold;" onmouseover="this.style.cursor='pointer';onOver(<?php 
                            echo $oferta->id;
                            ?>
Пример #10
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);
Пример #11
0
        } else {
            if ($client->TelefonServici != "") {
                $telefon = $client->TelefonServici;
            } else {
                if ($client->TelefonFax != "") {
                    $telefon = $client->TelefonFax;
                }
            }
        }
    }
}
if (isset($_POST['submit']) || isset($_POST['actualizare'])) {
    //print_r($_POST);
    $OfertaId = $_POST['xOfertaId'];
    $apartament = new Apartament();
    $oferta = new Oferta();
    $client = Client::find_by_id($_POST['ClientId']);
    $agent = User::find_by_id($client->idUtilizator);
    $dotariList = array();
    $syncList = array('ExportPitagora', 'ExportImobiliare', 'ExportRoImobile', 'ExportRomimo', 'ExportMC', 'ExportImopedia');
    $postlist = array_keys($_POST);
    foreach ($postlist as $variable) {
        if ($variable != "submit") {
            ${$variable} = $_POST[$variable];
        }
        $atribut = substr(array_shift(explode("_", $variable)), 2);
        //echo $variable."\n";
        if (substr($variable, 0, 2) == "Ap") {
            $apartament->{$atribut} = ${$variable};
        }
        if (substr($variable, 0, 2) == "Cl") {
<?php

require_once '../Model/Oferta.php';
$ofertaAux = new Oferta($_GET['id']);
$ofertaAux->delete();
header("Location: index.php");
Пример #13
0
 public function getMisOfertas()
 {
     if (!$this->checkLoggedEmpresa()) {
         return $this->redirect;
     }
     $ofertaC = new Oferta();
     $ofertas = $ofertaC->obtenerOfertas(Session::get('id_empresa'));
     return View::make('empresa/misOfertas', array('ofertas' => $ofertas, 'thisA' => $this));
 }
<?php

require_once 'Oferta.php';
// sube la imagen al servidor
move_uploaded_file($_FILES["imagen"]["tmp_name"], "imagenes/" . $_FILES["imagen"]["name"]);
// inserta la oferta en la base de datos
$aux = new Oferta("", $_POST['titulo'], $_FILES["imagen"]["name"], $_POST['descripcion']);
$aux->inserta();
header("Location: index.php");
Пример #15
0
 public function getOfertasComp()
 {
     return Oferta::where('area_empleo', '=', $this->areaEmpleo_id)->get();
 }
Пример #16
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);
Пример #17
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);
}
<?php

require_once '../Model/Oferta.php';
// sube la imagen al servidor
move_uploaded_file($_FILES["imagen"]["tmp_name"], "../View/images/" . $_FILES["imagen"]["name"]);
// inserta la oferta en la base de datos
$ofertaAux = new Oferta("", $_POST['titulo'], $_FILES["imagen"]["name"], $_POST['descripcion']);
$ofertaAux->insert();
header("Location: index.php");
Пример #19
0
 public static function obtenerOfertasParaUsuario(Usuario $usuario, $intervalo = 2, $tipo = "DAY")
 {
     $ofertasTable = new \apf\db\mysql5\Table("ofertas");
     $empresasTable = new \apf\db\mysql5\Table("empresas");
     $empresasDatosTable = new \apf\db\mysql5\Table("empresas_datos");
     $ofertasUbicacionTable = new \apf\db\mysql5\Table("ofertas_ubicacion");
     $localidadesTable = new \apf\db\mysql5\Table("localidades");
     $ofertasCategoriaTable = new \apf\db\mysql5\Table("ofertas_categoria");
     $categoriasTable = new \apf\db\mysql5\Table("categorias");
     $select = new \apf\db\mysql5\Select($ofertasTable);
     $fields = array("ofertas.id AS idOferta", "ofertas.email", "ofertas.titulo", "GROUP_CONCAT(categorias.id) AS categorias", "GROUP_CONCAT(localidades.id) AS localidades");
     $select->fields($fields);
     //INNER JOIN ofertas_ubicacion
     /////////////////////////////////////////////////////////
     $joinOfertasUbicacion = new \apf\db\mysql5\Join($ofertasUbicacionTable);
     $joinOfertasUbicacion->type("INNER");
     $on = array(array("field" => "ofertas.id", "value" => "ofertas_ubicacion.id_oferta", "quote" => FALSE));
     $joinOfertasUbicacion->on($on);
     $select->join($joinOfertasUbicacion);
     //INNER JOIN localidades
     /////////////////////////////////////////////////////////
     $joinLocalidades = new \apf\db\mysql5\Join($localidadesTable);
     $joinLocalidades->type("INNER");
     $on = array(array("field" => "localidades.id", "value" => "ofertas_ubicacion.id_localidad", "quote" => FALSE));
     $joinLocalidades->on($on);
     $select->join($joinLocalidades);
     //INNER JOIN ofertas_categoria
     /////////////////////////////////////////////////////////
     $joinOfertasCategoria = new \apf\db\mysql5\Join($ofertasCategoriaTable);
     $joinOfertasCategoria->type("INNER");
     $on = array(array("field" => "ofertas_categoria.id_oferta", "value" => "ofertas.id", "quote" => FALSE));
     $joinOfertasCategoria->on($on);
     $select->join($joinOfertasCategoria);
     //INNER JOIN categorias
     /////////////////////////////////////////////////////////
     $joinCategorias = new \apf\db\mysql5\Join($categoriasTable);
     $joinCategorias->type("INNER");
     $on = array(array("field" => "ofertas_categoria.id_categoria", "value" => "categorias.id", "quote" => FALSE));
     $joinCategorias->on($on);
     $select->join($joinCategorias);
     //WHERE
     /////////////////////////////////////////////////////////
     $where = array();
     $tmpWhere = array();
     $usuariosCategoria = new \apf\db\mysql5\Table("usuarios_categorias");
     $selectCategorias = new \apf\db\mysql5\Select($usuariosCategoria);
     $selectCategorias->fields(array("id_categoria"));
     $selectCategorias->where(array(array("field" => "id_usuario", "value" => $usuario->getId())));
     $tmpWhere[] = array("field" => "ofertas_categoria.id_categoria", "operator" => "IN", "value" => $selectCategorias);
     $prefUbicaciones = new \apf\db\mysql5\Table("usuarios_ubicaciones");
     $selectLocalidades = new \apf\db\mysql5\Select($prefUbicaciones);
     $selectLocalidades->fields(array("id_localidad"));
     $selectLocalidades->where(array(array("field" => "id_usuario", "value" => $usuario->getId())));
     $tmpWhere[] = array("field" => "ofertas_ubicacion.id_localidad", "operator" => "IN", "value" => $selectLocalidades);
     $postulacionesTable = new \apf\db\mysql5\Table("usuarios_postulaciones");
     $selectPostulaciones = new \apf\db\mysql5\Select($postulacionesTable);
     $selectPostulaciones->fields(array("id_oferta"));
     $selectPostulaciones->where(array(array("field" => "id_usuario", "value" => $usuario->getId())));
     $tmpWhere[] = array("field" => "ofertas.id", "operator" => "NOT IN", "value" => $selectPostulaciones);
     $prefCriterios = $usuario->getPreferencia("criterios");
     if ($prefCriterios) {
         $cantCriterios = sizeof($prefCriterios);
         foreach ($prefCriterios as $key => $criterio) {
             if ($key == 0) {
                 $tmpWhere[] = array("field" => "ofertas.titulo", "operator" => "LIKE", "value" => "%{$criterio}%", "begin_enclose" => TRUE);
             } else {
                 if ($key == $cantCriterios - 1) {
                     $tmpWhere[] = array("field" => "ofertas.titulo", "operator" => "LIKE", "value" => "%{$criterio}%", "end_enclose" => TRUE);
                 } else {
                     $tmpWhere[] = array("field" => "ofertas.titulo", "operator" => "LIKE", "value" => "%{$criterio}%");
                 }
             }
         }
     }
     foreach ($tmpWhere as $key => $value) {
         $where[] = $value;
         $op = $value["operator"] == "LIKE" ? "OR" : "AND";
         $where[] = array("operator" => $op);
     }
     unset($where[sizeof($where) - 1]);
     if ($intervalo) {
         $where[] = array("operator" => "AND");
         $where[] = array("field" => "ofertas.fecha_publicacion", "operator" => "BETWEEN", "value" => array("min" => "DATE_SUB(NOW(), INTERVAL {$intervalo} {$tipo})", "max" => "NOW()"));
     }
     $select->where($where);
     $select->group(array("ofertas.id"));
     $select->orderBy(array("fecha_publicacion"), "DESC");
     $res = $select->execute($smartMode = FALSE);
     $ofertas = array();
     $class = __CLASS__;
     foreach ($res as $r) {
         $oferta = new Oferta();
         $oferta->setId($r["idOferta"]);
         $oferta->setEmail($r["email"]);
         $oferta->setTitulo($r["titulo"]);
         $ofertas[] = $oferta;
     }
     return $ofertas;
 }
Пример #20
0
 public function postBuscador()
 {
     if (Input::get('vista') == 0) {
         $empresa = new Empresa();
         $empresa = $empresa->leftJoin('municipios', function ($join) {
             $join->on('empresas.municipio_id', '=', 'municipios.id');
         })->leftJoin('provincias', function ($join) {
             $join->on('empresas.provincia_id', '=', 'provincias.CPRO');
         });
         foreach (Input::get('empresa') as $index => $value) {
             if ($value != "") {
                 if ($index == "provincia_id" || $index == "municipio_id") {
                     $GLOBALS['index'] = $index;
                     $GLOBALS['value'] = $value;
                     if (is_array($value)) {
                         $empresa = $empresa->where(function ($query) {
                             $indexG = $GLOBALS['index'];
                             $valueG = $GLOBALS['value'];
                             $query->orWhere('empresas.' . $indexG, '=', $valueG);
                         });
                     } else {
                         $empresa = $empresa->where('empresas.' . $index, '=', $value);
                     }
                 } else {
                     $empresa = $empresa->where('empresas.' . $index, 'like', '%' . $value . '%');
                 }
             }
         }
         $return = array();
         if (sizeof($empresa) > 0) {
             $return['grupo'][0]['nombre'] = 'empresas';
             $return['grupo'][0]['resultados'] = $empresa->select('empresas.*', 'provincias.NOMBRE as provincia', 'municipios.NOMBRE as municipio')->get();
             $ofertas = new Oferta();
             $ofertas = $ofertas->leftJoin('municipios', function ($join) {
                 $join->on('ofertas.municipio_id', '=', 'municipios.id');
             })->leftJoin('provincias', function ($join) {
                 $join->on('ofertas.provincia_id', '=', 'provincias.CPRO');
             })->leftJoin('empresas', function ($join) {
                 $join->on('ofertas.empresa_id', '=', 'empresas.id');
             })->leftJoin('contratos_laborales', function ($join) {
                 $join->on('ofertas.contrato_id', '=', 'contratos_laborales.id');
             });
             $GLOBALS['empresa'] = $empresa;
             $ofertas = $ofertas->where(function ($query) {
                 $empresaG = $GLOBALS['empresa'];
                 foreach ($empresaG as $empresa) {
                     $query->orWhere('ofertas.empresa_id', '=', $empresa['id']);
                 }
             });
             $ofertas = $ofertas->select('ofertas.*', 'ofertas.id as oferta_id', 'provincias.NOMBRE as provincia', 'contratos_laborales.nombre as tipo_contrato', 'municipios.NOMBRE as municipio', 'empresas.razon_social as empresa')->get();
             //$this->lastSQL();
             if (sizeof($ofertas) > 0) {
                 foreach ($ofertas as $oferta) {
                     $oferta['salario'] = Oferta::rangoSalario($oferta['salario']);
                 }
                 $return['grupo'][1]['nombre'] = 'ofertas';
                 $return['grupo'][1]['resultados'] = $ofertas;
             }
         }
         //$this->lastSQL();
         return $return;
     }
     if (Input::get('vista') == 1) {
         //Búsqueda ofertas
         $oferta = new Oferta();
         $ofertas = $oferta->leftJoin('municipios', function ($join) {
             $join->on('ofertas.municipio_id', '=', 'municipios.id');
         })->leftJoin('provincias', function ($join) {
             $join->on('ofertas.provincia_id', '=', 'provincias.CPRO');
         })->leftJoin('empresas', function ($join) {
             $join->on('ofertas.empresa_id', '=', 'empresas.id');
         })->leftJoin('contratos_laborales', function ($join) {
             $join->on('ofertas.contrato_id', '=', 'contratos_laborales.id');
         });
         foreach (Input::get('oferta') as $index => $value) {
             if (is_array($value)) {
                 $GLOBALS['value'] = $value;
                 $ofertas = $ofertas->where(function ($query) {
                     $valueG = $GLOBALS['value'];
                     foreach ($valueG as $indice => $valor) {
                         $query->orWhere('ofertas.' . $indice, '=', $valor);
                     }
                 });
             } else {
                 if ($value != "") {
                     if ($index == "puesto") {
                         $ofertas = $ofertas->where('ofertas.' . $index, 'like', '%' . $value . '%');
                     } else {
                         if ($index == "experiencia") {
                             $ofertas = $ofertas->where('ofertas.' . $index, '<=', $value);
                         } else {
                             if ($index == "caducado" && $value == 0) {
                                 $ofertas = $ofertas->where('ofertas.fecha_caducidad', '>', date('Y-m-d H:i:s', time()));
                             }
                             if ($index != "caducado") {
                                 $ofertas = $ofertas->where('ofertas.' . $index, '=', $value);
                             }
                         }
                     }
                 }
             }
         }
         $ofertas = $ofertas->select('ofertas.*', 'ofertas.id as oferta_id', 'provincias.NOMBRE as provincia', 'contratos_laborales.nombre as tipo_contrato', 'municipios.NOMBRE as municipio', 'empresas.razon_social as empresa')->get();
         $GLOBALS['ofertas'] = $ofertas;
         $return = array();
         if (sizeof($ofertas) > 0) {
             foreach ($ofertas as $oferta) {
                 $oferta['salario'] = Oferta::rangoSalario($oferta['salario']);
             }
             $return['grupo'][0]['nombre'] = 'ofertas';
             $return['grupo'][0]['resultados'] = $ofertas;
             $empresas = new Empresa();
             $empresas = $empresas->leftJoin('municipios', function ($join) {
                 $join->on('empresas.municipio_id', '=', 'municipios.id');
             })->leftJoin('provincias', function ($join) {
                 $join->on('empresas.provincia_id', '=', 'provincias.CPRO');
             });
             $usuarios = new Usuario();
             $usuarios = $usuarios->belongsToMany('Usuario', 'oferta_usuario', 'deleted_at');
             $usuarios = $usuarios->leftJoin('municipios', function ($join) {
                 $join->on('usuarios.municipio_id', '=', 'municipios.id');
             })->leftJoin('provincias', function ($join) {
                 $join->on('usuarios.provincia_id', '=', 'provincias.CPRO');
             });
             $empresas = $empresas->where(function ($query) {
                 $ofertasG = $GLOBALS['ofertas'];
                 foreach ($ofertasG as $oferta) {
                     $query->orWhere('empresas.id', '=', $oferta['empresa_id']);
                 }
             });
             $usuarios = $usuarios->where(function ($query) {
                 $ofertasG = $GLOBALS['ofertas'];
                 foreach ($ofertasG as $oferta) {
                     $query->orWhere('oferta_usuario.oferta_id', '=', $oferta['id']);
                 }
             });
             $usuarios = $usuarios->select('usuarios.*', 'provincias.NOMBRE as provincia', 'municipios.NOMBRE as municipio')->get();
             //$this->lastSQL();
             $empresas = $empresas->select('empresas.*', 'provincias.NOMBRE as provincia', 'municipios.NOMBRE as municipio')->get();
             if (sizeof($empresas) > 0) {
                 $return['grupo'][1]['nombre'] = 'empresas';
                 $return['grupo'][1]['resultados'] = $empresas;
             }
             if (sizeof($usuarios) > 0) {
                 $return['grupo'][2]['nombre'] = 'usuarios';
                 $return['grupo'][2]['resultados'] = $usuarios;
             }
         }
         return $return;
     }
 }
Пример #21
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:
Пример #22
0
<?php

require_once 'Oferta.php';
$aux = new Oferta($_GET['id']);
$aux->borra();
header("Location: index.php");
Пример #23
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();
Пример #24
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";
            }
        }
    }
}
Пример #25
0
 public function getBorrarInscrito($ofertaId, $demandanteId)
 {
     Oferta::find($ofertaId)->inscritos()->detach($demandanteId);
 }
Пример #26
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();
//