public static function index() { $rules = ["id" => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]]]; $data = filter_input_array(INPUT_GET, $rules); if (self::checkValues($data)) { echo ViewHelper::render("view/editor/igralec-detail.php", ["igralec" => IgralecDB::get($data)]); } else { echo ViewHelper::render("view/editor/igralec-list.php", ["igralci" => IgralecDB::getAll()]); } }
<?php require_once 'model/IgralecDB.php'; /** * Created by PhpStorm. * User: Urban * Date: 08-Feb-16 * Time: 10:55 AM */ $igralci = IgralecDB::getAll(); ?> <script type="text/javascript" src="<?php echo JS_URL . "scriptIgralecList.js"; ?> "></script> <h1>Vsi igralci</h1> <ul id="igralecList"> <?php foreach ($igralci as $igralec) { ?> <li> <a href="#" name="detail" value="<?php echo $igralec["id"]; ?> " > <?php echo $igralec["ime"]; ?> <?php