PHP Classes

File: fwphp/glomodul/z_examples/todo_csv_js/todolist/list.phtml

Recommend this page to a friend!
  Classes of Slavko Srakocic   B12 PHP FW   fwphp/glomodul/z_examples/todo_csv_js/todolist/list.phtml   Download  
File: fwphp/glomodul/z_examples/todo_csv_js/todolist/list.phtml
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: Update of fwphp/glomodul/z_examples/todo_csv_js/todolist/list.phtml
Date: 1 year ago
Size: 1,825 bytes
 

Contents

Class file image Download
<?php
/*
 *
 */

namespace TodoList;

use \
DateTime;
use \
TodoList\Model\Todo;
use \
TodoList\Util\Utils;

//~ Template for list.php
// variables:
// $title - page title
// $status - status of TODOs to be displayed
// $todos - TODOs to be displayed

?>

<h1>
    <?php echo Utils::iconStatus($status); ?>
<?php echo $title; ?>
</h1>

<?php if (empty($todos)): ?>
<p>No TODO items found.</p>
<?php else: ?>
<ul class="list">
        <?php foreach ($todos as $todo): ?>
<?php /* @var $todo Todo */ ?>
<?php $tooLate = $status == Todo::STATUS_PENDING
                   
&& $todo->getDueOn() < new DateTime(); ?>
<li>
                <h4>
                    <a href="<?php echo Utils::createLink('detail', ['id' => $todo->getId()]) ?>"><?php echo Utils::escape($todo->getTitle()); ?></a>
                    <?php echo Utils::iconPriority($todo->getPriority()); ?>
<?php if ($tooLate): ?>
<i class="material-icons error" title="Should be already done!">error</i>
                    <?php endif; ?>
<span class="label">Created On:</span> <?php echo Utils::escape(Utils::formatDateTime($todo->getCreatedOn())); ?>
</h4>
                <p><span class="label">Due On:</span>
                    <?php if ($tooLate): ?><span class="too-late"><?php endif; ?>
<?php echo Utils::escape(Utils::formatDateTime($todo->getDueOn())); ?>
<?php if ($tooLate): ?></span><?php endif; ?>
<?php if ($todo->getDescription()): ?>
<span class="description"><?php echo Utils::escape($todo->getDescription()); ?></span>
                <?php endif; ?>
</p>
            </li>
        <?php endforeach; ?>
</ul>
<?php endif; ?>