name = $name; $this->text = get_POST_var($name); $this->set = false; $this->search = new SearchBox(); // see getSelectionSubset(); $this->select_static = new SelectBox("static"); $this->select_drc = new SelectBox("drc"); $this->select_marks = new SelectBox("marks"); $this->terms = $this->search->get(); // hmmmm I wonder if we have to sanitise? } function get() { return $this->text; } function toForm(&$lines, $tab = ' ') { $this->_makeSet(); $action = ""; // $lines[] = "$tab
"; formOpen($lines, $tab); $this->toFormTables($lines, $tab . ' '); formSubmit($lines, $tab); formClose($lines, $tab); // $lines[] = "$tab
"; } function toFormTables(&$lines, $tab = ' ') { $drc_copy = "DRC are copyright © David Ross. See rossde.com/CA_review/ for more details.
In this presentation, DRC are presented in yellow boxes to left,
and the review of CAcert is in white boxes to right."; $lines[] = "
"; $lines[] = ""; $lines[] = ""; $lines[] = " "; $lines[] = " "; $lines[] = ""; $lines[] = ""; // groups $lines[] = " "; $lines[] = " "; $lines[] = ""; $lines[] = ""; // status $lines[] = " "; $lines[] = ""; $lines[] = "
"; // DRC $this->select_drc->toFormTable($lines, $tab . ' '); $lines[] = " "; $lines[] = "

$drc_copy

"; // Copyright $lines[] = "
"; $this->select_static->toFormTable($lines, $tab . ' '); $lines[] = " "; // Search $this->search->toFormTable($lines, $tab . ' '); $lines[] = "
"; $this->select_marks->toFormTable($lines, $tab . ' '); $lines[] = "
"; $lines[] = "
"; } function isNone() { return $this->search->isNone() && $this->select_static->isNone() && $this->select_drc->isNone() && $this->select_marks->isNone(); } function _makeSet() { if (false !== $this->set) return ; /* * Get the user's selection of the clicked buttons. */ $clicked_drc = $this->select_drc->get(); $count_drc = count($clicked_drc); $clicked_statics = $this->select_static->get(); $count_statics = count($clicked_statics); $clicked_marks = $this->select_marks->get(); $count_marks = count($clicked_marks); $count_all = $count_drc + $count_statics + $count_marks; // echo "counts $count_drc / $count_statics / $count_marks
\n"; $terms = $this->terms; if (!$terms && (0 == $count_all)) // nothing gets nothing! { $this->set = array(); return ; } /* * Create a basic set, which is from A,B,C. */ if ($count_drc > 0) { $working_set = getGroups($clicked_drc); } else { $working_set = getDRC(); // echo "all DRC
\n"; } $total = count($working_set); // echo "yes, we got $total in working set
\n"; if ($count_statics > 0) { // echo "yes, we got some selections????
\n"; $statics_set = getGroups($clicked_statics); // echo "selections is " . count($statics_set) . "
\n"; $working_set = array_intersect($statics_set, $working_set); } // $total = $criteria_set->getCount(); $total = count($working_set); // echo "hey, now got $total in working set
\n"; /* * For internal searching we need Objects. */ $obj_set = array(); foreach ($working_set as $i => $cn) { $k = new Criteria($cn); $obj_set[] = $k; } // echo "

in obj set " . count($obj_set) . " of $total total.

\n"; /* * Now apply filtering for marks. */ if ($count_marks) { // echo "

Marks are: {$clicked_marks}

\n"; $searched = array(); foreach ($obj_set as $i => $k) { if ($k->hasMarks($clicked_marks)) $searched[] = $k; } $obj_set = $searched; // echo "

found " . count($searched) . " of $total total.

\n"; } // echo "

post marks in obj set " . count($obj_set) . " of $total total.

\n"; /* * Now apply Search Terms. */ if ($terms) { // echo "

Search terms are: {$this->terms}

\n"; // echo "

Fixed terms are: {$this->terms}

\n"; $searched = array(); foreach ($obj_set as $i => $k) { if ($k->includes($terms)) $searched[] = $k; } // $ccc = searchCriteria($this->terms, $this->set); $obj_set = $searched; // echo "

found " . count($searched) . " of $total total.

\n"; } // echo "

xxxxx " . count($obj_set) . " of $total total.

\n"; $this->set = $obj_set; // echo "

found " . count($this->set) . " of $total total.

\n"; } function toDisplay(&$lines, $tab = ' ') { if ($this->isNone()) { $lines[] = "

Select something, dude!

"; return ; } $this->toTable($lines, $tab); } function toTable(&$lines, $tab = ' ') { $this->_makeSet(); $terms = $this->terms; // $set = $this->set; $lines[] = TABLE; $lines[] = ""; foreach ($this->set as $i => $cn) { $cn->toTR2($lines, $terms); } $lines[] = ""; $lines[] = UNTABLE; $lines[] = ""; } } ?>