示例#1
0
 public function autocomplete($action, $id, $vars)
 {
     switch ($action) {
         case 'get':
             if (!empty($_GET['type']) && !empty($_GET['term'])) {
                 $res = NULL;
                 if ($_GET['type'] == 'motcle') {
                     $motCleDAO = new MotCleDAO(BDD::getInstancePDO());
                     $res = $motCleDAO->getAllComposedOf($_GET['term']);
                 } elseif ($_GET['type'] == 'membre') {
                     $membreDAO = new MembreDAO(BDD::getInstancePDO());
                     $res = $membreDAO->getAllComposedOf($_GET['term']);
                 } elseif ($_GET['type'] == 'titreTechnote') {
                     $technoteDAO = new TechnoteDAO(BDD::getInstancePDO());
                     $res = $technoteDAO->getAllTitreComposedOf($_GET['term']);
                 } elseif ($_GET['type'] == 'titreQuestion') {
                     $questionDAO = new QuestionDAO(BDD::getInstancePDO());
                     $res = $questionDAO->getAllTitreComposedOf($_GET['term']);
                 }
                 echo json_encode($res);
                 exit;
             }
             $this->vue->display('404.twig', $vars);
             exit;
         default:
             $this->vue->display('404.twig', $vars);
             exit;
     }
 }