<?php

class MLinkButton extends MLink
{
    public function __construct( $name = '', $label = '', $action = '', $text = NULL )
    {
        parent::__construct( $name, $label, $action, $text );
        $this->action = ($action ? $action : 'submit');
    }

    public function generateLink()
    {        
        // if $this->href is a "normal" url, prefix it with "BTN:" to generate a doLinkButton
        $href = ( substr(strtoupper($this->href), 0, 7) == 'HTTP://' ? 'BTN:'.$this->href : $this->href);
        $onclick = $this->getOnClick($href);

        if ($onclick != '')
        {
            $this->addAttribute('onclick', $onclick);
        }
    }
}
?>