* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3 * @version SVN: $Revision: 176 $ * @link http://pear.php.net/package/PHP_UML * @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $ */ /** * Implementation of the HTML renderer for the treeview menu (on the left panel) * * @category PHP * @package PHP_UML * @subpackage Output * @subpackage HtmlNew * @author Baptiste Autin * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3 */ class PHP_UML_Output_HtmlNew_DocMenu extends PHP_UML_Output_HtmlNew_DocElement { /** * Generates and saves the HTML menu * * @param PHP_UML_Metamodel_Package $p Starting package */ public function render($p) { $tpl = $this->getTemplate(self::MENU_FILENAME.'.'.self::FILE_EXT); $str = ''; $str = str_replace('#MENU', $str, $tpl); $this->save(self::MENU_FILENAME, $str); } /** * Returns the HTML content for a whole model * * @param PHP_UML_Metamodel_Package $p Starting package * * @return string */ private function getContent(PHP_UML_Metamodel_Package $p) { return $this->getPackage($p); } /** * Returns the HTML content for a given package * * @param PHP_UML_Metamodel_Package $p Package * @param string $path Relative path to the current package * @param int $level Recursion level * * @return string */ private function getPackage(PHP_UML_Metamodel_Package $p, $path='', $level=0) { $pt = $level>0 ? 'package' : 'model'; $empty = (count($p->nestedPackage)==0 && count($p->ownedType)==0 && count($p->ownedOperation)==0 && count($p->ownedAttribute)==0); $str = ($level==0 ? '
  • ' : ($empty ? '
  • ' : '
  • '; return $str; } protected function getPackagePropertyItem(PHP_UML_Metamodel_Property $p, $path) { return '
  • '. ''.$p->name.''. '
  • '; } protected function getPackageOperationItem(PHP_UML_Metamodel_Operation $o, $path) { return '
  • '. ''.$o->name.$this->getParameterList($o).''. '
  • '; } protected function getClassifierItem(PHP_UML_Metamodel_Classifier $c, $path, $level) { $str = ''; if ($level>0 || !in_array($c->name, $this->hiddenClassifiers)) { $str .= '
  • '. ''.$c->name.'
  • '; } return $str; } } ?>