array(),self::STYLESHEET_USER=>array(),self::STYLESHEET_ADMIN=>array());
private static $JAVASCRIPTS = array(self::JAVASCRIPT_GENERAL=>array(),self::JAVASCRIPT_USER=>array(),self::JAVASCRIPT_ADMIN=>array());
private static $onLoadEvents = array();
public static function generateHtmlHeaders(array $data = array(), $admin = false){
$conf = GlobalVariables::get("config");
$title = $conf->info->projectName;
if (array_key_exists("title", $data)){
$title = $data["title"];
}
$description = $conf->info->projectDescription;
if (array_key_exists("description", $data)){
$description = $data["description"];
}
$useAuthor = true;
$author = $conf->info->author;
if (array_key_exists("author", $data)){
if ($data["author"] === false){
$useAuthor = false;
$author = "";
}
else {
$author = $data["author"];
}
}
header("Content-type: text/html; charset=utf-8");
echo "\n";
echo "\n
\n";
echo "\n";
echo "$title\n";
echo "\n";
echo "\n";
if ($useAuthor){
echo "\n";
}
echo "\n";
echo ''."\n";
echo ''."\n";
echo ''."\n";
echo ''."\n";
if ($admin){
}
foreach (self::$STYLESHEETS[self::STYLESHEET_GENERAL] as $file){
echo ''."\n";
}
foreach (self::$JAVASCRIPTS[self::JAVASCRIPT_GENERAL] as $file){
echo ''."\n";
}
$othJs = $admin?self::JAVASCRIPT_ADMIN:self::JAVASCRIPT_USER;
foreach (self::$JAVASCRIPTS[$othJs] as $file){
echo ''."\n";
}
if (sizeof(self::$onLoadEvents)>0){
echo ''."\n";
}
if (array_key_exists("additionalHeaders", $data) && is_array($data["additionalHeaders"]) && sizeof($data["additionalHeaders"])>0){
echo implode("\n", $data["additionalHeaders"]);
}
if(!$admin){
echo "";
echo '';
}
}
public static function redirect($url){
// $tmp = new JavaScriptElement("var index = window.location.href.indexOf('#');window.location.href='".$url."'+(index == -1 ? '' : window.location.href.substr(index));");
// $tmp->render();
echo '';
die();
}
public static function pageReload(){
// $tmp = new JavaScriptElement("var index = window.location.href.indexOf('#');window.location.href='".$url."'+(index == -1 ? '' : window.location.href.substr(index));");
// $tmp->render();
echo '';
die();
}
public static function redirectPost($url,array $vals = array()){
// $tmp = new JavaScriptElement("var index = window.location.href.indexOf('#');window.location.href='".$url."'+(index == -1 ? '' : window.location.href.substr(index));");
// $tmp->render();
$valArr = array();
if (sizeof($vals)>0){
foreach ($vals as $key=>$val){
$valArr[] = '{"name":"'.$key.'","value":"'.$val.'"}';
}
}
$valString = '['.implode(",", $valArr).']';
echo '';
die();
}
public static function addStylesheet($group, $file){
if (array_key_exists($group, self::$STYLESHEETS)){
self::$STYLESHEETS[$group][] = $file;
}
else {
throw new CoreException("Invalid stylesheet group ($group) passed to GUIHandler::addStylesheet() for file '$file'");
}
}
public static function addJavascriptLib($group, $file){
if (array_key_exists($group, self::$JAVASCRIPTS)){
self::$JAVASCRIPTS[$group][] = $file;
}
else {
throw new CoreException("Invalid stylesheet group ($group) passed to GUIHandler::addJavascriptLib() for file '$file'");
}
}
// public static function generateLoadingOverlay(){
// echo 'Caricamento....
Attendere prego
.'/ajax-loader.gif)
';
// }
public static function getBaseUrl(){
$conf = GlobalVariables::get("config");
return $conf->pages->remoteLocationPath;
}
public static function getImagesUrl(){
return self::getBaseUrl()."images/";
}
public static function getStylesheetsUrl(){
return self::getBaseUrl()."style/";
}
public static function getJavascriptsUrl(){
return self::getBaseUrl()."js/";
}
public static function addOnLoadJsEvent($script){
self::$onLoadEvents[] = $script;
}
public static function generateHeadPublic($bannerCategory = BannerModel::GENERAL_CATEGORY){
$mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile',
'Maggio', 'Giugno', 'Luglio', 'Agosto',
'Settembre', 'Ottobre', 'Novembre','Dicembre');
$day = date("d");
ASDSessionHandler::setSessionValue("bannerActive",array());
?>
// window.fbAsyncInit = function() {
// FB.init({
// appId : '1707001356211512',
// xfbml : true,
// version : 'v2.6'
// });
// };
// (function(d, s, id){
// var js, fjs = d.getElementsByTagName(s)[0];
// if (d.getElementById(id)) {return;}
// js = d.createElement(s); js.id = id;
// js.src = "//connect.facebook.net/en_US/sdk.js";
// fjs.parentNode.insertBefore(js, fjs);
// }(document, 'script', 'facebook-jssdk'));
Questo sito utilizza cookie tecnici per offrirti una migliore esperienza di navigazione sul sito.
Navigando su questo sito accetti l'utilizzo dei cookie.
Chiudi
id;
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
}
public static function getTwitterShareFunction(NotiziaModel $notizia){
$url = self::getBaseUrl()."articolo.php?id=".$notizia->id;
return 'window.open("http://twitter.com/home?source=ifdn&status="+encodeURIComponent("'.$url.'"))';
}
public static function getGooglePlusShareFunction(NotiziaModel $notizia){
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
}
public static function getLinkedinShareFunction(NotiziaModel $notizia){
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
}
public static function generateRightBannerBlock($category = BannerModel::GENERAL_CATEGORY){
$stats = GlobalVariables::get("dao")->aggregate("StatisticModel",PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5));
$idArray = array_map(function ($ele){ return new MongoId($ele["_id"]["notizia"]);}, $stats);
$lastsNews = GlobalVariables::get("dao")->query("NotiziaModel",
array("status"=>NotiziaModel::STATUS_ACCEPTED,"_id"=>array('$in'=>$idArray)),
array("sort"=>array("about.data"=>-1))
);
if (sizeof($lastsNews)<5){
$missing = 5-sizeof($lastsNews);
$add = GlobalVariables::get("dao")->query("NotiziaModel",
array("status"=>NotiziaModel::STATUS_ACCEPTED,"_id"=>array('$nin'=>$idArray)),
array("sort"=>array("about.data"=>-1),"limit"=>$missing)
);
$lastsNews = array_merge($lastsNews,$add);
}
// $lastsNews = GlobalVariables::get("dao")->query("NotiziaModel",
// array("status"=>NotiziaModel::STATUS_ACCEPTED),
// array("sort"=>array("about.data"=>-1),"limit"=>5)
// );
if (sizeof($lastsNews)>0){
$lastsNews = array_map(function($ele){$ele->testo = strip_tags($ele->testo);$ele->sottotitolo = strip_tags($ele->sottotitolo); return $ele; }, $lastsNews);
}
$mesi = array(1=>'Gennaio', 'Febbraio', 'Marzo', 'Aprile',
'Maggio', 'Giugno', 'Luglio', 'Agosto',
'Settembre', 'Ottobre', 'Novembre','Dicembre');
?>
0){
$i=0;
foreach($lastsNews as $last){
$i++;
$data = $mesi[date("n",$last->about->data->sec)]." ".date("Y",$last->about->data->sec);
$string = (strlen($last->titolo) > 103) ? substr($last->titolo,0,100).'...' : $last->titolo;?>