<?php
/**
 *
 * @category        admin
 * @package         access
 * @author          Ryan Djurovich, WebsiteBaker Project
 * @author          Werner v.d. Decken
 * @copyright       WebsiteBaker Org. e.V.
 * @link            http://websitebaker.org/
 * @license         http://www.gnu.org/licenses/gpl.html
 * @platform        WebsiteBaker 2.8.3
 * @requirements    PHP 5.3.6 and higher
 * @version         $Id: index.php 2 2017-07-02 15:14:29Z Manuela $
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/trunk/admin/access/index.php $
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
 *
 *
 */
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
if ( !class_exists('admin', false) ) { require(WB_PATH.'/framework/class.admin.php'); }

$admin = new admin('Access', 'access');

// Setup template object, parse vars to it, then parse it
// Create new template object
$template = new Template(dirname($admin->correct_theme_source('access.htt')));
// $template->debug = true;
$template->set_file('page', 'access.htt');

$template->set_block('page', 'main_block', 'main');

// Insert values into the template object
$template->set_var(array(
        'ADMIN_URL' => ADMIN_URL,
        'THEME_URL' => THEME_URL,
        'WB_URL' => WB_URL
    )
);

/**
 *    Insert permission values into the template object
 *    Deprecated - as we are using blocks.
 */
$display_none = 'style="display: none;"';
if($admin->get_permission('users') != true) { $template->set_var('DISPLAY_USERS', $display_none);}
if($admin->get_permission('groups') != true){ $template->set_var('DISPLAY_GROUPS', $display_none);}

$template->set_block('main_block', 'users_block', 'user');
// Insert section names and descriptions
$template->set_var(array(
        'USERS' => $MENU['USERS'],
        'USERS_OVERVIEW' => $OVERVIEW['USERS'],
        'ACCESS' => $MENU['ACCESS'],
    )
);
if ( $admin->get_permission('users') == true ){
$template->parse('main_block', "users_block", true);
} else {
    $template->set_block('users', '');
}

$template->set_block('main_block', 'groups_block', 'group');
$template->set_var(array(
        'GROUPS' => $MENU['GROUPS'],
        'ACCESS' => $MENU['ACCESS'],
        'GROUPS_OVERVIEW' => $OVERVIEW['GROUPS'],
    )
);
if ( $admin->get_permission('groups') == true ){
$template->parse('main_block', "groups_block", true);
} else {
    $template->set_block('groups', '');
}

// Parse template object
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');

// Print admin footer
$admin->print_footer();

?>