Merge branch '874-Añadir-posibilidad-de-ver-todos-los-eventos' into 'develop'

add checkbox for show all events in view agent detail

See merge request !585
This commit is contained in:
vgilc 2017-06-19 09:09:24 +02:00
commit 2e72025bbf
3 changed files with 36 additions and 5 deletions

View File

@ -503,15 +503,27 @@ if ($table_events) {
require_once ("include/functions_graph.php");
$id_agente = (int)get_parameter('id_agente', 0);
$all_events_24h = (int)get_parameter('all_events_24h', 0);
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
$groups = users_get_groups($config["id_user"]);
$tags_condition = tags_get_acl_tags($config['id_user'],
array_keys($groups), 'ER', 'event_condition', 'AND');
echo '<div id="div_all_events_24h">';
echo '<label><b>' . __('Show all Events 24h') . '</b></label>';
echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true);
echo '</div>';
$date_subtract_day = time() - (24 * 60 * 60);
if($all_events_24h){
events_print_event_table ("utimestamp > $date_subtract_day", 10, '100%',
false, $id_agente,true);
}
else{
events_print_event_table ("estado <> 1 $tags_condition", 10, '100%',
false, $id_agente,true);
}
}
if ($get_list_events_agents) {

View File

@ -4152,3 +4152,8 @@ div#footer_help{
.ui-dialog-titlebar .ui-icon-closethick {
margin-top: -5px !important;
}
/*view-agents lastest events for this agent*/
#div_all_events_24h{
padding: 4px;
}

View File

@ -35,11 +35,15 @@ ui_toggle(
?>
<script type="text/javascript">
$(document).ready(function() {
var parameters = {};
events_table(0);
});
function events_table(all_events_24h){
var parameters = {};
parameters["table_events"] = 1;
parameters["id_agente"] = <?php echo $id_agente; ?>;
parameters["page"] = "include/ajax/events";
parameters["all_events_24h"] = all_events_24h;
jQuery.ajax ({
data: parameters,
@ -49,7 +53,17 @@ ui_toggle(
success: function (data) {
$("#event_list").empty();
$("#event_list").html(data);
$('#checkbox-all_events_24h').on('change',function(){
if( $('#checkbox-all_events_24h').is(":checked") ){
$('#checkbox-all_events_24h').val(1);
}
else{
$('#checkbox-all_events_24h').val(0);
}
all_events_24h = $('#checkbox-all_events_24h').val();
events_table(all_events_24h);
});
}
});
});
}
</script>