Author: sb
Date: Tue Feb 12 13:56:37 2008
New Revision: 7350

Log:
- Add workflow variables.

Modified:
    trunk/Workflow/src/execution/plugin/visualizer.php
    trunk/Workflow/src/visitors/visualization.php

Modified: trunk/Workflow/src/execution/plugin/visualizer.php
==============================================================================
--- trunk/Workflow/src/execution/plugin/visualizer.php [iso-8859-1] (original)
+++ trunk/Workflow/src/execution/plugin/visualizer.php [iso-8859-1] Tue Feb 12 
13:56:37 2008
@@ -88,12 +88,12 @@
             $activatedNodes[] = $node->getId();
         }
 
-        $visitor = new ezcWorkflowVisitorVisualization( $activatedNodes );
+        $visitor = new ezcWorkflowVisitorVisualization( $activatedNodes, 
$execution->getVariables() );
         $execution->workflow->accept( $visitor );
 
         file_put_contents(
           sprintf(
-            '%s%s%s_%d_%d.dot',
+            '%s%s%s_%03d_%03d.dot',
 
             $this->directory,
             DIRECTORY_SEPARATOR,

Modified: trunk/Workflow/src/visitors/visualization.php
==============================================================================
--- trunk/Workflow/src/visitors/visualization.php [iso-8859-1] (original)
+++ trunk/Workflow/src/visitors/visualization.php [iso-8859-1] Tue Feb 12 
13:56:37 2008
@@ -72,13 +72,22 @@
     protected $highlightedNodes = array();
 
     /**
+     * Holds the workflow variables.
+     *
+     * @var array
+     */
+    protected $workflowVariables = array();
+
+    /**
      * Constructor.
      *
-     * @param array $highlightedNodes Array of nodes that should be 
highlighted.
-     */
-    public function __construct( array $highlightedNodes = array() )
-    {
-        $this->highlightedNodes = $highlightedNodes;
+     * @param array $highlightedNodes Array of nodes that should be highlighted
+     * @param array $workflowVariables Array of workflow variables
+     */
+    public function __construct( array $highlightedNodes = array(), array 
$workflowVariables = array() )
+    {
+        $this->highlightedNodes  = $highlightedNodes;
+        $this->workflowVariables = $workflowVariables;
     }
 
     /**
@@ -261,6 +270,23 @@
             }
         }
 
+        if ( !empty( $this->workflowVariables ) )
+        {
+            $dot .= 'variables [shape=none, label=<<table>';
+
+            foreach ( $this->workflowVariables as $name => $value )
+            {
+                $dot .= sprintf(
+                  '<tr><td>%s</td><td>%s</td></tr>',
+
+                  $name,
+                  ezcWorkflowUtil::variableToString( $value )
+                );
+            }
+
+            $dot .= "</table>>]\n";
+        }
+
         return $dot . "}\n";
     }
 }


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to