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/tekma-detail.php", ["tekma" => TekmaDB::get($data)]); } else { echo ViewHelper::render("view/editor/tekma-list.php", ["tekme" => TekmaDB::getAll()]); } }
<?php require_once 'model/IgralecDB.php'; /** * Created by PhpStorm. * User: Urban * Date: 08-Feb-16 * Time: 10:55 AM */ $tekme = TekmaDB::getAll(); ?> <script type="text/javascript" src="<?php echo JS_URL . "scriptTekmaList.js"; ?> "></script> <h1>Vse tekme</h1> <ul id="tekmaList"> <?php foreach ($tekme as $tekma) { ?> <?php $ekipa1 = EkipaDB::getById($tekma["ekipa1_id"]); $ekipa2 = EkipaDB::getById($tekma["ekipa2_id"]); ?> <li> <a href="#" name="detail" value="<?php echo $tekma["id"]; ?>