예제 #1
0
         $assignedengineer = $_POST['cmn-toggle-selfassign'];
     }
     if ($row->email_on_newticket == '1') {
         // email all engineers of this helpdesk so they know something has been added.
         // Get engineers emails
         $STHemail = $DBH->Prepare('SELECT engineerEmail FROM engineers WHERE helpdesk = :helpdesk');
         $STHemail->bindParam(':helpdesk', $_POST['helpdesk'], PDO::PARAM_INT);
         $STHemail->setFetchMode(PDO::FETCH_OBJ);
         $STHemail->execute();
         while ($rowemail = $STHemail->fetch()) {
             //Construct message
             $to = $rowemail->engineerEmail;
             $message = "<p>" . $_POST['name'] . " has added a ticket to the " . helpdesk_friendlyname($_POST['helpdesk']) . " Helpdesk</p>";
             $message .= "<p>To view the details of this ticket please <a href='" . HELPDESK_LOC . "'>Visit " . CODENAME . "</a></p>";
             $message .= "<p>This is an automated message please <b>do not reply, login to update your ticket</b></p></span>";
             $msgtitle = "New Helpdesk Added to " . helpdesk_friendlyname($_POST['helpdesk']) . " helpdesk";
             $headers = 'From: Helpdesk@cheltladiescollege.org' . "\r\n";
             $headers .= 'Reply-To: helpdesk@cheltladiescollege.org' . "\r\n";
             $headers .= 'MIME-Version: 1.0' . "\r\n";
             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
             $headers .= 'X-Mailer: PHP/' . phpversion();
             // In case any of our lines are larger than 70 characters, we wordwrap()
             $message = wordwrap($message, 70, "\r\n");
             // Send email
             mail($to, $msgtitle, $message, $headers);
         }
     }
 }
 // Check form for auto close and set status acordingly
 if ($_POST['cmn-toggle-retro'] !== null) {
     $status = '2';
<?php

session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/functions.php';
?>
<h3>Closed this month</h3>
<?php 
$STH = $DBH->Prepare("SELECT Month(closed) AS MonthNum, helpdesk, count(callid) AS Totals\n\t\tFROM calls\n\t\tWHERE status = 2 AND Month(closed) = :month AND Year(closed) = :year\n\t\tGROUP BY helpdesk, Month(closed)\n\t\tORDER BY helpdesk, MonthNum");
$STH->bindParam(':month', date("m"), PDO::PARAM_INT);
$STH->bindParam(':year', date("o"), PDO::PARAM_INT);
$STH->setFetchMode(PDO::FETCH_OBJ);
$STH->execute();
while ($row = $STH->fetch()) {
    $lables .= "' " . helpdesk_friendlyname($row->helpdesk) . "(" . $row->Totals . ") ',";
    $data .= $row->Totals . ",";
}
$data = rtrim($data, ",");
$lables = rtrim($lables, " ,");
?>

<script type="text/javascript">
	$(function() {
	// WAIT FOR DOM
	// Draw Bar chartist.js
	var data = {
		labels: [<?php 
echo $lables;
?>
],
		series: [<?php 
<?php

session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/config/config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/functions.php';
?>
<h3>Category Breakdown This Month</h3>
<?php 
$STH = $DBH->Prepare("SELECT Month(closed) AS MonthNum, helpdesk, category, count(callid) AS Totals\n\t\tFROM calls\n\t\tWHERE status = 2 AND Month(closed) = :month AND Year(closed) = :year\n\t\tGROUP BY category\n\t\tORDER BY Totals");
$STH->bindParam(':month', date("m"), PDO::PARAM_INT);
$STH->bindParam(':year', date("o"), PDO::PARAM_INT);
$STH->setFetchMode(PDO::FETCH_OBJ);
$STH->execute();
while ($row = $STH->fetch()) {
    $lables .= "'" . category_friendlyname($row->category) . " (" . helpdesk_friendlyname($row->helpdesk) . ")',";
    $data .= $row->Totals . ",";
}
$data = rtrim($data, ",");
$lables = rtrim($lables, " ,");
?>

<script type="text/javascript">
	$(function() {
	// WAIT FOR DOM
	// Draw Bar chartist.js
	var data = {
		labels: [<?php 
echo $lables;
?>
],
		series: [[<?php 
    ?>
	<?php 
    echo helpdesk_friendlyname(1);
    ?>
, <?php 
    echo helpdesk_friendlyname(2);
    ?>
, <?php 
    echo helpdesk_friendlyname(3);
    ?>
.
	<?php 
} else {
    ?>
	<?php 
    echo helpdesk_friendlyname($_SESSION['engineerHelpdesk']);
    ?>
	<?php 
}
?>
</p>
	<table>
	<tbody>
	<?php 
if ($_SESSION['engineerHelpdesk'] <= '3') {
    $STH = $DBH->Prepare("SELECT * FROM calls WHERE helpdesk <= :helpdeskid AND status !='2'");
    $hdid = 3;
} else {
    $STH = $DBH->Prepare("SELECT * FROM calls WHERE helpdesk = :helpdeskid AND status !='2'");
    $hdid = $_SESSION['engineerHelpdesk'];
}