Пример #1
0
                    <th>Author</th>
                    <th>Synced</th>
                    <th>Actions</th>
                </tr>
                </thead>
                <tbody>
                <?php 
/**
 * Created by PhpStorm.
 * User: evolutionarycoder
 * Date: 2/3/16
 * Time: 7:06 PM
 */
use Backend\Database\Tables\Poems;
use Backend\Helpers\TableBuilder;
$table = new Poems();
$data = $table->readAll();
$builder = new TableBuilder();
if ($data !== false) {
    for ($i = 0; $i < count($data); $i++) {
        $current = $data[$i];
        $decoded = clone $data[$i];
        $table->stripAndDecode($decoded);
        $table->strip($current);
        $builder->buildCell($decoded->getName())->buildCell($decoded->getPoem())->buildCell($decoded->getDate())->buildCell($decoded->getAuthor())->buildCell($decoded->getSynced());
        $builder->addActionAttrs("name", $current->getName())->addActionAttrs("id", $current->getId())->addActionAttrs("poem", $current->getPoem())->addActionAttrs("author", $current->getAuthor());
        $builder->addRowAttr("id", $current->getId());
        echo $builder->buildRow();
    }
}
?>
Пример #2
0
<?php

/**
 * Created by PhpStorm.
 * User: prince
 * Date: 1/6/16
 * Time: 2:57 PM
 */
header("Cache-Control: no-cache, no-store");
header("Pragma: no-cache");
use Backend\Database\Tables\Poems;
use Backend\Helpers\Email;
include "../../../vendor/autoload.php";
if (isset($_GET["fetch"])) {
    $table = new Poems();
    if ($table->createJson()) {
        $email = new Email("MyLove Synced", "Table " . Poems::TABLE_NAME);
        $email->send();
        header("Location: ../json/" . Poems::JSON_NAME);
    } else {
        echo "false";
    }
}
Пример #3
0
    }
}
if (isset($_POST["update"])) {
    $name = $_POST[Poems::NAME];
    $poem = $_POST[Poems::POEM];
    $author = $_POST[Poems::AUTHOR];
    $id = $_POST[Poems::ROW_ID];
    $obj = new Poem($id, $author, $name, $poem, null, null, "true", "true");
    $obj->setSynced(null);
    $table = new Poems();
    if ($table->update($obj)) {
        echo "true";
    } else {
        echo "false";
    }
}
if (isset($_POST["delete"])) {
    $id = $_POST[Poems::ROW_ID];
    $table = new Poems();
    if ($table->delete($id)) {
        echo "true";
    } else {
        echo "false";
    }
}
// fetch total rows
if (isset($_GET["total"])) {
    $table = new Poems();
    $total = $table->totalRows();
    echo $total . " poem";
}
Пример #4
0
    Welcome Daniel Prince!

                        </h4>
                    </div>
                </div>

                
    <!-- Fetch Total Records from the relevant table  -->
    <?php 
use Backend\Database\Tables\ILove;
use Backend\Database\Tables\Memory;
use Backend\Database\Tables\Poems;
use Backend\Database\Tables\Promises;
use Backend\Database\Tables\Quotes;
use Backend\Database\Tables\Reassurance;
$poems = new Poems();
$totalPoems = (int) $poems->totalRows();
$iloves = new ILove($poems->getConnection());
$totalIloves = (int) $iloves->totalRows();
$assure = new Reassurance($poems->getConnection());
$totalAssure = (int) $assure->totalRows();
$promise = new Promises($poems->getConnection());
$totalPromise = (int) $promise->totalRows();
$memory = new Memory($poems->getConnection());
$totalMemory = (int) $memory->totalRows();
$quote = new Quotes($poems->getConnection());
$totalQuotes = (int) $quote->totalRows();
$total = $totalPoems + $totalIloves + $totalAssure + $totalPromise + $totalMemory + $totalQuotes;
?>
    <!--Widget-4 -->
    <div class="row">