function build_process_graph($pId) { $attributes = array(); $graph = new Process_GraphViz(true, $attributes); $pm = new ProcessManager($this->db); $name = $pm->_get_normalized_name($pId); $graph->set_pid($name); // Nodes are process activities so get // the activities and add nodes as needed $nodes = $this->get_process_activities($pId); foreach ($nodes as $node) { if ($node['isInteractive'] == 'y') { $color = 'blue'; } else { $color = 'black'; } $auto[$node['name']] = $node['isAutoRouted']; $graph->addNode($node['name'], array('URL' => "foourl?activityId=" . $node['activityId'], 'label' => $node['name'], 'shape' => $this->_get_activity_shape($node['type']), 'color' => $color)); } // Now add edges, edges are transitions, // get the transitions and add the edges $edges = $this->get_process_transitions($pId); foreach ($edges as $edge) { if ($auto[$edge['actFromName']] == 'y') { $color = 'red'; } else { $color = 'black'; } $graph->addEdge(array($edge['actFromName'] => $edge['actToName']), array('color' => $color)); } // Save the map image and the image graph $graph->image_and_map(); unset($graph); return true; }