mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Prima pagina per gruppo utenti
This commit is contained in:
parent
6239311578
commit
4d03890ce9
@ -243,5 +243,16 @@ switch (filter('op')) {
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
echo 'ok';
|
echo 'ok';
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'update':
|
||||||
|
|
||||||
|
$dbo->update('zz_groups',[
|
||||||
|
'id_module_start' => filter('id_module_start'),
|
||||||
|
],['id' => $id_record]);
|
||||||
|
|
||||||
|
ob_end_clean();
|
||||||
|
echo 'ok';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -110,5 +110,24 @@ switch ($resource) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'moduli_gruppo':
|
||||||
|
|
||||||
|
$query = "SELECT zz_modules.id, zz_modules.title AS descrizione FROM zz_modules LEFT JOIN zz_permissions ON zz_permissions.idmodule=zz_modules.id |where| ORDER BY descrizione";
|
||||||
|
|
||||||
|
$where[] = 'zz_modules.enabled=1';
|
||||||
|
|
||||||
|
if( isset($superselect['idgruppo']) && $superselect['idgruppo']!=1 ){
|
||||||
|
$where[] = 'zz_permissions.idgruppo='.prepare($superselect['idgruppo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($elements as $element) {
|
||||||
|
$filter[] = 'zz_modules.id='.prepare($element);
|
||||||
|
}
|
||||||
|
if (!empty($search)) {
|
||||||
|
$search_fields[] = 'descrizione LIKE '.prepare('%'.$search.'%');
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,13 @@ echo '
|
|||||||
]).'</h3>
|
]).'</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-body">';
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 pull-right">
|
||||||
|
{["type":"select", "label":"", "name":"id_module_start", "ajax-source":"moduli_gruppo", "select-options": '.json_encode(['idgruppo' => $record['id']]).', "placeholder":"'.tr('Modulo iniziale').'", "value":"'.$record['id_module_start'].'" ]}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>';
|
||||||
|
|
||||||
if (!empty($utenti)) {
|
if (!empty($utenti)) {
|
||||||
echo '
|
echo '
|
||||||
@ -231,10 +237,31 @@ function update_permissions(id, value){
|
|||||||
function(data){
|
function(data){
|
||||||
if(data == "ok") {
|
if(data == "ok") {
|
||||||
toastr["success"]("'.tr('Permessi aggiornati!').'");
|
toastr["success"]("'.tr('Permessi aggiornati!').'");
|
||||||
|
if( id==$("#id_module_start").val() && value=="-" ){
|
||||||
|
$("#id_module_start").selectReset();
|
||||||
|
update_user($("#id_module_start").val());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
swal("'.tr('Errore').'", "'.tr("Errore durante l'aggiornamento dei permessi!").'", "error");
|
swal("'.tr('Errore').'", "'.tr("Errore durante l'aggiornamento dei permessi!").'", "error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#id_module_start").change(function(){
|
||||||
|
update_user($(this).val());
|
||||||
|
});
|
||||||
|
|
||||||
|
function update_user(value){
|
||||||
|
$.get(
|
||||||
|
globals.rootdir + "/actions.php?id_module='.$id_module.'&id_record='.$id_record.'&op=update&id_module_start=" + value,
|
||||||
|
function(data){
|
||||||
|
if(data == "ok") {
|
||||||
|
toastr["success"]("'.tr('Prima pagina aggiornata!').'");
|
||||||
|
} else {
|
||||||
|
swal("'.tr('Errore').'", "'.tr("Errore durante l'aggiornamento delle informazioni!").'", "error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
15
src/Auth.php
15
src/Auth.php
@ -129,8 +129,11 @@ class Auth extends \Util\Singleton
|
|||||||
|
|
||||||
if (!empty($user['enabled'])) {
|
if (!empty($user['enabled'])) {
|
||||||
$this->identifyUser($user['id']);
|
$this->identifyUser($user['id']);
|
||||||
$module = $this->getFirstModule();
|
$gruppo = $database->fetchOne("SELECT zz_groups.* FROM zz_groups INNER JOIN zz_users ON zz_users.idgruppo=zz_groups.id");
|
||||||
|
|
||||||
|
$module = $gruppo['id_module_start'];
|
||||||
|
$module = $this->getFirstModule($module);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->isAuthenticated() &&
|
$this->isAuthenticated() &&
|
||||||
$this->password_check($password, $user['password'], $user['id']) &&
|
$this->password_check($password, $user['password'], $user['id']) &&
|
||||||
@ -247,7 +250,7 @@ class Auth extends \Util\Singleton
|
|||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getFirstModule()
|
public function getFirstModule($first = null)
|
||||||
{
|
{
|
||||||
if (empty($this->first_module)) {
|
if (empty($this->first_module)) {
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
@ -264,8 +267,10 @@ class Auth extends \Util\Singleton
|
|||||||
|
|
||||||
if (!empty($results)) {
|
if (!empty($results)) {
|
||||||
$module = null;
|
$module = null;
|
||||||
|
|
||||||
$first = setting('Prima pagina');
|
if( empty($first) ){
|
||||||
|
$first = setting('Prima pagina');
|
||||||
|
}
|
||||||
if (!in_array($first, array_column($results, 'id'))) {
|
if (!in_array($first, array_column($results, 'id'))) {
|
||||||
$module = $results[0]['id'];
|
$module = $results[0]['id'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,4 +32,7 @@ INSERT INTO `zz_group_module` (`idgruppo`, `idmodule`, `name`, `clause`, `positi
|
|||||||
|
|
||||||
-- Aggiornamento title e icona per Causali (Causali trasporto) e Causali movimenti
|
-- Aggiornamento title e icona per Causali (Causali trasporto) e Causali movimenti
|
||||||
UPDATE `zz_modules` SET `title` = 'Causali trasporto', `icon` = 'fa fa-truck' WHERE `zz_modules`.`name` = 'Causali';
|
UPDATE `zz_modules` SET `title` = 'Causali trasporto', `icon` = 'fa fa-truck' WHERE `zz_modules`.`name` = 'Causali';
|
||||||
UPDATE `zz_modules` SET `icon` = 'fa fa-exchange' WHERE `zz_modules`.`name` = 'Causali movimenti';
|
UPDATE `zz_modules` SET `icon` = 'fa fa-exchange' WHERE `zz_modules`.`name` = 'Causali movimenti';
|
||||||
|
|
||||||
|
-- Prima pagina per gruppo utenti
|
||||||
|
ALTER TABLE `zz_groups` ADD `id_module_start` INT NULL AFTER `editable`;
|
Loading…
x
Reference in New Issue
Block a user