| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:05:01 2008 ] | [ OneOrZero 1.6.3 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * file: mygroupopen.php 5 * 6 * This file grabs group information about the logged in supporter and displays all open 7 * tickets of that user. 8 * 9 /*************************************************************************** 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public 21 * License along with This program; if not, write to: 22 * Free Software Foundation, Inc. 23 * 59 Temple Place 24 * Suite 330 25 * Boston, MA 02111-1307 USA 26 * 27 * Copyright 2005 One or Zero 28 * info@oneorzero.com 29 * http://www.oneorzero.com 30 * Developers: OneOrZero Team / Contributors: OneOrZero Community 31 ****************************************************************************/ 32 33 require_once "../common/common.php"; 34 require_once "../common/init_server_settings.php"; 35 require_once "../common/$database.class.php"; 36 require_once "../common/init_ooz.php"; 37 require_once "../common/login.php"; 38 39 $supporter_id = getUserID($_SESSION[user]); 40 $highest_pri = getRPriority(getHighestRank($tpriorities_table)); //set the highest priority rating 41 startTable("$lang_yourgroups", "center"); 42 echo '<tr><td class=back> '; 43 $num_groups = getNumberGroups(); 44 $groups = getSGroupList($supporter_id); 45 if (sizeof($groups) == 0 && $num_groups != 1) { 46 printerror("$lang_nogroups"); 47 $no_groups = 1; 48 } 49 // everything in here should be the ticket information 50 // start the table, use a while loop to cycle through all the tickets. 51 if ($no_groups != 1) { 52 echo '<table class=border cellSpacing=0 cellPadding=0 width="100%" align=center border=0> 53 <tr> 54 <td> 55 <table cellSpacing=1 cellPadding=5 width="100%" border=0> 56 <tr>'; 57 if ($_GET[s] == 'id') { 58 echo '<td class=hf align=center> 59 <a class=hf href=index.php?t=tmgo><b>' . $lang_id . '</b></a></td>'; 60 } else { 61 echo '<td class=hf align=center> 62 <a class=hf href=index.php?t=tmgo&s=id><b>' . $lang_id . '</b></a></td>'; 63 } 64 65 if ($_GET[s] == 'sup') { 66 echo '<td class=hf align=center> 67 <a class=hf href=index.php?t=tmgo&s=pus><b>' . $lang_Supporter . '</b></a></td>'; 68 } else { 69 echo '<td class=hf align=center> 70 <a class=hf href=index.php?t=tmgo&s=sup><b>' . $lang_Supporter . '</b></a></td>'; 71 } 72 73 if ($_GET[s] == 'sho') { 74 echo '<td class=hf align=center> 75 <a class=hf href=index.php?t=tmgo&s=ohs><b>' . $lang_shortdesc . '</b></a></td>'; 76 } else { 77 echo '<td class=hf align=center> 78 <a class=hf href=index.php?t=tmgo&s=sho><b>' . $lang_shortdesc . '</b></a></td>'; 79 } 80 81 if ($_GET[s] == 'usr') { 82 echo '<td class=hf align=center> 83 <a class=hf href=index.php?t=tmgo&s=rsu><b>' . $lang_user . '</b></a></td>'; 84 } else { 85 echo '<td class=hf align=center> 86 <a class=hf href=index.php?t=tmgo&s=usr><b>' . $lang_user . '</b></a></td>'; 87 } 88 89 if ($_GET[s] == 'pri') { 90 echo '<td class=hf align=center> 91 <a class=hf href=index.php?t=tmgo&s=irp><b>' . $lang_priority . '</b></a></td>'; 92 } else { 93 echo '<td class=hf align=center> 94 <a class=hf href=index.php?t=tmgo&s=pri><b>' . $lang_priority . '</b></a></td>'; 95 } 96 97 if ($_GET[s] == 'cre') { 98 echo '<td class=hf align=center> 99 <a class=hf href=index.php?t=tmgo&s=erc><b>' . $lang_created . '</b></a></td>'; 100 } else { 101 echo '<td class=hf align=center> 102 <a class=hf href=index.php?t=tmgo&s=cre><b>' . $lang_created . '</b></a></td>'; 103 } 104 105 if ($_GET[s] == 'sta') { 106 echo '<td class=hf align=center> 107 <a class=hf href=index.php?t=tmgo&s=ats><b>' . $lang_status . '</b></a></td>'; 108 } else { 109 echo '<td class=hf align=center> 110 <a class=hf href=index.php?t=tmgo&s=sta><b>' . $lang_status . '</b></a></td>'; 111 } 112 113 if ($_GET[s] == 'rt') { 114 echo '<td class=hf align=center> 115 <a class=hf href="' . $supporter_site_url . '/index.php?t=tmgo&s=tr"><b>' . $lang_time . '</b></a></td>'; 116 } else { 117 echo '<td class=hf align=center> 118 <a class=hf href="' . $supporter_site_url . '/index.php?t=tmgo&s=rt"><b>' . $lang_time . '</b></a></td>'; 119 } 120 echo '</tr>'; 121 122 listOpenTickets($supporter_id, $_GET[s], $groups); 123 124 endTable(); 125 } 126 endTable(); 127 128 function listOpenTickets($id, $sort, $groups) 129 { 130 global $tickets_table, $tstatus_table, $tpriorities_table, $num_groups, $db; 131 global $table_prefix; 132 $time = time(); 133 // grab the list of groups that the user is in so we can print out all tickets for that user's groups. 134 // we have a list of groups that the user is a member of...now print out all tickets for all users in those groups. 135 if ($num_groups == 1) { 136 $sql2 = "select * from $tickets_table where status!='" . getRStatus(getHighestRank($tstatus_table)) . "' and (groupid=1"; 137 138 if ($sort == 'rt' || $sort == 'tr') { 139 $sql2 = "SELECT t.*, ($time - t.lastupdate)/p.response_time as a from $tickets_table t, $tpriorities_table p where p.priority=t.priority and status!='" . getRStatus(getHighestRank($tstatus_table)) . "' and (groupid=1"; 140 } 141 } else { 142 $sql2 = "select * from $tickets_table where status!='" . getRStatus(getHighestRank($tstatus_table)) . "' and (groupid="; 143 144 if ($sort == 'rt' || $sort == 'tr') { 145 $sql2 = "SELECT t.*, ($time - t.lastupdate)/p.response_time as a from $tickets_table t, $tpriorities_table p where p.priority=t.priority and status!='" . getRStatus(getHighestRank($tstatus_table)) . "' and (groupid="; 146 } 147 // finsih setting up the sql2 statement. 148 for($i = 0; $i < sizeof($groups);$i++) { 149 // special case: sgroup1 is in the list means no other groups are present at all. 150 if ($groups[$i] == $table_prefix.'sgroup1') { 151 $sql2 = "select * from $tickets_table where status!='" . getRStatus(getHighestRank($tstatus_table)); 152 } else { 153 if (inGroup($_SESSION[user], $groups[$i])) { 154 $group_id = eregi_replace($table_prefix."sgroup", "", $groups[$i]); 155 if ($flag != 1) { 156 $sql2 .= $group_id; 157 $flag = 1; 158 } else { 159 $sql2 .= " or groupid=" . $group_id; 160 $flag = 1; 161 } //end else statement 162 } 163 } 164 } //end for loop 165 } //end else 166 $sql2 .= ")"; 167 168 switch ($sort) { 169 case ("sup"): 170 $sql2 .= " order by supporter asc, create_date asc"; 171 break; 172 case ("pus"): 173 $sql2 .= " order by supporter desc, create_date asc"; 174 break; 175 case ("sho"): 176 $sql2 .= " order by short asc, create_date asc"; 177 break; 178 case ("ohs"): 179 $sql2 .= " order by short desc, create_date asc"; 180 break; 181 case ("usr"): 182 $sql2 .= " order by user asc, create_date asc"; 183 break; 184 case ("rsu"): 185 $sql2 .= " order by user desc, create_date asc"; 186 break; 187 case ("pri"): 188 listByPriority($id, $sql2, "asc"); 189 break; 190 case ("irp"): 191 listByPriority($id, $sql2, "desc"); 192 break; 193 case ("cre"): 194 $sql2 .= " order by create_date asc"; 195 break; 196 case ("erc"): 197 $sql2 .= " order by create_date desc"; 198 break; 199 case ("sta"): 200 listByStatus($id, $sql2, "asc"); 201 break; 202 case ("ats"): 203 listByStatus($id, $sql2, "desc"); 204 break; 205 case ("tr"): 206 $sql2 .= " order by a desc"; 207 break; 208 case ("rt"): 209 $sql2 .= " order by a asc"; 210 break; 211 default: 212 $sql2 .= " order by id asc"; 213 break; 214 } 215 216 if ($sort != "pri" && $sort != "sta" && $sort != 'irp' && $sort != 'ats') { 217 $result2 = $db->query($sql2); 218 219 displayTicket($result2); 220 } 221 } 222 223 224 225 function listByPriority($id, $query, $order) 226 { 227 global $tpriorities_table, $tickets_table, $db; 228 229 $sql = "select priority from $tpriorities_table order by rank $order"; 230 $result = $db->query($sql); 231 while ($row = $db->fetch_array($result)) { 232 $query2 = $query . " and priority='$row[0]'"; 233 $result2 = $db->query($query2); 234 displayTicket($result2); 235 } 236 // now we have to list all of the tickets that have a priority other than what is in the priority list 237 // ie. if a priority gets deleted via the admin tool and there are still tickets with that priority, we 238 // still need to list them. 239 $sql = "select * from $tickets_table where "; 240 $prios = getPriorityList(); 241 for($i = 0; $i < sizeof($prios); $i++) { 242 if ($flag != 1) { 243 $sql .= "priority!='" . $prios[$i] . "'"; 244 $flag = 1; 245 } else { 246 $sql .= " and priority!='" . $prios[$i] . "'"; 247 $flag = 1; 248 } 249 } 250 251 $result3 = $db->query($sql); 252 displayTicket($result3); 253 } 254 255 function listByStatus($id, $query, $order) 256 { 257 global $tstatus_table, $tickets_table, $db; 258 259 $sql = "select status from $tstatus_table order by rank $order"; 260 $result = $db->query($sql); 261 while ($row = $db->fetch_array($result)) { 262 $query2 = $query . " and status='$row[0]'"; 263 $result2 = $db->query($query2); 264 displayTicket($result2); 265 } 266 // now we have to list all of the tickets that have a priority other than what is in the priority list 267 // ie. if a priority gets deleted via the admin tool and there are still tickets with that priority, we 268 // still need to list them. 269 $sql = "select * from $tickets_table where "; 270 $status = getStatusList(); 271 for($i = 0; $i < sizeof($status); $i++) { 272 if ($flag != 1) { 273 $sql .= "status!='" . $status[$i] . "'"; 274 $flag = 1; 275 } else { 276 $sql .= " and status!='" . $status[$i] . "'"; 277 $flag = 1; 278 } 279 } 280 281 $result3 = $db->query($sql); 282 displayTicket($result3); 283 } 284 285 286 287 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |