diff --git a/databaseOperations.php b/databaseOperations.php index d102b17..5d183b5 100755 --- a/databaseOperations.php +++ b/databaseOperations.php @@ -48,6 +48,54 @@ function getCategories($db) } } +/** + * @brief queries all the sub categories from a certain tab + * @param $db: the PDO connection to the database + * @param $tab: the ID of the tab + * @return a list of the subcategories for $tab + */ +function getSousCategories($db, $tab) +{ + try + { + $request = $db->prepare('SELECT * FROM sous_categorie WHERE sous_cat_tab = ? ORDER BY sous_cat_id ASC'); + $request->execute(array($tab)); + $result = $request->fetchAll(); + $request->closeCursor(); + return $result; + } + catch(PDOException $e) + { + //NOTE: change $e->getMessage() by an error message before going to production + echo($e->getMessage()); + die(); + } +} + +/** + * @brief queries all the categories from a subcategorie + * @param $db: the PDO connection to the database + * @param $sous_cat_id: the ID of the subcategorie + * @return a list of the categories for the subcategorie + */ +function getCategoriesBySousCategorie($db, $sous_cat_id) +{ + try + { + $request = $db->prepare('SELECT * FROM categorie WHERE sous_cat_id = ? ORDER BY cat_id ASC'); + $request->execute(array($sous_cat_id)); + $result = $request->fetchAll(); + $request->closeCursor(); + return $result; + } + catch(PDOException $e) + { + //NOTE: change $e->getMessage() by an error message before going to production + echo($e->getMessage()); + die(); + } +} + /** * @brief queries all the events from the database * @param $db: the PDO connection to the database diff --git a/index.css b/index.css index 02eecde..bf21b83 100755 --- a/index.css +++ b/index.css @@ -78,6 +78,7 @@ form input[type="checkbox"] { display:none; } + input[type="checkbox"] + label span { display:inline-block; width:19px; diff --git a/index.php b/index.php index 046dc0a..b483320 100644 --- a/index.php +++ b/index.php @@ -32,8 +32,6 @@ if(isset($_GET['w'])&&is_numeric($_GET['w'])) else $weekOffset = 0; -$categories = getCategories($db); - ?> @@ -68,6 +66,39 @@ $categories = getCategories($db); + Ajouter un Évènement