<?php } } if ($_POST['menu'] == 'arch') { $page = $_POST['page']; $perpage = '10'; if (isset($_SESSION['hd.rustem_list_arch'])) { $perpage = $_SESSION['hd.rustem_list_arch']; } $start_pos = ($page - 1) * $perpage; $user_id = id_of_user($_SESSION['helpdesk_user_login']); $unit_user = unit_of_user($user_id); $units = explode(",", $unit_user); $units = implode("', '", $units); $priv_val = priv_status($user_id); $ee = explode(",", $unit_user); $s = 1; foreach ($ee as $key => $value) { $in_query = $in_query . ' :val_' . $key . ', '; $s++; } $c = $s - 1; foreach ($ee as $key => $value) { $in_query2 = $in_query2 . ' :val_' . ($c + $key) . ', '; } $in_query = substr($in_query, 0, -2);
function get_helper() { global $dbConnection; $user_id = id_of_user($_SESSION['helpdesk_user_login']); $unit_user = unit_of_user($user_id); $priv_val = priv_status($user_id); $units = explode(",", $unit_user); array_push($units, "0"); $stmt = $dbConnection->prepare('SELECT id, user_init_id, unit_to_id, dt, title, message, hashname from helper order by dt desc limit 5'); $stmt->execute(); $result = $stmt->fetchAll(); ?> <table class="table table-hover" style="margin-bottom: 0px;" id=""> <?php if (empty($result)) { ?> <div id="" class="well well-large well-transparent lead"> <center> <?php echo lang('MSG_no_records'); ?> </center> </div> <?php } else { if (!empty($result)) { foreach ($result as $row) { $unit2id = explode(",", $row['unit_to_id']); $diff = array_intersect($units, $unit2id); if ($priv_val == 1) { if ($diff) { $ac = "ok"; } if ($user_id == $row['user_init_id']) { $priv_h = "yes"; } } else { if ($priv_val == 0) { $ac = "ok"; if ($user_id == $row['user_init_id']) { $priv_h = "yes"; } } else { if ($priv_val == 2) { $ac = "ok"; $priv_h = "yes"; } } } if ($ac == "ok") { ?> <tr><td><small><i class="fa fa-file-text-o"></i> </small><a href="helper?h=<?php echo $row['hashname']; ?> "><small><?php echo cutstr_help2_ret($row['title']); ?> </small></a></td><td><small style="float:right;" class="text-muted">(<?php echo lang('DASHBOARD_author'); ?> : <?php echo nameshort(name_of_user_ret($row['user_init_id'])); ?> )</small></td></tr> <?php } } } } ?> </table> <?php }