//XOOPS_URL .'/uploads/' .(($responseOwner)?$responseOwner->getVar('user_avatar') : 'blank.gif')); $all_users[$response->getVar('uid')] = ''; } if (isset($review)) { unset($review); } $staff = array(); $_staff = $hStaff->getObjects(new Criteria('uid', "(" . implode(array_keys($all_users), ',') . ")", 'IN'), true); foreach ($_staff as $key => $_user) { $staff[$key] = $_user->getVar('attachSig'); } unset($_staff); $users = array(); $_users = $member_handler->getUsers(new Criteria('uid', "(" . implode(array_keys($all_users), ',') . ")", 'IN'), true); foreach ($_users as $key => $_user) { $users[$key] = array('uname' => xhelpGetUsername($_user, $xoopsModuleConfig['xhelp_displayName']), 'user_sig' => isset($staff[$key]) && $staff[$key] || !isset($staff[$key]) && $user->getVar('attachsig') ? $_user->getVar('user_sig') : '', 'user_avatar' => strlen($_user->getVar('user_avatar')) ? $_user->getVar('user_avatar') : 'blank.gif'); } unset($_users); unset($_user); unset($all_users); for ($i = 0; $i < count($aResponses); $i++) { $_response = $aResponses[$i]; $_uid = $_response['uid']; if (isset($users[$_uid])) { $aResponses[$i]['user_sig'] = $users[$_uid]['user_sig']; $aResponses[$i]['user_avatar'] = XOOPS_URL . '/uploads/' . $users[$_uid]['user_avatar']; $aResponses[$i]['uname'] = $users[$_uid]['uname']; } } unset($users); $has_responses = count($responses) > 0;
function editStaff() { global $_POST, $_GET, $xoopsModule, $xoopsUser, $oAdminButton, $displayName; require_once XHELP_CLASS_PATH . '/session.php'; $_xhelpSession = new Session(); if (isset($_REQUEST['uid'])) { $uid = $_REQUEST['uid']; } /* if(isset($_REQUEST['user'])){ // Remove me $uid = $_REQUEST['user']; } */ if (isset($_POST['clearRoles'])) { header("Location: " . XHELP_ADMIN_URL . "/staff.php?op=clearRoles"); exit; } $_xhelpSession->set("xhelp_return_op", "editStaff"); if (!isset($_POST['updateStaff'])) { //xoops_cp_header(); $member_handler =& xoops_gethandler('member'); // Get member handler $member =& $member_handler->getUser($uid); $hRoles =& xhelpGetHandler('role'); $crit = new Criteria('', ''); $crit->setOrder('ASC'); $crit->setSort('name'); $roles =& $hRoles->getObjects($crit, true); $hDepartments =& xhelpGetHandler('department'); // Get department handler $crit = new Criteria('', ''); $crit->setSort('department'); $crit->setOrder('ASC'); $total = $hDepartments->getCount($crit); $departmentInfo =& $hDepartments->getObjects($crit); $hStaff =& xhelpGetHandler('staff'); // Get staff handler $staff =& $hStaff->getByUid($uid); $hMembership =& xhelpGetHandler('membership'); $staffDepts = $hMembership->membershipByStaff($uid); $staffroles = $staff->getAllRoleRights(); $global_roles = isset($staffroles[0]['roles']) ? array_keys($staffroles[0]['roles']) : array(); //Get all Global Roles $xhelp_depts = array(); foreach ($staffDepts as $myDept) { $deptid = $myDept->getVar('id'); if ($deptid != 0) { $xhelp_depts[] = $deptid; } } $xhelp_depts = implode(',', $xhelp_depts); //$myRoles =& $hStaff->getRoles($staff->getVar('uid')); xoops_cp_header(); echo $oAdminButton->renderButtons('manStaff'); echo '<script type="text/javascript" src="' . XOOPS_URL . '/modules/xhelp/include/functions.js"></script>'; echo "<form name='frmEditStaff' method='post' action='staff.php?op=editStaff&uid=" . $uid . "'>"; echo "<table width='100%' border='0' cellspacing='1' class='outer'>\r\n <tr><th colspan='2'><label>" . _AM_XHELP_EDIT_STAFF . "</label></th></tr>"; echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_USER . "</td>\r\n <td class='even'>" . xhelpGetUsername($member, $displayName); echo "</td></tr>"; echo "<tr><td class='head'>" . _AM_XHELP_TEXT_ROLES . "</td>\r\n <td class='even'><table width='75%'>"; foreach ($roles as $role) { $roleid = $role->getVar('id'); if (in_array($roleid, $global_roles)) { echo "<tr><td><input type='checkbox' name='roles[]' checked='checked' value='" . $role->getVar('id') . "' onclick=\"xhelpRoleCustOnClick('frmEditStaff', 'roles[]', 'xhelp_role', '&', 'xhelp_dept_cust');\" /><a href='staff.php?op=editRole&id=" . $role->getVar('id') . "&uid=" . $uid . "'>" . $role->getVar('name') . "</a> - " . $role->getVar('description') . "</td></tr>"; } else { if ($mainRoles = $_xhelpSession->get("xhelp_mainRoles")) { if (in_array($roleid, $mainRoles)) { echo "<tr><td><input type='checkbox' name='roles[]' checked='checked' value='" . $role->getVar('id') . "' onclick=\"xhelpRoleCustOnClick('frmEditStaff', 'roles[]', 'xhelp_role', '&', 'xhelp_dept_cust');\" /><a href='staff.php?op=editRole&id=" . $role->getVar('id') . "&uid=" . $uid . "'>" . $role->getVar('name') . "</a> - " . $role->getVar('description') . "</td></tr>"; } else { echo "<tr><td><input type='checkbox' name='roles[]' value='" . $role->getVar('id') . "' onclick=\"xhelpRoleCustOnClick('frmEditStaff', 'roles[]', 'xhelp_role', '&', 'xhelp_dept_cust');\" /><a href='staff.php?op=editRole&id=" . $role->getVar('id') . "&uid=" . $uid . "'>" . $role->getVar('name') . "</a> - " . $role->getVar('description') . "</td></tr>"; } } else { echo "<tr><td><input type='checkbox' name='roles[]' value='" . $role->getVar('id') . "' onclick=\"xhelpRoleCustOnClick('frmEditStaff', 'roles[]', 'xhelp_role', '&', 'xhelp_dept_cust');\" /><a href='staff.php?op=editRole&id=" . $role->getVar('id') . "&uid=" . $uid . "'>" . $role->getVar('name') . "</a> - " . $role->getVar('description') . "</td></tr>"; } } } echo "<tr><td><input type='checkbox' name='checkallRoles' value='0' onclick='selectAll(this.form,\"roles[]\",this.checked); xhelpRoleCustOnClick(\"frmEditStaff\", \"roles[]\", \"xhelp_role\", \"&\", \"xhelp_dept_cust\");' /><b>" . _AM_XHELP_TEXT_SELECT_ALL . "</b></td></tr>"; echo "</table></td></tr>"; echo "<tr><td class='head'>" . _AM_XHELP_TEXT_DEPARTMENTS . "</td>\r\n <td class='even'><table width='75%'>"; // This block is used to append custom role names to each department foreach ($departmentInfo as $dept) { $deptid = $dept->getVar('id'); $deptname = $dept->getVar('department'); $inDept = false; //Is the user a member of the dept $deptroleids = ''; $deptrolenames = ''; if ($sess_roles = $_xhelpSession->get("xhelp_dept_{$deptid}")) { //Customized roles stored in session? if ($sess_roles['roles'] != -1) { //Is the user assigned to any roles in the dept? $inDept = true; foreach ($sess_roles['roles'] as $roleid) { // Check if customized roles match global roles if (in_array($roleid, $global_roles)) { // If found role in global roles $deptroleids[] = $roleid; // Add role to array of checked roles } } $deptroleids = implode(',', $sess_roles['roles']); // Put all roles into 1 string separated by a ',' //An empty string means dept roles match global roles if (strlen($deptroleids) > 0) { //Customized Roles $deptrolenames = implode(', ', $sess_roles['roleNames']); } } else { //Not a member of the dept $inDept = false; } } elseif (isset($staffroles[$deptid])) { //User has assigned dept roles $inDept = true; if ($staffroles[$deptid]['roles'] == $staffroles[0]['roles']) { // If global roles same as dept roles $deptrolenames = ''; $deptroleids = array(); foreach ($staffroles[$deptid]['roles'] as $roleid => $tasks) { if (isset($roles[$roleid])) { $deptroleids[] = $roleid; } } $deptroleids = implode(',', $deptroleids); } else { $deptrolenames = array(); $deptroleids = array(); foreach ($staffroles[$deptid]['roles'] as $roleid => $tasks) { if (isset($roles[$roleid])) { $deptroleids[] = $roleid; $deptrolenames[] = $roles[$roleid]->getVar('name'); } } $deptrolenames = implode(', ', $deptrolenames); $deptroleids = implode(',', $deptroleids); } } else { //Not a member of the dept $deptroleids = array(); foreach ($staffroles[0]['roles'] as $roleid => $tasks) { if (isset($roles[$roleid])) { $deptroleids[] = $roleid; } } $deptroleids = implode(',', $deptroleids); $deptrolenames = ''; $inDept = false; } //Should element be checked? $checked = $inDept ? "checked='checked'" : ''; printf("<tr><td><input type='checkbox' name='departments[]' value='%u' %s onclick=\"xhelpRoleCustOnClick('frmEditStaff', 'departments[]', 'xhelp_depts', '&', 'xhelp_dept_cust');\" />%s [<a href='staff.php?op=customDept&deptid=%u&uid=%u&xhelp_role=%s&xhelp_depts=%s' class='xhelp_dept_cust'>Customize</a>] <i>%s</i><input type='hidden' name='custrole[%u]' value='%s' /></td></tr>", $deptid, $checked, $deptname, $deptid, $uid, $deptroleids, $xhelp_depts, $deptrolenames, $deptid, $deptroleids); } echo "<tr><td>\r\n <input type='checkbox' name='checkAll' value='0' onclick='selectAll(this.form,\"departments[]\", this.checked);xhelpRoleCustOnClick(\"frmEditStaff\", \"departments[]\", \"xhelp_depts\", \"&\", \"xhelp_dept_cust\");' /><b>" . _AM_XHELP_TEXT_SELECT_ALL . "</b></td></tr>"; echo "<tr><td>"; echo "</td></tr>"; echo "</table>"; echo "</td></tr>"; echo "<tr><td colspan='2' class='foot'>\r\n <input type='hidden' name='uid' value='" . $uid . "' />\r\n <input type='submit' name='updateStaff' value='" . _AM_XHELP_BUTTON_UPDATESTAFF . "' />\r\n <input type='button' name='cancel' value='" . _AM_XHELP_BUTTON_CANCEL . "' onclick='history.go(-1)' class='formButton' />\r\n </td></tr>"; echo "</table></form>"; xhelpAdminFooter(); xoops_cp_footer(); } else { $uid = intval($_POST['uid']); $depts = $_POST['departments']; $roles = $_POST['roles']; $custroles = $_POST['custrole']; $hStaff =& xhelpGetHandler('staff'); $hMembership =& xhelpGetHandler('membership'); //Remove existing dept membership if (!$hMembership->clearStaffMembership($uid)) { $message = _XHELP_MESSAGE_EDITSTAFF_NOCLEAR_ERROR; redirect_header(XHELP_ADMIN_URL . '/staff.php?op=manageStaff', 3, $message); } //Add staff member to selected depts if ($hMembership->addDeptToStaff($depts, $uid)) { $message = _XHELP_MESSAGE_EDITSTAFF; } else { $message = _XHELP_MESSAGE_EDITSTAFF_ERROR; } //Clear Existing Staff Role Permissions $removedRoles = $hStaff->removeStaffRoles($uid); //Add Global Role Permissions foreach ($roles as $role) { $hStaff->addStaffRole($uid, $role, 0); } //Add Department Specific Roles foreach ($depts as $dept) { if (strlen($custroles[$dept]) > 0) { $dept_roles = explode(',', $custroles[$dept]); } else { $dept_roles = $roles; } foreach ($dept_roles as $role) { $hStaff->addStaffRole($uid, $role, $dept); } } $staff =& $hStaff->getByUid($uid); $staff->setVar('permTimestamp', time()); if (!$hStaff->insert($staff)) { $message = _XHELP_MESSAGE_EDITSTAFF; } redirect_header(XHELP_ADMIN_URL . '/staff.php?op=clearRoles', 3, $message); } //end if }
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&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(); }
/** * Event: batch_response * Triggered after a batch response addition * Note: the $response->getVar('ticketid') field is empty for this function * @param array $tickets The xhelpTicket objects that were modified * @param xhelpResponses $response The response added to each ticket */ function batch_response($tickets, $response) { global $xoopsUser, $xoopsConfig, $xoopsModuleConfig; $displayName =& $xoopsModuleConfig['xhelp_displayName']; // Determines if username or real name is displayed $responseText = $this->_ts->stripslashesGPC($response->getVar('message', 'n')); $uname = $xoopsUser->getVar('uname'); $uid = $xoopsUser->getVar('uid'); $updated = formatTimestamp(time(), 'm'); $private = $response->getVar('private'); $hMBoxes =& xhelpGetHandler('departmentMailBox'); $mBoxes =& $hMBoxes->getObjects(null, true); $hDepartments =& xhelpGetHandler('department'); $settings =& $this->_hNotification->get(XHELP_NOTIF_NEWRESPONSE); $staff_setting = $settings->getVar('staff_setting'); $user_setting = $settings->getVar('user_setting'); $staff_options = $settings->getVar('staff_options'); if ($staff_setting != XHELP_NOTIF_STAFF_NONE) { $dept_email_tpl = $this->_getEmailTpl('dept', 'new_response', $this->_module, $template_id); } else { $dept_email_tpl = false; } if ($user_setting != XHELP_NOTIF_USER_NO) { $user_email_tpl = $this->_getEmailTpl('ticket', 'new_this_response', $this->_module, $template_id); } else { $user_email_tpl = false; } foreach ($tickets as $ticket) { $bFromEmail = false; $tags = array(); $tags['TICKET_ID'] = $ticket->getVar('id'); $tags['TICKET_RESPONSE'] = $responseText; $tags['TICKET_SUBJECT'] = $ticket->getVar('subject'); $tags['TICKET_TIMESPENT'] = $response->getVar('timeSpent'); $tags['TICKET_STATUS'] = xhelpGetStatus($ticket->getVar('status')); $tags['TICKET_RESPONDER'] = $uname; $tags['TICKET_POSTED'] = $updated; $tags['TICKET_URL'] = XHELP_BASE_URL . '/ticket.php?id=' . $ticket->getVar('id'); $tags['TICKET_DEPARTMENT'] = $this->_ts->stripslashesGPC($hDepartments->getNameById($ticket->getVar('department'))); $owner = $ticket->getVar('ownership'); if ($owner == 0) { $tags['TICKET_OWNERSHIP'] = _XHELP_NO_OWNER; } else { $tags['TICKET_OWNERSHIP'] = xhelpGetUsername($owner, $displayName); } if ($ticket->getVar('serverid') > 0) { //Ticket was submitted via email $mBox =& $mBoxes[$ticket->getVar('serverid')]; if (is_object($mBox)) { $bFromEmail = true; } } if ($bFromEmail) { $from = $server->getVar('emailaddress'); $tags['TICKET_SUPPORT_EMAIL'] = $from; $tags['TICKET_SUPPORT_KEY'] = '{' . $ticket->getVar('emailHash') . '}'; } else { $from = ''; $tags['TICKET_SUPPORT_EMAIL'] = $xoopsConfig['adminmail']; $tags['TICKET_SUPPORT_KEY'] = ''; } $sendTo = array(); if ($ticket->getVar('uid') != $uid && $response->getVar('private') == 0) { // If response from staff member if ($private == 0) { if ($user_email_tpl) { $sendTo = $this->_getUserEmail($ticket->getVar('uid')); $success = $this->_sendEvents($user_email_tpl, $sendTo, $tags, $from); } } else { if ($dept_email_tpl) { if ($ticket->getVar('ownership') != 0) { $sendTo = $this->_getStaffEmail($owner, $ticket->getVar('department'), $staff_options); } else { $sendTo = $this->_getSubscribedStaff($ticket, $dept_email_tpl['bit_value'], $settings); } } } } else { // If response from submitter if ($dept_email_tpl) { if ($ticket->getVar('ownership') != 0) { // If ticket has owner, send to owner if ($this->_isSubscribed($owner, $email_tpl['bit_value'])) { // Check if the owner is subscribed $sendTo = $this->_getStaffEmail($owner, $ticket->getVar('department'), $staff_options); } } else { // If ticket has no owner, send to department $sendTo =& $this->_getSubscribedStaff($ticket, $dept_email_tpl['bit_value'], $settings); } $success = $this->_sendEvents($dept_email_tpl, $sendTo, $tags); } } } }
$xoopsTpl->assign('xhelp_deptNotifications', $deptNotification); } else { $xoopsTpl->assign('xhelp_deptNotifications', 0); } $hReview =& xhelpGetHandler('staffReview'); $hMembers =& xoops_gethandler('member'); $crit = new Criteria('staffid', $xoopsUser->getVar('uid')); $crit->setSort('id'); $crit->setOrder('DESC'); $crit->setLimit(5); $reviews =& $hReview->getObjects($crit); $displayName =& $xoopsModuleConfig['xhelp_displayName']; // Determines if username or real name is displayed foreach ($reviews as $review) { $reviewer = $hMembers->getUser($review->getVar('submittedBy')); $xoopsTpl->append('xhelp_reviews', array('rating' => $review->getVar('rating'), 'ratingdsc' => xhelpGetRating($review->getVar('rating')), 'submittedBy' => $reviewer ? xhelpGetUsername($reviewer, $displayName) : $xoopsConfig['anonymous'], 'submittedByUID' => $review->getVar('submittedBy'), 'responseid' => $review->getVar('responseid'), 'comments' => $review->getVar('comments'), 'ticketid' => $review->getVar('ticketid'))); } $xoopsTpl->assign('xhelp_hasReviews', count($reviews) > 0); // Ticket Lists $ticketLists =& $hTicketList->getListsByUser($xoopsUser->getVar('uid')); $aMySavedSearches = array(); $mySavedSearches = xhelpGetSavedSearches(array($xoopsUser->getVar('uid'), XHELP_GLOBAL_UID)); $has_savedSearches = count($aMySavedSearches > 0); $ticketListCount = count($ticketLists); $aTicketLists = array(); $aUsedSearches = array(); $eleNum = 0; foreach ($ticketLists as $ticketList) { $weight = $ticketList->getVar('weight'); $searchid = $ticketList->getVar('searchid'); $aTicketLists[$ticketList->getVar('id')] = array('id' => $ticketList->getVar('id'), 'uid' => $ticketList->getVar('uid'), 'searchid' => $searchid, 'weight' => $weight, 'name' => $mySavedSearches[$ticketList->getVar('searchid')]['name'], 'hasWeightUp' => $eleNum != $ticketListCount - 1 ? true : false, 'hasWeightDown' => $eleNum != 0 ? true : false, 'hasEdit' => $mySavedSearches[$ticketList->getVar('searchid')]['uid'] != -999 ? true : false);