header('Content-type: application/json'); $proccessSearch = null; if ($toSearch == "video") { requireVideo(); $proccessSearch = new ProccessVideoSearch($resultSearch); } elseif ($toSearch == "paper") { requirePaper(); $proccessSearch = new ProccessPublicationSearch($resultSearch); } elseif ($toSearch == 'analysis') { requireAnalysis(); $proccessSearch = new ProccessAnalysisSearch($resultSearch); } $json = new JsonResponse(); $json->response(true, $proccessSearch->getResultsFound(), TRUE); $json->addValue("searchType", $toSearch); print_r($json->serialize()); } else { $json = new JsonResponse(); print_r($json->response(false, "Nenhum registro encontrado")->addValue("searchType", $toSearch)->serialize()); } ?> <? function requirePublications(){ require_once '../core/Publication/Publication.php'; require_once '../core/generics/SubArea.php'; require_once '../core/SearchEngine/ProccessPublicationSearch.php'; } function requireVideo(){ require_once '../core/Video/Video.php'; require_once '../core/Video/SubArea.php';