%s\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 "
\n"; echo "\n"; while ($tablerow = mysqli_fetch_assoc($note)) { $thisnote = $tablerow["lognoteid"]; $refs = "    \"Add"; if (islink($thisnote)) { $refs = $refs . "      \"View"; } // 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 = ""; $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 . "$flagsym  "; } if ($flagstring) { $fmtnote = $fmtnote . "
" . $flagstring . "     "; } else { $fmtnote = $fmtnote . "
"; } 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 . "PARTS"; } } // now print the line in the table if ($showtime) { printf( "\n", $tablerow["lognoteid"], $tablerow["lognoteid"], $tablerow["time"], $tname, $subjname, $fmtnote, $refs ); } else { printf( "\n", $tablerow["lognoteid"], $tablerow["lognoteid"], $tname, $subjname, $fmtnote, $refs ); } } echo "
Note IDTechSubjectNoteReferences
%s  %s %s %s %s %s
%s %s %s %s %s
\n"; } else { // print the shift header echo "No entries for $shname"; } echo "

\n"; } // define the shifttable_clean function 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); if ($dshdr) { // print the shift header printf("%s\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 "

"; echo "
\n"; while ($tablerow = mysqli_fetch_assoc($note)) { $thisnote = $tablerow["lognoteid"]; $refs = "    \"Add"; if (islink($tablerow["lognoteid"])) { $refs = $refs . "      \"View"; } // 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 = ""; $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 . "$flagsym  "; } if ($flagstring) { $fmtnote = $fmtnote . "
" . $flagstring . "     "; } else { $fmtnote = $fmtnote . "
"; } 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 . "PARTS"; } } // now print the line in the table if ($showtime) { printf( "%s   %s      %s      %s      %s
%s

\n", $tablerow["lognoteid"], $tablerow["lognoteid"], $tablerow["time"], $tname, $subjname, $refs, $fmtnote ); } else { printf( "%s   %s      %s      %s
%s

\n", $tablerow["lognoteid"], $tablerow["lognoteid"], $tname, $subjname, $refs, $fmtnote ); } } echo "
\n"; } else { // print the shift header echo "No entries for $shname"; } echo "

\n"; } framework("begin", "$logname", "Online Logbook", $print); pagetable("begin"); if (!$print) { pageblock("left", "begin"); //calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php"); echo "
"; echo htmlspecialchars($tgt_date); echo "
"; sidemenu(); echo "

"; showlinklist($print); pageblock("left", "end"); } else { echo "
$tgt_year-$tgt_month-$tgt_day

"; } 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); } } banner($print); pageblock("right", "end"); pagetable("end"); framework("end", "", "", $print);