Creating a UI-wizard

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Rupo
Forum Commoner
Posts: 25
Joined: Thu Jul 05, 2007 11:22 am

Creating a UI-wizard

Post 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.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post 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.
Post Reply