* $unset = new ezcWorkflowNodeVariableUnset ( 'variable name' ) ; * * * Incoming nodes: 1 * Outgoing nodes: 1 * * @package Workflow * @version 1.1rc1 */ class ezcWorkflowNodeVariableUnset extends ezcWorkflowNode { /** * Constructs a new unset node. * * Configuration format: * String: * The name of the workflow variable to unset. * * Array: * An array of names of the workflow variables to unset. * * @param mixed $configuration * @throws ezcBaseValueException */ public function __construct( $configuration = '' ) { if ( is_string( $configuration ) ) { $configuration = array( $configuration ); } if ( !is_array( $configuration ) ) { throw new ezcBaseValueException( 'configuration', $configuration, 'array' ); } parent::__construct( $configuration ); } /** * Executes this node. * * @param ezcWorkflowExecution $execution * @ignore */ public function execute( ezcWorkflowExecution $execution ) { foreach ( $this->configuration as $variable ) { $execution->unsetVariable( $variable ); } $this->activateNode( $execution, $this->outNodes[0] ); return parent::execute( $execution ); } /** * Generate node configuration from XML representation. * * @param DOMElement $element */ public static function configurationFromXML( DOMElement $element ) { $configuration = array(); foreach ( $element->getElementsByTagName( 'variable' ) as $variable ) { $configuration[] = $variable->getAttribute( 'name' ); } return $configuration; } /** * Generate XML representation of this node's configuration. * * @param DOMElement $element */ public function configurationToXML( DOMElement $element ) { foreach ( $this->configuration as $variable ) { $variableXml = $element->appendChild( $element->ownerDocument->createElement( 'variable' ) ); $variableXml->setAttribute( 'name', $variable ); } } /** * Returns a textual representation of this node. * * @return string * @ignore */ public function __toString() { return 'unset(' . implode( ', ', $this->configuration ) . ')'; } } ?>