Merge branch 'master' of ssh://gitolite@asdynamics.com:50005/projects/fdn2.git
This commit is contained in:
@@ -7,7 +7,7 @@ Creation Date: 14/gen/2016
|
||||
class DatatablesHelper {
|
||||
private static $instCount = 0;
|
||||
|
||||
public static function getResult($useModel,$permissionFlagRequired, array $exposedModel){
|
||||
public static function getResult($useModel, $permissionFlagRequired, array $exposedModel, array $dataFilter = array()){
|
||||
$ret = new stdClass();
|
||||
$ret->draw = $_POST["draw"];
|
||||
$ret->recordsTotal = 0;
|
||||
@@ -18,7 +18,7 @@ class DatatablesHelper {
|
||||
$admin = AdminLoginManager::getLogged();
|
||||
if ($admin->hasRole($permissionFlagRequired)){
|
||||
$dao = GlobalVariables::get("dao");
|
||||
$filter = array();
|
||||
$filter = $dataFilter;
|
||||
|
||||
$options = array('limit'=>$_POST["length"], 'skip'=>$_POST["start"]);
|
||||
if (sizeof($_POST["order"])>0){
|
||||
@@ -64,7 +64,7 @@ class DatatablesHelper {
|
||||
$toolbarClass = "toolbar_".self::$instCount++;
|
||||
|
||||
$buttonDiv = "";
|
||||
$buttonJS = "";
|
||||
$buttonJs = "";
|
||||
$useButtons = false;
|
||||
if (array_key_exists("buttons",$htmlOpts) && is_array($htmlOpts["buttons"]) && sizeof($htmlOpts["buttons"])>0){
|
||||
$useButtons = true;
|
||||
@@ -100,7 +100,7 @@ class DatatablesHelper {
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var dTab = $("#<?php echo $tabId;?>").DataTable({
|
||||
<?php echo ($useButtons)?'"dom":"<\''.$toolbarClass.'\'>frtip",'."\n":"";?>
|
||||
<?php echo ($useButtons)?'"dom":"<\'toolbar '.$toolbarClass.'\' f>rtip",'."\n":"";?>
|
||||
"language": {"url": "<?php echo GUIHandler::getJavascriptsUrl();?>datatables.ita.lang"},
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
@@ -110,10 +110,11 @@ class DatatablesHelper {
|
||||
},
|
||||
"columns": [ <?php echo implode(",", $jsCols);?> ],
|
||||
"initComplete": function () {
|
||||
$("div.<?php echo $toolbarClass;?>").html('<?php echo $buttonDiv;?>');
|
||||
$("div.<?php echo $toolbarClass;?>").prepend('<?php echo $buttonDiv;?>');
|
||||
<?php echo $buttonJs;?>
|
||||
},
|
||||
"columnDefs": [
|
||||
{"className":"lastVisible","targets":[<?php echo sizeof($columns)-2;?>]},
|
||||
{"className":"hidden","targets":[<?php echo sizeof($columns)-1;?>]}
|
||||
]
|
||||
});
|
||||
@@ -126,6 +127,7 @@ class DatatablesHelper {
|
||||
$(this).addClass('selected');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,15 +7,42 @@ Creation Date: 13/gen/2016
|
||||
class MenuGenerator {
|
||||
|
||||
private static $voices = array(
|
||||
array("label"=>"superAdmin","page"=>"superAdmin.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Amministra Utenti","page"=>"roleAdmin.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
|
||||
array("label"=>"users","page"=>"users.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
|
||||
array("label"=>"notizie","page"=>"notizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR),
|
||||
array("label"=>"myNotizie","page"=>"myNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE),
|
||||
array("label"=>"banner","page"=>"banner.php","requires"=>AdminModel::ADMIN_TYPE_BANNER),
|
||||
array("label"=>"commenti","page"=>"commenti.php","requires"=>AdminModel::ADMIN_TYPE_COMMENTI_SUPERVISOR),
|
||||
array("label"=>"statistiche","page"=>"statistiche.php","requires"=>AdminModel::ADMIN_TYPE_STATISTICHE_SUPERVISOR),
|
||||
array("label"=>"newsletter","page"=>"newsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER)
|
||||
array("label"=>"Notizie", "subvoices"=>array(
|
||||
array("label"=>"Nuova","page"=>"editNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE),
|
||||
array("label"=>"Tutte","page"=>"listNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR),
|
||||
array("label"=>"Mie Notizie","page"=>"myNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE),
|
||||
array("label"=>"Da accettare","page"=>"unacceptedNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR),
|
||||
array("label"=>"Respinte","page"=>"rejectedNotizie.php","requires"=>AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR)
|
||||
)),
|
||||
array("label"=>"Giornalisti","page"=>"listGiornalisti.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
|
||||
array("label"=>"Commenti","page"=>"unacceptedCommenti.php","requires"=>AdminModel::ADMIN_TYPE_COMMENTI_SUPERVISOR),
|
||||
|
||||
|
||||
array("label"=>"Banner", "subvoices"=>array(
|
||||
array("label"=>"Nuovo","page"=>"editBanner.php","requires"=>AdminModel::ADMIN_TYPE_BANNER),
|
||||
array("label"=>"Lista","page"=>"listBanner.php","requires"=>AdminModel::ADMIN_TYPE_BANNER)
|
||||
)),
|
||||
|
||||
array("label"=>"Utenti registrati","page"=>"listUsers.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
|
||||
array("label"=>"Newsletter", "subvoices"=>array(
|
||||
array("label"=>"Nuova","page"=>"editNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
array("label"=>"Da inviare","page"=>"pendingNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
array("label"=>"Inviate","page"=>"sentNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER)
|
||||
)),
|
||||
array("label"=>"Statistiche", "subvoices"=>array(
|
||||
array("label"=>"Sito","page"=>"statSito.php","requires"=>AdminModel::ADMIN_TYPE_STATISTICHE_SUPERVISOR),
|
||||
array("label"=>"Banner","page"=>"statBanner.php","requires"=>AdminModel::ADMIN_TYPE_BANNER_SUPERVISOR)
|
||||
)),
|
||||
|
||||
array("label"=>"Superuser", "subvoices"=>array(
|
||||
array("label"=>"Amministratori","page"=>"listAmministratori.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Accessi","page"=>"listAccess.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Task","page"=>"listTasks.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Config","page"=>"listConfig.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Logs","page"=>"logs.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN)
|
||||
)),
|
||||
|
||||
array("label"=>"Logout","page"=>"logout.php")
|
||||
);
|
||||
|
||||
public static function getVoices(){
|
||||
@@ -30,14 +57,64 @@ class MenuGenerator {
|
||||
}
|
||||
|
||||
public static function generateMenu(){
|
||||
$voices = self::getVoices();
|
||||
if (sizeof($voices)>0){
|
||||
echo "<div id=\"admin_menu\"><ul>";
|
||||
foreach ($voices as $voice){
|
||||
echo '<li><a href="'.$voice["page"].'">'.$voice["label"].'</a></li>';
|
||||
$admin = AdminLoginManager::getLogged();
|
||||
$menuText = "";
|
||||
foreach (self::$voices as $voice){
|
||||
$submenuText = "";
|
||||
if (array_key_exists("subvoices", $voice)){
|
||||
foreach ($voice["subvoices"] as $subvoice){
|
||||
if ($admin->hasRole($subvoice["requires"])){
|
||||
$submenuText.='<li><a href="'.$subvoice["page"].'">'.$subvoice["label"].'</a></li>';
|
||||
}
|
||||
}
|
||||
if (strcmp("", $submenuText)!=0){
|
||||
$menuText.='<li><a href="#">'.$voice["label"].'</a><ul>'.$submenuText.'</ul></li>';
|
||||
}
|
||||
}
|
||||
echo "</ul></div>";
|
||||
else if (array_key_exists("requires", $voice)){
|
||||
if ( $admin->hasRole($voice["requires"]) ){
|
||||
$menuText.='<li><a href="'.$voice["page"].'">'.$voice["label"].'</a></li>';
|
||||
}
|
||||
}
|
||||
else if (array_key_exists("label", $voice) && array_key_exists("page", $voice) ) {
|
||||
$menuText.='<li><a href="'.$voice["page"].'">'.$voice["label"].'</a></li>';
|
||||
}
|
||||
|
||||
}
|
||||
if (strcmp("",$menuText)!=0){
|
||||
echo "<div id=\"admin_menu\"><ul>$menuText</ul></div>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$("#admin_menu > ul > li").click(function (){
|
||||
$("#admin_menu > ul > li.selected").removeClass("selected");
|
||||
$(this).addClass("selected");
|
||||
|
||||
var useUl = $(this).find("ul");
|
||||
var curHeight = useUl.height();
|
||||
var desiredHeight = 0;
|
||||
if (curHeight == 0){
|
||||
useUl.css("height", "auto");
|
||||
desiredHeight = useUl.height();
|
||||
useUl.height(curHeight);
|
||||
}
|
||||
|
||||
useUl.animate({height:desiredHeight},200);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// $voices = self::getVoices();
|
||||
// if (sizeof($voices)>0){
|
||||
// echo "<div id=\"admin_menu\"><ul>";
|
||||
// foreach ($voices as $voice){
|
||||
// echo '<li><a href="'.$voice["page"].'">'.$voice["label"].'</a></li>';
|
||||
// }
|
||||
// echo "</ul></div>";
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ GUIHandler::addStylesheet(GUIHandler::STYLESHEET_ADMIN, "datatables.css");
|
||||
GUIHandler::addStylesheet(GUIHandler::STYLESHEET_ADMIN, "icons.css");
|
||||
|
||||
|
||||
GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_ADMIN, "jquery.js");
|
||||
GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_ADMIN, "jquery-1.12.0.min.js");
|
||||
|
||||
// GUIHandler::addJavascriptLib(GUIHandler::JAVASCRIPT_ADMIN, "jquery-ui-1.8.23.custom.min.js");
|
||||
|
||||
|
||||
@@ -13,4 +13,10 @@ if (!AdminLoginManager::isLogged()){
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
?>
|
||||
<div>
|
||||
Benvenuto!
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ GUIHandler::generateHtmlHeaders(array(),true);
|
||||
if (!AdminLoginManager::isLogged()){
|
||||
GUIHandler::redirect("admin/login.php");
|
||||
}
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_NORMALADMIN)){
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
@@ -19,15 +19,17 @@ MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
$columns = array(
|
||||
array("label"=>"Titolo","data"=>"titolo"),
|
||||
array("label"=>"Sottotitolo","data"=>"sottotitolo"),
|
||||
array("label"=>"Autore","data"=>"about.author"),
|
||||
array("label"=>"Data","data"=>"about.data")
|
||||
array("label"=>"Nome","data"=>"nome"),
|
||||
array("label"=>"Cognome","data"=>"cognome")
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-medium-blue icon-editmed","page"=>"editAdmin.php")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
DatatablesHelper::generateTable("notiziaTableBackend.php",$columns);
|
||||
$details = DatatablesHelper::generateTable("giornalistiTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -26,17 +26,12 @@ $columns = array(
|
||||
);
|
||||
|
||||
$buttons = array(
|
||||
array("icon"=>"icon-big-blue icon-edit","page"=>"editNotizia.php")
|
||||
array("icon"=>"icon-medium-blue icon-editmed","page"=>"editNotizie.php")
|
||||
);
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
$details = DatatablesHelper::generateTable("notiziaTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
$details = DatatablesHelper::generateTable("notizieTableBackend.php",$columns,array("buttons"=>$buttons));
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("div.<?php echo $details["toolbarClass"];?>").html('<b>Custom tool bar! Text/images etc.</b>');
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 18/gen/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../../load.php");
|
||||
|
||||
$useModel = "AdminModel";
|
||||
$permissionFlagRequired = AdminModel::ADMIN_TYPE_EDITORE_SUPERVISOR;
|
||||
$exposedFields = array(
|
||||
"nome"=>null,
|
||||
"cognome"=>null,
|
||||
"id"=>null
|
||||
);
|
||||
|
||||
$roleFlag = AdminModel::ADMIN_TYPE_EDITORE;
|
||||
|
||||
$ret = DatatablesHelper::getResult($useModel, $permissionFlagRequired, $exposedFields, array('$where'=>"obj.roles%($roleFlag*2) >= $roleFlag"));
|
||||
echo json_encode($ret);
|
||||
|
||||
|
||||
?>
|
||||
Vendored
+5
File diff suppressed because one or more lines are too long
+17
-5
@@ -4,9 +4,21 @@
|
||||
|
||||
#admin_menu{position:fixed; left:0; top:0; bottom:0; width:300px; background-color:#393939; display:inline-block;}
|
||||
|
||||
#admin_menu ul{list-style: none; width:100%; border:0; margin:0; padding:0;}
|
||||
#admin_menu ul{list-style: none; width:100%; border:0; margin:0; padding:0; display:block; overflow:hidden;}
|
||||
#admin_menu ul li{width:100%; height:50px; display:inline-block;}
|
||||
#admin_menu ul li a{width:100%; line-height:50px; display:inline-block; text-decoration:none; color:white; font-weight:bold;}
|
||||
#admin_menu ul li a:hover{background-color:#505050;}
|
||||
#admin_menu + .admin_head{margin-left:300px; }
|
||||
.admin_head + div{margin-left:300px; padding: 20px;}
|
||||
#admin_menu ul li.selected{background-color:#7E97D6; }
|
||||
#admin_menu ul li a{width:100%; line-height:50px; display:inline-block; text-decoration:none; color:white; font-weight:bold; padding-left:15px; }
|
||||
#admin_menu ul li a:hover{background-color:rgba(255,255,255,0.2);}
|
||||
#admin_menu ul ul li a{padding-left:25px; }
|
||||
#admin_menu ul ul{height:0px;}
|
||||
|
||||
.admin_head{margin-left:300px;}
|
||||
.admin_head + div{margin-left:300px; padding: 20px;}
|
||||
|
||||
|
||||
table.dataTable th{text-align:left; }
|
||||
table.dataTable tr .lastVisible{text-align:right; }
|
||||
table.dataTable tr.odd td{background-color:rgba(126, 151, 214, 0.3); }
|
||||
table.dataTable tr.even td{background-color:rgba(126, 151, 214, 0.4); }
|
||||
.dataTables_wrapper .toolbar{float:right;}
|
||||
.dataTables_wrapper .toolbar > *{vertical-align:middle;}
|
||||
@@ -294,7 +294,7 @@ table.dataTable td {
|
||||
float: left;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: right;
|
||||
display:inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
.dataTables_wrapper .dataTables_filter input {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
.icon-small-blue{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_blue.png");background-repeat:no-repeat;}
|
||||
.icon-small-grey{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_grey.png");background-repeat:no-repeat;}
|
||||
.icon-small-white{display:block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_white.png");background-repeat:no-repeat;}
|
||||
.icon-small-blue{display:inline-block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_blue.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-small-grey{display:inline-block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_grey.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-small-white{display:inline-block;width:27px;height:27px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_small_white.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
|
||||
.icon-medium-blue{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_blue.png");background-repeat:no-repeat;}
|
||||
.icon-medium-grey{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_grey.png");background-repeat:no-repeat;}
|
||||
.icon-medium-white{display:block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_white.png");background-repeat:no-repeat;}
|
||||
.icon-medium-blue{display:inline-block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_blue.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-medium-grey{display:inline-block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_grey.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-medium-white{display:inline-block;width:38px;height:38px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_medium_white.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
|
||||
.icon-big-blue{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_blue.png");background-repeat:no-repeat;}
|
||||
.icon-big-grey{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_grey.png");background-repeat:no-repeat;}
|
||||
.icon-big-white{display:block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_white.png");background-repeat:no-repeat;}
|
||||
.icon-big-blue{display:inline-block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_blue.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-big-grey{display:inline-block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_grey.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
.icon-big-white{display:inline-block;width:50px;height:50px;background-repeat:no-repeat;background-image:url("../images/sprite/sprite_big_white.png");background-repeat:no-repeat; cursor:pointer;}
|
||||
|
||||
/* BIG */
|
||||
.icon-view{background-position:0px 0px;}
|
||||
|
||||
Reference in New Issue
Block a user