<td style=""><strong><small><center><?php echo lang('ALLSTATS_unit_free'); ?> </center></small></strong></td> <td style=""><strong><small><center><?php echo lang('ALLSTATS_unit_lock'); ?> </center></small></strong></td> <td style=""><strong><small><center><?php echo lang('ALLSTATS_unit_ok'); ?> </center></small></strong></td> </tr> <?php $unit_user = unit_of_user($_SESSION['helpdesk_user_id']); $ee = explode(",", $unit_user); foreach ($ee as $key => $value) { ?> <tr> <td style=""><small><?php echo get_unit_name_return4news($value); ?> </small></td> <td style=""><small><center><?php echo get_unit_stat_free($value); ?> </center></small></td>
<?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); $in_query2 = substr($in_query2, 0, -2);
<div class="col-sm-4 text-right" ><strong ><small><?php echo lang('PROFILE_priv'); ?> :</small></strong></div> <div class="col-sm-8"><small><?php echo priv_status_name($usid); ?> </small></div> </div> <div class="form-group"> <div class="col-sm-4 text-right"><strong><small><?php echo lang('PROFILE_priv_unit'); ?> :</small></strong></div> <div class="col-sm-8"><p><small><?php echo view_array(get_unit_name_return(unit_of_user($_SESSION['helpdesk_user_id']))); ?> </small></p></div> <div class="col-sm-12"> <hr> </div> </div> <div class="form-group"> <label for="login" class="col-sm-4 control-label"><?php echo lang('P_login'); ?> </label> <div class="col-sm-8"> <input autocomplete="off" name="login" type="" class="form-control input-sm" id="login" placeholder="<?php echo lang('P_login'); ?>
if (strtotime($current_ticket_update) > strtotime($lu)) { echo $current_ticket_update; } if (strtotime($current_ticket_update) <= strtotime($lu)) { echo "no"; } //update $stmt = $dbConnection->prepare('update users set last_time=now() where id=:cid'); $stmt->execute(array(':cid' => $uid)); } if ($mode == "list_ticket_update") { $pm = $_POST['type']; $uid = $_SESSION['helpdesk_user_id']; $lu = $_POST['last_update']; $nlu = $_POST['new_last_update']; $unit_user = unit_of_user($uid); $priv_val = priv_status($uid); $units = explode(",", $unit_user); $units = implode("', '", $units); $ee = explode(",", $unit_user); foreach ($ee as $key => $value) { $in_query = $in_query . ' :val_' . $key . ', '; } $in_query = substr($in_query, 0, -2); foreach ($ee as $key => $value) { $vv[":val_" . $key] = $value; } if ($priv_val == "0") { $stmt = $dbConnection->prepare('SELECT id, hash_name, last_update from tickets where (unit_id IN (' . $in_query . ') or user_init_id=:uid) and last_update > :lu'); $paramss = array(':uid' => $uid, ':lu' => $lu); $stmt->execute(array_merge($vv, $paramss));
$text = get_unit_name_return(unit_of_user($_SESSION['helpdesk_user_id'])); } else { if ($priv_val == "2") { $text = $CONF['name_of_firm']; } } } } else { $_GET['in'] = '1'; $status_in = "active"; $priv_val = priv_status($_SESSION['helpdesk_user_id']); if ($priv_val == "0") { $text = get_unit_name_return(unit_of_user($_SESSION['helpdesk_user_id'])); } else { if ($priv_val == "1") { $text = get_unit_name_return(unit_of_user($_SESSION['helpdesk_user_id'])); } else { if ($priv_val == "2") { $text = $CONF['name_of_firm']; } } } } } } } $newt = get_total_tickets_free(); if ($newt != 0) { $newtickets = "(" . $newt . ")"; } if ($newt == 0) {
function get_total_pages($menu, $id) { global $dbConnection; $perpage = '10'; if ($menu == "dashboard") { $perpage = '10'; if (isset($_SESSION['hd.rustem_list_in'])) { $perpage = $_SESSION['hd.rustem_list_in']; } $unit_user = unit_of_user($id); $priv_val = priv_status($id); $units = explode(",", $unit_user); $units = implode("', '", $units); $ee = explode(",", $unit_user); foreach ($ee as $key => $value) { $in_query = $in_query . ' :val_' . $key . ', '; } $in_query = substr($in_query, 0, -2); foreach ($ee as $key => $value) { $vv[":val_" . $key] = $value; } if ($priv_val == "0") { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0'"); $res->execute($vv); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($priv_val == "1") { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0'))"); $paramss = array(':id' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($priv_val == "2") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0'"); $res->execute(); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } if ($menu == "in") { $perpage = '10'; if (isset($_SESSION['hd.rustem_list_in'])) { $perpage = $_SESSION['hd.rustem_list_in']; } $unit_user = unit_of_user($id); $priv_val = priv_status($id); $units = explode(",", $unit_user); $units = implode("', '", $units); $ee = explode(",", $unit_user); foreach ($ee as $key => $value) { $in_query = $in_query . ' :val_' . $key . ', '; } $in_query = substr($in_query, 0, -2); foreach ($ee as $key => $value) { $vv[":val_" . $key] = $value; } if ($priv_val == "0") { if (isset($_SESSION['hd.rustem_sort_in'])) { if ($_SESSION['hd.rustem_sort_in'] == "ok") { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0' and status=:s"); $paramss = array(':s' => '1'); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "free") { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0' and lock_by=:lb and status=:s"); $paramss = array(':lb' => '0', ':s' => '0'); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "ilock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0' and lock_by=:lb"); $paramss = array(':lb' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "lock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0' and (lock_by<>:lb and lock_by<>0) and (status=0)"); $paramss = array(':lb' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } } if (!isset($_SESSION['hd.rustem_sort_in'])) { $res = $dbConnection->prepare("SELECT count(*) from tickets where unit_id IN (" . $in_query . ") and arch='0'"); $res->execute($vv); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } else { if ($priv_val == "1") { if (isset($_SESSION['hd.rustem_sort_in'])) { if ($_SESSION['hd.rustem_sort_in'] == "ok") { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0')) and status=:s"); $paramss = array(':id' => $id, ':s' => '1'); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "free") { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0')) and lock_by=:lb and status=:s"); $paramss = array(':id' => $id, ':lb' => '0', ':s' => '0'); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "ilock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0')) and lock_by=:lb"); $paramss = array(':id' => $id, ':lb' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "lock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0')) and (lock_by<>:lb and lock_by<>0) and (status=0)"); $paramss = array(':id' => $id, ':lb' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } } if (!isset($_SESSION['hd.rustem_sort_in'])) { $res = $dbConnection->prepare("SELECT count(*) from tickets where ((user_to_id=:id and arch='0') or (user_to_id='0' and unit_id IN (" . $in_query . ") and arch='0'))"); $paramss = array(':id' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } else { if ($priv_val == "2") { if (isset($_SESSION['hd.rustem_sort_in'])) { if ($_SESSION['hd.rustem_sort_in'] == "ok") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0' and status=:s"); $res->execute(array(':s' => '1')); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "free") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0' and lock_by=:lb and status=:s"); $res->execute(array(':lb' => '0', ':s' => '0')); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "ilock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0' and lock_by=:lb"); $res->execute(array(':lb' => $id)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_in'] == "lock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0' and (lock_by<>:lb and lock_by<>0) and (status=0)"); $res->execute(array(':lb' => $id)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } } if (!isset($_SESSION['hd.rustem_sort_in'])) { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='0'"); $res->execute(); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } } if ($menu == "out") { $perpage = '10'; if (isset($_SESSION['hd.rustem_list_out'])) { $perpage = $_SESSION['hd.rustem_list_out']; } if (isset($_SESSION['hd.rustem_sort_out'])) { if ($_SESSION['hd.rustem_sort_out'] == "ok") { $res = $dbConnection->prepare("SELECT count(*) from tickets where user_init_id=:id and arch='0' and status=:s"); $res->execute(array(':id' => $id, ':s' => '1')); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_out'] == "free") { $res = $dbConnection->prepare("SELECT count(*) from tickets where user_init_id=:id and arch='0' and lock_by=:lb and status=:s"); $res->execute(array(':id' => $id, ':lb' => '0', ':s' => '0')); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_out'] == "ilock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where user_init_id=:id and arch='0' and lock_by=:lb"); $res->execute(array(':id' => $id, ':lb' => $id)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($_SESSION['hd.rustem_sort_out'] == "lock") { $res = $dbConnection->prepare("SELECT count(*) from tickets where user_init_id=:id and arch='0' and (lock_by<>:lb and lock_by<>0) and (status=0)"); $res->execute(array(':id' => $id, ':lb' => $id)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } } if (!isset($_SESSION['hd.rustem_sort_out'])) { $res = $dbConnection->prepare("SELECT count(*) from tickets where user_init_id=:id and arch='0'"); $res->execute(array(':id' => $id)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } if ($menu == "arch") { $perpage = '10'; if (isset($_SESSION['hd.rustem_list_arch'])) { $perpage = $_SESSION['hd.rustem_list_arch']; } $unit_user = unit_of_user($id); $priv_val = priv_status($id); $units = explode(",", $unit_user); $units = implode("', '", $units); $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); $in_query2 = substr($in_query2, 0, -2); foreach ($ee as $key => $value) { $vv[":val_" . $key] = $value; } foreach ($ee as $key => $value) { $vv2[":val_" . ($c + $key)] = $value; } if ($priv_val == "0") { $res = $dbConnection->prepare("SELECT count(*) from tickets where (unit_id IN (" . $in_query . ") or user_init_id=:id) and arch='1'"); $paramss = array(':id' => $id); $res->execute(array_merge($vv, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($priv_val == "1") { $res = $dbConnection->prepare("SELECT count(*) from tickets\n\t\t\t\t\t\t\twhere (user_to_id=:id and unit_id IN (" . $in_query . ") and arch='1') or\n\t\t\t\t\t\t\t(user_to_id='0' and unit_id IN (" . $in_query2 . ") and arch='1') or\n\t\t\t\t\t\t\t(user_init_id=:id2 and arch='1')"); $paramss = array(':id' => $id, ':id2' => $id); $res->execute(array_merge($vv, $vv2, $paramss)); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } else { if ($priv_val == "2") { $res = $dbConnection->prepare("SELECT count(*) from tickets where arch='1'"); $res->execute(); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } } } } if ($menu == "client") { $res = $dbConnection->prepare("SELECT count(*) from clients"); $res->execute(); $count = $res->fetch(PDO::FETCH_NUM); $count = $count[0]; } if ($count != 0) { $pages_count = ceil($count / $perpage); return $pages_count; } else { $pages_count = 0; return $pages_count; } return $count; }