Page 1 of 1

Creating a UI-wizard

Posted: Wed Jul 18, 2007 4:58 pm
by Rupo
Hi,

at the moment I'm working on a UI-wizard, in this case to integrate a newnewsWizard to a wikisystem.

Therefore I#ve created two classes:

Code: Select all

abstract class wizardBase
    {
    public $pages = array();
    private $currentpage;
    private $numpages;

    public function __construct()
        {
        if (isset($_SESSION['wizard']))
            $this->wSession=$_SESSION['wizard'];
        }

    protected function gotoNextPage()
        {
        if (($currentpage < $numpages) && $this->pages[$currentpage]->isvalid())
            {
            $currentpage+=1;
            $this->pages[$currentpage]->show();
            }
        else
            {
            echo "niemals!";
            }
        }

Code: Select all

class newPageWizard
    extends wizardBase
    {
    var $mArticle;

    public function __construct()
        {
        global $wgRequest;
        $title=$wgRequest->getVal('title');
        $title=Title::newFromText($title);
        $article=new Article($title);
        
        $this->showToolbarButtonsButtons();
        }
The main problem at the moment ist to tell the abstract class the currentpage and numpages which the wizard contains.

I would be happy about some support

thanks
r.

Posted: Mon Jul 23, 2007 3:37 am
by miro_igov
Why you need to tell the abstract class this? Abstract classes cannot be initiated they only could be inherited. You may use parent::__construct() and write some code for the pages in the abstract class but what is the meaning? You can just work with this on the extended class.