function requirement_row($req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri) { $ret = ""; if ((!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) { $pkg_name = array(); foreach ($req->classes as $c) { array_push($pkg_name, $table_creator->link($c->full_name(), $c->name)); } array_unique($pkg_name); sort($pkg_name); $cells = array($table_creator->child_indentation($indentation), $table_creator->link($req->public_id(), $req->public_id()), implode("\n\n", $pkg_name)); $ret .= $table_creator->row($cells); } $nested = Requirement::model()->with('classes')->findAll("t.parent=:parent", array(':parent' => $req->id_requirement)); foreach ($nested as $nreq) { $ret .= requirement_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri); } return $ret; }
function requirement_row($req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri) { $ret = ""; if ((!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) { $source_desc = array(); foreach ($req->sources as $rc) { $rc->with('useCase', 'externalSource'); if (isset($rc->useCase)) { array_push($source_desc, $table_creator->link($rc->useCase->public_id(), $rc->useCase->public_id())); } else { array_push($source_desc, $rc->externalSource->description); } } sort($source_desc); $cells = array($table_creator->child_indentation($indentation), $table_creator->anchor($req->public_id(), $req->public_id()), $req->category0->name . "\n\n" . $req->priority0->name, $req->description, implode("\n\n", $source_desc)); $ret .= $table_creator->row($cells); } $nested = Requirement::model()->with('sources', 'category0', 'priority0')->findAll("t.parent=:parent", array(':parent' => $req->id_requirement)); foreach ($nested as $nreq) { $ret .= requirement_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri); } return $ret; }