public function listAvalible() { global $db; $sql = "SELECT count(*) FROM " . self::RELATION_TABLE . " WHERE medlem_id = " . $this->getMedlemId(); $count = $db->value($sql); if ($count == 0) { return Mal::listAll(); } else { return Mal::listByIds(array_keys($this->listMal()), true); } }
<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php"; Security::demand(ADMIN); $smarty = new AdminSmarty(); $listMal = Mal::listAll(); $smarty->assign("listMal", $listMal); $smarty->display('listmal.tpl');