Example #1
0
<?php

$model_data = array();
function model_load()
{
    global $model_data;
    if (empty($_SESSION['ladu'])) {
        $model_data = array();
    } else {
        $model_data = json_decode($_SESSION['ladu'], true);
    }
}
function model_save()
{
    global $model_data;
    $_SESSION['ladu'] = json_encode($model_data);
    return true;
}
model_load();
Example #2
0
File: view.php Project: andris9/itk
    </form>

    <table id="ladu" border="1">
        <thead>
            <tr>
                <th>Nimetus</th>
                <th>Kogus</th>
                <th>Tegevused</th>
            </tr>
        </thead>

        <tbody>

        <?php 
// koolon tsükli lõpus tähendab, et tsükkel koosneb HTML osast
foreach (model_load($page) as $rida) {
    ?>

            <tr>
                <td>
                    <?php 
    echo htmlspecialchars($rida['nimetus']);
    ?>
                </td>
                <td>
                    <form method="post" action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
">
                        <input type="hidden" name="action" value="update">
                        <input type="hidden" name="csrf_token" value="<?php 
Example #3
0
    </form>

    <table id="ladu" border="1">
        <thead>
            <tr>
                <th>Nimetus</th>
                <th>Kogus</th>
                <th>Tegevused</th>
            </tr>
        </thead>

        <tbody>

        <?php 
// koolon tsükli lõpus tähendab, et tsükkel koosneb HTML osast
foreach (model_load() as $rida) {
    ?>

        	<tr>
        		<td>
        			<?php 
    echo htmlspecialchars($rida['Nimetus']);
    ?>
        		</td>
        		<td>
        			<?php 
    echo $rida['Kogus'];
    ?>
        		</td>
        		<td>
function model_get_all()
{
    $data = model_load();
    return $data["data"];
}