Initial git commit for OpenLog beginning with v5.2.4.
This commit is contained in:
103
distfiles/refchain.php
Normal file
103
distfiles/refchain.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*
|
||||
refchain.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
include("functions.php");
|
||||
|
||||
$print=$_REQUEST['print'];
|
||||
$chainnote=$_REQUEST['chainnote'];
|
||||
|
||||
$logname=LOG_NAME;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
}
|
||||
|
||||
|
||||
framework("begin","$logname","Reference Chain Display",$print);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
$master=generate_chain($chainnote);
|
||||
|
||||
// ******** end database manipulation ********
|
||||
|
||||
pagetable("begin");
|
||||
if(!$print){
|
||||
pageblock("left","begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
banner($print);
|
||||
// display the chain
|
||||
$mptr=0;
|
||||
echo "<br><br><table border=\"1\" width=\"100%\">";
|
||||
echo "<tr><th>Note ID</th><th>Date / Time</th><th>Shift</th><th>Tech</th><th>Subject</th><th>Note</th><th>References</th></tr>";
|
||||
while($mptr<count($master)) {
|
||||
if(mysqli_num_rows(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"))) {
|
||||
$tablerow = mysqli_fetch_assoc(mysqli_query($db,"select * from lognotes where lognoteid=$master[$mptr]"));
|
||||
$noteid=$tablerow["lognoteid"];
|
||||
$urldatestr="y=".date("Y",strtotime($tablerow["date"]))."&m=".date("m",strtotime($tablerow["date"]))."&d=".date("d",strtotime($tablerow["date"]));
|
||||
$refs=" <a href=\"logentry.php?add=1&refto=$noteid\"><img src=\"icons/plus.png\" border=\"0\" alt=\"Add referring note\" title=\"Add referring note\"></a> <a href=\"lognotes.php?$urldatestr\" title=\"View note in log\"><img src=\"icons/magnifier--arrow.png\"></a>";
|
||||
// convert the shift number to a name
|
||||
$shname=dblookup($db,"shifts","shiftid","shiftname",$tablerow["shift"]);
|
||||
// convert tech number to name
|
||||
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
|
||||
//convert subject number to name
|
||||
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
|
||||
// create links of urls in note
|
||||
$fmtnote=convertweblinks($tablerow["lognote"]);
|
||||
// generate the flags string
|
||||
$flagstring="";
|
||||
$allflagqry=mysqli_query($db,"select flagid from flags");
|
||||
while ($allflagids=mysqli_fetch_row($allflagqry)) {
|
||||
$flagid=$allflagids[0];
|
||||
$flag_tbl="flag_".$flagid;
|
||||
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$noteid\""))) {
|
||||
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
|
||||
$flagcolor=$flagparam["flagcolor"];
|
||||
$flagsym=$flagparam["flagsym"];
|
||||
$flagstring=$flagstring."<font color=\"$flagcolor\">$flagsym</font> ";
|
||||
}
|
||||
}
|
||||
if ($flagstring) $fmtnote=$fmtnote."<br>".$flagstring;
|
||||
printf("
|
||||
<tr>
|
||||
<td><a href=\"logentry.php?edit=1¬eid=%s\">%s</a></td>
|
||||
<td>%s / %s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
</tr>",
|
||||
$tablerow["lognoteid"],$tablerow["lognoteid"],
|
||||
$tablerow["date"],$tablerow["time"],
|
||||
$shname,
|
||||
$tname,
|
||||
$subjname,
|
||||
$fmtnote,
|
||||
$refs);
|
||||
} else {
|
||||
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n",$master[$mptr]);
|
||||
}
|
||||
$mptr=$mptr+1;
|
||||
}
|
||||
echo "</table><br><br>";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user