flag fixes in work
This commit is contained in:
@@ -34,7 +34,7 @@ $srchpname=$_REQUEST['srchpname'] ?? NULL;
|
||||
$srchploc=$_REQUEST['srchploc'] ?? NULL;
|
||||
$srchnha=$_REQUEST['srchnha'] ?? NULL;
|
||||
$srchrepord=$_REQUEST['srchrepord'] ?? NULL;
|
||||
$srchflags=$_REQUEST['srchflags'] ?? NULL;
|
||||
$srchflags=$_POST['srchflags'] ?? [];
|
||||
$target=$_REQUEST['target'] ?? NULL;
|
||||
|
||||
$doparts=PARTS_FUNCTIONS;
|
||||
@@ -57,6 +57,15 @@ framework("begin","$logname Search","Search",$print);
|
||||
//var_dump($_REQUEST);
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
|
||||
// define the arrays
|
||||
$logfromtables=[];
|
||||
$mffromtables=[];
|
||||
$pfromtables=[];
|
||||
$logconstraints=[];
|
||||
$mfconstraints=[];
|
||||
$pconstraints=[];
|
||||
|
||||
// get the date range of lognotes
|
||||
$logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes");
|
||||
$logdateresults=mysqli_fetch_row($logdateqry);
|
||||
@@ -75,8 +84,6 @@ if ($mfmaxdate == "") $mfmaxdate = $today;
|
||||
$mindate=min($logmindate, $mfmindate);
|
||||
$maxdate=max($logmaxdate, $mfmaxdate);
|
||||
|
||||
|
||||
|
||||
if ($search) {
|
||||
// strip whitespace from beginning and end of text fields
|
||||
$srchtext=trim($srchtext);
|
||||
@@ -122,8 +129,9 @@ if ($search) {
|
||||
$logfromtables[]="lognotes";
|
||||
$logconstraints[]="lognotes.lognote like \"%$srchtext%\"";
|
||||
}
|
||||
// fixme
|
||||
// flags
|
||||
if ($srchflags != NULL) {
|
||||
if (!empty($srchflags)) {
|
||||
foreach ($srchflags as $flagtblnum) {
|
||||
$flagtblname="flag_{$flagtblnum}";
|
||||
$logfromtables[]="lognotes";
|
||||
@@ -231,6 +239,7 @@ if ($search) {
|
||||
$mffromtables[]="maintactions";
|
||||
$mfconstraints[]="maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
||||
}
|
||||
// fixme
|
||||
// flags
|
||||
foreach ($srchflags as $flagtblnum) {
|
||||
$flagtblname="flag_{$flagtblnum}";
|
||||
@@ -463,27 +472,37 @@ if (!$print) {
|
||||
<br><br>
|
||||
<b>Flags:</b>
|
||||
";
|
||||
$flagslist=mysqli_query($db,"select * from flags");
|
||||
$flagsperline=8;
|
||||
$flagcount=1;
|
||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
||||
if ($srchflags[0]=="") $srchflags=[];
|
||||
if (in_array($flagcheckbox["flagid"],$srchflags)) {
|
||||
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
$flagslist = mysqli_query($db, "select * from flags");
|
||||
$flagsperline = 8;
|
||||
$flagcount = 1;
|
||||
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||
if ($srchflags[0] == "") $srchflags = [];
|
||||
if (in_array($flagcheckbox["flagid"], $srchflags)) {
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
} else {
|
||||
$flagid=$flagcheckbox["flagid"];
|
||||
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
||||
$flagid = $flagcheckbox["flagid"];
|
||||
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||
printf(
|
||||
"<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||
$flagcheckbox["flagid"],
|
||||
$flagcheckbox["flagcolor"],
|
||||
$flagcheckbox["flagname"],
|
||||
$flagcheckbox["flagsym"]
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($flagcount<$flagsperline) {
|
||||
if ($flagcount < $flagsperline) {
|
||||
echo " ";
|
||||
$flagcount++;
|
||||
} else {
|
||||
echo "<br>";
|
||||
$flagcount=1;
|
||||
$flagcount = 1;
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -656,20 +675,23 @@ if ($search) {
|
||||
$logsubjname=dblookup($db,"subjects","subjectid","subjectname",$logtablerow['subject']);
|
||||
// create links of urls in note
|
||||
$logfmtnote=convertweblinks($logtablerow['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=\"$logtablerow[lognoteid]\""))) {
|
||||
$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> ";
|
||||
}
|
||||
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$logtablerow[lognoteid]");
|
||||
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> ";
|
||||
}
|
||||
if ($flagstring) $logfmtnote=$logfmtnote."<br>".$flagstring;
|
||||
if ($flagstring) {
|
||||
$logfmtnote=$logfmtnote."<br>".$flagstring." ";
|
||||
} else {
|
||||
$logfmtnote=$logfmtnote."<br>";
|
||||
}
|
||||
|
||||
printf("<tr>
|
||||
<td valign=\"top\"><a href=logentry.php?edit=1¬eid=%s>%s</a></td>
|
||||
<td valign=\"top\">%s / %s</td>
|
||||
|
||||
Reference in New Issue
Block a user