usare un widget al di fuori di /protected/views

Buongiorno. intanto ringrazio tutti perchè non ho mai trovato una comunità attiva come questa di Yii.

ho un problema che non riesco a risolvere.

Ho modelizzato l’entità “Task” e generato il crud della tabella task su database. Per effettuare l’insert tuttavia non utilizzo myapplication/protected/views/task , ma una pagina task-new.php all’altezza di myapplication/task

vorrei tuttavia utilizzare comunque un widget che ho settato correttamente all’interno della views nella mia applicazione scrivendo :




<?php


$yii=dirname(__FILE__).'/../../yii/framework/yii.php';

$config=dirname(__FILE__).'/../protected/config/main.php';

require_once($yii);

// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);


Yii::setPathOfAlias('estensioni', dirname(__FILE__).'/../protected');


Yii::import('estensioni.extensions.CJuiDateTimePicker.CJuiDateTimePicker');

?>



fino a qua nessun problema.

il problema si presenta quando tento di fare





	<?php  

	   

		$this->widget('CJuiDateTimePicker',array(

  		 'model'=>Activity::model(), //Model object

   		 'attribute'=>'activity_deadline', //attribute name

  		 'mode'=>'datetime', //use "time","date" or "datetime" (default)

  		 'options'=>array('dateFormat'=>'yy-mm-dd'), // jquery plugin options

  		 'language' => '',

    ));

    ?> 


perchè ovviamente %this non è riconosciuto :


Fatal error: Using $this when not in object context in /var/www/tasker/task/task-new.php on line 20 




effettuando un var dump dove funziona ho rilevato che $this è un oggetto ActivityController, quindi forse avrei bisogno di ottenere un riferimento ad un oggetto TaskController (il mio modello in questo caso non è Activity ma Task).

è questa la via giusta? come dovrei muovermi? grazie.





object(ActivityController)#10 (15) { ["layout"]=> string(17) "//layouts/column2" ["menu"]=> array(2) { [0]=> array(2) { ["label"]=> string(13) "List Activity" ["url"]=> array(1) { [0]=> string(5) "index" } } [1]=> array(2) { ["label"]=> string(15) "Manage Activity" ["url"]=> array(1) { [0]=> string(5) "admin" } } } ["breadcrumbs"]=> array(2) { ["Activities"]=> array(1) { [0]=> string(5) "index" } [0]=> string(6) "Create" } ["defaultAction"]=> string(5) "index" ["_id":"CController":private]=> string(<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' /> "activity" ["_action":"CController":private]=> object(CInlineAction)#11 (4) { ["_id":"CAction":private]=> string(6) "create" ["_controller":"CAction":private]=> *RECURSION* ["_e":"CComponent":private]=> NULL ["_m":"CComponent":private]=> NULL } ["_pageTitle":"CController":private]=> NULL ["_cachingStack":"CController":private]=> NULL ["_clips":"CController":private]=> NULL ["_dynamicOutput":"CController":private]=> NULL ["_pageStates":"CController":private]=> NULL ["_module":"CController":private]=> NULL ["_widgetStack":"CBaseController":private]=> array(1) { [0]=> object(CActiveForm)#37 (18) { ["action"]=> string(0) "" ["method"]=> string(4) "post" ["stateful"]=> bool(false) ["errorMessageCssClass"]=> string(12) "errorMessage" ["htmlOptions"]=> array(1) { ["id"]=> string(13) "activity-form" } ["clientOptions"]=> array(0) { } ["enableAjaxValidation"]=> bool(false) ["enableClientValidation"]=> bool(false) ["focus"]=> NULL ["attributes":protected]=> array(0) { } ["summaryID":protected]=> NULL ["actionPrefix"]=> NULL ["skin"]=> string(7) "default" ["_id":"CWidget":private]=> string(13) "activity-form" ["_owner":"CWidget":private]=> *RECURSION* ["_widgetStack":"CBaseController":private]=> array(0) { } ["_e":"CComponent":private]=> NULL ["_m":"CComponent":private]=> NULL } } ["_e":"CComponent":private]=> NULL ["_m":"CComponent":private]=> NULL } 




ho fatto una cosa del genere

$mycontroller = CWebApplication->createController(’../protected/controllers/TaskController’);

tuttavia ottengo l’errore :

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/tasker/task/task-new.php on line 15

Qualche consiglio per cortesia? ho googlato a fondo l’argomento tuttavia non sono riuscito a trovare risposta :(