#196 More progress on permission templates

merge-requests/2/head
Mike Koch 9 years ago
parent e095534648
commit 723674fab1

@ -74,7 +74,16 @@ else {return false;}
<?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();
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `name` 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">
@ -87,27 +96,29 @@ else {return false;}
<th><?php echo $hesklang['actions']; ?></th>
</thead>
<tbody>
<?php while ($row = hesk_dbFetchAssoc($res)): ?>
<?php foreach ($templates as $row): ?>
<tr>
<td><?php echo $row['name']; ?></td>
<td><?php echo getNumberOfUsersWithPermissionGroup($row['id']); ?></td>
<td>
<i class="fa fa-search icon-link" data-toggle="tooltip"
title="<?php echo $hesklang['view_permissions_for_this_template'] ?>"></i>
<i class="fa fa-pencil icon-link orange" data-toggle="tooltip"
title="<?php echo $hesklang['edit']; ?>"></i>
<a href="#" data-toggle="modal" data-target="#modal-template-<?php echo $row['id'] ?>">
<i class="fa fa-pencil icon-link" data-toggle="tooltip"
title="<?php echo $hesklang['view_permissions_for_this_template'] ?>"></i></a>
<i class="fa fa-times icon-link red" data-toggle="tooltip"
title="<?php echo $hesklang['delete']; ?>"></i>
</td>
</tr>
<?php endwhile; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php
foreach ($templates as $template) {
createModal($template, $featureArray, $categories);
}
require_once(HESK_PATH . 'inc/footer.inc.php');
exit();
@ -119,4 +130,44 @@ function getNumberOfUsersWithPermissionGroup($templateId) {
$res = hesk_dbQuery("SELECT 1 FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `permission_template` = ".intval($templateId));
return hesk_dbNumRows($res);
}
function createModal($template, $features, $categories) {
global $hesklang;
?>
<div class="modal fade" id="modal-template-<?php echo $template['id'] ?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><?php echo sprintf($hesklang['permissions_for_template'], $template['name']); ?></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 col-sm-12">
<h4><?php echo $hesklang['menu_cat']; ?></h4>
<div class="footerWithBorder blankSpace"></div>
<?php foreach ($categories as $category): ?>
<p><?php echo $category['name']; ?></p>
<?php endforeach; ?>
</div>
<div class="col-md-6 col-sm-12">
<h4><?php echo $hesklang['allow_feat']; ?></h4>
<div class="footerWithBorder blankSpace"></div>
<?php foreach ($features as $feature): ?>
<p><?php echo $feature; ?></p>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-primary"><?php echo $hesklang['save_changes']; ?></button>
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $hesklang['close_modal']; ?></button>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>

@ -73,7 +73,9 @@ $hesklang['no_manager'] = 'No manager';
$hesklang['manage_permission_templates'] = 'Manage Permission Templates';
$hesklang['number_of_users'] = 'Number of Users';
$hesklang['actions'] = 'Actions';
$hesklang['view_permissions_for_this_template'] = 'View permissions for this template';
$hesklang['view_permissions_for_this_template'] = 'View/edit permissions for this template';
$hesklang['permission'] = 'Permission';
$hesklang['permissions_for_template'] = 'Permissions for template <code>%s</code>'; // %s template name
// ADDED OR MODIFIED IN Mods for HESK 2.2.1
$hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)

Loading…
Cancel
Save