XoopsModules25x /
xhelp
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | //$Id: index.php,v 1.144 2005/11/29 17:48:12 ackbarr Exp $ |
||
| 3 | include('../../../include/cp_header.php'); |
||
| 4 | include_once('admin_header.php'); |
||
| 5 | include_once(XOOPS_ROOT_PATH . '/class/pagenav.php'); |
||
| 6 | define('MAX_STAFF_RESPONSETIME', 5); |
||
| 7 | define('MAX_STAFF_CALLSCLOSED', 5); |
||
| 8 | |||
| 9 | global $HTTP_GET_VARS, $xoopsModule; |
||
| 10 | $module_id = $xoopsModule->getVar('mid'); |
||
| 11 | |||
| 12 | $op = 'default'; |
||
| 13 | |||
| 14 | if ( isset( $_REQUEST['op'] ) ) |
||
| 15 | { |
||
| 16 | $op = $_REQUEST['op']; |
||
| 17 | } |
||
| 18 | |||
| 19 | switch ( $op ) |
||
| 20 | { |
||
| 21 | case "about": |
||
| 22 | about(); |
||
| 23 | break; |
||
| 24 | |||
| 25 | case "mailEvents": |
||
| 26 | mailEvents(); |
||
| 27 | break; |
||
| 28 | |||
| 29 | case "searchMailEvents": |
||
| 30 | searchMailEvents(); |
||
| 31 | break; |
||
| 32 | |||
| 33 | case "blocks": |
||
| 34 | require 'myblocksadmin.php'; |
||
| 35 | break; |
||
| 36 | |||
| 37 | case "createdir": |
||
| 38 | createdir(); |
||
| 39 | break; |
||
| 40 | |||
| 41 | case "setperm": |
||
| 42 | setperm(); |
||
| 43 | break; |
||
| 44 | |||
| 45 | case "manageFields": |
||
| 46 | manageFields(); |
||
| 47 | break; |
||
| 48 | |||
| 49 | default: |
||
| 50 | xhelp_default(); |
||
| 51 | break; |
||
| 52 | } |
||
| 53 | |||
| 54 | function modifyTicketFields() |
||
| 55 | { |
||
| 56 | //xoops_cp_header(); |
||
| 57 | //echo "not created yet"; |
||
| 58 | xoops_cp_footer(); |
||
| 59 | } |
||
| 60 | |||
| 61 | function displayEvents($mailEvents, $mailboxes) |
||
| 62 | { |
||
| 63 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
| 64 | if(count($mailEvents) > 0){ |
||
| 65 | echo "<tr><th colspan='4'>"._AM_XHELP_TEXT_MAIL_EVENTS."</th></tr>"; |
||
| 66 | echo "<tr class='head'><td>"._AM_XHELP_TEXT_MAILBOX."</td> |
||
| 67 | <td>"._AM_XHELP_TEXT_EVENT_CLASS."</td> |
||
| 68 | <td>"._AM_XHELP_TEXT_DESCRIPTION."</td> |
||
| 69 | <td>"._AM_XHELP_TEXT_TIME."</td> |
||
| 70 | </tr>"; |
||
| 71 | |||
| 72 | $class = 'odd'; |
||
| 73 | foreach($mailEvents as $event){ |
||
| 74 | echo "<tr class='". $class ."'><td>".$mailboxes[$event->getVar('mbox_id')]->getVar('emailaddress')."</td> |
||
| 75 | <td>".xhelpGetEventClass($event->getVar('event_class'))."</td> |
||
| 76 | <td>".$event->getVar('event_desc')."</td> |
||
| 77 | <td>".$event->posted()."</td> |
||
| 78 | </tr>"; |
||
| 79 | $class = ($class == 'odd') ? 'even' : 'odd'; |
||
| 80 | } |
||
| 81 | |||
| 82 | } else { |
||
| 83 | echo "<tr><th>"._AM_XHELP_TEXT_MAIL_EVENTS."</th></tr>"; |
||
| 84 | echo "<tr><td class='odd'>"._AM_XHELP_NO_EVENTS."</td></tr>"; |
||
| 85 | } |
||
| 86 | echo "</table><br />"; |
||
| 87 | echo "<a href='index.php?op=searchMailEvents'>"._AM_XHELP_SEARCH_EVENTS."</a>"; |
||
| 88 | } |
||
| 89 | |||
| 90 | function mailEvents() |
||
| 91 | { |
||
| 92 | // Will display the last 50 mail events |
||
| 93 | $hMailEvent =& xhelpGetHandler('mailEvent'); |
||
| 94 | $hDeptMbox =& xhelpGetHandler('departmentMailBox'); |
||
| 95 | $mailboxes =& $hDeptMbox->getObjects(null, true); |
||
| 96 | |||
| 97 | $crit = new Criteria('', ''); |
||
| 98 | $crit->setLimit(50); |
||
| 99 | $crit->setOrder('DESC'); |
||
| 100 | $crit->setSort('posted'); |
||
| 101 | $mailEvents =& $hMailEvent->getObjects($crit); |
||
| 102 | |||
| 103 | xoops_cp_header(); |
||
| 104 | //echo $oAdminButton->renderButtons('mailEvents'); |
||
| 105 | $indexAdmin = new ModuleAdmin(); |
||
| 106 | echo $indexAdmin->addNavigation('main.php'); |
||
| 107 | |||
| 108 | displayEvents($mailEvents, $mailboxes); |
||
| 109 | |||
| 110 | include_once "admin_footer.php"; |
||
| 111 | } |
||
| 112 | |||
| 113 | function searchMailEvents() |
||
| 114 | { |
||
| 115 | xoops_cp_header(); |
||
| 116 | //echo $oAdminButton->renderButtons('mailEvents'); |
||
| 117 | $indexAdmin = new ModuleAdmin(); |
||
| 118 | echo $indexAdmin->addNavigation('main.php'); |
||
| 119 | |||
| 120 | if(!isset($_POST['searchEvents'])){ |
||
| 121 | |||
| 122 | $stylePath = include_once XHELP_INCLUDE_PATH.'/calendar/calendarjs.php'; |
||
| 123 | 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]-->'; |
||
| 124 | |||
| 125 | echo "<form method='post' action='".XHELP_ADMIN_URL."/index.php?op=searchMailEvents'>"; |
||
| 126 | |||
| 127 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
| 128 | echo "<tr><th colspan='2'>"._AM_XHELP_SEARCH_EVENTS."</th></tr>"; |
||
| 129 | echo "<tr><td width='20%' class='head'>"._AM_XHELP_TEXT_MAILBOX."</td> |
||
| 130 | <td class='even'><input type='text' size='55' name='email' class='formButton'></td></tr>"; |
||
| 131 | echo "<tr><td class='head'>"._AM_XHELP_TEXT_DESCRIPTION."</td> |
||
| 132 | <td class='even'><input type='text' size='55' name='description' class='formButton'></td></tr>"; |
||
| 133 | echo "<tr><td class='head'>"._AM_XHELP_SEARCH_BEGINEGINDATE."</td> |
||
| 134 | <td class='even'><input type='text' name='begin_date' id='begin_date' size='10' maxlength='10' value='".formatTimestamp(time(), 'mysql')."' /> |
||
| 135 | <a href='' onclick='return showCalendar(\"begin_date\");'><img src='".XHELP_IMAGE_URL."/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent' /></a> "; |
||
| 136 | xhelpDrawHourSelect("begin_hour", 12); |
||
| 137 | xhelpDrawMinuteSelect("begin_minute"); |
||
| 138 | xhelpDrawModeSelect("begin_mode"); |
||
| 139 | echo "<tr><td class='head'>"._AM_XHELP_SEARCH_ENDDATE."</td> |
||
| 140 | <td class='even'><input type='text' name='end_date' id='end_date' size='10' maxlength='10' value='".formatTimestamp(time(), 'mysql')."' /> |
||
| 141 | <a href='' onclick='return showCalendar(\"end_date\");'><img src='".XHELP_IMAGE_URL."/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent' /></a> "; |
||
| 142 | xhelpDrawHourSelect("end_hour", 12); |
||
| 143 | xhelpDrawMinuteSelect("end_minute"); |
||
| 144 | xhelpDrawModeSelect("end_mode"); |
||
| 145 | echo "<tr><td class='foot' colspan='2'><input type='submit' name='searchEvents' value='"._AM_XHELP_BUTTON_SEARCH."' /></td></tr>"; |
||
| 146 | echo "</table>"; |
||
| 147 | echo "</form>"; |
||
| 148 | |||
| 149 | include_once "admin_footer.php"; |
||
| 150 | } else { |
||
| 151 | $hMailEvent =& xhelpGetHandler('mailEvent'); |
||
| 152 | $hDeptMbox =& xhelpGetHandler('departmentMailBox'); |
||
| 153 | $mailboxes =& $hDeptMbox->getObjects(null, true); |
||
| 154 | |||
| 155 | $begin_date = explode( '-', $_POST['begin_date']); |
||
| 156 | $end_date = explode('-', $_POST['end_date']); |
||
| 157 | $begin_hour = xhelpChangeHour($_POST['begin_mode'], $_POST['begin_hour']); |
||
| 158 | $end_hour = xhelpChangeHour($_POST['end_mode'], $_POST['end_hour']); |
||
| 159 | |||
| 160 | // Get timestamps to search by |
||
| 161 | $begin_time = mktime($begin_hour, $_POST['begin_minute'], 0, $begin_date[1], $begin_date[2], $begin_date[0]); |
||
| 162 | $end_time = mktime($end_hour, $_POST['end_minute'], 0, $end_date[1], $end_date[2], $end_date[0]); |
||
| 163 | |||
| 164 | $crit = new CriteriaCompo(new Criteria('posted', $begin_time, '>=')); |
||
| 165 | $crit->add(new Criteria('posted', $end_time, '<=')); |
||
| 166 | if($_POST['email'] != ''){ |
||
| 167 | $email = $_POST['email']; |
||
| 168 | $crit->add(new Criteria('emailaddress', "%$email%", "LIKE", "d")); |
||
| 169 | } |
||
| 170 | if($_POST['description'] != ''){ |
||
| 171 | $description = $_POST['description']; |
||
| 172 | $crit->add(new Criteria('event_desc', "%$description%", "LIKE")); |
||
| 173 | } |
||
| 174 | $crit->setOrder('DESC'); |
||
| 175 | $crit->setSort('posted'); |
||
| 176 | if(isset($email)){ |
||
| 177 | $mailEvents =& $hMailEvent->getObjectsJoin($crit); |
||
| 178 | } else { |
||
| 179 | $mailEvents =& $hMailEvent->getObjects($crit); |
||
| 180 | } |
||
| 181 | |||
| 182 | displayEvents($mailEvents, $mailboxes); |
||
| 183 | |||
| 184 | include_once "admin_footer.php"; |
||
| 185 | } |
||
| 186 | } |
||
| 187 | |||
| 188 | /** |
||
| 189 | * changes hour to am/pm |
||
| 190 | * |
||
| 191 | * @param int $mode, 1-am, 2-pm |
||
| 192 | * @param int $hour hour of the day |
||
| 193 | * |
||
| 194 | * @return hour in 24 hour mode |
||
| 195 | */ |
||
| 196 | function xhelpChangeHour($mode, $hour) |
||
| 197 | { |
||
| 198 | $mode = intval($mode); |
||
| 199 | $hour = intval($hour); |
||
| 200 | |||
| 201 | if($mode == 2){ |
||
| 202 | $hour = $hour + 12; |
||
| 203 | |||
| 204 | return $hour; |
||
| 205 | } |
||
| 206 | |||
| 207 | return $hour; |
||
| 208 | } |
||
| 209 | |||
| 210 | function xhelpDrawHourSelect($name, $lSelect="-1") |
||
| 211 | { |
||
| 212 | echo "<select name='".$name."'>"; |
||
| 213 | for($i = 1; $i <= 12; $i++){ |
||
| 214 | if($lSelect == $i){ |
||
| 215 | $selected = "selected='selected'"; |
||
| 216 | } else { |
||
| 217 | $selected = ''; |
||
| 218 | } |
||
| 219 | echo "<option value='".$i."'".$selected.">".$i."</option>"; |
||
| 220 | } |
||
| 221 | echo "</select>"; |
||
| 222 | } |
||
| 223 | |||
| 224 | function xhelpDrawMinuteSelect($name) |
||
| 225 | { |
||
| 226 | $lSum = 0; |
||
| 227 | |||
| 228 | echo "<select name='".$name."'>"; |
||
| 229 | for($i = 0; $lSum <= 50; $i++){ |
||
| 230 | if($i == 0){ |
||
| 231 | echo "<option value='00' selected='selected'>00</option>"; |
||
| 232 | } else { |
||
| 233 | $lSum = $lSum + 5; |
||
| 234 | echo "<option value='".$lSum."'>".$lSum."</option>"; |
||
| 235 | } |
||
| 236 | } |
||
| 237 | echo "</select>"; |
||
| 238 | } |
||
| 239 | |||
| 240 | function xhelpDrawModeSelect($name, $sSelect='AM') |
||
| 241 | { |
||
| 242 | echo "<select name='".$name."'>"; |
||
| 243 | if($sSelect == 'AM'){ |
||
| 244 | echo "<option value='1' selected='selected'>AM</option>"; |
||
| 245 | echo "<option value='2'>PM</option>"; |
||
| 246 | } else { |
||
| 247 | echo "<option value='1'>AM</option>"; |
||
| 248 | echo "<option value='2' selected='selected'>PM</option>"; |
||
| 249 | } |
||
| 250 | } |
||
| 251 | |||
| 252 | function xhelp_default() |
||
| 253 | { |
||
| 254 | global $xoopsModuleConfig; |
||
| 255 | xoops_cp_header(); |
||
| 256 | //echo $oAdminButton->renderButtons('index'); |
||
| 257 | $indexAdmin = new ModuleAdmin(); |
||
| 258 | echo $indexAdmin->addNavigation('main.php'); |
||
| 259 | |||
| 260 | $displayName =& $xoopsModuleConfig['xhelp_displayName']; // Determines if username or real name is displayed |
||
| 261 | |||
| 262 | $stylePath = XHELP_BASE_URL.'/styles/xhelp.css'; |
||
| 263 | 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]-->'; |
||
| 264 | |||
| 265 | global $xoopsUser, $xoopsDB; |
||
| 266 | $hTickets =& xhelpGetHandler('ticket'); |
||
| 267 | $hStatus =& xhelpGetHandler('status'); |
||
| 268 | |||
| 269 | $crit = new Criteria('', ''); |
||
| 270 | $crit->setSort('description'); |
||
| 271 | $crit->setOrder('ASC'); |
||
| 272 | $statuses =& $hStatus->getObjects($crit); |
||
| 273 | $table_class = array('odd', 'even'); |
||
| 274 | echo "<table border='0' width='100%'>"; |
||
| 275 | echo "<tr><td width='50%' valign='top'>"; |
||
| 276 | echo "<div id='ticketInfo'>"; |
||
| 277 | echo "<table border='0' width='95%' cellspacing='1' class='outer'> |
||
| 278 | <tr><th colspan='2'>". _AM_XHELP_TEXT_TICKET_INFO ."</th></tr>"; |
||
| 279 | $class = "odd"; |
||
| 280 | $totalTickets = 0; |
||
| 281 | foreach($statuses as $status){ |
||
| 282 | $crit = new Criteria('status', $status->getVar('id')); |
||
| 283 | $numTickets =& $hTickets->getCount($crit); |
||
| 284 | $totalTickets += $numTickets; |
||
| 285 | |||
| 286 | echo "<tr class='".$class."'><td>".$status->getVar('description')."</td><td>".$numTickets."</td></tr>"; |
||
| 287 | if($class == "odd"){ |
||
| 288 | $class = "even"; |
||
| 289 | } else { |
||
| 290 | $class = "odd"; |
||
| 291 | } |
||
| 292 | } |
||
| 293 | echo "<tr class='foot'><td>"._AM_XHELP_TEXT_TOTAL_TICKETS."</td><td>".$totalTickets."</td></tr>"; |
||
| 294 | echo "</table></div><br />"; |
||
| 295 | |||
| 296 | $hStaff =& xhelpGetHandler('staff'); |
||
| 297 | $hResponses =& xhelpGetHandler('responses'); |
||
| 298 | echo "</td><td valign='top'>"; // Outer table |
||
| 299 | echo "<div id='timeSpent'>"; // Start inner top-left cell |
||
| 300 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 301 | <tr><th colspan='2'>". _AM_XHELP_TEXT_RESPONSE_TIME ."</th></tr>"; |
||
| 302 | |||
| 303 | $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')); |
||
| 304 | $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME); |
||
| 305 | $i = 0; |
||
| 306 | View Code Duplication | while (list($uid, $uname, $name, $avgResponseTime) = $xoopsDB->fetchRow($ret)) { |
|
| 307 | $class = $table_class[$i % 2]; |
||
| 308 | echo "<tr class='$class'><td>". xhelpGetDisplayName($displayName, $name,$uname) ."</td><td align='right'>". xhelpFormatTime($avgResponseTime) ."</td></tr>"; |
||
| 309 | $i++; |
||
| 310 | } |
||
| 311 | echo "</table></div><br />"; // End inner top-left cell |
||
| 312 | echo "</td></tr><tr><td valign='top'>"; // End first, start second cell |
||
| 313 | |||
| 314 | //Get Calls Closed block |
||
| 315 | $sql = sprintf('SELECT SUM(callsClosed) FROM %s', $xoopsDB->prefix('xhelp_staff')); |
||
| 316 | $ret = $xoopsDB->query($sql); |
||
| 317 | if (list($totalStaffClosed) = $xoopsDB->fetchRow($ret)) { |
||
| 318 | if ($totalStaffClosed) { |
||
| 319 | $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')); |
||
| 320 | $ret = $xoopsDB->query($sql, MAX_STAFF_CALLSCLOSED); |
||
| 321 | echo "<div id='callsClosed'>"; |
||
| 322 | echo "<table border='0' width='95%' cellspacing='1' class='outer'> |
||
| 323 | <tr><th colspan='2'>". _AM_XHELP_TEXT_TOP_CLOSERS ."</th></tr>"; |
||
| 324 | $i = 0; |
||
| 325 | while (list($uid, $uname, $name, $callsClosed) = $xoopsDB->fetchRow($ret)) { |
||
| 326 | $class = $table_class[$i % 2]; |
||
| 327 | echo "<tr class='$class'><td>". xhelpGetDisplayName($displayName, $name,$uname) ."</td><td align='right'>". $callsClosed. ' ('.round(($callsClosed/$totalStaffClosed)*100, 2) ."%)</td></tr>"; |
||
| 328 | $i++; |
||
| 329 | } |
||
| 330 | echo "</table></div><br />"; // End inner table top row |
||
| 331 | echo "</td><td valign='top'>"; // End top row of outer table |
||
| 332 | |||
| 333 | $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')); |
||
| 334 | $ret = $xoopsDB->query($sql, MAX_STAFF_RESPONSETIME); |
||
| 335 | echo "<div id='leastCallsClosed'>"; |
||
| 336 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 337 | <tr><th colspan='2'>". _AM_XHELP_TEXT_RESPONSE_TIME_SLOW ."</th></tr>"; |
||
| 338 | $i = 0; |
||
| 339 | View Code Duplication | while (list($uid, $uname, $name, $avgResponseTime) = $xoopsDB->fetchRow($ret)) { |
|
| 340 | $class = $table_class[$i % 2]; |
||
| 341 | echo "<tr class='$class'><td>". xhelpGetDisplayName($displayName, $name,$uname) ."</td><td align='right'>". xhelpFormatTime($avgResponseTime) ."</td></tr>"; |
||
| 342 | $i++; |
||
| 343 | } |
||
| 344 | echo "</table></div>"; // End first cell, second row of inner table |
||
| 345 | } |
||
| 346 | } |
||
| 347 | echo "</td></tr></table><br />"; // End second cell, second row of inner table |
||
| 348 | |||
| 349 | $crit = new Criteria('state', '2', '<>', 's'); |
||
| 350 | $crit->setSort('priority'); |
||
| 351 | $crit->setOrder('ASC'); |
||
| 352 | $crit->setLimit(10); |
||
| 353 | $highPriority =& $hTickets->getObjects($crit); |
||
| 354 | $has_highPriority = (count($highPriority) > 0); |
||
| 355 | if($has_highPriority){ |
||
| 356 | echo "<div id='highPriority'>"; |
||
| 357 | echo "<table border='0' width='100%' cellspacing='1' class='outer'> |
||
| 358 | <tr><th colspan='8'>". _AM_XHELP_TEXT_HIGH_PRIORITY ."</th></tr>"; |
||
| 359 | 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>"; |
||
| 360 | $i = 0; |
||
| 361 | foreach($highPriority as $ticket){ |
||
| 362 | if($ticket->isOverdue()){ |
||
| 363 | $class = $table_class[$i % 2] . " overdue"; |
||
| 364 | } else { |
||
| 365 | $class = $table_class[$i % 2]; |
||
| 366 | } |
||
| 367 | $priority_url = "<img src='".XHELP_IMAGE_URL."/priority". $ticket->getVar('priority') .".png' alt='". $ticket->getVar('priority') ."' />"; |
||
| 368 | $subject_url = sprintf("<a href='".XHELP_BASE_URL."/ticket.php?id=". $ticket->getVar('id') ."' target='_BLANK'>%s</a>", $ticket->getVar('subject')); |
||
| 369 | if($dept = $ticket->getDepartment()){ |
||
| 370 | $dept_url = sprintf("<a href='".XHELP_BASE_URL."/index.php?op=staffViewAll&dept=". $dept->getVar('id') ."' target='_BLANK'>%s</a>", $dept->getVar('department')); |
||
| 371 | } else { |
||
| 372 | $dept_url = _AM_XHELP_TEXT_NO_DEPT; |
||
| 373 | } |
||
| 374 | if($ticket->getVar('ownership') <> 0){ |
||
| 375 | $owner_url = sprintf("<a href='".XOOPS_URL."/userinfo.php?uid=". $ticket->getVar('uid') ."' target='_BLANK'>%s</a>", xhelpGetUsername($ticket->getVar('ownership'), $displayName)); |
||
| 376 | } else { |
||
| 377 | $owner_url = _AM_XHELP_TEXT_NO_OWNER; |
||
| 378 | } |
||
| 379 | $user_url = sprintf("<a href='".XOOPS_URL."/userinfo.php?uid=". $ticket->getVar('uid') ."' target='_BLANK'>%s</a>", xhelpGetUsername($ticket->getVar('uid'), $displayName)); |
||
| 380 | echo "<tr class='$class'><td>". $priority_url ."</td> |
||
| 381 | <td>". $ticket->elapsed() ."</td> |
||
| 382 | <td>". xhelpGetStatus($ticket->getVar('status')) ."</td> |
||
| 383 | <td>". $subject_url ."</td> |
||
| 384 | <td>". $dept_url ."</td> |
||
| 385 | <td>". $owner_url ." </td> |
||
| 386 | <td>". $ticket->lastUpdated() ."</td> |
||
| 387 | <td>". $user_url ."</td> |
||
| 388 | </tr>"; |
||
| 389 | $i++; |
||
| 390 | } |
||
| 391 | echo "</table></div>"; |
||
| 392 | } |
||
| 393 | |||
| 394 | pathConfiguration(); |
||
| 395 | |||
| 396 | include_once "admin_footer.php"; |
||
| 397 | } |
||
| 398 | |||
| 399 | function pathConfiguration() |
||
| 400 | { |
||
| 401 | global $xoopsModule, $xoopsConfig; |
||
| 402 | |||
| 403 | // Upload and Images Folders |
||
| 404 | |||
| 405 | $paths = array(); |
||
| 406 | $paths[_AM_XHELP_PATH_TICKETATTACH] = XHELP_UPLOAD_PATH; |
||
| 407 | $paths[_AM_XHELP_PATH_EMAILTPL] = XHELP_BASE_PATH."/language/{$xoopsConfig['language']}"; |
||
| 408 | |||
| 409 | echo "<h3>"._AM_XHELP_PATH_CONFIG."</h3>"; |
||
| 410 | echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; |
||
| 411 | echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_DESCRIPTION . "</b></td>"; |
||
| 412 | echo "<td class='bg3'><b>" . _AM_XHELP_TEXT_PATH . "</b></td>"; |
||
| 413 | echo "<td class='bg3' align='center'><b>" . _AM_XHELP_TEXT_STATUS . "</b></td></tr>"; |
||
| 414 | |||
| 415 | foreach($paths as $desc=>$path) { |
||
| 416 | echo "<tr><td class='odd'>$desc</td>"; |
||
| 417 | echo "<td class='odd'>$path</td>"; |
||
| 418 | echo "<td class='even' style='text-align: center;'>" . xhelp_admin_getPathStatus($path) . "</td></tr>"; |
||
| 419 | } |
||
| 420 | |||
| 421 | echo "</table>"; |
||
| 422 | echo "<br />"; |
||
| 423 | |||
| 424 | echo "</div>"; |
||
| 425 | } |
||
| 426 | |||
| 427 | function about() |
||
| 428 | { |
||
| 429 | |||
| 430 | xoops_cp_header(); |
||
| 431 | //echo $oAdminButton->renderButtons(); |
||
| 432 | $indexAdmin = new ModuleAdmin(); |
||
| 433 | echo $indexAdmin->addNavigation('main.php'); |
||
| 434 | |||
| 435 | require_once(XHELP_ADMIN_PATH."/about.php"); |
||
| 436 | } |
||
| 437 | |||
| 438 | function createdir() |
||
| 439 | { |
||
| 440 | $path = $_GET['path']; |
||
| 441 | $res = xhelp_admin_mkdir($path); |
||
| 442 | |||
| 443 | $msg = ($res)?_AM_XHELP_PATH_CREATED:_AM_XHELP_PATH_NOTCREATED; |
||
| 444 | redirect_header(XHELP_ADMIN_URL.'/index.php', 2, $msg . ': ' . $path); |
||
| 445 | exit(); |
||
| 446 | } |
||
| 447 | |||
| 448 | function setperm() |
||
| 449 | { |
||
| 450 | $path = $_GET['path']; |
||
| 451 | $res = xhelp_admin_chmod($path, 0777); |
||
| 452 | $msg = ($res ? _AM_XHELP_PATH_PERMSET : _AM_XHELP_PATH_NOTPERMSET); |
||
| 453 | redirect_header(XHELP_ADMIN_URL.'/index.php', 2, $msg . ': ' . $path); |
||
| 454 | exit(); |
||
| 455 | } |
||
| 456 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.