function home()
{
    DoMenu();
    global $db, $maintablewidth, $backover, $backout, $background, $maintablealign, $sess_uid, $prefix, $tr_color1;
    if (!isset($_GET['order']) && !isset($_POST['keywords'])) {
        $_GET['order'] = 'Open';
    }
    // PROCESS THE FUNCTIONS WHEN THE CHECKBOXES ARE CHECKED - IE OPEN CLOSE TICKET
    if (isset($_POST['status'])) {
        if (isset($_POST['ticket'])) {
            foreach ($_POST['ticket'] as $ticketid) {
                $query = "\tUPDATE " . $prefix . "_hosting_tickets_tickets\r\n\t\t\t\t\t\t\t\tSET tickets_status = '" . $_POST['status'] . "'\r\n\t\t\t\t\t\t\t\tWHERE tickets_id = '" . $ticketid . "'";
                if ($db->sql_query($query)) {
                    $msg = 'Ticket ' . $_POST['status'];
                } else {
                    $msg = 'This could not be done at this time';
                }
            }
        } else {
            $msg = 'Please select a Ticket.';
        }
        ?>
				<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="<?php 
        echo $maintablealign;
        ?>
">
				  <tr bgcolor="#AACCEE">
					<td><p><?php 
        echo $msg;
        ?>
</p></td>
				  </tr>
				</table>
<?php 
    }
    // QUERY TO SELECT THE TICKETS LISTING - THIS CAN BE CHANGED TO OPEN OR CLOSED ONLY
    // DEPENDING ON THE LINK THAT IS HIT ON THE NAV BAR - HOME PAGE DEFAULTS TO BOTH.
    $query = "\tSELECT tickets_id, tickets_subject, tickets_timestamp, tickets_status, tickets_status_name, tickets_status_color, tickets_categories_name\r\n\t\t\t\t\tFROM " . $prefix . "_hosting_tickets_tickets a, " . $prefix . "_hosting_tickets_status b, " . $prefix . "_hosting_tickets_categories c\r\n\t\t\t\t\tWHERE a.tickets_uid = '" . $sess_uid . "'\r\n\t\t\t\t\tAND a.tickets_child = '0'\r\n\t\t\t\t\tAND a.tickets_urgency = b.tickets_status_id\r\n\t\t\t\t\tAND a.tickets_category = c.tickets_categories_id";
    if (isset($_GET['order'])) {
        $query .= "\tAND a.tickets_status = '" . $_GET['order'] . "'";
        $addon = '&amp;order=' . $_GET['order'];
    } elseif (isset($_POST['keywords'])) {
        $query .= "\tAND a.tickets_subject LIKE '%" . $_POST['keywords'] . "%'";
        $addon = '';
    }
    $query .= '	ORDER BY a.tickets_id DESC, a.tickets_timestamp DESC';
    $result = $db->sql_query($query);
    $totaltickets = $db->sql_numrows($result);
    ?>
			<div style="padding-top:5"></div>
			<table width="<?php 
    echo $maintablewidth;
    ?>
" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="<?php 
    echo $maintablealign;
    ?>
">
			  <tr bgcolor="<?php 
    echo $background;
    ?>
">
				<td class="boxborder"><p>Recent Tickets
<?php 
    if ($totaltickets > '0') {
        echo ' ' . $totaltickets . ' - Click on the Ticket Number to read the ticket.';
    } else {
        echo ' 0';
    }
    ?>
				</p></td>
			  </tr>
			</table>
<?php 
    if ($totaltickets > '0') {
        ?>
				<script language="javascript">
				<!--
				function check_all()
					{
					for (var c = 0; c < document.myform.elements.length; c++)
					  	{
				  		if (document.myform.elements[c].type == 'checkbox')
						    	{
							if(document.myform.elements[c].checked == true)
								{
								document.myform.elements[c].checked = false;
								}
								else
									{
									document.myform.elements[c].checked = true;
									}
							}
						}
					}
				// -->
				</script>

				<form name="myform" action="modules.php?name=<?php 
        echo $_GET[name];
        ?>
&amp;caseid=home<?php 
        echo $addon;
        ?>
" method="post">
				<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="<?php 
        echo $maintablealign;
        ?>
">
				  <tr align="center" bgcolor="<?php 
        echo $background;
        ?>
">
					<td class="boxborder"><p><b>Ticket ID</b></p></td>
					<td class="boxborder"><p><b>Replies</b></p></td>
					<td class="boxborder"><p><b>Subject</b></p></td>
					<td class="boxborder"><p><b>Date / Time</b></p></td>
					<td class="boxborder"><p><b>Urgency</b></p></td>
					<td class="boxborder"><p><b>Department</b></p></td>
					<td class="boxborder"><p><b>Status</b></p></td>
				  </tr>
<?php 
        // LOOP THROUGH THE REQUESTS FOR THE USERS ACCOUNT
        while ($row = $db->sql_fetchrow($result)) {
            // QUERY TO GET THE AMOUNT OF REPLIES TO A CERTAIN TICKET AND DATE OF LAST ENTRY
            $queryA = "\tSELECT COUNT(*) FROM " . $prefix . "_hosting_tickets_tickets WHERE tickets_child = '" . $row[tickets_id] . "'";
            $resultA = $db->sql_query($queryA);
            $rowA = $db->sql_fetchrow($resultA);
            if ($rowA['0'] <= '0') {
                $rowA['0'] = '0';
            }
            //	508		<td class="boxborder" onclick="check_all();" style="cursor:hand"><p><b><u>All</u></b></p></td>
            //	540		<td class="boxborder"><input type="checkbox" name="ticket[]" value="<?php echo $tickets_id
            ?>
					<tr align="center" bgcolor="<?php 
            echo UseColor();
            ?>
">
						<td class="boxborder" bgcolor="<?php 
            echo $backout;
            ?>
" onmouseover="this.style.background='<?php 
            echo $backover;
            ?>
';window.status='Read Ticket';return true;" onmouseout="this.style.background='<?php 
            echo $backout;
            ?>
';window.status=' ';return true;"><p>
							<a href="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?name=<?php 
            echo $_GET[name];
            ?>
&amp;caseid=view&amp;ticketid=<?php 
            echo $row[tickets_id];
            ?>
" style="width:100%"><?php 
            echo $row[tickets_id];
            ?>
</a>
						</p></td>
						<td class="boxborder"><p>[<?php 
            echo $rowA['0'];
            ?>
]</p></td>
						<td class="boxborder"><p><?php 
            echo $row[tickets_subject];
            ?>
</p></td>
						<td class="boxborder"><p><?php 
            echo $row[tickets_timestamp];
            ?>
</p></td>
						<td class="boxborder" bgcolor="#<?php 
            echo $row[tickets_status_color];
            ?>
"><p><?php 
            echo $row[tickets_status_name];
            ?>
</p></td>
						<td class="boxborder"><p><?php 
            echo $row[tickets_categories_name];
            ?>
</p></td>
						<td class="boxborder"><p>
<?php 
            if ($row[tickets_status] == 'Closed') {
                echo '<span style="color:#FF0000">';
            } else {
                echo '<span style="color:#000000">';
            }
            echo $row[tickets_status] . '</span></p></td>
						  </tr>';
        }
        ?>

				</table>
				</form>
<?php 
    } else {
        if (isset($_POST['keywords'])) {
            $msg = 'Sorry but the search returned Zero results please try again.';
        } else {
            $msg = 'You have no recent tickets for your account.';
        }
        ?>
					<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1" class="boxborder" align="<?php 
        echo $maintablealign;
        ?>
">
					  <tr>
						<td><p><?php 
        echo $msg;
        ?>
</p></td>
					  </tr>
					</table>
<?php 
    }
}
Exemple #2
0
    <td class="boxborder text"><b>Action</b></td>
  </tr>
  <?php 
        // LOOP THROUGH ALL EXISTING USERS IN THE DATABASE AND GIVE OPTIONS TO SUSPEND - DELETE ETC
        $query = '	SELECT tickets_status_id, tickets_status_name, tickets_status_order, tickets_status_color
					FROM tickets_status
					ORDER BY tickets_status_id ASC';
        $result = sql_query_read($query);
        while ($row = mysql_fetch_array($result)) {
            ?>
  <form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?caseid=status" Method="post">
    <tr bgcolor="<?php 
            echo UseColor();
            ?>
">
      <td class="boxborder text"><?php 
            echo $row['tickets_status_id'];
            ?>
</td>
      <td class="boxborder"><input name="status" value="<?php 
            echo $row['tickets_status_name'];
            ?>
" size="40" /></td>
      <td class="boxborder"><input name="order" value="<?php 
            echo $row['tickets_status_order'];
            ?>
" size="20" /></td>
      <td class="boxborder text" bgcolor="#<?php 
    function Status()
    {
        global $db, $maintablealign, $maintablewidth;
        // EDIT OR DELETE USER SETTINGS
        if (isset($_POST['sub']) && isset($_POST['depid'])) {
            if ($_POST['sub'] == 'Delete') {
                $query = "DELETE FROM nuke_hosting_tickets_status WHERE tickets_status_id = '" . $_POST['depid'] . "'";
                $actiontaken = 'Status Deleted';
            } elseif ($_POST['sub'] == 'Edit') {
                $query = "\tUPDATE nuke_hosting_tickets_status SET tickets_status_name = '" . $_POST['status'] . "', tickets_status_order = '" . $_POST['order'] . "',\r\n\t\t\t\ttickets_status_color = '" . $_POST['color'] . "' WHERE tickets_status_id = '" . $_POST['depid'] . "'";
                $actiontaken = 'Edited';
            }
            $result = $db->sql_query($query);
            PageTitle('Status ' . $_POST['depid'] . ' ' . $actiontaken);
        }
        ?>
	<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1"  align="<?php 
        echo $maintablealign;
        ?>
">
		<tr bgcolor="#AACCEE">
			<td><p>Please add in all the details below for the each status.</p></td>
		</tr>
	</table>

	<form action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?op=Support&amp;caseid=status" method="post">
	<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1"  align="<?php 
        echo $maintablealign;
        ?>
">
		<tr><td><br /><p>Be careful about deleting status's. Deleting them will cause
			errors with all tickets assigned to that particular status. Therefore be careful
			when you add them, make sure they are concise and what you want. Order refers
			to where in the list it will appear, 1 being first.<br /><br />
				<table width="300" cellpadding="0" cellspacing="0" align="center">
					<tr>
						<td><p>Status Name:</p></td>
						<td><input name="firstname" size="30"
<?php 
        if (isset($_POST['userform']) && isset($_POST['firstname']) && $_POST['firstname'] != '') {
            echo ' value="' . $_POST['name'] . '"';
        } else {
            echo ' style="background-color:#FDD3D4"';
            $error = 'T';
        }
        ?>
						> <input type="submit" value="Submit" name="userform" /></td>
				  	</tr>
<?php 
        if (!isset($error)) {
            $query = "\tINSERT INTO nuke_hosting_tickets_status SET tickets_status_name = '" . $_POST['name'] . "'";
            $result = $db->sql_query($query);
            ?>
					<tr>
						<td colspan="2"><p><b>Everythings OK Status added.</b></p></td>
					</tr>
<?php 
        }
        ?>
				</table><br>
			</p></td>
		</tr>
	</table>
	</form>

	<table width="<?php 
        echo $maintablewidth;
        ?>
" cellspacing="1" cellpadding="1" border="1"  align="<?php 
        echo $maintablealign;
        ?>
">
		<tr>
			<td colspan="5" bgcolor="#AACCEE"><p>Status's Already In The System.</p></td>
		</tr><tr>
			<td><p><b>ID.</b></p></td>
			<td><p><b>Status</b></p></td>
			<td><p><b>Order</b></p></td>
			<td><p><b>Color</b></p></td>
			<td><p><b>Action</b></p></td>
		</tr>
<?php 
        // LOOP THROUGH ALL EXISTING USERS IN THE DATABASE AND GIVE OPTIONS TO SUSPEND - DELETE ETC
        $query = "SELECT tickets_status_id, tickets_status_name, tickets_status_order, tickets_status_color FROM nuke_hosting_tickets_status ORDER BY tickets_status_id ASC";
        $result = $db->sql_query($query);
        while ($row = $db->sql_fetchrow($result)) {
            ?>
				<form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?op=Support&amp;caseid=status" Method="post">
				<tr bgcolor="<?php 
            echo UseColor();
            ?>
">
					<td><p><?php 
            echo $row[tickets_status_id];
            ?>
</p></td>
					<td><input name="status" value="<?php 
            echo $row[tickets_status_name];
            ?>
" size="40" /></td>
					<td><input name="order" value="<?php 
            echo $row[tickets_status_order];
            ?>
" size="20" /></td>
					<td bgcolor="#<?php 
            echo $row[tickets_status_color];
            ?>
"><input name="color" value="<?php 
            echo $row[tickets_status_color];
            ?>
" size="20" /></td>
					<td><p>
					<input type="submit" name="sub" value="Delete" onclick="return deletemember()" />
					<input type="hidden" name="depid" value="<?php 
            echo $row[tickets_status_id];
            ?>
">
					<input type="submit" name="sub" value="Edit" />
					</p></td>
				  </tr>
				</form>
<?php 
        }
        ?>
	</table>
<?php 
    }