/** * Execute action. * * @param string $schema Name of workflow schema. * @param array &$obj Data object. * @param string $actionID Action to perform. * @param string $table Table where data will be stored (default = null). * @param string $module Name of module (defaults calling module). * @param string $idcolumn ID column of table. * * @return mixed */ public static function executeAction($schema, &$obj, $actionID, $table = null, $module = null, $idcolumn = 'id') { if (!isset($obj)) { throw new \Exception(__f('%1$s: %2$s not set.', array('Zikula_Workflow_Util', 'obj'))); } if (!is_array($obj) && !is_object($obj)) { throw new \Exception(__f('%1$s: %2$s must be an array or an object.', array('Zikula_Workflow_Util', 'obj'))); } if (empty($schema)) { throw new \Exception(__f('%1$s: %2$s needs to be named', array('Zikula_Workflow_Util', 'schema'))); } if (is_null($module)) { // default to calling module $module = ModUtil::getName(); } $stateID = self::getWorkflowState($obj, $table, $idcolumn, $module); if (!$stateID) { $stateID = 'initial'; } // instanciate workflow $workflow = new Zikula_Workflow($schema, $module); return $workflow->executeAction($actionID, $obj, $stateID); }