}
    if (strpos($categorie->Proprietati, "xb") !== false) {
        $xb = 1;
    }
    if (strpos($categorie->Proprietati, "xc") !== false) {
        $xc = 1;
    }
    if (strpos($categorie->Proprietati, "xt") !== false) {
        $xt = 1;
    }
    if (strpos($categorie->Proprietati, "xs") !== false) {
        $xs = 1;
    }
}
if (isset($_POST['submit'])) {
    $categorie = Categoriedotari::find_by_id($_POST['id']);
    $categorie->Descriere = $_POST['Descriere'];
    $categorie->TipProprietate = $_POST['TipProprietate'];
    $categorie->TipControl = $_POST['TipControl'];
    $categorie->Prioritate = $_POST['Prioritate'];
    if (isset($_POST['Privat'])) {
        $categorie->Privat = $_POST['Privat'];
    } else {
        $categorie->Privat = 0;
    }
    $categorie->Proprietati = "";
    if (isset($_POST['xa'])) {
        $xa = 1;
        $categorie->Proprietati = $categorie->Proprietati . "xa";
    }
    if (isset($_POST['xb'])) {
				</fieldset>
				<?php 
    }
}
?>
				</div>
			</div>
			
			
			<div style="display: inline-block; width:325px; float: left">
				<div>
			<?php 
//Dotari
$tipp = $apartament->TipProprietate + 1;
$sql = "SELECT * FROM CategorieDotari where TipControl='2' ORDER BY Prioritate";
$categorieDotariList = Categoriedotari::find_by_sql($sql);
if (!empty($categorieDotariList)) {
    $rows = 0;
    foreach ($categorieDotariList as $categorie) {
        $rows = $rows + 2;
        if ($rows > 22) {
            $rows = 0;
            echo "</div></div>";
            echo "<div style=\"display: inline-block; width:325px; float: left\"><div>";
        }
        ?>
				<fieldset id="FS<?php 
        echo $categorie->id . "_" . $categorie->Proprietati;
        ?>
">
					<legend><?php 
function CategoriiDot($tip)
{
    if ($tip != "nc") {
        $tip = "Proprietati LIKE '%{$tip}%'";
    } else {
        $tip = "Proprietati='' OR Proprietati IS NULL";
    }
    ?>
		<div id="butoane" class="butoanestanga">
			<input type="button" value="Adauga categorie" onclick="addCategoriedotare()"></input>
		</div>
		<?php 
    $sql = "SELECT * FROM CategorieDotari WHERE {$tip} ORDER BY Prioritate";
    echo $sql;
    $categoriedotariList = Categoriedotari::find_by_sql($sql);
    if (!empty($categoriedotariList)) {
        foreach ($categoriedotariList as $categoriedotari) {
            ?>
	   		<div class="view">
	   			<h3><?php 
            echo $categoriedotari->Prioritate . " - " . $categoriedotari->Descriere . ($categoriedotari->Privat == 1 ? " - Privat - " : "") . ($categoriedotari->TipControl == 1 ? " - checkbox - " : " - lista - ");
            ?>
    | <a class="header" href="categoriedotare_update.php?id=<?php 
            echo $categoriedotari->id;
            ?>
">modifica</a></h3>
	   			<?php 
            $sql = "SELECT * FROM Dotare WHERE idCategorieDotari={$categoriedotari->id}";
            $dotareList = Dotare::find_by_sql($sql);
            if (!empty($dotareList)) {
                $i = 0;
                ?>
	   				<table width="650px">
				   		<tr>
				   			<td class="header" width="40%">Denumire</td>
				   			<td class="header" width="10%">Implicit</td>
				   			<td class="header" width="20%">ID Imobiliare</td>
				   			<td class="header" width="30%">Operatii</td>
				   		</tr>   	
	   				<?php 
                foreach ($dotareList as $dotare) {
                    $i++;
                    $class = $i % 2 ? "impar" : "par";
                    ?>
		   				<tr id="<?php 
                    echo $dotare->id;
                    ?>
" class="<?php 
                    echo $class;
                    ?>
" ondblclick='dotareEdit("<?php 
                    echo $dotare->id;
                    ?>
")' onmouseover='onOver("<?php 
                    echo $dotare->id;
                    ?>
",1,<?php 
                    echo $i;
                    ?>
)' onmouseout='onOver("<?php 
                    echo $dotare->id;
                    ?>
",0,<?php 
                    echo $i;
                    ?>
)'>
		   					<td><?php 
                    echo $dotare->Descriere;
                    ?>
</td>
		   					<td><input type="checkbox" disabled="disabled" <?php 
                    if ($dotare->Implicit == 1) {
                        echo "checked=\"checked\"";
                    }
                    ?>
/></td>
		   					<td><?php 
                    echo $dotare->idImobiliare;
                    ?>
</td>
		   					<td> <a href="dotare_update.php?id=<?php 
                    echo $dotare->id;
                    ?>
">modifica</a> | <a href="dotare_delete.php?id=<?php 
                    echo $dotare->id;
                    ?>
">sterge</a> | <a href="dotare_new.php?idCateg=<?php 
                    echo $categoriedotari->id;
                    ?>
">adauga</a></td>
		   				</tr>
	   					<?php 
                }
                ?>
					</table>
	   			<?php 
            } else {
                ?>
	   				<input type="button" value="Adauga Dotare" onclick="addDotare(<?php 
                echo $categoriedotari->id;
                ?>
)"></input>
	   				<input type="button" value="Sterge Categorie" onclick="delCategoriedotare(<?php 
                echo $categoriedotari->id;
                ?>
)"></input> <?php 
            }
            ?>
	   		</div>
	   		<?php 
        }
    }
}
Beispiel #4
0
    		</tr>
        	<tr>
            	<td class="label">Descriere: </td>
                <td><input type="text" name="Descriere" maxlength="30" value="<?php 
if (isset($Descriere)) {
    echo htmlentities($Descriere);
}
?>
" /></td>
            </tr>
            <tr>
            	<td class="label">Categorie: </td>
                <td>
            		<select name='idCategorieDotari'>
            		<?php 
$categoriedotariList = Categoriedotari::find_all();
foreach ($categoriedotariList as $categoriedotari) {
    $selected = isset($idCategorieDotari) && $idCategorieDotari == $categoriedotari->id ? " selected " : "";
    echo "<option value='" . $categoriedotari->id . "'" . $selected . ">" . $categoriedotari->Descriere . "</option>";
}
?>
            		</select>
            	</td>
			</tr>
			<tr>
				<td class="label">Selectat implicit</td>
				<td>
					<input type="checkbox" name="Implicit" <?php 
if ($Implicit == 1) {
    echo "checked=\"checked\"";
}
<?php

require_once ".././include/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
$message = "";
if (isset($_POST['submit'])) {
    $dotare = new Categoriedotari();
    $Descriere = $_POST['Descriere'];
    $TipProprietate = $_POST['TipProprietate'];
    $TipControl = $_POST['TipControl'];
    $Prioritate = $_POST['Prioritate'];
    if (isset($_POST['Privat'])) {
        $Privat = $_POST['Privat'];
    } else {
        $Privat = 0;
    }
    $sql = "SELECT * FROM CategorieDotari WHERE Descriere='{$Descriere}' AND TipProprietate='{$TipProprietate}'";
    $dotareList = Dotare::find_by_sql($sql);
    if (!empty($dotareList)) {
        $message = "Categoria deja exista in baza de date";
    } else {
        $dotare->Descriere = $Descriere;
        $dotare->TipProprietate = $TipProprietate;
        $dotare->TipControl = $TipControl;
        $dotare->Prioritate = $Prioritate;
        $dotare->Privat = $Privat;
        $categorie->Proprietati = "";
        if (isset($_POST['xa'])) {
            $xa = 1;
<?php

require_once ".././include/initialize.php";
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
$CatDot = Categoriedotari::find_by_id($_GET['id']);
$CatDot->delete();
redirect_to("categoriedotare_list.php");