<?php

use app\model\CasaCaracteristica;
use app\repository\CaracteristicaRepository;
use app\repository\CasaCaracteristicaRepository;
use app\repository\EstadoRepository;
require_once '../../repository/EstadoRepository.php';
require_once '../../repository/CaracteristicaRepository.php';
require_once '../../repository/CasaCaracteristicaRepository.php';
require_once '../../model/Estado.php';
require_once '../../model/Caracteristica.php';
require_once '../../model/CasaCaracteristica.php';
require_once '../../repository/Connection.php';
$estadoRepository = new EstadoRepository();
$estado = $estadoRepository->getOneByName("Valida");
$caracteristicaRepository = new CaracteristicaRepository();
$caracteristicas = $caracteristicaRepository->getAllByEstado($estado->getId());
foreach ($caracteristicas as $c) {
    $idCasa = $_POST['idCasa'];
    $idCaracteristica = $c->getId();
    $casaCaracteristicaRepository = new CasaCaracteristicaRepository();
    $casaCaracteristica = $casaCaracteristicaRepository->getOneByCasaAndCaracteristica($idCasa, $idCaracteristica);
    if (isset($casaCaracteristica) && !is_null($casaCaracteristica->getId())) {
        echo $casaCaracteristica->getId();
        if (!isset($_POST[$c->getId()])) {
            $casaCaracteristicaRepository->delete($casaCaracteristica->getId());
        }
    } else {
        if (isset($_POST[$c->getId()])) {
            $casaCaracteristica = new CasaCaracteristica();
            $casaCaracteristica->setDescripcion(null);
Пример #2
0
                    <?php 
        }
        ?>
                    <!--Se muestra solo si se definio previamente el intervalo de fechas de reserva-->

                </div>
            </div>
            <div class="row">
                <div class="col-md-8 col-xs-12 caracteristicas">
                    <h3>Caracteristicas</h3>
                    <?php 
        if ($casaCaracteristicas->count() == 0) {
            echo '<p>Esta casa no posee ninguna caracteristica especial</p>';
        } else {
            foreach ($casaCaracteristicas as $cc) {
                $caracteristicaRepository = new CaracteristicaRepository();
                $caracteristica = $caracteristicaRepository->getOne($cc->getIdCaracteristica());
                ?>
                            <p><span
                                    class="glyphicon glyphicon-star"></span> <?php 
                echo $caracteristica->getNombre();
                ?>
                            </p>
                        <?php 
            }
        }
        ?>
                </div>
            </div>
        </div>
        <?php 
Пример #3
0
<?php

use app\model\Caracteristica;
use app\repository\CaracteristicaRepository;
require_once 'repository/CaracteristicaRepository.php';
require_once 'repository/Connection.php';
require_once 'model/Caracteristica.php';
if (isset($_SESSION['id']) && $_SESSION['admin']) {
    if (isset($_GET['id'])) {
        $id = $_GET['id'];
        $caracteristica = new Caracteristica();
        $caracteristicaRepository = new CaracteristicaRepository();
        $caracteristica = $caracteristicaRepository->getOne($id);
        $nombre = $caracteristica->getNombre();
    }
    ?>
<div class="container principal" ng-controller="CaracteristicasController">
    <div class="row">
        <div class="col-md-4 col-xs-12">
            <h3>Agregar caracteristica</h3>

            <form role="form" method="post" id="caractAlta"
                  action="controller/caracteristica/caracteristica_update.php">
                <?php 
    if (isset($id)) {
        ?>
                    <div class="form-group" hidden>
                        <label for="id">ID</label>
                        <input type="text" class="form-control" id="id"
                               name="id" value="<?php 
        echo $id;
Пример #4
0
 }
 ?>
             <th>Nombre </th>
             <?php 
 if (!isset($_POST['idCasa'])) {
     ?>
                 <th>Editar </th>
                 <th>Eliminar</th>
             <?php 
 }
 ?>
         </tr>
         <?php 
 $estadoRepository = new EstadoRepository();
 $estado = $estadoRepository->getOneByName("Valida");
 $caracteristicaRepository = new CaracteristicaRepository();
 if (!isset($_POST['idCasa'])) {
     $caracteristicas = $caracteristicaRepository->getAllByEstado($estado->getId());
 } else {
     $casaCaracteristicaRepository = new CasaCaracteristicaRepository();
     $casaCaracteristicas = $casaCaracteristicaRepository->getAllByCasa($_POST['idCasa']);
     $caracteristicas = new ArrayObject();
     foreach ($casaCaracteristicas as $cc) {
         $caracteristica = $caracteristicaRepository->getOne($cc->getIdCaracteristica());
         $caracteristicas->append($caracteristica);
     }
 }
 foreach ($caracteristicas as $c) {
     ?>
         <tr>
             <?php 
Пример #5
0
<?php

use app\model\Caracteristica;
use app\repository\CaracteristicaRepository;
use app\repository\EstadoRepository;
require_once '../../repository/CaracteristicaRepository.php';
require_once '../../repository/EstadoRepository.php';
require_once '../../model/Caracteristica.php';
require_once '../../model/Estado.php';
require_once '../../repository/Connection.php';
$caracteristicaRepository = new CaracteristicaRepository();
if (isset($_POST['id'])) {
    $id = $_POST['id'];
    //Busco la caracteristica
    $caracteristica = $caracteristicaRepository->getOne($id);
    //Seteo los campos que podrian haber cambiado
    $caracteristica->setNombre($_POST['nombre']);
    //Actualizo la caracteristica
    $caracteristicaRepository->update($caracteristica);
} else {
    $caracteristica = new Caracteristica();
    $caracteristica->setNombre($_POST['nombre']);
    //Le seteo el estado "valida"
    $estadoRepository = new EstadoRepository();
    $estado = $estadoRepository->getOneByName("Valida");
    $caracteristica->setIdEstado($estado->getId());
    $caracteristicaRepository->insert($caracteristica);
}
header("location: ../../carac_list.php");
Пример #6
0
<?php

use app\repository\CaracteristicaRepository;
require_once '../../repository/CaracteristicaRepository.php';
require_once '../../repository/Connection.php';
$id = $_GET['id'];
$caracteristicaRepository = new CaracteristicaRepository();
$caracteristicaRepository->delete($id);
header("location: ../../carac_list.php");