Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
<?php
$paginas = array(1,2,3);
foreach ($paginas as $p) { echo '<a href="?p='.$p.'">pagina '.$p.'</a><br />'; }
if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['p']) && in_array($_GET['p'],$paginas)) {
//dit staat op elke pagina, als $_GET['p'] bestaat en geldig is
echo 'dit is pagina '.$_GET['p'].'<br />';
//dit staat alleen op pagina 2
if ($_GET['p'] == 2) {
echo 'uniek stukje tekst<br />';
}
}
?>
<?php
// DETAIL.PHP: DETAIL bestand voor Support Request System
// datum: 9-04-2003
// inhoud:
// detail.php - show details of a single request with possibility to make changes
// includes
include("SRSconfig.php");
include("SRSFunctions.php");
$maxKB=$max_file_size / 1024;
/**** Browser Title ****/
Headtitle();
/**************************FUNCTIONS*****************************************/
function upload($attachment="", $attachment_type="text/plain")
{
global $map, $attachment_name, $hostname;
$error = validate_upload($attachment, $attachment_type);
if ($error)
{
javaAlert($error);
}
else
{
// cool, we can continue
if (!@move_uploaded_file($_FILES['attachment']['tmp_name'], $map . "/" . basename($attachment)))
{
javaalert("Could not move the uploade file ro its destination! Click OK to try to copy.");
if (!@copy($_FILES['attachment']['tmp_name'], $map . "/" . basename($attachment)))
{
javaAlert("Unknown error while copying the file to its destination: check the path to and the permissions for the upload directory!");
}
}
else // attachment was uploaded successfully:
{
$connection = odbc_connect("$hostname", "", "") or die("Database unavailable!");
$ID = getRequestId($connection);
$markeerBijSabern = "true";
$markeerBijKlant = "false";
if ($_SESSION["SESSION_UserLevel"] == "Medewerker")
{
$markeerBijSabern = "false";
$markeerBijKlant = "true";
}
$updateQuery = "UPDATE Request SET MarkeerBijSabern = ".$markeerBijSabern.", MarkeerBijKlant = ".$markeerBijKlant." WHERE ID = ".$ID;
$updateResult = odbc_exec($connection, $updateQuery) or die ("Unable to update request data!");
odbc_free_result($updateResult);
odbc_close($connection);
}
}
} // END upload
function validate_upload($attachment, $attachment_type)
{
global $max_file_size, $max_image_width, $max_height_width,$allowed_types,$registered_types;
$start_error = "Error: ";
if ($attachment == "")
{
//do we even have a file?
$error .= "You have not chosen a file to attach/upload!";
}
//possible check for type of attachment (jpg, txt, etc.): see checkattachment_part.php
if ($error)
{
$error = $start_error . $error;
return $error;
}
else
{
return false;
}
} // END validate_upload
/**************************END FUNCTIONS*****************************************/
// check for valid user session
session_start();
if (!session_is_registered("SESSION_UserID"))
{
header("Location: index.php?ec=1");
exit;
}
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function CheckLength(fieldname, maxlen)
{
var invoer= document.forms[0].elements[fieldname].value;
if (invoer.length > maxlen)
{
alert("You have entered more text (" + invoer.length + " chars.) than this field can store (maximum number of characters is " + maxlen + "). Please correct.");
document.forms[0].elements[fieldname].focus();
return false;
}
}
function dateupdate(RID)
{
str = "changesolvedate.php?RID=" + RID;
window.open(str);
}
function hoursspend(RID, RKlant)
{
str = "fillhours.php?RID="+RID+"&RKlant="+RKlant;
window.open(str);
}
//-->
</SCRIPT>
<?php
// First, check whether the current user is either:
// - a Sabern employee
// - employee of the customer that submitted the current request
/*******************************************************************/
$connection = odbc_connect("$hostname", "", "") or die("Database unavailable!");
$send=PostGet("send");
$attachment=PostGet("attachment");
$ID = getRequestId($connection);
if ($send=="Send")
{
$map=sprintf("Attachment/%05d", $ID);
if (!is_dir($map))
{
if (!mkdir($map))
{
JavaAlert("Sorry: no map could be made to store the attachment you want to upload");
$send="";
}
}
if ($send=="Send")
{
if ($attachment=="")
{
$attachment=$_FILES['attachment']['name'];
}
//user sent or pushed button to send
upload($attachment, $attachment_type);
$send="";
}
}
/*******************************************************************/
$Type = $_SESSION["SESSION_UserLevel"];
$query = "SELECT * from Gebruiker, Klant WHERE Gebruiker.ID = ".$_SESSION["SESSION_UserID"]." AND Gebruiker.Klant = Klant.Klantnaam";
$result = odbc_exec($connection, $query) or die ("Unable to retrieve customer data!");
if (odbc_fetch_row($result))
{
$Klant = odbc_result($result,"Klantnaam");
}
else
{
echo "ERROR: User not attached to customer<br>";
exit;
}
if ($Type == "Medewerker")
printf("<p class=\"User\">%s (%s)</p>", $_SESSION["SESSION_FullName"], $Type);
else
printf("<p class=\"User\">%s (%s)</p>", $_SESSION["SESSION_FullName"], $Klant);
if ($Type == "Medewerker")
$Filter .= "";
if ($Type == "Klant")
$Filter .= " AND Request.Klant='$Klant'";
$query = "SELECT Request.ID As RID, Request.Klant As RKlant, * FROM Request, Contactpersoon, Status WHERE Request.ID=".$ID;
$result = odbc_exec($connection, $query) or die ("Unable to retrieve request and customer data! Query: ".$query);
?>
<link rel="stylesheet" type="text/css" href="srs.css" media="screen"></link>
<form action="save.php" method="POST" class="DetailForm" >
<input type="hidden" name="RID" value="<?php echo $ID; ?>"/>
<table class="list" border="0">
<?php
if (odbc_fetch_row($result))
{
printf(" <tr><td colspan=\"4\" class=\"DetailHeader\">Request %05d</td></tr>\n", $ID);
printf(" <tr style=\"height: 20px\"><td colspan=\"4\"> </td></tr>\n");
$maxlen=GetFieldLength("Titel");
echo "<tr>\n";
echo "<td class=\"Detail\">Short description:</td>";
echo "<td><textarea name=\"titel\" maxlength=\"$maxlen\" cols=\"60\" rows=\"1\">";
printf( "%s </textarea></td>\n", trim (odbc_result($result,"Titel")));
//-----------Select Priority---------------//
printf(" <td class=\"Detail\">Priority:</td><td><select name=\"prioriteit\">\n");
$queryPrio = "SELECT * FROM Prioriteit ORDER BY Waarde";
$resultPrio = odbc_exec($connection, $queryPrio) or die ("Unable to retrieve priorities!");
while (odbc_fetch_row($resultPrio))
{
$Prio = odbc_result($resultPrio,"Prioriteitnaam");
$PrioLabel=odbc_result($resultPrio,"Prioriteitlabel");
$PrioriteitID=odbc_result($resultPrio,"ID");
if (odbc_result($result,"Prioriteit") == $Prio || odbc_result($result,"PrioriteitID") == $PrioriteitID)
printf(" <option value=\"%s\" selected>%s</option>\n", $PrioriteitID, $PrioLabel);
else
printf(" <option value=\"%s\">%s</option>\n", $PrioriteitID, $PrioLabel);
}
printf(" </select></td></tr>\n");
odbc_free_result($resultPrio);
//----textarea----
$maxlen=GetFieldLength("Omschrijving");
$omschrijving = odbc_result($result,"Omschrijving");
$rowcount = getRowCount($omschrijving,2,15);
printf(" <tr>\n <td class=\"Detail\">Detailed description:</td><td rowspan=\"2\">");
printf("<textarea name=\"omschrijving\" cols=\"70\" rows=\"".$rowcount."\" onchange=\"javascript: CheckLength('omschrijving', $maxlen);\">");
printf("%s</textarea></td>", $omschrijving);
//-----------Select Category---------------//
printf(" <td class=\"Detail\">Category:</td><td class=\"Detail\"><select name=\"categorie\">\n");
$queryCat = "SELECT * FROM Categorie";
$resultCat = odbc_exec($connection, $queryCat) or die ("Unable to retrieve categories!");
while (odbc_fetch_row($resultCat))
{
$Cat = odbc_result($resultCat,"Categorienaam");
$CatLabel = odbc_result($resultCat,"Categorielabel");
$CategorieID=odbc_result($resultCat,"ID");
if (odbc_result($result,"Categorie") == $Cat || odbc_result($result,"CategorieID") == $CategorieID)
printf(" <option value=\"%s\" selected>%s</option>\n", $CategorieID, $CatLabel);
else
printf(" <option value=\"%s\">%s</option>\n", $CategorieID, $CatLabel);
}
printf(" </select></td></tr>\n");
odbc_free_result($resultCat);
($Type == "Medewerker") ? $ReadOnly = "" : $ReadOnly = "disabled";
//-----------Select Status---------------//
$Stat = odbc_result($result,"Status");
$StatusID = odbc_result($result,"StatusID");
echo "<tr><td></td><td class=\"Detail\">Status:</td><td class=\"Detail\">\n<select name=\"status\" $ReadOnly>\n";
// $queryStat = "SELECT * FROM Status, StatusOvergang WHERE Statusnaam = '$Stat' AND Statusnaam = HuidigeStatus ORDER BY Waarde";
$queryStat = "SELECT * FROM Status, StatusOvergang WHERE Status.ID=$StatusID ";
$queryStat.= "AND Status.ID = StatusOvergang.HuidigeStatusID ORDER BY Waarde";
$resultStat = odbc_exec($connection, $queryStat) or die ("Unable to retrieve status!");
if (odbc_fetch_row($resultStat))
{
//===Vorige status
$queryPrev="SELECT * FROM Status WHERE ID=".odbc_result($resultStat,"VorigeStatusID");
$resultPrev=odbc_exec($connection, $queryPrev) or die("Unable to retrieve previous status!");
// $Stat2 = odbc_result($resultStat,"VorigeStatus");
$Stat2 = odbc_result($resultPrev,"Statuslabel");
$StatusID = odbc_result($resultPrev,"ID");
if ($Stat2 != "")
printf(" <option value=\"%s\">%s</option>\n", $StatusID, $Stat2);
//===Huidige status
$queryCurrent="SELECT * FROM Status WHERE ID=".odbc_result($result,"StatusID");
$resultCurrent=odbc_exec($connection, $queryCurrent) or die("Unable to retrieve current status!");
$StatCurrent = odbc_result($resultCurrent,"StatusLabel");
$StatusID = odbc_result($resultCurrent,"ID");
printf(" <option value=\"%s\" selected>%s</option>\n", $StatusID, $StatCurrent);
//===Volgende status
// $Stat2 = odbc_result($resultStat,"VolgendeStatus");
$queryNext="SELECT * FROM Status WHERE ID=".odbc_result($resultStat,"VolgendeStatusID");
$resultNext=odbc_exec($connection, $queryNext) or die("Unable to retrieve next status!");
$Stat2 = odbc_result($resultNext,"Statuslabel");
$StatusID = odbc_result($resultNext,"ID");
if ($Stat2 != "")
printf(" <option value=\"%s\">%s</option>\n", $StatusID, $Stat2);
odbc_free_result($resultNext);
odbc_free_result($resultCurrent);
odbc_free_result($resultPrev);
}
printf(" </select></td></tr>\n");
odbc_free_result($resultStat);
$ReadOnly = "";
$oplossing = "";
$rowcount = 5;
if ($Type != "Medewerker")
{
$ReadOnly = "readonly";
$oplossing = odbc_result($result,"Oplossing");
$rowcount = getRowCount($oplossing,2,15);
}
//----textarea----
$maxlen=GetFieldLength("Oplossing");
printf(" <tr>\n <td class=\"Detail\">Answer:</td><td rowspan=\"2\">\n");
printf("<textarea name=\"oplossing\" cols=\"70\" rows=\"".$rowcount."\" $ReadOnly onchange=\"javascript: CheckLength('oplossing', $maxlen);\">\n");
printf("%s</textarea></td>\n", $oplossing);
$ReadOnly = "";
if ($Type != "Medewerker")
{
$ReadOnly = "disabled";
}
printf(" <td class=\"Detail\">Assigned To:</td><td class=\"Detail\"><select name=\"toegewezenaan\" $ReadOnly>\n");
$query2 = "SELECT * FROM Gebruiker,GebruikersType WHERE TypeNaam='Medewerker' AND Gebruiker.Type = GebruikersType.ID ORDER BY VolledigeNaam";//<----- ORBER BY is op ALFABETISCH het ligt er aan welk Tabel je kiest
$result2 = odbc_exec($connection, $query2) or die ("Unable to retrieve Sabern employees!");
while (odbc_fetch_row($result2))
{
$Name = odbc_result ($result2,"VolledigeNaam" );
if (odbc_result($result,"ToegewezenAan") == $Name )
printf(" <option value=\"%s\" selected>%s</option>\n", $Name, $Name);
else
printf(" <option value=\"%s\">%s</option>\n", $Name, $Name);
}
printf(" </select></td></tr>\n");
odbc_free_result($result2);
if ($Type == "Medewerker")
{
printf(" <tr>\n<td></td>\n<td class=\"Detail\">Customer:</td>\n<td class=\"Detail\"><select name=\"klant\">\n");
$query2 = "SELECT * FROM Klant";
$result2 = odbc_exec($connection, $query2) or die ("Unable to retrieve customers!");
while (odbc_fetch_row($result2))
{
$Cust = odbc_result($result2,"Klantnaam");
if (odbc_result($result,"RKlant") == $Cust)
printf(" <option value=\"%s\" selected>%s</option>\n", $Cust, $Cust);
else
printf(" <option value=\"%s\">%s</option>\n", $Cust, $Cust);
}
printf(" </select></td></tr>\n");
odbc_free_result($result2);
}
else
{
printf(" <tr><td></td></td><td></td></tr>\n");
}
$DateFormat = "d-m-Y";
//----textarea----
$maxlen=GetFieldLength("History");
if ($Type == "Medewerker")
{
$history = odbc_result($result,"History");
$rowcount = getRowCount($history,2,5);
echo "<tr>\n <td class=\"Detail\">History:</td>\n";
echo "<td rowspan=\"5\">\n";
echo "<textarea name=\"history\" cols=\"70\" rows=\"".$rowcount."\" onchange=\"javascript: CheckLength('history', $maxlen);\">";
printf("%s\n</textarea>\n", $history);
$solution = odbc_result($result,"Oplossing");
$rowcount = getRowCount($solution,2,36);
echo "<br/>";
echo "<textarea name=\"history2\" cols=\"70\" rows=\"".$rowcount."\" onchange=\"javascript: CheckLength('history', $maxlen);\">";
//printf("%s\n</textarea></td>\n", $solution);
printf("%s\n</textarea></td>\n", $solution);
}
else
{
$comments = odbc_result($result,"AdditionalInfo");
$rowcount = getRowCount($comments,2,15);
echo "<tr>\n <td class=\"Detail\">Add Comment:</td>\n";
echo "<td rowspan=\"5\">\n";
echo "<textarea name=\"comments\" cols=\"70\" rows=\"".$rowcount."\" onchange=\"javascript: CheckLength('history', $maxlen);\">";
printf("%s\n</textarea></td>\n", $comments);
}
$SubmitDate = odbc_result($result,"Ingediend");
if ($SubmitDate != "")
$SubmitDate = date($DateFormat, strtotime($SubmitDate));
echo " <td class=\"Detail\">Date submitted:</td>\n<td class=\"Date\">".$SubmitDate."</td></tr>\n";
$SubmittedBy = odbc_result($result,"SubmittedBy");
printf(" <tr><td></td><td class=\"Detail\">Submitted by:</td>");
printf(" \n<td class=\"Date\">".$SubmittedBy."</td></tr>\n");
$SolvedDate = odbc_result($result,"Opgelost");
if ($SolvedDate != "")
$SolvedDate = date($DateFormat, strtotime($SolvedDate));
printf(" <tr><td></td><td class=\"Detail\">Date solved:</td>");
printf("<td class=\"Date\">".$SolvedDate."</td></tr>\n");
$ClosedDate = odbc_result($result,"Gesloten");
if ($ClosedDate != "")
$ClosedDate = date($DateFormat, strtotime($ClosedDate));
printf(" <tr><td></td><td class=\"Detail\">Date closed:</td>");
printf("<td class=\"Date\">".$ClosedDate."</td></tr>\n");
$SolveDate = odbc_result($result,"Streefdatum");
$SolveTime = strtotime($SolveDate);
$Color = "";
if ($SolveDate != "")
{
$SolveDate = date($DateFormat, strtotime($SolveDate));
if (time() >= $SolveTime)
$Color = "red";
}
echo "<tr>\n<td></td><td class=\"Detail\">Solve before:</td>";
echo "<td class=\"Date$Color\">".$SolveDate;
if ($Type == "Medewerker")
{
echo " <a href=\"javascript:dateupdate(".$ID.");\" >Change</a> ";
}
echo "</td></tr>\n";
//13-05-2003: show attachments (if map exists then attachments exist)
$map=sprintf("Attachment/%05d", $ID);
if (is_dir($map))
{
$dp=opendir($map);
while (!(($filename=readdir($dp)) === False))
{
if (is_file("$map/$filename"))
{
$attachments[]=$filename;
}
}
//sorteren?
if (is_array($attachments))
{
asort($attachments);
echo "<tr>\n<td class=\"Detail\">Attachment(s):</td>\n";
foreach ($attachments as $attachmentname)
{
$att_name = str_replace("%20", "%2520", $attachmentname);
echo "<td colspan=\"2\" >";
echo "<a name=\"attachments\" target=\"_blank\" href =\"$map/$att_name\">";
echo $attachmentname."\n</a></td></tr>\n<tr><td> </td>\n";
}
echo "</tr>\n";
}
}
clearstatcache();
$markeerBijSabern = false;
echo "<tr>";
if ($Type == "Medewerker")
{
echo "<td class=\"Detail\" colspan=\"2\" style=\"text-align: left; width: auto;\">";
echo "<input type=\"checkbox\" name=\"wachtopklant\"";
echo " value=\"true\"";
if (odbc_result($result, "WachtOpKlant"))
echo " checked>Waiting on customer\n";
else
echo "> Waiting on customer";
echo " <input type=\"checkbox\" name=\"markeerbijklant\"";
if (odbc_result($result, "MarkeerBijKlant"))
{
echo " checked";
}
echo "/>Highlight this SRS at Customer";
echo " <input type=\"checkbox\" name=\"markeerbijsabern\"";
if (odbc_result($result, "MarkeerBijSabern"))
{
if ($_SESSION["SESSION_FullName"] != odbc_result($result, "ToegewezenAan") || PostGet('referer') != 'list')
{
echo " checked";
$markeerBijSabern = true;
}
}
echo "/>Highlight this SRS at Sabern";
echo "</td>";
echo "<td class=\"Hours\" align=\"center\"> </td>";
//timesheet option removed for now
//echo "<input type=\"button\" onclick=\"hoursspend('".$ID."', '".odbc_result($result,"RKlant")."')\" name=\"hours\" value=\"Hours spent\"></td>";
}
else
echo "<td colspan=\"3\" align=\"center\"> </td>\n";
echo "<td align=\"center\">";
if ($Type == "Medewerker")
{
echo "<input type=\"button\" name=\"delete\" value=\"DELETE\" onClick=\"location.href='delete.php?RID=".$ID."';\">";
}
else
{
if ($Stat == "AANGEMELD")
echo "<input type=\"button\" name=\"cancel\" value=\"CANCEL REQUEST\" onClick=\"location.href='cancel.php?RID=".$ID."';\">";
}
printf("<input type=\"submit\" name=\"save\" value=\"SAVE\"></td>\n");
printf("</tr>\n");
printf("<tr height=\"20\"></tr>\n");
echo "</form>\n\n";
if ($Type == "Medewerker")
{
$query = "UPDATE Request SET MarkeerBijSabern = ";
if ($markeerBijSabern)
{
$query .= "true";
}
else
{
$query .= "false";
}
$query .= " WHERE ID=".$ID;
$resultUpdate = odbc_exec($connection, $query) or die ("Unable to update request data!".$query);
odbc_free_result($resultUpdate);
}
//<input type="hidden" name="MAX_FILE_SIZE" value="$max_file_size">
//<b valign="top"> NOTE: Maximum file size is $maxKB kB</b>
echo <<<HERE_UPLOAD
<form ENCTYPE="multipart/form-data" action="$PHP_SELF" method="POST">
<input type="hidden" name="ID" value="$ID">
<tr>
<td class="Detail">Add attachment:</td>
<td Align="left"> <input type="file" name="attachment" size="50"></td>
<td colspan="0" align="left"><input type="submit" name="send" value="Send"></td>
<td colspan="0" align="left"></td>
</tr>
</form>
</table>
<!---<input type="submit" name="previous" value="Previous">
<input type="submit" name="next" value="Next">
!----->
HERE_UPLOAD;
}
echo "<p class=\"User\">";
if ($Type == "Medewerker")
{
echo "<a href=\"search.php\">Back to search page</a> ";
}
echo "<a href=\"list.php\">Back to list</a>";
echo "</p></html>";
//not strictly necessary
odbc_free_result($result);
// close connection
odbc_close($connection);
function getRowCount($str, $minRows, $maxRows)
{
$rowCount = 0;
$lines = explode("\n",$str);
for ($i = 0; $i < count($lines); $i++)
{
$rowCount += ceil(strlen($lines[$i]) / 60);
}
if ($rowCount < $minRows)
{
$rowCount = $minRows;
}
else if ($rowCount > $maxRows)
{
$rowCount = $maxRows;
}
return $rowCount;
}
function getRequestId($connection)
{
$ID = PostGet("ID");
if (! is_numeric($ID))
{
header("Location: menu.php");
}
$Type = $_SESSION["SESSION_UserLevel"];
if ($Type == "Klant")
{
$userId = $_SESSION["SESSION_UserID"];
$query = "SELECT * FROM Request, Gebruiker WHERE Request.Klant = Gebruiker.Klant AND Gebruiker.Id = ".$userId." AND Request.ID = ".$ID;
$result = odbc_exec($connection, $query) or die ("Unable to verify this request! Query: ".$query);
while (odbc_fetch_row($result))
{
return $ID;
}
header("Location: menu.php");
}
else
{
$query = "SELECT * FROM Request WHERE ID = ".$ID;
$result = odbc_exec($connection, $query) or die ("Unable to verify this request! Query: ".$query);
while (odbc_fetch_row($result))
{
return $ID;
}
header("Location: menu.php");
}
}
?>
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.