Various reformats. Changed boolean variables from 1/0 to TRUE/FALSE in multiple files.

This commit is contained in:
2026-02-19 14:08:40 -05:00
parent 9122040863
commit 01fd47814b
22 changed files with 3502 additions and 3150 deletions

View File

@@ -12,103 +12,107 @@ include("functions.php");
//$tgt_year=$_REQUEST['y'];
//$tgt_month=$_REQUEST['m'];
//$tgt_day=$_REQUEST['d'];
$tgt_date=$_REQUEST['tgt_date'] ?? "";
$print=$_REQUEST['print'] ?? "";
if (isset($_SESSION['login'])) $techid=$_SESSION['login'];
$tgt_date = $_REQUEST['tgt_date'] ?? "";
$print = $_REQUEST['print'] ?? "";
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
$logname=LOG_NAME;
$tablestyle=LOG_STYLE;
$logname = LOG_NAME;
$tablestyle = LOG_STYLE;
if ($print) {
$sbcolor=P_SIDEBAR_COLOR;
$mbgcolor=P_MENUBG_COLOR;
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor=SIDEBAR_COLOR;
$mbgcolor=MENUBG_COLOR;
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
// use default date values if not supplied
if ($tgt_date=="") $tgt_date=$today;
if ($tgt_date == "") $tgt_date = $today;
// define shifttable_classic function
function shifttable_classic($shift, $tgt_date, $db) {
function shifttable_classic($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts=PARTS_FUNCTIONS;
$showtime=SHOW_TS;
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr=mysqli_fetch_row($dshdrdata);
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr = mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><table border=\"1\" width=\"100%\">\n";
echo "<tr><th width=\"70\">Note ID</th><th width=\"70\">Tech</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$thisnote=$tablerow["lognoteid"];
$refs="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
$thisnote = $tablerow["lognoteid"];
$refs = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($thisnote)) {
$refs=$refs."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
$refs = $refs . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
//convert subject number to name
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
// create links of urls in note
$fmtnote=convertweblinks($tablerow["lognote"]);
$fmtnote = convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring="";
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$thisnote");
while ($flagid=mysqli_fetch_row($flagqry)) {
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
$flagcolor=$flagparams["flagcolor"];
$flagsym=$flagparams["flagsym"];
$flagname=$flagparams["flagname"];
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
$flagstring = "";
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
while ($flagid = mysqli_fetch_row($flagqry)) {
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
$flagcolor = $flagparams["flagcolor"];
$flagsym = $flagparams["flagsym"];
$flagname = $flagparams["flagname"];
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
if ($flagstring) {
$fmtnote=$fmtnote."<br>".$flagstring."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote=$fmtnote."<br>";
$fmtnote = $fmtnote . "<br>" . $flagstring . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote = $fmtnote . "<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote=$fmtnote."<a href=\"logentry.php?partview=1&noteid=$thisnote\">PARTS</a>";
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote = $fmtnote . "<a href=\"logentry.php?partview=1&noteid=$thisnote\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<tr>
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\" title=\"Edit this note\">%s</a>&nbsp;&nbsp;%s</td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],$tablerow["time"],
$tname,
$subjname,
$fmtnote,
$refs
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$fmtnote,
$refs
);
} else {
printf(
"<tr>
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\">%s</a></td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tname,
$subjname,
$fmtnote,
$refs
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$fmtnote,
$refs
);
}
}
@@ -121,82 +125,85 @@ function shifttable_classic($shift, $tgt_date, $db) {
}
// define the shifttable_clean function
function shifttable_clean($shift, $tgt_date, $db) {
function shifttable_clean($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts=PARTS_FUNCTIONS;
$showtime=SHOW_TS;
$shname=dblookup($db,"shifts","shiftid","shiftname",$shift);
$dshdrdata=mysqli_query($db,"select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr=mysqli_fetch_row($dshdrdata);
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr = mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n",$shname);
$note=mysqli_query($db,"select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><br>";
echo "<table border=\"0\" width=\"100%\"><tr><td>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$thisnote=$tablerow["lognoteid"];
$refs="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
$thisnote = $tablerow["lognoteid"];
$refs = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($tablerow["lognoteid"])) {
$refs=$refs."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
$refs = $refs . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname=dblookup($db,"techs","techid","techname",$tablerow["tech"]);
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
//convert subject number to name
$subjname=dblookup($db,"subjects","subjectid","subjectname",$tablerow["subject"]);
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
// create links of urls in note
$fmtnote=convertweblinks($tablerow["lognote"]);
$fmtnote = convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring="";
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$thisnote");
while ($flagid=mysqli_fetch_row($flagqry)) {
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
$flagcolor=$flagparams["flagcolor"];
$flagsym=$flagparams["flagsym"];
$flagname=$flagparams["flagname"];
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
$flagstring = "";
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
while ($flagid = mysqli_fetch_row($flagqry)) {
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
$flagcolor = $flagparams["flagcolor"];
$flagsym = $flagparams["flagsym"];
$flagname = $flagparams["flagname"];
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
if ($flagstring) {
$fmtnote=$fmtnote."<br>".$flagstring."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote=$fmtnote."<br>";
$fmtnote = $fmtnote . "<br>" . $flagstring . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote = $fmtnote . "<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote=$fmtnote."<a href=\"logentry.php?edit=1&noteid=$thisnote\" title=\"Click here to see note and parts data.\">PARTS</a>";
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote = $fmtnote . "<a href=\"logentry.php?edit=1&noteid=$thisnote\" title=\"Click here to see note and parts data.\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\" title=\"Note ID. Click to edit.\">%s</a>&nbsp;&nbsp;
"<a href=\"logentry.php?edit=1&noteid=%s\" title=\"Note ID. Click to edit.\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$refs,
$fmtnote
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$refs,
$fmtnote
);
} else {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>&nbsp;&nbsp;
"<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tname,
$subjname,
$refs,
$fmtnote
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$refs,
$fmtnote
);
}
}
@@ -208,11 +215,11 @@ function shifttable_clean($shift, $tgt_date, $db) {
echo "<br><br>\n";
}
framework("begin","$logname","Online Logbook",$print);
framework("begin", "$logname", "Online Logbook", $print);
pagetable("begin");
if(!$print) {
pageblock("left","begin");
if (!$print) {
pageblock("left", "begin");
//calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php");
echo "<div id=\"caldate\" style=\"display: none;\">";
echo htmlspecialchars($tgt_date);
@@ -225,29 +232,27 @@ if(!$print) {
sidemenu();
echo "<br><br>";
showlinklist($print);
pageblock("left","end");
pageblock("left", "end");
} else {
echo "
<center><b>$tgt_year-$tgt_month-$tgt_day</b></center><br>
";
}
pageblock("right","begin");
banner($print);
pageblock("right", "begin");
banner($print);
if (isset($techid)) nag($techid);
//$date=date("Y-m-d",mktime(0,0,0,$tgt_month,$tgt_day,$tgt_year));
$qry=mysqli_query($db,"select shiftid from shifts where status=1 order by shiftid asc");
while ($shnum=mysqli_fetch_row($qry)) {
if ($tablestyle==1) {
shifttable_classic($shnum[0],$tgt_date,$db);
} else if ($tablestyle==2) {
shifttable_clean($shnum[0],$tgt_date,$db);
$qry = mysqli_query($db, "select shiftid from shifts where status=1 order by shiftid asc");
while ($shnum = mysqli_fetch_row($qry)) {
if ($tablestyle == 1) {
shifttable_classic($shnum[0], $tgt_date, $db);
} else if ($tablestyle == 2) {
shifttable_clean($shnum[0], $tgt_date, $db);
}
}
banner($print);
pageblock("right","end");
pageblock("right", "end");
pagetable("end");
framework("end","","",$print);
?>
framework("end", "", "", $print);