footer_select.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:11k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: footer_select.php,v $
- // | $Date: 2004/02/10 01:34:28 $
- // | $Revision: 1.46 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Ticket selection footer.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include('./../global.php');
- reload_index_nourl();
- require_once(INCLUDE_PATH.'functions/calendar_functions.php');
- footer_html(NULL, $_REQUEST['searchid']);
- // get category, priority and techinformation
- $categories[0] = 'Not Categorized';
- $db->query("SELECT * FROM ticket_cat");
- while ($result = $db->row_array()) {
- $categories[$result[id]] = $result[name];
- }
- $priorities[0] = 'Not Prioritized';
- $db->query("SELECT * FROM ticket_pri");
- while ($result = $db->row_array()) {
- $priorities[$result[id]] = $result[name];
- }
- $techs[0] = 'Not Assigned';
- $db->query("SELECT * FROM tech");
- while ($result = $db->row_array()) {
- $techs[$result[id]] = $result[username];
- }
- $db->query("
- SELECT tech, category, priority
- FROM ticket
- WHERE is_open
- AND awaiting_tech
- " . iff($user[cats_admin], " AND category NOT IN ($user[cats_admin]) ") . "
- AND !nodisplay
- ");
- $t_own = 0; $t_none = 0; $t_other = 0;
- while ($result = $db->row_array()) {
- if (!$result['priority']) {
- $result['priority'] == 0;
- }
- if (!$result['category']) {
- $result['category'] == 0;
- }
- if (!$result['tech']) {
- $result['tech'] == 0;
- }
- if ($result['tech'] == $user['id']) {
- $your_cat[$result['category']]++;
- $your_pri[$result['priority']]++;
- $t_own++;
- } elseif ($result['tech']) {
- $other_cat[$result['category']]++;
- $other_pri[$result['priority']]++;
- $other_tech[$result['tech']]++;
- $t_other++;
- } else {
- $unassigned_cat[$result['category']]++;
- $unassigned_pri[$result['priority']]++;
- $t_none++;
- }
- }
- $js_cat = ""ANY ($t_none) " . "","-2",";
- $js_cat_your = ""ANY ($t_own) " . "","-2",";
- $js_cat_other = ""ANY ($t_other) " . "","-2",";
- $js_pri = ""ANY ($t_none) " . "","-2",";
- $js_pri_your = ""ANY ($t_own) " . "","-2",";
- $js_pri_other = ""ANY ($t_other) " . "","-2",";
- $js_tech = ""ANY ($t_other) " . "","-2",";
- foreach ($categories AS $key => $var) {
- if ($unassigned_cat[$key]) {
- $js_cat .= """ . $var . " ($unassigned_cat[$key]) " . "","$key",";
- }
- if ($your_cat[$key]) {
- $js_cat_your .= """ . $var . " ($your_cat[$key]) " . "","$key",";
- }
- if ($other_cat[$key]) {
- $js_cat_other .= """ . $var . " ($other_cat[$key]) " . "","$key",";
- }
- }
- foreach ($priorities AS $key => $var) {
- if ($unassigned_pri[$key]) {
- $js_pri .= """ . $var . " ($unassigned_pri[$key]) " . "","$key",";
- }
- if ($your_pri[$key]) {
- $js_pri_your .= """ . $var . " ($your_pri[$key]) " . "","$key",";
- }
- if ($other_pri[$key]) {
- $js_pri_other .= """ . $var . " ($other_pri[$key]) " . "","$key",";
- }
- }
- foreach ($techs AS $key => $var) {
- if ($other_tech[$key]) {
- $js_tech .= """ . $var . " ($other_tech[$key]) " . "","$key",";
- }
- }
- $js_cat = substr($js_cat, 0, -1);
- $js_pri = substr($js_pri, 0, -1);
- $js_cat_your = substr($js_cat_your, 0, -1);
- $js_pri_your = substr($js_pri_your, 0, -1);
- $js_pri_other = substr($js_pri_other, 0, -1);
- $js_cat_other = substr($js_cat_other, 0, -1);
- $js_tech = substr($js_tech, 0, -1);
- give_default($js_cat, """");
- give_default($js_pri, """");
- give_default($js_cat_your, """");
- give_default($js_pri_your, """");
- give_default($js_cat_other, """");
- give_default($js_pri_other, """");
- give_default($js_tech, """");
- echo get_javascript('DynamicOptionList.js');
- echo "
- <SCRIPT LANGUAGE="JavaScript">
- var listA = new DynamicOptionList("unassigned_category","actiontype");
- var listB = new DynamicOptionList("unassigned_priority","actiontype");
- var listC = new DynamicOptionList("your_category","actiontype");
- var listD = new DynamicOptionList("your_priority","actiontype");
- var listE = new DynamicOptionList("other_category","actiontype");
- var listF = new DynamicOptionList("other_priority","actiontype");
- var listG = new DynamicOptionList("other_tech","actiontype");
- listA.addOptions("category",$js_cat);
- listB.addOptions("priority",$js_pri);
- listC.addOptions("your_category",$js_cat_your);
- listD.addOptions("your_priority",$js_pri_your);
- listE.addOptions("other_category",$js_cat_other);
- listF.addOptions("other_priority",$js_pri_other);
- listG.addOptions("other_tech",$js_tech);
- listA.setDefaultOption("category",-2);
- listB.setDefaultOption("priority",-2);
- listC.setDefaultOption("your_category",-2);
- listD.setDefaultOption("your_priority",-2);
- listE.setDefaultOption("other_category",-2);
- listF.setDefaultOption("other_priority",-2);
- listG.setDefaultOption("other_tech",-2);
- function init(theform) {
- var theform = document.forms[1];
- listA.init(theform);
- listB.init(theform);
- listC.init(theform);
- listD.init(theform);
- listE.init(theform);
- listF.init(theform);
- listG.init(theform);
- }
- </SCRIPT>
- ";
- ?>
- <table height="100%" width="100%"><tr><td valign="middle"><form id="theform" name="theform" method="post" action="./../tickets/ticketsearch.php" target="center">
- <table><tr><td valign="center">
- <select size="4" name="actiontype" onChange="listG.populate();listF.populate();listE.populate();listD.populate();listC.populate();listB.populate();listA.populate();">
- <option value="your_category" selected>Your tickets by category (<?php echo $t_own ?>)</option>
- <option value="your_priority">Your tickets by priority (<?php echo $t_own ?>)</option>
- <option value="category">Unassigned tickets by category (<?php echo $t_none ?>)</option>
- <option value="priority">Unassigned tickets by priority (<?php echo $t_none ?>)</option>
- <option value="other_category">Assigned tickets by category (<?php echo $t_other ?>)</option>
- <option value="other_priority">Assigned tickets by priority (<?php echo $t_other ?>)</option>
- <option value="other_tech">Assigned tickets by owner (<?php echo $t_other ?>)</option>
- </select>
- </td><td> </td>
- <td>
- <select name="unassigned_category[]" id="unassigned_category" size="4" MULTIPLE>
- <script language="JavaScript">listA.printOptions()</script>
- </select>
- <select name="unassigned_priority[]" id="unassigned_priority" size="4" MULTIPLE>
- <script language="JavaScript">listB.printOptions()</script>
- </select>
- <select name="your_category[]" id="your_category" size="4" MULTIPLE>
- <script language="JavaScript">listC.printOptions()</script>
- </select>
- <select name="your_priority[]" id="your_priority" size="4" MULTIPLE>
- <script language="JavaScript">listD.printOptions()</script>
- </select>
- <select name="other_category[]" id="other_category" size="4" MULTIPLE>
- <script language="JavaScript">listE.printOptions()</script>
- </select>
- <select name="other_priority[]" id="other_priority" size="4" MULTIPLE>
- <script language="JavaScript">listF.printOptions()</script>
- </select>
- <select name="other_tech[]" id="other_tech" size="4" MULTIPLE>
- <script language="JavaScript">listG.printOptions()</script>
- </select>
- </td><td> </td>
- <td>
- <input type="submit" name="Process" value="View Results"> <br>
- <input type="submit" name="Jump" value="Jump to Tickets">
- <script language="JavaScript">
- init()
- </script>
- </td></tr></table>
- </form></td>
- <?php
- ################################### PRIVATE MESSAGES ###################################
- $res = $db->query_return("SELECT count(*) AS total FROM pm_source, pm_relations
- WHERE pm_source.id = pm_relations.pmid
- AND pm_relations.techid = $user[id]
- AND !pm_relations.is_read");
- $unread_pm = $res['total'];
- ################################### TASKS ###################################
- $overdue = get_tasks(1, 2);
- $overdue_watches = get_tasks(1, 1);
- $tasks = get_tasks() + $overdue;
- $watches = get_tasks(0, 1) + $overdue_watches;
- ################################### FAQ ARTICLES ###################################
- $db->query('SELECT id FROM faq_articles WHERE to_validate');
- $faqarticles = $db->num_rows();
- $db->query('SELECT id FROM faq_comments WHERE new');
- $faqcomments = $db->num_rows();
- ################################### USER VERIFICATION ###################################
- $validations = $db->query_return('SELECT COUNT(*) AS total FROM user WHERE awaiting_manual_validation AND !awaiting_validation');
- if ($validations['total']) {
- $validations = "<A HREF="../users/index.php" target="center"><B>$validations[total]</B></A>";
- } else {
- $validations = $validations['total'];
- }
- ################################### DISPLAY AT A GLANCE STUFF###################################
- echo "<td valign="top" align="center">";
- if ($unread_pm) {
- $unread_pm = "<A HREF="../teamwork/pms.php" target="center">$unread_pm</A>";
- }
- if ($tasks) {
- $tasks = "<A HREF="../calendar/index.php?do=daily&type=calendar" target="center">$tasks</A>";
- }
- if ($overdue) {
- $overdue = "<A HREF="../calendar/index.php?do=daily&type=calendar&overdue=1" target="center">$overdue</A>";
- }
- if ($watches) {
- $watches = "<A HREF="../calendar/index.php?do=daily&type=calendar&watch=1" target="center">$watches</A>";
- }
- if ($overdue_watches) {
- $overdue_watches = "<A HREF="../calendar/index.php?do=daily&type=calendar&watch=1&overdue=1" target="center">$overdue_watches</A>";
- }
- if ($faqarticles) {
- $faqarticles = "<A HREF="../faq/validate.php" target="center">$faqarticles</A>";
- }
- if ($faqcomments) {
- $faqcomments = "<A HREF="../faq/comments.php" target="center">$faqcomments</A>";
- }
- echo "<table cellpadding="1" cellspacing="0">";
- echo "<tr><td width="18" align="left">" . html_image('tech/bul085.gif') . "</td><td><b>$unread_pm</b> message(s)</td></tr>";
- if ($user[p_approve_new_registrations]) {
- echo "<tr><td align="center">" . html_image('tech/bul095.gif') . "</td><td><b>$validations</b> user(s) pending</td></tr>";
- }
- echo "<tr><td align="center">" . html_image('tech/bul086.gif') . "</td><td><b>$tasks</b> task(s) due (<B>$overdue</B> overdue)</td></tr>";
- echo "<tr><td align="center">" . html_image('tech/bul092.gif') . "</td><td><b>$watches</b> ticket(s) to check ($overdue_watches overdue)</td></tr>";
- echo "<tr><td align="center">" . html_image('tech/bul087.gif') . "</td><td><b>$faqarticles</b> faq article(s) | <b>$faqcomments</b> faq comment(s)</td></tr>";
- echo "</td></tr></table></td></tr></table>";