function widget_supporttickets_overview($vars) { global $chart; $title = "Support Tickets Overview"; $activestatuses = $replystatuses = array(); $result = select_query("tblticketstatuses", "title,showactive,showawaiting", "showactive=1"); while ($data = mysql_fetch_array($result)) { if ($data['showactive']) { $activestatuses[] = $data['title']; } if ($data['showawaiting']) { $replystatuses[] = $data['title']; } } $ticketcount = 0; $awaitingReplyByDept = array(); if (count($replystatuses) > 0) { $query = "SELECT name,(SELECT COUNT(*) FROM tbltickets WHERE tbltickets.did=tblticketdepartments.id AND tbltickets.status IN (" . db_build_in_array($replystatuses) . ")) FROM tblticketdepartments ORDER BY `order` ASC"; $result = full_query($query); while ($data = mysql_fetch_array($result)) { $awaitingReplyByDept[] = array('c' => array(array('v' => addcslashes(Sanitize::decode($data[0]), '"')), array('v' => $data[1], 'f' => $data[1]))); $ticketcount += $data[1]; } } $awaitingReplyByStatus = array(); $query = "SELECT tblticketstatuses.title,(SELECT COUNT(*) FROM tbltickets WHERE tbltickets.status=tblticketstatuses.title) FROM tblticketstatuses WHERE showawaiting=1 ORDER BY sortorder ASC"; $result = full_query($query); while ($data = mysql_fetch_array($result)) { $awaitingReplyByStatus[] = array('c' => array(array('v' => addcslashes(Sanitize::decode($data[0]), '"')), array('v' => $data[1], 'f' => $data[1]))); $ticketcount += $data[1]; } if (!$ticketcount) { $content = <<<EOT <br /> <div align="center"> There are <strong>0</strong> Tickets Currently Awaiting a Reply </div> <br /> EOT; } else { // Awaiting Reply by Department $chartData = array('cols' => array(array('label' => 'Department', 'type' => 'string'), array('label' => 'Ticket Count', 'type' => 'number')), 'rows' => $awaitingReplyByDept); $content = '<div id="ticketOverviewDepartments">' . $chart->drawChart('Pie', $chartData, array('title' => 'Awaiting Reply by Department', 'legendpos' => 'right'), '250px') . '</div>'; // Awaiting Reply by Status $chartData = array('cols' => array(array('label' => 'Status', 'type' => 'string'), array('label' => 'Ticket Count', 'type' => 'number')), 'rows' => $awaitingReplyByStatus); $content .= '<div id="ticketOverviewStatuses">' . $chart->drawChart('Pie', $chartData, array('title' => 'Awaiting Reply by Status', 'legendpos' => 'right'), '250px') . '</div>'; } return array('title' => $title, 'content' => $content); }
$reportdata["headertext"] = $reportHeader; $reportdata["tableheadings"] = array($aInt->lang('fields', 'client'), $aInt->lang('fields', 'domain'), $aInt->lang('fields', 'dateSent'), $aInt->lang('domains', 'reminder'), $aInt->lang('emails', 'recipients'), $aInt->lang('domains', 'sent')); $typeMap = array(1 => $aInt->lang('domains', 'firstReminder'), 2 => $aInt->lang('domains', 'secondReminder'), 3 => $aInt->lang('domains', 'thirdReminder'), 4 => $aInt->lang('domains', 'fourthReminder'), 5 => $aInt->lang('domains', 'fifthReminder')); # Report Footer Text - this gets displayed below the report table of data $data["footertext"] = ""; $table = "tbldomainreminders"; $fields = "tbldomainreminders.id AS reminder_id,\n tbldomainreminders.date,\n tbldomainreminders.type,\n tbldomainreminders.days_before_expiry,\n tbldomainreminders.recipients,\n tblclients.firstname,\n tblclients.lastname,\n tblclients.companyname,\n tbldomains.domain\n"; $sort = "reminder_id"; $sortOrder = "DESC"; $join = "tbldomains ON (tbldomainreminders.domain_id = tbldomains.id) " . "JOIN tblclients ON (tbldomains.userid = tblclients.id)"; $where = array(); if ($userID) { $where['tblclients.id'] = (int) $userID; } if ($domain) { $where['tbldomains.domain'] = Sanitize::encode($domain); } if ($dateFrom && !$dateTo) { $where['date'] = array('sqltype' => '>=', 'value' => str_replace('-', '', $dateFrom)); } if ($dateTo && !$dateFrom) { $where['date'] = array('sqltype' => '<=', 'value' => str_replace('-', '', $dateTo)); } if ($registrar) { $where['tbldomains.registrar'] = $registrar; } $result = select_query($table, $fields, $where, $sort, $sortOrder, '', $join); while ($data = mysql_fetch_array($result)) { if ($dateFrom && $dateFrom != '' && ($dateTo && $dateTo != '')) { $from = new DateTime(str_replace('-', '', $dateFrom)); $to = new DateTime(str_replace('-', '', $dateTo));