Beispiel #1
0
function xhelp_default()
{
    global $xoopsModuleConfig, $oAdminButton;
    xoops_cp_header();
    echo $oAdminButton->renderButtons('index');
    $displayName =& $xoopsModuleConfig['xhelp_displayName'];
    // Determines if username or real name is displayed
    $stylePath = XHELP_BASE_URL . '/styles/xhelp.css';
    echo '<link rel="stylesheet" type="text/css" media="all" href="' . $stylePath . '" /><!--[if gte IE 5.5000]><script src="iepngfix.js" language="JavaScript" type="text/javascript"></script><![endif]-->';
    global $xoopsUser, $xoopsDB;
    $hTickets =& xhelpGetHandler('ticket');
    $hStatus =& xhelpGetHandler('status');
    $crit = new Criteria('', '');
    $crit->setSort('description');
    $crit->setOrder('ASC');
    $statuses =& $hStatus->getObjects($crit);
    $table_class = array('odd', 'even');
    echo "<table border='0' width='100%'>";
    echo "<tr><td width='50%' valign='top'>";
    echo "<div id='ticketInfo'>";
    echo "<table border='0' width='95%' cellspacing='1' class='outer'>\r\n          <tr><th colspan='2'>" . _AM_XHELP_TEXT_TICKET_INFO . "</th></tr>";
    $class = "odd";
    $totalTickets = 0;
    foreach ($statuses as $status) {
        $crit = new Criteria('status', $status->getVar('id'));
        $numTickets =& $hTickets->getCount($crit);
        $totalTickets += $numTickets;
        echo "<tr class='" . $class . "'><td>" . $status->getVar('description') . "</td><td>" . $numTickets . "</td></tr>";
        if ($class == "odd") {
            $class = "even";
        } else {
            $class = "odd";
        }
    }
    echo "<tr class='foot'><td>" . _AM_XHELP_TEXT_TOTAL_TICKETS . "</td><td>" . $totalTickets . "</td></tr>";
    echo "</table></div><br />";
    $hStaff =& xhelpGetHandler('staff');
    $hResponses =& xhelpGetHandler('responses');
    echo "</td><td valign='top'>";
    // Outer table
    echo "<div id='timeSpent'>";
    // Start inner top-left cell
    echo "<table border='0' width='100%' cellspacing='1' class='outer'>\r\n          <tr><th colspan='2'>" . _AM_XHELP_TEXT_RESPONSE_TIME . "</th></tr>";
    $sql = sprintf('SELECT u.uid, u.uname, u.name, (s.responseTime / s.ticketsResponded) as AvgResponseTime FROM %s u INNER JOIN %s s ON u.uid = s.uid WHERE ticketsResponded > 0 ORDER BY AvgResponseTime', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff'));
    $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME);
    $i = 0;
    while (list($uid, $uname, $name, $avgResponseTime) = $xoopsDB->fetchRow($ret)) {
        $class = $table_class[$i % 2];
        echo "<tr class='{$class}'><td>" . xhelpGetDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . xhelpFormatTime($avgResponseTime) . "</td></tr>";
        $i++;
    }
    echo "</table></div><br />";
    // End inner top-left cell
    echo "</td></tr><tr><td valign='top'>";
    // End first, start second cell
    //Get Calls Closed block
    $sql = sprintf('SELECT SUM(callsClosed) FROM %s', $xoopsDB->prefix('xhelp_staff'));
    $ret = $xoopsDB->query($sql);
    if (list($totalStaffClosed) = $xoopsDB->fetchRow($ret)) {
        if ($totalStaffClosed) {
            $sql = sprintf('SELECT u.uid, u.uname, u.name, s.callsClosed FROM %s u INNER JOIN %s s ON u.uid = s.uid WHERE s.callsClosed > 0 ORDER BY s.callsClosed DESC', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff'));
            $ret = $xoopsDB->query($sql, MAX_STAFF_CALLSCLOSED);
            echo "<div id='callsClosed'>";
            echo "<table border='0' width='95%' cellspacing='1' class='outer'>\r\n                  <tr><th colspan='2'>" . _AM_XHELP_TEXT_TOP_CLOSERS . "</th></tr>";
            $i = 0;
            while (list($uid, $uname, $name, $callsClosed) = $xoopsDB->fetchRow($ret)) {
                $class = $table_class[$i % 2];
                echo "<tr class='{$class}'><td>" . xhelpGetDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . $callsClosed . ' (' . round($callsClosed / $totalStaffClosed * 100, 2) . "%)</td></tr>";
                $i++;
            }
            echo "</table></div><br />";
            // End inner table top row
            echo "</td><td valign='top'>";
            // End top row of outer table
            $sql = sprintf('SELECT u.uid, u.uname, u.name, (s.responseTime / s.ticketsResponded) as AvgResponseTime FROM %s u INNER JOIN %s s ON u.uid = s.uid WHERE ticketsResponded > 0 ORDER BY AvgResponseTime DESC', $xoopsDB->prefix('users'), $xoopsDB->prefix('xhelp_staff'));
            $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME);
            echo "<div id='leastCallsClosed'>";
            echo "<table border='0' width='100%' cellspacing='1' class='outer'>\r\n                  <tr><th colspan='2'>" . _AM_XHELP_TEXT_RESPONSE_TIME_SLOW . "</th></tr>";
            $i = 0;
            while (list($uid, $uname, $name, $avgResponseTime) = $xoopsDB->fetchRow($ret)) {
                $class = $table_class[$i % 2];
                echo "<tr class='{$class}'><td>" . xhelpGetDisplayName($displayName, $name, $uname) . "</td><td align='right'>" . xhelpFormatTime($avgResponseTime) . "</td></tr>";
                $i++;
            }
            echo "</table></div>";
            // End first cell, second row of inner table
        }
    }
    echo "</td></tr></table><br />";
    // End second cell, second row of inner table
    $crit = new Criteria('state', '2', '<>', 's');
    $crit->setSort('priority');
    $crit->setOrder('ASC');
    $crit->setLimit(10);
    $highPriority =& $hTickets->getObjects($crit);
    $has_highPriority = count($highPriority) > 0;
    if ($has_highPriority) {
        echo "<div id='highPriority'>";
        echo "<table border='0' width='100%' cellspacing='1' class='outer'>\r\n              <tr><th colspan='8'>" . _AM_XHELP_TEXT_HIGH_PRIORITY . "</th></tr>";
        echo "<tr class='head'><td>" . _AM_XHELP_TEXT_PRIORITY . "</td><td>" . _AM_XHELP_TEXT_ELAPSED . "</td><td>" . _AM_XHELP_TEXT_STATUS . "</td><td>" . _AM_XHELP_TEXT_SUBJECT . "</td><td>" . _AM_XHELP_TEXT_DEPARTMENT . "</td><td>" . _AM_XHELP_TEXT_OWNER . "</td><td>" . _AM_XHELP_TEXT_LAST_UPDATED . "</td><td>" . _AM_XHELP_TEXT_LOGGED_BY . "</td></tr>";
        $i = 0;
        foreach ($highPriority as $ticket) {
            if ($ticket->isOverdue()) {
                $class = $table_class[$i % 2] . " overdue";
            } else {
                $class = $table_class[$i % 2];
            }
            $priority_url = "<img src='" . XHELP_IMAGE_URL . "/priority" . $ticket->getVar('priority') . ".png' alt='" . $ticket->getVar('priority') . "' />";
            $subject_url = sprintf("<a href='" . XHELP_BASE_URL . "/ticket.php?id=" . $ticket->getVar('id') . "' target='_BLANK'>%s</a>", $ticket->getVar('subject'));
            if ($dept = $ticket->getDepartment()) {
                $dept_url = sprintf("<a href='" . XHELP_BASE_URL . "/index.php?op=staffViewAll&amp;dept=" . $dept->getVar('id') . "' target='_BLANK'>%s</a>", $dept->getVar('department'));
            } else {
                $dept_url = _AM_XHELP_TEXT_NO_DEPT;
            }
            if ($ticket->getVar('ownership') != 0) {
                $owner_url = sprintf("<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $ticket->getVar('uid') . "' target='_BLANK'>%s</a>", xhelpGetUsername($ticket->getVar('ownership'), $displayName));
            } else {
                $owner_url = _AM_XHELP_TEXT_NO_OWNER;
            }
            $user_url = sprintf("<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $ticket->getVar('uid') . "' target='_BLANK'>%s</a>", xhelpGetUsername($ticket->getVar('uid'), $displayName));
            echo "<tr class='{$class}'><td>" . $priority_url . "</td>\r\n                         <td>" . $ticket->elapsed() . "</td>\r\n                         <td>" . xhelpGetStatus($ticket->getVar('status')) . "</td>\r\n                         <td>" . $subject_url . "</td>\r\n                         <td>" . $dept_url . "</td>\r\n                         <td>" . $owner_url . " </td>\r\n                         <td>" . $ticket->lastUpdated() . "</td>\r\n                         <td>" . $user_url . "</td>\r\n                     </tr>";
            $i++;
        }
        echo "</table></div>";
    }
    pathConfiguration();
    xhelpAdminFooter();
    xoops_cp_footer();
}
Beispiel #2
0
     $xoopsTpl->assign('xhelp_responseTpl', 0);
 }
 $xoopsTpl->assign('xhelp_hasResponseTpl', isset($aResponseTpl) ? count($aResponseTpl) > 0 : 0);
 if (!empty($responseTplID)) {
     $xoopsTpl->assign('xhelp_displayTpl_id', $displayTpl->getVar('id'));
     $xoopsTpl->assign('xhelp_displayTpl_name', $displayTpl->getVar('name'));
     $xoopsTpl->assign('xhelp_displayTpl_response', $displayTpl->getVar('response', 'e'));
 } else {
     $xoopsTpl->assign('xhelp_displayTpl_id', 0);
     $xoopsTpl->assign('xhelp_displayTpl_name', '');
     $xoopsTpl->assign('xhelp_displayTpl_response', '');
 }
 $xoopsTpl->assign('xoops_module_header', $module_header);
 $xoopsTpl->assign('xhelp_callsClosed', $staff->getVar('callsClosed'));
 $xoopsTpl->assign('xhelp_numReviews', $staff->getVar('numReviews'));
 $xoopsTpl->assign('xhelp_responseTime', xhelpFormatTime($staff->getVar('ticketsResponded') ? $staff->getVar('responseTime') / $staff->getVar('ticketsResponded') : 0));
 $notify_method = $xoopsUser->getVar('notify_method');
 $xoopsTpl->assign('xhelp_notify_method', $notify_method == 1 ? _XHELP_NOTIFY_METHOD1 : _XHELP_NOTIFY_METHOD2);
 if ($staff->getVar('rating') == 0 || $staff->getVar('numReviews') == 0) {
     $xoopsTpl->assign('xhelp_rating', 0);
 } else {
     $xoopsTpl->assign('xhelp_rating', intval($staff->getVar('rating') / $staff->getVar('numReviews')));
 }
 $xoopsTpl->assign('xhelp_uid', $xoopsUser->getVar('uid'));
 $xoopsTpl->assign('xhelp_rating0', _XHELP_RATING0);
 $xoopsTpl->assign('xhelp_rating1', _XHELP_RATING1);
 $xoopsTpl->assign('xhelp_rating2', _XHELP_RATING2);
 $xoopsTpl->assign('xhelp_rating3', _XHELP_RATING3);
 $xoopsTpl->assign('xhelp_rating4', _XHELP_RATING4);
 $xoopsTpl->assign('xhelp_rating5', _XHELP_RATING5);
 $xoopsTpl->assign('xhelp_staff_email', $staff->getVar('email'));