Commentaire et travail à réaliser
This commit is contained in:
parent
66f7fca498
commit
195282e4f2
|
@ -59,5 +59,13 @@ $projects = getProjects($page, $limit);
|
|||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
|
||||
<!--
|
||||
Générer la pagination :
|
||||
|
||||
Première page | Précédent | 1 | 2 | 3 ... | Suivant | Dernière page
|
||||
|
||||
Mettre en avant la page courrante
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @return PDO Une instance PDO
|
||||
*/
|
||||
function getDatabaseConnection()
|
||||
{
|
||||
static $pdo;
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Retourne une liste de projets en fonction d'une pagination
|
||||
*
|
||||
* @param int $page La page courrante
|
||||
* @param int $limit Nombre de projet par page
|
||||
* @return array Les projets
|
||||
*/
|
||||
function getProjects($page = 1, $limit = 5)
|
||||
{
|
||||
if (!is_integer($page)) {
|
||||
|
@ -24,6 +31,12 @@ function getProjects($page = 1, $limit = 5)
|
|||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne un projet en fonction de son id
|
||||
*
|
||||
* @param int $id id du projet
|
||||
* @return array|false Le projet
|
||||
*/
|
||||
function getProject($id)
|
||||
{
|
||||
if (!is_integer($id)) {
|
||||
|
@ -41,6 +54,10 @@ function getProject($id)
|
|||
return $query->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $maxPerPage Nombre de projets par page
|
||||
* @return int Le nombre de pages
|
||||
*/
|
||||
function getProjectNumberOfPages($maxPerPage)
|
||||
{
|
||||
if (!is_integer($maxPerPage)) {
|
||||
|
@ -58,6 +75,12 @@ function getProjectNumberOfPages($maxPerPage)
|
|||
return ceil($result['total'] / $maxPerPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returne les commentaires d'un projet
|
||||
*
|
||||
* @param int $id L'id du projet
|
||||
* @return array Les commentaire du projet
|
||||
*/
|
||||
function getCommentsByProject($id)
|
||||
{
|
||||
// À réaliser
|
||||
|
|
Loading…
Reference in a new issue