90 lines
3.8 KiB
PHP
90 lines
3.8 KiB
PHP
<?php
|
|
|
|
use api\classes\API;
|
|
use bin\php\Classes\formBuilder;
|
|
use bin\php\Classes\pageNavbar;
|
|
|
|
if (!defined('APP_INIT')) {
|
|
exit;
|
|
}
|
|
# IDE Section
|
|
|
|
# Includes Section
|
|
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
|
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php';
|
|
|
|
# Check permissions
|
|
$API = new API();
|
|
if (!$API->checkPermissions('admin-access-control-user-groups', 'RW', true)) {
|
|
echo 'error 401 unauthorized';
|
|
exit;
|
|
}
|
|
|
|
# Page functions
|
|
|
|
# JS Scripts to load for this page
|
|
$jsScriptLoadData['form'][] = true;
|
|
$jsScriptLoadData['slugify'] = true;
|
|
$jsScriptLoadData['breadCrumbs'] = true;
|
|
|
|
# PageClasses Setup
|
|
$pageNavbar = new pageNavbar(true);
|
|
$formBuilder = new formBuilder('add_user_groups', '<i class="fas fa-plus"></i>', '/accesscontrol/#user-groups');
|
|
|
|
# Retrieve Information for the page
|
|
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM vc_user_groups ORDER BY user_group_weight ASC");
|
|
$user_groups = array();
|
|
while ($user_group = $user_groups_data->fetch_assoc()) {
|
|
array_push($user_groups, $user_group);
|
|
$last_weight = $user_group['user_group_weight'];
|
|
}
|
|
|
|
# Set breadcrumb data
|
|
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_groups'), 'href' => '/accesscontrol/#user-groups'));
|
|
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_user_groups'), 'href' => ''));
|
|
|
|
# Start page output
|
|
$pageNavbar->outPutNavbar();
|
|
$formBuilder->startForm();
|
|
?>
|
|
<form id="FormValidation" enctype="multipart/form-data" method="post" action="/api/v1/user-groups/">
|
|
<div class="card-body">
|
|
<div class="form-group form-show-validation row">
|
|
<label for="user_group_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_group_name') ?></label>
|
|
<div class="col-lg-9 col-md-12 col-sm-10">
|
|
<input type="text" class="form-control" id="user_group_name" name="user_group_name" placeholder="" data-slugify="user_group_slugify" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-show-validation row">
|
|
<label for="user_group_slugify" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_group_slugify') ?></label>
|
|
<div class="col-lg-9 col-md-12 col-sm-10">
|
|
<input type="text" class="form-control" id="user_group_slugify" name="user_group_slugify" placeholder="" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-show-validation row">
|
|
<label for="user_group_type" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_group_type') ?></label>
|
|
<div class="col-lg-9 col-md-12 col-sm-10">
|
|
<div class="select2-input">
|
|
<select id="user_group_type" name="user_group_type" class="form-control" required>
|
|
<option value="user" selected><?php echo __('users') ?></option>
|
|
<option value="admin"><?php echo __('administrators') ?></option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-show-validation row">
|
|
<label for="user_group_slugify" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('weight') ?></label>
|
|
<div class="col-lg-9 col-md-12 col-sm-10">
|
|
<div class="mb-3">
|
|
<input type="number" class="form-control" name="user_group_weight" min="1" max="900" step="1" value="<?php echo $last_weight + 10 ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php $formBuilder->formFooter(); ?>
|
|
</form>
|
|
<?php $formBuilder->endForm(); ?>
|