Ejemplo n.º 1
0
 public function download_tex()
 {
     if (!isset($_SESSION['logged'])) {
         $this->login();
     } else {
         $rs = Requirement::reqSources();
         $sr = Requirement::sourcesReq();
         $frq = Requirement::functionalRequirements();
         $tex = "\\section{Requisiti funzionali}<br>\n                    \\begin{longtable}[H]{|l|p{2cm}|p{6cm}|p{4cm}|}<br>\n                    \\hline<br>\n                    \\textbf{Requisito} & \\textbf{Tipologia} & \\textbf{Descrizione} & \\textbf{Fonti}\\\\<br>\n                    \\hline<br>";
         foreach ($frq as $funcReq) {
             if ($funcReq->getType() == 'F') {
                 $type = 'Funzionale';
             } elseif ($funcReq->getType() == 'T') {
                 $type = 'Tecnologico';
             } elseif ($funcReq->getType() == 'Q') {
                 $type = 'Qualitativo';
             } elseif ($funcReq->getType() == 'B') {
                 $type = 'Vincolo';
             }
             $tex .= $funcReq->getCode() . " & \\multiLineCell{" . $type . "\\\\" . $funcReq->getPriority() . "} & " . $funcReq->getDescription() . " & \\multiLineCell{";
             foreach ($funcReq->getSources() as $sources) {
                 $tex .= $sources->getName() . "\\\\";
             }
             $tex .= "}\\\\<br>\n                        \\hline<br>";
         }
         $tex .= "\\end{longtable}<br>";
         $tex .= "\\section{Tracciamento Requisiti-Fonti}<br>\n                    \\begin{longtable}[H]{|p{5.5cm}|p{5.5cm}|}<br>\n                    \\hline<br>\n                    \\textbf{Requisito} & \\textbf{Fonti}\\\\<br>\n                    \\hline<br>";
         foreach ($rs as $key => $val) {
             $tex .= $key . " & \\multiLineCell[t]{";
             foreach ($val as $v) {
                 $tex .= $v . "\\\\";
             }
             $tex .= "}\\\\<br>\n                        \\hline<br>";
         }
         $tex .= "\\end{longtable}<br>\n                    \\section{Tracciamento Fonti-Requisiti}<br>\n                    \\begin{longtable}[H]{|p{5.5cm}|p{5.5cm}|}<br>\n                    \\hline<br>\n                    \\textbf{Fonte} & \\textbf{Requisiti}\\\\<br>\n                    \\hline<br>";
         foreach ($sr as $key => $val) {
             $tex .= $key . " & \\multiLineCell[t]{";
             foreach ($val as $v) {
                 $tex .= $v . "\\\\";
             }
             $tex .= "}\\\\<br>\n                        \\hline<br>";
         }
         $tex .= "\\end{longtable}<br>";
         require_once 'views/pages/output.php';
     }
 }