<?php

class MFormFlow extends MFormObject
{
    public $flowData;

    function __construct($base, $title = NULL)
    {
        $this->flowData = $base->flowData;
        parent::__construct($base, $title);
    }

    public function getFlowData($attribute = '')
    {
        return ($attribute == '' ? $this->flowData : $this->flowData->$attribute);
    }

    public function setFlowData($attribute, $value = NULL)
    {
        if ($value === NULL)
        {
            $this->flowData = $attribute;
        }
        else
        {
            $this->flowData->$attribute = $value;
        }
    }

    public function getURL($flow = '', $oid = '', $args = '')
    {
        return $this->base->getURL($flow, $oid, $args);    
    }

    public function go($flow = '', $oid = '')
    {
        $this->base->go($flow, $oid);
    }

    public function restartURL()
    {
        return $this->base->getURL();
    }

    public function finalizeURL()
    {
        return $this->base->getURL($this->base->finalAction);
    }

    public function previousURL()
    {
        return $this->base->getURL($this->flowData->__previous);
    }

    public function nextURL()
    {
        return $this->base->getURL($this->base->actionFlow->defaultFlow);
    }

    public function restart()
    {
        $this->base->go = $this->restartURL();
    }

    public function finalize()
    {
        $this->base->go = $this->finalizeURL();
    }

}

?>