/** * Fonction renvoyant un tableau contenant les activités dont le libellé contient le string envoyé par le formulaire * de recherche d'activité. * @return array : le tableau d'activités. */ function rechercheActivite() { $cat = $_GET['categorie']; $cm = new CategorieManager(connexionDb()); $catId = $cm->getCategorieByLibelle($cat); $cam = new Categorie_ActivityManager(connexionDb()); $tabId = $cam->getActIdByCatId($catId); if (isPostFormulaire()) { $name = $_POST['activite']; } else { $name = ""; } $am = new ActivityManager(connexionDb()); $tabAct = $am->searchAllActivityByLibelle($name); $tab = array(); $i = -1; foreach ($tabAct as $elem) { $i++; foreach ($tabId as $act) { if ($elem->getId() == $act['id_activity']) { $tab[$i] = $elem; } } } return $tab; }