| // +----------------------------------------------------------------------+ // require_once 'PHP/CodeDoc/Data.php'; /** * Class Data Container * * @package PHP_CodeDoc * @access public * @author Alan Knowles * */ class PHP_CodeDoc_Data_Class { var $id; // id in the big classes array. var $name; // the name of the class var $filename; // original filename var $rfilename; // relative filename in relation to root directory. var $rdir; // relative directory var $Parent; // Parent Class (maybe an array in PHP5?) var $Operations =array(); // Array of Method Classes var $Attributes =array(); // Array of Var Classes var $iOperations =array(); // Array of inherited Method Classes var $iAttributes =array(); // Array of inherited Var Classes var $package=""; // package name if any var $copyright; // copyright var $extends = array(); // Array of Parents (names) var $description; // phpdoc class function output_extends() { // cheesy tree?? = better ideas; $indent=0; $t = count($this->extends) -1; for ($i=0;$i<$t+1;$i++) { echo "\n"; if ($i) echo str_repeat(' ',$i) . "|\n". str_repeat(' --',$i); //if ($i != $t) { // last one = no link echo ''.$this->extends[$i].''; //} else { //echo $this->extends[$i]; //} } } // move later to inherited function toJS() { $ret = array(); $cats = array(); $cls = str_replace('_','-',strtolower($this->name)); foreach($this->Operations as $op) { if (!isset($op->description->category)) { echo "missing Category for {$this->name}::{$op->name}\n"; } else { $cats[$op->description->category] = isset($cats[$op->description->category]) ? $cats[$op->description->category] : array(); $cats[$op->description->category][] = $op; } $n = $cls . '/'. ($op->name == '__construct' ? 'new' : $op->name;; $ret[$n] = $op->toJS(); } foreach($this->Attributes as $op) { // $ret[$this->name . '.'.$op->name] = $op->toJS(); } $ret[ $this->name] = array(); foreach($cats as $k=>$v ) { $ret[ $this->name][$k] = $this->catsToJs($v); } return $ret; } function catsToJs($ar) { sort($ar); $ret = array( '|xns' => 'Roo.bootstrap', 'xtype' => 'NavGroup', 'items' => array( ) ); foreach($ar as $op) { $c = $cname = $op->name; if ($c == '__construct') { $cname = 'new ' . $op->{'class'}; $c = 'new'; } $ret['items'][] = array( '|xns' => 'Roo.bootstrap', 'xtype' => 'NavItem', 'href' => '#' . str_replace('_','-',strtolower($this->name)). '/'.$c, 'html' => $cname ); } return $ret; } } ?>