Ejemplo n.º 1
0
 /**
  * Simple link to render the graph of this object
  * with the function render the parts includes
  * @param integer $level
  * @return string
  */
 function table($level)
 {
     return bnfSubParts::table($this, $level);
 }
Ejemplo n.º 2
0
 /**
  * 
  * Draw the table of a part given in parameter
  * depending of the level
  * @param bnfPart $_origine
  * @param integer $level
  * @return string
  */
 protected function tableAnd(bnfPart &$_origine, $level)
 {
     $__origine = bnfSubParts::testAlwaysRepetition($_origine);
     $origine = bnfSubParts::testSuffixedRepetition($__origine);
     $nbParts = count($origine->parts);
     $hasTitle = bnfSubParts::hasTitle($origine, $level);
     $placeCol = $level === 0 && ($origine->type === bnf::RULE || $origine->type === bnf::PART_SET) ? "<td></td>" : "<td class=\"placeCols\" width=\"50%\"></td>";
     $simpleCol = "<td></td>";
     $classPart = bnfSubParts::defineClassPart($origine);
     $classAndOr = "and";
     $classRepetitionForced = isset($origine->type_repetition) && $origine->type_repetition == bnf::PART_REPETITION_FORCED ? "forced" : "";
     $classRepetitionSuffixed = isset($origine->type_repetition) && $origine->type_repetition == bnf::PART_REPETITION_SUFFIXED ? "suffixed" : "";
     $classLevel = $level === 0 ? "level1" : "levelmore";
     $classWithTitle = $hasTitle ? "withtitle" : "notitle";
     $class = $classPart . " " . $classLevel . " " . $classWithTitle . " " . $classAndOr . " " . $classRepetitionForced . " " . $classRepetitionSuffixed;
     $id = isset($origine->id) ? $origine->id : "";
     $icon = "<div class=\"icon\"></div>";
     $colspan = $nbParts * 2 - 1;
     $width = $level === 0 && $origine->type === bnf::RULE ? "" : "width=\"100%\"";
     $response = "<table {$width} align=\"center\" class=\"{$classPart}\">";
     $response .= "<tr class=\"title {$class}\">";
     $response .= $placeCol;
     $response .= "<td class=\"title left {$class}\">{$icon}</td>";
     $response .= "<td class=\"title content {$class}\" colspan=\"{$colspan}\">" . $id . "</td>";
     $response .= "<td class=\"title right {$class}\">{$icon}</td>";
     $response .= $placeCol;
     $response .= "</tr>";
     $response .= "<tr>";
     $response .= $simpleCol;
     $response .= "<td class=\"left link first last {$class}\">{$icon}</td>";
     for ($i = 0; $i < $nbParts; $i++) {
         $first = $i === 0;
         $last = $i === $nbParts - 1;
         $part = $origine->parts[$i];
         $classFirst = $first ? "first" : "notfirst";
         $classLast = $last ? "last" : "notlast";
         $class = $classPart . " " . $classLevel . " " . $classFirst . " " . $classLast . " " . $classWithTitle . " " . $classAndOr . " " . $classRepetitionForced . " " . $classRepetitionSuffixed;
         $response .= "<td class=\"content\">" . $part->table($level) . "</td>";
         if (!$last) {
             $response .= "<td class=\"middle link {$class}\">{$icon}</td>";
         }
     }
     $response .= "<td class=\"right link first last {$class}\">{$icon}</td>";
     $response .= $simpleCol;
     $response .= "</tr>";
     if (isset($origine->suffixe)) {
         $class = $classPart . " " . $classLevel . " last notfirst suffixe " . $classWithTitle . " " . $classAndOr;
         $response .= "<tr>";
         $response .= $first && !$hasTitle ? $placeCol : $simpleCol;
         $response .= "<td class=\"left link first last {$class}\">{$icon}</td>";
         $response .= "<td class=\"content\">" . $origine->suffixe->table($level) . "</td>";
         $response .= "<td class=\"right link first last {$class}\">{$icon}</td>";
         $response .= $first && !$hasTitle ? $placeCol : $simpleCol;
         $response .= "</tr>";
     }
     $response .= "</table>";
     return $response;
 }
Ejemplo n.º 3
0
 /**
  * Draw the graph
  * @param integer $level
  */
 function table($level)
 {
     bnfSubParts::$changeToSet = false;
     return bnfSubParts::table($this, $level);
 }