function ($data){ if (array_key_exists($data, NotiziaModel::$NOTIZIE_CATEGORY) ){ return NotiziaModel::$NOTIZIE_CATEGORY[$data]["label"]; } else { return "Sconosciuta"; } }, "titolo"=>function($data, $obj){ return $obj->cutTextHtmlSafe("titolo",80); // $rval = $data; // if (strlen($rval)>80){ // $rval = substr($rval, 0, 80)."..."; // } // return $rval; }, "sottotitolo"=>function($data, $obj){ return $obj->cutTextHtmlSafe("sottotitolo",80); // $rval = $data; // if (strlen($rval)>80){ // $rval = substr($rval, 0, 80)."..."; // } // return $rval; }, "about"=>array("data"=>null,"author"=>null), "id"=>null ); $filter = array("status"=>NotiziaModel::STATUS_ACCEPTED); $categoryPost = PostHandler::get("category"); if (!is_null($categoryPost) && array_key_exists($categoryPost, NotiziaModel::$NOTIZIE_CATEGORY)){ $filter["category"] = intval($categoryPost); } $ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields, $filter); if (property_exists($ret, "data") && sizeof($ret->data)>0){ foreach ($ret->data as $key=>$ele ){ $ret->data[$key]->sottotitolo = iconv('UTF-8', 'UTF-8//IGNORE', html_entity_decode($ret->data[$key]->sottotitolo)); $ret->data[$key]->titolo = iconv('UTF-8', 'UTF-8//IGNORE', html_entity_decode($ret->data[$key]->titolo)); } } echo json_encode($ret); ?>