if (confirm('<?php 
echo hesk_makeJsString($hesklang['confirm_del_cat']);
?>
')) {return true;}
else {return false;}
}
//-->
</script>

<?php 
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` ORDER BY `name` ASC");
$templates = array();
while ($row = hesk_dbFetchAssoc($res)) {
    array_push($templates, $row);
}
$featureArray = hesk_getFeatureArray();
$orderBy = $modsForHesk_settings['category_order_column'];
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
$categories = array();
while ($row = hesk_dbFetchAssoc($res)) {
    array_push($categories, $row);
}
?>
<div class="row" style="margin-top: 20px">
    <div class="col-md-10 col-md-offset-1">
        <h3><?php 
echo $hesklang['manage_permission_templates'];
?>
 
			<i class="fa fa-question-circle settingsquestionmark" data-toggle="tooltip" data-placement="right" 
			title="<?php 
define('IN_SCRIPT', 1);
define('HESK_PATH', '../');
/* Get all the required files and functions */
require HESK_PATH . 'hesk_settings.inc.php';
require HESK_PATH . 'modsForHesk_settings.inc.php';
require HESK_PATH . 'inc/common.inc.php';
require HESK_PATH . 'inc/admin_functions.inc.php';
require HESK_PATH . 'inc/profile_functions.inc.php';
hesk_load_database_functions();
hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();
/* Check permissions for this feature */
hesk_checkPermission('can_man_users');
/* Possible user features */
$hesk_settings['features'] = hesk_getFeatureArray();
/* Set default values */
$default_userdata = array('name' => '', 'email' => '', 'cleanpass' => '', 'user' => '', 'autoassign' => 'Y', 'signature' => '', 'isadmin' => 1, 'active' => 1, 'categories' => array('1'), 'features' => array('can_view_tickets', 'can_reply_tickets', 'can_change_cat', 'can_assign_self', 'can_view_unassigned', 'can_view_online'), 'afterreply' => 0, 'autorefresh' => 0, 'autostart' => 1, 'notify_customer_new' => 1, 'notify_customer_reply' => 1, 'show_suggested' => 1, 'notify_new_unassigned' => 1, 'notify_new_my' => 1, 'notify_reply_unassigned' => 1, 'notify_reply_my' => 1, 'notify_assigned' => 1, 'notify_note' => 1, 'notify_pm' => 1, 'notify_note_unassigned' => 1);
/* A list of all categories */
$orderBy = $modsForHesk_settings['category_order_column'];
$hesk_settings['categories'] = array();
$res = hesk_dbQuery('SELECT `id`,`name` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` ORDER BY `' . $orderBy . '` ASC');
while ($row = hesk_dbFetchAssoc($res)) {
    if (hesk_okCategory($row['id'], 0)) {
        $hesk_settings['categories'][$row['id']] = $row['name'];
    }
}
/* Non-admin users may not create users with more permissions than they have */
if (!$_SESSION['isadmin']) {
    /* Can't create admin users */
    if (isset($_POST['isadmin'])) {