The question seemed interesting to me, I spent some time on it. Here you go
Save the following to a file \PH_scripts\count\tasks_count.php
<?php
$ph_count_tasks = 0;
$ph_staff_id = $thisstaff->getId();
$spojeni = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
$ost_tasks = mysqli_query($spojeni, "SELECT COUNT(`id`) AS count FROM ost_task WHERE ost_task.staff_id = $ph_staff_id AND closed IS NULL");
while ($zaznam_task = mysqli_fetch_array ($ost_tasks))
{
$ph_count_tasks = $zaznam_task["count"];
}
define('ph_count_tasks', $ph_count_tasks)
?>
Save_ the following to a file \PH_scripts\count\tickets_count.php
<?php
$ph_count_tickets = 0;
$ph_staff_id = $thisstaff->getId();
$spojeni = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
$ost_dept = mysqli_query($spojeni, "SELECT ost_staff.dept_id FROM ost_staff WHERE ost_staff.staff_id = $ph_staff_id");
while ($zaznam_ticket = mysqli_fetch_array ($ost_dept))
{
$ph_dept_id = $zaznam_ticket["dept_id"];
$ost_tcnt = mysqli_query($spojeni, "SELECT COUNT(`ticket_id`) AS count FROM `ost_ticket` WHERE `status_id` = 1 AND `dept_id` = $ph_dept_id");
while ($zaznam_tcnt = mysqli_fetch_array ($ost_tcnt)) {$ph_count_tickets = $ph_count_tickets + $zaznam_tcnt["count"];}
}
$ost_dept = mysqli_query($spojeni, "SELECT ost_staff_dept_access.dept_id FROM ost_staff_dept_access WHERE ost_staff_dept_access.staff_id = $ph_staff_id");
while ($zaznam_ticket = mysqli_fetch_array ($ost_dept))
{
$ph_dept_id = $zaznam_ticket["dept_id"];
$ost_tcnt = mysqli_query($spojeni, "SELECT COUNT(`ticket_id`) AS count FROM `ost_ticket` WHERE `status_id` = 1 AND `dept_id` = $ph_dept_id");
while ($zaznam_tcnt = mysqli_fetch_array ($ost_tcnt)) {$ph_count_tickets = $ph_count_tickets + $zaznam_tcnt["count"];}
}
define('ph_count_tickets', $ph_count_tickets)
?>
In the file \include\class.nav.php, put the following on line 17 and 18:
include (INCLUDE_DIR.'../PH_scripts/count/tickets_count.php');
include (INCLUDE_DIR.'../PH_scripts/count/tasks_count.php');
... and edit line 140 and 141 as follows:
$this->tabs['tasks'] = array('desc'=>__('Tasks')." (".ph_count_tasks.")", 'href'=>'tasks.php', 'title'=>__('Task Queue'));
$this->tabs['tickets'] = array('desc'=>__('Tickets')." (".ph_count_tickets.")",'href'=>'tickets.php','title'=>__('Ticket Queue'));
Optimization would be appropriate. Do it yourself.