<?php

class MRangeCalendarField extends MContainer
{
    private $calendarField1, $calendarField2, $label;

    public function __construct($label='', $calendarField1, $calendarField2)
    {
       
        $this->calendarField1 = $calendarField1;
        $this->calendarField2 = $calendarField2;
        $this->label = $label;

        $calendarField1->setClass('input-sm form-control datepicker w100', true);
        $calendarField2->setClass('input-sm form-control datepicker w100', true);

        parent::__construct('', array($calendarField1, $calendarField2));
    }

    public function generate()
    {
        $label = new MLabel($this->label);
        $label->setClass('-label');

        $separador = new MSpan(NULL, 'a', 'input-group-addon');
        $div = new MDiv(NULL, $this->getControl(0) . $separador . $this->getControl(1), "input-daterange input-group");
        $div->addStyle('width', '33.3333333% !important');
        $html = $label . $div;

        return $html;
    }
}

?>
