Esempio n. 1
0
$table = new pSimpleTable("100%", 'grid');
$table->checkImage(false);
$table->addSimpleField(!isset($hdr['Name']) ? _('Nome') : $hdr['Name'], 'do_name', 'CALCULATED', null, array('visible' => true, 'sortable' => true, 'order_fields' => 'do_name, do_auth_type'));
$table->addSimpleField(!isset($hdr['Alias']) ? _('Alias') : $hdr['Alias'], 'do_alais', 'CALCULATED', null, array('visible' => true));
$table->addSimpleField(!isset($hdr['Applications']) ? _('Applicativi') : $hdr['Applications'], 'do_applications', 'CALCULATED', null, array('visible' => true));
$table->addSimpleField(!isset($hdr['action']) ? _('Azione') : $hdr['action'], '', 'LINK', 100);
$limit = max(10, $auth->getConfigValue('SETTINGS', 'ROW_COUNT', 10));
$pg = max(1, PageVar('pg', 1, isset($_REQUEST['reset'])));
$st = ($pg - 1) * $limit;
/** Get the users list */
$list = $auth->getDomainsList(array('fields' => 'dn_name as do_name, do_auth_type', 'order' => $table->getSQLOrder($order), 'offset' => $st, 'limit' => $limit), $tot);
$table_html = $table->CreateTableHeader($order);
foreach ($list as $value) {
    // Get the lockup data
    $data = $auth->getDomainData($value['do_name'], true);
    $table->addCalcValue('do_name', $data['names'][0]);
    /** The 1st element is the name, the others are alias) */
    // Alias
    $alias = array();
    for ($i = 1; $i < count($data['names']); $i++) {
        $alias[] = $data['names'][$i];
    }
    $s = implode(', ', $alias);
    $table->addCalcValue('do_alais', $s, $s);
    // Applications
    $apps = array();
    foreach ($data['applications'] as $val) {
        $apps[] = $val;
    }
    $s = implode(', ', $apps);
    $table->addCalcValue('do_applications', $s, $s);
Esempio n. 2
0
$table->checkImage(false);
$table->addSimpleField(!isset($hdr['CODE']) ? _('Codice') : $hdr['CODE'], 'app_name', 'STRING', 150, array('visible' => true, 'sortable' => true));
$table->addSimpleField(!isset($hdr['Name']) ? _('Nome') : $hdr['Name'], 'gr_name', 'STRING', 150, array('visible' => true, 'sortable' => true, 'sort_field' => 'app_name, gr_name'));
$table->addSimpleField(!isset($hdr['Privato']) ? _('Privato') : $hdr['Privato'], 'private', 'CALCULATED', 50, array('visible' => true, 'sortable' => true));
$table->addSimpleField(!isset($hdr['Description']) ? _('Descrizione') : $hdr['Description'], 'gr_descr', 'STRING', null, array('visible' => true, 'sortable' => true));
$table->addSimpleField(!isset($hdr['action']) ? _('Azione') : $hdr['action'], '', 'LINK', 100);
$limit = max(10, $auth->getConfigValue('SETTINGS', 'ROW_COUNT', 10));
$pg = max(1, PageVar('pg', 1, isset($_REQUEST['reset'])));
$st = ($pg - 1) * $limit;
//SS: Prende campi di altre tabelle
$sql2 = "SELECT user_manager.*, COUNT(ugt.gr_id) AS us_tot \n" . "FROM <SQL> \n" . "LEFT JOIN " . $auth_options['users_groups_table'] . " ugt ON user_manager.gr_id=ugt.gr_id \n" . "GROUP BY user_manager.gr_id, gr_name, gr_descr, do_id, app_code, app_name, dn_name  \n" . "ORDER BY " . $table->getSQLOrder();
/** Get the groups list */
$list = $auth->getGroupsList($fltapp_code, array('fields' => 'gr_id, gr_name, gr_descr, ' . $auth_options['groups_table'] . '.do_id, ' . 'app_code, app_name, dn_name', 'offset' => $st, 'limit' => $limit, 'sql' => $sql2), $tot);
$table_html = $table->CreateTableHeader($order);
foreach ($list as $value) {
    $table->addCalcValue('private', $value['do_id'] == '' ? '' : (!isset($hdr['Si']) ? _('Si') : $hdr['Si']));
    $links = array();
    $canMod = $auth->hasPerm('MOD', 'GROUP') || $auth->hasPerm('MOD', 'ALL_GROUP');
    $canDel = $auth->hasPerm('DEL', 'GROUP') || $auth->hasPerm('DEL', 'ALL_GROUP');
    $param = "code={$value['app_code']}&name={$value['gr_name']}&";
    $defAct = "groups_edit.php?act=show&{$param}";
    $links[] = $table->AddLinkCell(!isset($hdr['visualizza']) ? _('Visualizza') : $hdr['visualizza'], $defAct, '', R3_ICONS_URL . 'ico_view.gif');
    if ($canMod) {
        $defAct = "groups_edit.php?act=mod&{$param}";
        $links[] = $table->AddLinkCell(!isset($hnt['edit']) ? _('Modifica') : $hnt['edit'], $defAct, '', R3_ICONS_URL . 'ico_edit.gif');
    } else {
        $links[] = $table->AddLinkCell('', '', '', R3_ICONS_URL . 'ico_spacer.gif');
    }
    if ($canDel) {
        $links[] = $table->AddLinkCell(!isset($hnt['delete']) ? _('Cancella') : $hnt['delete'], "JavaScript:askDel('" . $value['app_code'] . "', '" . $value['gr_name'] . "')", '', R3_ICONS_URL . 'ico_del.gif');
    } else {