$result = execute_querry($sql, $conexiune2); } $td = $td + (time() - $td1); } $ti1 = time(); if ($oferta->OfertaWeb == 1 && $oferta->Stare == "de actualitate") { $proprietate = array(); $proprietate["id"] = $oferta->id; $subzona = Subzona::find_by_id($apartament->idSubzona); $proprietate["idSubzona"] = $subzona->idCartier; $proprietate["idAgent"] = $client->idUtilizator; $proprietate["TipProprietate"] = $apartament->TipProprietate; $proprietate["Titlu"] = $oferta->Titlu; if ($proprietate["Titlu"] == "") { $proprietate["Titlu"] = $apartament->NumarCamere > 1 ? "Apartament " . $apartament->NumarCamere . " camere " : "Garsoniera "; $zona = Subzona::find_by_id($apartament->idSubzona); $proprietate["Titlu"] .= $zona->Denumire; if ($apartament->PunctReper != "") { $proprietate["Titlu"] .= " - " . $apartament->PunctReper; } } $proprietate["Descriere"] = $apartament->Detalii; $proprietate["Vanzare"] = $oferta->Vanzare; $proprietate["Inchiriere"] = $oferta->Inchiriere; $proprietate["Pret"] = $oferta->Pret; $proprietate["PretChirie"] = $oferta->PretChirie; $proprietate["Moneda"] = $oferta->Moneda; $proprietate["NumarCamere"] = $apartament->NumarCamere; $proprietate["Confort"] = $apartament->Confort; $proprietate["TipApartament"] = $apartament->TipApartament; $proprietate["Etaj"] = $apartament->Etaj;
<?php require_once ".././include/initialize.php"; $q = $_GET["q"]; $result = ""; if (strlen($q) > 2) { $sql = "SELECT * FROM Subzona WHERE Denumire LIKE '%" . $q . "%' "; $subzonaList = Subzona::find_by_sql($sql); if (!empty($subzonaList)) { $i = 0; $result = "<table width=\"200px\">"; foreach ($subzonaList as $subzona) { $i++; $Denumire = mysql_real_escape_string($subzona->Denumire); $class = $i % 2 ? "impar" : "par"; $result .= "<tr id=\"SubHint{$subzona->id}\" class=\"{$class}\" onclick=subzonaHintSelect('" . str_replace(" ", "%20", $Denumire) . "','divSubzonaHint') onmouseover=\"this.style.cursor='hand';subzonaHintOnOver('SubHint{$subzona->id}',1,{$i})\" onmouseout=\"subzonaHintOnOver('SubHint{$subzona->id}',0,{$i})\"><td>{$subzona->Denumire}</td></tr>"; } $result .= "</table>"; } } echo $result;
public function actionGetSubZonas() { if (!empty($_GET)) { $EventoId = $_GET['EventoId']; $FuncionesId = $_GET['FuncionesId']; $ZonasId = $_GET['ZonasId']; echo "<option value='0'>Todas las subzonas</option>"; $subzonas = Subzona::model()->findAll("EventoId = {$EventoId} AND FuncionesId={$FuncionesId} AND ZonasId={$ZonasId}"); foreach ($subzonas as $key => $subzona) { echo "<option value='" . $subzona->SubzonaId . "'>" . $subzona->SubzonaId . "</option>"; } } }
$idCartier = $subzona->idCartier; $idPitagora = $subzona->idPitagora; $idImobiliare = $subzona->idImobiliare; $idMC = $subzona->idMC; $idImopedia = $subzona->idImopedia; $_SESSION['curentIdSubzona'] = $subzona->id; } if (isset($_POST['submit'])) { $subzona = new Subzona(); $Denumire = $_POST['Denumire']; $idCartier = $_POST['idCartier']; $idPitagora = $_POST['idPitagora']; $idImobiliare = $_POST['idImobiliare']; $idMC = $_POST['idMC']; $idImopedia = $_POST['idImopedia']; $subzona = Subzona::find_by_id($_SESSION['curentIdSubzona']); unset($_SESSION['curentIdSubzona']); $subzona->Denumire = $Denumire; $subzona->idCartier = $idCartier; $subzona->idPitagora = $idPitagora; $subzona->idImobiliare = $idImobiliare; $subzona->idMC = $idMC; $subzona->idImopedia = $idImopedia; $subzona->save(); $message = "salvat"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ro" lang="ro"> <head>
} } } $i = $i + 1; $class = $i % 2 ? "impar" : "par"; echo "<tr id='" . $cerere->id . "' class='" . $class . "' ondblclick=cerereView(" . $cerere->id . ") onmouseover=this.style.cursor='pointer';onOver(" . $cerere->id . ",1," . $i . ") onmouseout=onOver(" . $cerere->id . ",0," . $i . ") style=\"height:30px;font-weight:bold;\">"; echo "<td>" . $cerere->id . "</td>"; echo "<td>" . $client->full_name() . "</td>"; echo "<td>" . $client->TelefonMobil . "</td>"; echo "<td>" . $TipProprietateList . "</td>"; echo "<td align=\"center\">" . substr($cerere->NumarCamere, 1, -1) . "</td>"; echo "<td>" . substr($cerere->TipApartament, 1, -1) . "</td>"; echo "<td>" . ($cerere->EtajMinim > 0 ? $cerere->EtajMinim : "P") . " -> " . ($cerere->EtajMaxim ? $cerere->EtajMaxim : "-") . "</td>"; echo "<td>"; foreach ($zoneIdList as $zonaId) { if ($zonaId != "") { $zona = Subzona::find_by_id($zonaId); echo $zona->Denumire . ","; } } echo "</td>"; echo "<td align=\"right\">" . $cerere->Buget . " " . $cerere->Moneda . "</td>"; echo "<td>" . ($cerere->Credit == 1 ? "credit" : "cash") . "</td>"; echo "</tr>"; } ?> </table> </div> <?php } }
height: 270px; text-align: left; border:1px solid #EEE; position: relative; } #cargando{ color: #FF8000; font-size: 14pt; font-weight: bold; } </style> <div class="row"> <div class="coor-menu span7"> <?php $subzonas = Subzona::model()->findAll(array('condition' => "t.EventoId={$eventoId} AND t.FuncionesId = (SELECT FuncionesId FROM subzona WHERE subzona.EventoId={$eventoId} ORDER BY subzona.FuncionesId ASC LIMIT 1)")); $funcionesId = Funciones::model()->findAll("EventoId={$eventoId}"); ?> <table> <tr class="controles-submenu"> <td><?php echo CHtml::link('<i class="fa fa-eye"></i> Ver coordenadas', '#', array('id' => 'ver-coordenadas', 'class' => 'btn btn-success')); ?> </td> <td><?php echo CHtml::link('<i class="fa fa-repeat"></i> Descartar', '#', array('id' => 'descartar', 'class' => 'btn btn-info')); ?> </td> <td></td> <td></td> </tr>
<?php require_once ".././include/initialize.php"; if (!$session->is_logged_in()) { redirect_to("login.php"); } $message = ""; if (isset($_POST['submit'])) { $subzona = new Subzona(); $Denumire = $_POST['Denumire']; $idCartier = $_POST['idCartier']; $sql = "SELECT * FROM Subzona WHERE Denumire='{$Denumire}'"; $subzonaList = Subzona::find_by_sql($sql); if (!empty($subzonaList)) { $message = "Subzona deja exista in baza de date"; } else { $subzona->Denumire = $Denumire; $subzona->idCartier = $idCartier; $subzona->save(); $message = "Adaugat"; redirect_to("subzona_list.php"); } } include_layout_template('admin_header.php'); ?> <script type="text/javascript"> <!-- function back(){ document.location = ("subzona_list.php"); }
<script> hide("extraClient"); </script> <div id="Zone" class="view"> <h3>Detalii apartament</h3> <table> <tr> <td class="label">Zone:</td> <td> <?php $zone = ""; if (strlen($cerere->Zona) > 0) { $zoneList = explode(",", $cerere->Zona); foreach ($zoneList as $idZona) { $zona = Subzona::find_by_id($idZona); if ($zone != "") { $zone .= ", {$zona->Denumire}"; } else { $zone = $zona->Denumire; } } } echo $zone; ?> </td> </tr> <tr> <td class="label">Tip proprietate:</td> <td><?php $tmp = "";
public function actionAlinearSubzona($EventoId, $FuncionesId, $ZonasId, $SubzonaId, $direccion = 'izquierda') { // alinea todos los lugares de una subzona $subzona = Subzona::model()->with('filas')->findByPk(compact('EventoId', 'FuncionesId', 'ZonasId', 'SubzonaId')); foreach ($subzona->filas as $fila) { // alinea los lugares de cada fila $fila->alinear($direccion); } }
public function eliminarDistribucion() { $identificador = array('EventoId' => $this->EventoId); $nfunciones = Funciones::model()->countByAttributes($identificador); if ($nfunciones > 1) { // Si no se esta tratando de eliminar la unica funcion. $identHijos = array('EventoId' => $this->EventoId, 'FuncionesId' => $this->FuncionesId); $this->deleteConfpvfuncion(); Zonas::model()->deleteAllByAttributes($identHijos); Subzona::model()->deleteAllByAttributes($identHijos); Filas::model()->deleteAllByAttributes($identHijos); Lugares::model()->deleteAllByAttributes($identHijos); $mapagrande = ConfigurlFuncionesMapaGrande::model()->findByAttributes(array('EventoId' => $this->EventoId, 'FuncionId' => $this->FuncionesId)); if (is_object($mapagrande)) { // Si tiene un mapa grande se eliminan primero sus coordenadas para que no de restriccion de llaves foraneas ConfigurlMapaGrandeCoordenadas::model()->deleteAllByAttributes(array('configurl_funcion_mapa_grande_id' => $mapagrande->id)); $mapagrande->delete(); } $this->ForoMapIntId = 0; $this->save(); return true; } else { return false; } }
height: 270px; text-align: left; border:1px solid #EEE; position: relative; } #cargando{ color: #FF8000; font-size: 14pt; font-weight: bold; } </style> <div class="row"> <div class="coor-menu span7"> <?php $subzonas = Subzona::model()->findAll(array('condition' => "t.EventoId={$eventoId} AND t.FuncionesId = {$funcionId}")); ?> <table> <tr class="controles-submenu"> <td><?php echo CHtml::link('Descartar', '#', array('id' => 'descartar', 'class' => 'btn ')); ?> </td> <td><?php echo CHtml::link(' Ver coordenadas', '#', array('id' => 'ver-coordenadas', 'class' => 'btn btn-info fa fa-eye')); ?> </td> <td></td> <td></td> </tr> </table>
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 = ("subzona_list.php"); } //--> </script> <?php $subzona = Subzona::find_by_id($_GET['id']); $subzona->delete(); ?> <h3>Subzona <?php echo $subzona->Denumire; ?> a fost stearsa.</h3> <div id="butoane" class="butoane"> <input type="button" name="submit" value="Inapoi" onclick="back()" /> </div> <?php include_layout_template('admin_footer.php');
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); }
static function removerAsignacion($EventoId, $FuncionesId) { //Elimina todas las zonas, subzonas, filas, lugares de la funcion que se le indique $identificador = compact('EventoId', 'FuncionesId'); $transaction = Yii::app()->db->beginTransaction(); Subzona::model()->deleteAllByAttributes($identificador); Filas::model()->deleteAllByAttributes($identificador); Lugares::model()->deleteAllByAttributes($identificador); Zonaslevel1::model()->deleteAllByAttributes($identificador); Zonastipo::model()->deleteAllByAttributes($identificador); Zonastipolevel1::model()->deleteAllByAttributes($identificador); $mapagrande = ConfigurlFuncionesMapaGrande::model()->findByAttributes(array('EventoId' => $EventoId, 'FuncionId' => $FuncionesId)); if (is_object($mapagrande)) { // Si tiene un mapa grande se eliminan primero sus coordenadas para que no de restriccion de llaves foraneas ConfigurlMapaGrandeCoordenadas::model()->deleteAllByAttributes(array('configurl_funcion_mapa_grande_id' => $mapagrande->id)); $mapagrande->delete(); } if (Zonas::model()->deleteAllByAttributes($identificador)) { $funcion = Funciones::model()->findByPk($identificador); $funcion->ForoId = 0; $funcion->ForoMapIntId = 0; $transaction->commit(); } else { $transaction->rollback(); } return Zonas::model()->countByAttributes($identificador) == 0; }
public function eliminarSubzonas() { #### !!!!! Elimina todas las subzonas, filas y lugares de la zona !!!! #### $identificador = array('EventoId' => $this->EventoId, 'FuncionesId' => $this->FuncionesId, 'ZonasId' => $this->ZonasId); $ventas = Ventaslevel1::model()->countByAttributes(array('EventoId' => $this->EventoId)); if ($ventas == 0) { //Si no hay ventas elimina todas las subzonas filas y lugares $ret = Subzona::model()->deleteAllByAttributes($identificador); Filas::model()->deleteAllByAttributes($identificador); Lugares::model()->deleteAllByAttributes($identificador); return $ret; } else { return -1; } }