function class_row(Class_Prog $class, TableCreator $table_creator) { $ret = ""; $pkg_name = array(); foreach ($class->requirements as $c) { array_push($pkg_name, $c->public_id()); } array_unique($pkg_name); sort($pkg_name); $cells = array($table_creator->anchor($class->full_name(), $class->name), implode("\n\n", $pkg_name)); $ret .= $table_creator->row($cells); return $ret; }
function test_row(Requirement $req, $indentation, TableCreator $table_creator, $filter_cat, $filter_pri) { $test = $req->with('system_test')->system_test; $ret = ""; if (isset($req->system_test) && (!is_numeric($filter_cat) || $req->category == $filter_cat) && (!is_numeric($filter_pri) || $req->priority == $filter_pri)) { $test->with('test'); $ret .= $table_creator->row(array($test->public_id(), $test->test->description, 'success', $table_creator->anchor($req->public_id(), $req->public_id()))); } $nested = $req->with('requirements')->requirements; foreach ($nested as $nreq) { $ret .= test_row($nreq, $indentation + 1, $table_creator, $filter_cat, $filter_pri); } return $ret; }
function test_row(ValidationTest $test, TableCreator $table_creator) { $test->with('children'); if (!isset($test->children) || count($test->children) == 0) { return ""; } $str = "\nAll'utente è richiesto di:\n"; $str .= $table_creator->begin_list(); foreach ($test->children as $child) { $child->with('test'); $id = $child->public_id(); $str .= $table_creator->list_item($table_creator->anchor($id, $child->test->description . " ({$id})")); $str .= test_row($child, $table_creator); } $str .= $table_creator->end_list(); return $str; }
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) && isset($req->packages) && count($req->packages) > 0) { $pkg_name = array(); foreach ($req->packages as $c) { $c->with('package'); array_push($pkg_name, $table_creator->link($c->full_name(), $c->full_name("::\\-"))); } array_unique($pkg_name); sort($pkg_name); $cells = array($table_creator->child_indentation($indentation), $table_creator->anchor($req->public_id(), $req->public_id()), $req->description, implode("\n\n", $pkg_name)); $ret .= $table_creator->row($cells); } $nested = Requirement::model()->with('packages')->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; }
function display_class(Class_Prog $class, TableCreator $table_creator) { $txt = ""; if (!$class->library) { $id = $class->full_name(); $name = $class->full_name(" :: "); $txt .= $table_creator->anchor($id, '') . "\n"; $txt .= $table_creator->title(4, $name, $class->name); $txt .= $table_creator->begin_desc_list(); $txt .= $table_creator->desc_list_item('Descrizione', $class->description); if (strlen(trim($class->usage)) > 0) { $txt .= $table_creator->desc_list_item('Utilizzo', $class->usage); } $class->with('children', 'parents'); if (count($class->parents)) { $inh_txt = ''; $inh_txt .= "\\vspace{-7mm}\n"; $inh_txt .= $table_creator->begin_list(); foreach ($class->parents as $par) { if (!$par->library) { $inh_txt .= $table_creator->list_item($table_creator->link($par->full_name(), $par->full_name(" :: "))); } else { $inh_txt .= $table_creator->list_item($par->full_name()); } } $inh_txt .= $table_creator->end_list(); $txt .= $table_creator->desc_list_item('Classi ereditate', $inh_txt); } if (count($class->children)) { $inh_txt = ''; $inh_txt .= "\\vspace{-7mm}\n"; $inh_txt .= $table_creator->begin_list(); foreach ($class->children as $par) { $inh_txt .= $table_creator->list_item($table_creator->link($par->full_name(), $par->full_name(" :: "))); } $inh_txt .= $table_creator->end_list(); $txt .= $table_creator->desc_list_item('Classi figlie', $inh_txt); } $ass = Association::model()->findAll('class_from = :idc or class_to = :idc', array(':idc' => $class->id_class)); if (count($ass)) { $rel = ''; $rel .= "\\vspace{-7mm}\n"; $rel .= $table_creator->begin_desc_list(); foreach ($ass as $ss) { if ($ss->class_to != $class->id_class) { $par = $ss->with('classTo')->classTo; $ass_dir = "uscente"; } else { if ($ss->class_from != $class->id_class) { $par = $ss->with('classFrom')->classFrom; $ass_dir = "entrante"; } else { continue; } } $ss->with('attribute'); if (!$par->library) { $acn = $par->full_name(); if (strlen($acn) > 60) { $acn = substr($acn, strlen($acn) - 60); $acn = "..." . substr($acn, strpos($acn, "::") + 2); } $ass_name = $table_creator->link($par->full_name(), $acn); } else { $ass_name = $par->full_name(); } $ass_txt = "Relazione {$ass_dir}, " . lcfirst($ss->attribute->description); $rel .= $table_creator->desc_list_item($ass_name, $ass_txt); } $rel .= $table_creator->end_desc_list(); $txt .= $table_creator->desc_list_item('Relazioni con altre classi', $rel); } } $txt .= $table_creator->end_desc_list(); $txt .= "\n\\vspace{0.5cm}\n"; return $txt; }
function display_comp($component, TableCreator $table_creator) { $string = ''; $id = $component->full_name(); $name = $component->full_name("::\\-"); //$actors = implode(', ',$useCase->actors()); $string .= $table_creator->anchor($id, '') . "\n"; $string .= $table_creator->title(2, $name); $string .= "\n \\begin{figure}[H]\n \\centering\n \\scalegraphics{img/package/{$component->name}}\n \\caption{Componente {$name}}\\label{fig:{$id}} \n \\end{figure}\n "; $string .= $table_creator->title(4, 'Descrizione'); $string .= $component->description . ". \n"; $component->with('classes'); if (count($component->classes) > 0) { $string .= $table_creator->title(4, 'Classi'); $string .= $table_creator->begin_list(); foreach ($component->classes as $class) { $name = $class->full_name(); $string .= $table_creator->list_item($table_creator->link($name, $name)); } $string .= $table_creator->end_list(); } $component->with('packages'); $nested = $component->packages; if (count($nested) > 0) { $string .= $table_creator->title(4, 'Figli'); $string .= $table_creator->begin_list(); foreach ($nested as $nuc) { $name = $nuc->full_name(); $string .= $table_creator->list_item($table_creator->link($name, $name)); } $string .= $table_creator->end_list(); } $allass = $component->get_dependencies(false); if (count($allass) > 0) { $skip = $component->all_descendant_id(); $alldep = array(); foreach ($allass as $dep) { if (!in_array($dep['id_from'], $skip)) { $alldep[] = $dep['id_from']; } else { if (!in_array($dep['id_to'], $skip)) { $alldep[] = $dep['id_to']; } } } if (count($alldep) > 0) { $string .= $table_creator->title(4, 'Interazioni con altri componenti'); $string .= $table_creator->begin_list(); foreach ($alldep as $d) { $nuc = Package::model()->findByPk($d); $name = $nuc->full_name(); $string .= $table_creator->list_item($table_creator->link($name, $name)); } $string .= $table_creator->end_list(); } } foreach ($nested as $nuc) { $string .= display_comp($nuc, $table_creator); } return $string; }
function display_comp($component, TableCreator $table_creator) { $string = ''; $id = $component->full_name(); $name = $component->full_name("::\\-"); $component->with('classes'); //$actors = implode(', ',$useCase->actors()); /*if ( !empty($component->classes) ) {*/ $string .= $table_creator->anchor($id, '') . "\n"; $string .= $table_creator->title(2, $name); $string .= "\n \\begin{figure}[H]\n \\centering\n \\scalegraphics{img/package/{$component->name}}\n \\caption{Componente {$name}}\\label{fig:{$id}} \n \\end{figure}\n "; //} $string .= $component->description . "\n "; foreach ($component->classes as $class) { $string .= display_class($class, $table_creator); } $component->with('packages'); $nested = $component->packages; foreach ($nested as $nuc) { $string .= display_comp($nuc, $table_creator); } return $string; }