19 require_once(BASE.
"wcmf/lib/output/class.OutputStrategy.php");
20 require_once(BASE.
"wcmf/lib/util/class.Log.php");
32 var
$DEFAULT_NODE_STYLE =
'height=0.1,width=1,shape=box,style=filled,color="#49B4CF",fillcolor="#49B4CF",fontcolor=white,fontsize=14,fontname="Helvetica-Bold"';
52 $this->_fileOk =
false;
55 $this->_nodeStyle = $nodeStyle;
59 $this->_edgeStyle = $edgeStyle;
69 if (file_exists($this->_file))
71 $this->_fp = fopen($this->_file,
"r");
74 Log::warn(
"Can't write to file ".$this->_file.
". Another user holds the lock. Try again later.", __CLASS__);
81 $this->_fp = fopen($this->_file,
"w");
83 if (flock ($this->_fp, LOCK_EX))
85 $this->_fileOk =
true;
86 fputs($this->_fp,
"digraph G {\n\n");
87 fputs($this->_fp,
" node [".$this->_nodeStyle.
"]\n");
88 fputs($this->_fp,
" edge [".$this->_edgeStyle.
"]\n\n");
99 fputs($this->_fp,
"\n}\n");
100 flock ($this->_fp, LOCK_UN);
110 if (!$obj->getProperty(
'nodeIndex'))
111 $obj->setProperty(
'nodeIndex', $this->getNextIndex());
115 fputs($this->_fp,
' n'.$obj->getProperty(
'nodeIndex').
' [label="'.$obj->getOID().
'"]'.
"\n");
116 $children = $obj->getChildren();
117 for($i=0; $i<sizeOf($children); $i++)
119 if (!$children[$i]->getProperty(
'nodeIndex'))
120 $children[$i]->setProperty(
'nodeIndex', $this->
getNextIndex());
121 fputs($this->_fp,
' n'.$obj->getProperty(
'nodeIndex').
' -> n'.$children[$i]->getProperty(
'nodeIndex').
"\n");
123 fputs($this->_fp,
"\n");
132 return $this->_nodeIndex++;
warn($message, $category)
OutputStrategy is used to write an object's content to a destination (called 'document') using a spec...
DotOutputStrategy($file, $nodeStyle='', $edgeStyle='')
This OutputStrategy outputs an object's content in a dot file.