Functionality similar to TDatepicker

I want to transform a Prado application into Yii. At the moment I stuck at the TDatepicker. The Prado application uses it extensively. So I tried to create an CHtml-element with an integrated jnterface-datepicker, similar to the TDatepicker from Prado.

<?php


class EHTML extends CHTML


{


	public static function activeDatePicker($model,$attribute,$htmlOptions=array())


	{


		self::resolveNameID($model,$attribute,$htmlOptions);


		self::clientChange('change',$htmlOptions);


			$html=self::activeInputField('text',$model,$attribute,$htmlOptions);


      // THE WRONG COMMAND:


      $this->widget('application.extensions.jnterface.datepicker', array('name'=>$model->$attribute));


      return $html;


	}


}

I know, that "$this->" is wrong, but what is the right way?

Greetings

Carsten

If you really want to encapsulate the widget call in a static method, you should refer to the implementation of CBaseController::widget() since you can't use $this in a static method.

I have now taken another way. The datepicker of the jui-extension seems to fit more to my needs.

I added to the following code to the view:

<?php $calendar=array('model'=>$order,                    


                      'language'=>'de',


                      'mode'=>'button',


                      'theme'=>'cupertino',


                      'dateFormat'=>'dd.mm.yy',


                      'htmlOptions'=>array('size'=>10)


                      ); ?>


...


<div class="simple">


<?php echo CHtml::activeLabelEx($order,'orderdate'); ?>


<?php $calendar['attribute']='orderdate'; ?>


<?php $this->widget('application.extensions.jui.EDatePicker',$calendar);?>


</div>


...


<div class="simple">


<?php echo CHtml::activeLabelEx($order,'deliverdate'); ?>


<?php $calendar['attribute']='deliverdate'; ?>


<?php $this->widget('application.extensions.jui.EDatePicker',$calendar);?>


</div>


...