aggiunta funzione di ricerca nelle tabelle
This commit is contained in:
@@ -8,3 +8,6 @@ db.runCommand({
|
||||
textSearchEnabled: 1
|
||||
});
|
||||
|
||||
|
||||
INDEX DA CREARE
|
||||
db.notizia.ensureIndex({"about.author":"text",titolo:"text",sottotitolo:"text",testo:"text"})
|
||||
|
||||
@@ -250,7 +250,12 @@ class GenericDao{
|
||||
|
||||
/**
|
||||
* Ritorna la lista dei notizia model ordinati per pertinenza
|
||||
* @param string $searchStr
|
||||
* @param string $modelClass
|
||||
* @param string $searchWord
|
||||
* @param array $filter
|
||||
* @param array $options
|
||||
* @throws CoreException
|
||||
* @return DaoSaveable[]
|
||||
*/
|
||||
public function search($modelClass, $searchWord, array $filter = array(), array $options = array()){
|
||||
if (!is_null($modelClass)){
|
||||
|
||||
@@ -27,8 +27,16 @@ class DatatablesHelper {
|
||||
$options["sort"][$key] = strcasecmp($details["dir"], "asc")==0?1:-1;
|
||||
}
|
||||
}
|
||||
|
||||
$models = array();
|
||||
if (array_key_exists("search", $_POST) && array_key_exists("value", $_POST["search"]) && strcmp(trim($_POST["search"]["value"]),"")!=0 ){
|
||||
$models = $dao->query($useModel, trim($_POST["search"]["value"]),$filter, $options);
|
||||
}
|
||||
else {
|
||||
$models = $dao->query($useModel, $filter, $options);
|
||||
}
|
||||
|
||||
$models = $dao->query($useModel, $filter, $options);
|
||||
|
||||
|
||||
if (sizeof($models)>0){
|
||||
foreach ($models as $model){
|
||||
|
||||
@@ -13,7 +13,7 @@ try {
|
||||
if(array_key_exists("search", $_POST) && strcmp($_POST["search"], "")!=0){
|
||||
$searchParameters = strip_tags(PostHandler::get("search"));
|
||||
|
||||
$notizie = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
$notizie = GlobalVariables::get("dao")->search("NotiziaModel",$searchParameters,
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED),
|
||||
array("sort"=>array("about.data"=>-1),"limit"=>10)
|
||||
);
|
||||
|
||||
@@ -68,7 +68,7 @@ form > div{margin:5px 0;}
|
||||
.notiziaMenu ul {list-style:none; display:inline-block; padding:0 20px;}
|
||||
.notiziaMenu ul li{margin: 10px 0px;display: block; clear:both;}
|
||||
|
||||
div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;}
|
||||
div.notiziaAcceptance{text-align: center; background-color: #ffd677; padding: 20px; border: 1px solid grey; border-radius: 10px;margin-bottom:10px;}
|
||||
div.notiziaAcceptance > .buttons a{text-decoration:none; color:rgb(51, 102, 255); font-weight:bold; margin-right:5px; padding:5px; display:inline-block;}
|
||||
div.notiziaAcceptance > .buttons a.green:hover{background-color:#7EFF83;}
|
||||
div.notiziaAcceptance > .buttons a.red:hover{background-color:#FF8DA6;}
|
||||
|
||||
Reference in New Issue
Block a user