public function getBooks($params) { if (!is_array($params)) { return array('result' => 'fail', 'message' => 'Некорректные параметры запроса getBooks'); } $name = isset($params['name']) ? $params['name'] : ''; $author = isset($params['author']) ? $params['author'] : ''; return Books::getBooks($name, $author); }
} else { ?> <div class="panel panel-default"> <div class="panel-heading">Lista Carti <p style="margin-top: 15px"> <a class="btn btn-primary btn-sm" href="books.php?action=add"><i class="fa fa-plus" style="padding-right: 15px"></i>Adauga Carti</a> </p> </div> <div class="panel-body"> <?php if (isset($_SESSION['succes'])) { echo "\n <div class=\"alert alert-success\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\">Close</span>\n </button>\n \n {$_SESSION['succes']}\n </div>"; unset($_SESSION['succes']); } $book = new Books(); $books = $book->getBooks(); if (count($books) > 0) { ?> <table class="table"> <thead> <tr> <th>#</th> <th>Nume</th> <th>Caetgorie</th> <th>Autor</th> <th>Imagine</th> <th>Pret</th> <th>Optiuni</th> </tr> </thead> <?php