Skip to content

Commit

Permalink
Update v0.1.02
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Clark authored and Ray Clark committed Jan 21, 2015
2 parents b584848 + fcd4467 commit 2617b8d
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 61 deletions.
21 changes: 10 additions & 11 deletions issues_assignProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

$URL=$_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Help Desk/issues_view.php" ;


if (isActionAccessible($guid, $connection2, "/modules/Help Desk/issues_assign.php")==FALSE) {
//Fail 0
$URL = $URL."&addReturn=fail0" ;
header("Location: {$URL}");
exit();
}
Expand All @@ -51,6 +51,7 @@
$technician = $_POST["technician"];
}
else {
$URL = $URL."&addReturn=fail1" ;
header("Location: {$URL}");
exit();
}
Expand All @@ -62,11 +63,13 @@
print "</div>" ;
}
if(!($highestAction=="View issues_All&Assign")) {
$URL = $URL."&addReturn=fail0" ;
header("Location: {$URL}");
exit();
}

if($technicianID==null){
$URL = $URL."&addReturn=fail1" ;
header("Location: {$URL}");
exit();
}
Expand All @@ -75,6 +78,7 @@
$issueID = (int) $_GET["issueID"];
}
else {
$URL = $URL."&addReturn=fail1" ;
header("Location: {$URL}");
exit();
}
Expand All @@ -86,19 +90,14 @@
$result->execute($data);
}
catch(PDOException $e) {
//Fail 2q
// $fail = TRUE;
$URL = $URL."&addReturn=fail2" ;
header("Location: {$URL}");
exit();
}

$URL = $URL."&addReturn=success0" ;
header("Location: {$URL}");

// if ($fail==TRUE) {
//Fail 2
// header("Location: {$URL}");
// }
// else {
//Success 0
// header("Location: {$URL}");
// }

}
?>
16 changes: 8 additions & 8 deletions issues_create.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}

try {
$data=array();
$data=array();
$sql="SELECT * FROM gibbonSetting WHERE scope='Help Desk' AND name='issuePriority'" ;
$result=$connection2->prepare($sql);
$result->execute($data);
Expand All @@ -75,7 +75,7 @@
}
}
try {
$data=array();
$data=array();
$sql="SELECT * FROM gibbonSetting WHERE scope='Help Desk' AND name='issuePriorityName'" ;
$result=$connection2->prepare($sql);
$result->execute($data);
Expand All @@ -84,7 +84,7 @@
$row=$result->fetch() ;
$priorityName = $row["value"];
try {
$data=array();
$data=array();
$sql="SELECT * FROM gibbonSetting WHERE scope='Help Desk' AND name='issueCategory'" ;
$result=$connection2->prepare($sql);
$result->execute($data);
Expand Down Expand Up @@ -123,7 +123,7 @@
print "</td>";
print "<td class=\"right\">";
print "<select name='category' id='category' style='width:302px'>" ;
print "<option value=''>Please select...</option>" ;
print "<option value=''>Please select...</option>" ;
foreach($categoryOptions as $option) {
$selected="" ;
if ($option==$filter) {
Expand Down Expand Up @@ -163,7 +163,7 @@
print "</td>";
print "<td class=\"right\">";
print "<select name='priority' id='priority' style='width:302px'>" ;
print "<option value=''>Please select...</option>" ;
print "<option value=''>Please select...</option>" ;
foreach($priorityOptions as $option) {
$selected="" ;
if ($option==$filter) {
Expand Down Expand Up @@ -193,20 +193,20 @@
<option value=''>Select...</option>
<?php
try {
$data=array();
$data=array();
$sql="SELECT gibbonPersonID, surname, preferredName, title FROM gibbonPerson WHERE status='Full'" ;
$result=$connection2->prepare($sql);
$result->execute($data);
}
catch(PDOException $e) { }
while(($row = $result->fetch())!=null) {
if(intval($row["gibbonPersonID"])!=$_SESSION[$guid]["gibbonPersonID"]) {
print "<option value='" . $row["gibbonPersonID"] . "'>". formatName($row['title'],$row['preferredName'],$row['surname'], "Student", FALSE, FALSE) ."</option>" ;
print "<option value='" . $row["gibbonPersonID"] . "'>". formatName($row['title'],$row['preferredName'],$row['surname'], "Student", FALSE, FALSE) ."</option>" ;
}
}
?>
</select>
</td>
</td>
</tr>
<?php
}
Expand Down
5 changes: 3 additions & 2 deletions issues_createProccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
header("Location: {$URL}");
}
else {

$personID = $_SESSION[$guid]["gibbonPersonID"];
//Proceed!
if(isset($_POST["name"])) {
Expand All @@ -65,7 +66,7 @@
$personID = $_POST["createFor"];
$createdByID = $_SESSION[$guid]["gibbonPersonID"];
}


if ($name=="" || $description=="") {
//Fail 3
Expand All @@ -84,7 +85,7 @@
$URL=$URL . "/issues_create.php&addReturn=fail2";
header("Location: {$URL}");
break ;
}
}

$issueID = $connection2->lastInsertId();
setNotification($connection2, $guid, $personID, "A new issue has been created on your behalf.", "Help Desk", "/index.php?q=/modules/Help Desk/issues_discuss_view.php&issueID=" . $issueID);
Expand Down
5 changes: 4 additions & 1 deletion issues_createTechnicianProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
$URL=$_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/" . getModuleName($_POST["address"]) . "/issues_manage_technicians.php" ;

if (isActionAccessible($guid, $connection2, "/modules/Help Desk/issues_createTechnician.php")==FALSE) {
$URL = $URL."&addReturn=fail0" ;
header("Location: {$URL}");
}
else {
Expand All @@ -49,6 +50,7 @@
}

if ($person == "" || technicianExistsFromPersonID($connection2, $person)) {
$URL = $URL."&addReturn=fail1" ;
header("Location: {$URL}");
}
else {
Expand All @@ -61,11 +63,12 @@
$result->execute($data);
}
catch(PDOException $e) {
print $e ;
$URL = $URL."&addReturn=fail2" ;
break ;
}

//Success 0
$URL = $URL."&addReturn=success0" ;
header("Location: {$URL}");

}
Expand Down
38 changes: 33 additions & 5 deletions issues_discuss_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,34 @@
echo $e->getMessage();
}

if (isset($_GET["addReturn"])) { $addReturn=$_GET["addReturn"] ; } else { $addReturn="" ; }
$addReturnMessage="" ;
$class="error" ;
if (!($addReturn=="")) {
if ($addReturn=="fail0") {
$addReturnMessage=_("Your request failed because you do not have access to this action.") ;
}
else if ($addReturn=="fail2") {
$addReturnMessage=_("Your request failed due to a database error.") ;
}
else if ($addReturn=="fail3") {
$addReturnMessage=_("Your request failed because your inputs were invalid.") ;
}
else if ($addReturn=="fail4") {
$addReturnMessage="Your request failed because your inputs were invalid." ;
}
else if ($addReturn=="fail5") {
$addReturnMessage="Your request was successful, but some data was not properly saved." ;
}
else if ($addReturn=="success0") {
$addReturnMessage=_("Your request was completed successfully. You can now add another record if you wish.") ;
$class="success" ;
}
print "<div class='$class'>" ;
print $addReturnMessage;
print "</div>" ;
}

$issueID=$_GET["issueID"] ;
$data=array("issueID"=>$issueID) ;

Expand All @@ -65,7 +93,7 @@
$sql3="SELECT * FROM helpDeskIssueDiscuss WHERE issueID=:issueID ORDER BY timestamp ASC" ;
$result3=$connection2->prepare($sql3);
$result3->execute($data);

$sql4="SELECT helpDeskIssue.createdByID, surname , preferredName , title FROM helpDeskIssue JOIN gibbonPerson ON (helpDeskIssue.createdByID=gibbonPerson.gibbonPersonID) WHERE issueID=:issueID";
$result4=$connection2->prepare($sql4);
$result4->execute($data);
Expand All @@ -74,7 +102,7 @@
catch(PDOException $e) {
print $e ;
}

if (!isset($array2[0]["gibbonPersonID"])) {
$technicianName = "UNASSIGNED" ;
} else {
Expand Down Expand Up @@ -128,12 +156,12 @@
exit();
}
}

$tdWidth = "33%" ;
if(isset($row4["createdByID"])) {
$tdWidth = "25%";
}
}

while ($row=$result->fetch()){
$studentName = formatName($row["title"] , $row["preferredName"] , $row["surname"] , "Student", FALSE, FALSE);
print "<h1>" . $row["issueName"] . "</h1>" ;
Expand Down
4 changes: 2 additions & 2 deletions issues_discuss_view_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
if (!relatedToIssue($connection2, $_GET["issueID"], $_SESSION[$guid]["gibbonPersonID"]) && !($highestAction=="View issues_All&Assign" || $highestAction=="View issues_All")) {
//Fail 0
print "<div class='error'>" ;
print "You do not have access to this action." ;
print "</div>" ;
print "You do not have access to this action." ;
print "</div>" ;
exit();
}

Expand Down
8 changes: 4 additions & 4 deletions issues_discuss_view_postProccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
header("Location: {$URL}");
}
//Write to database


$isTech = isTechnician($_SESSION[$guid]["gibbonPersonID"], $connection2) && !isPersonsIssue($connection2, $issueID, $_SESSION[$guid]["gibbonPersonID"]);

try {
$data=array("issueDiscussID"=>0 , "issueID"=>$issueID, "comment"=>$comment, "timestamp" => date("Y-m-d H:i:a"), "gibbonPersonID" => $_SESSION[$guid]["gibbonPersonID"]) ;
Expand All @@ -77,7 +78,7 @@
header("Location: {$URL}");
break ;
}

$isTech = isTechnician($_SESSION[$guid]["gibbonPersonID"], $connection2) && !isPersonsIssue($connection2, $issueID, $_SESSION[$guid]["gibbonPersonID"]) || $highestAction=="View issues_All&Assign" || $highestAction=="View issues_All";

$message = "A new message has been left for you";
Expand All @@ -95,8 +96,7 @@
else {
$personID = getTechWorkingOnIssue($connection2, $issueID);
}
setNotification($connection2, $guid, $personID, $message, "Help Desk", "/index.php?q=/modules/Help Desk/issues_discuss_view.php&issueID=" . $issueID);

setNotification($connection2, $guid, $personID, $message, "Help Desk", "/index.php?q=/modules/Help Desk/issues_discuss_view.php&issueID=" . $issueID);

//Success 2 aka Posted
$URL=$URL . "&addReturn=success2" ;
Expand Down
29 changes: 29 additions & 0 deletions issues_manage_technicians.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,35 @@
print "<div class='trail'>" ;
print "<div class='trailHead'><a href='" . $_SESSION[$guid]["absoluteURL"] . "'>" . _("Home") . "</a> > <a href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/" . getModuleName($_GET["q"]) . "/" . getModuleEntry($_GET["q"], $connection2, $guid) . "'>" . _(getModuleName($_GET["q"])) . "</a> > </div><div class='trailEnd'>" . _('Assign Issue') . "</div>" ;
print "</div>" ;

if (isset($_GET["addReturn"])) { $addReturn=$_GET["addReturn"] ; } else { $addReturn="" ; }
$addReturnMessage="" ;
$class="error" ;
if (!($addReturn=="")) {
if ($addReturn=="fail0") {
$addReturnMessage=_("Your request failed because you do not have access to this action.") ;
}
else if ($addReturn=="fail2") {
$addReturnMessage=_("Your request failed due to a database error.") ;
}
else if ($addReturn=="fail3") {
$addReturnMessage=_("Your request failed because your inputs were invalid.") ;
}
else if ($addReturn=="fail4") {
$addReturnMessage="Your request failed because your inputs were invalid." ;
}
else if ($addReturn=="fail5") {
$addReturnMessage="Your request was successful, but some data was not properly saved." ;
}
else if ($addReturn=="success0") {
$addReturnMessage=_("Your request was completed successfully. You can now add another record if you wish.") ;
$class="success" ;
}
print "<div class='$class'>" ;
print $addReturnMessage;
print "</div>" ;
}


try {
$data=array();
Expand Down
6 changes: 1 addition & 5 deletions issues_resolveProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,15 @@
$result->execute($data);
}
catch(PDOException $e) {
//Fail 2q
print $e;
$URL=$URL . "&addReturn=fail2" ;
header("Location: {$URL}");
break ;
}

//Success 0
$URL=$URL . "&addReturn=success0" ;
header("Location: {$URL}");
}
else
{
else {
$URL=$URL . "&addReturn=fail0" ;
header("Location: {$URL}");
}
Expand Down
6 changes: 3 additions & 3 deletions issues_technicianDeleteProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$technicianID=$_GET["technicianID"] ;
}
else {
$URL=$URL . "&addReturn=fail0" ;
$URL=$URL . "&addReturn=fail1" ;
header("Location: {$URL}");
}
//Write to database
Expand All @@ -66,8 +66,8 @@
$result2->execute($data);
} catch(PDOException $e) {
//Fail 2
print $e ;
break ;
$URL = $URL."&addReturn=fail2" ;
header("Location: {$URL}");
}
//Success 0
$URL=$URL . "&addReturn=success0" ;
Expand Down
Loading

0 comments on commit 2617b8d

Please sign in to comment.