예제 #1
0
 public function createWidget($owner, $className, $properties = array())
 {
     $widgetName = Yii::import($className);
     if (strpos($widgetName, 'CJui') === 0) {
         $assetsPublishedPath = Yii::app()->assetManager->getPublishedPathOfAlias('application.assets.components');
         $properties = CMap::mergeArray(array('scriptUrl' => $assetsPublishedPath, 'scriptFile' => 'jquery-ui/ui/minified/jquery-ui.min.js', 'themeUrl' => $assetsPublishedPath . '/jquery-ui/themes'), $properties);
     }
     return parent::createWidget($owner, $className, $properties);
 }
예제 #2
0
 /**
  * Creates a new widget based on the given class name and initial properties.
  * @param CBaseController $owner the owner of the new widget
  * @param string $className the class name of the widget. This can also be a path alias (e.g. system.web.widgets.COutputCache)
  * @param array $properties the initial property values (name=>value) of the widget.
  * @return CWidget the newly created widget whose properties have been initialized with the given values.
  */
 public function createWidget($owner, $className, $properties = array())
 {
     if (!($this->hasEventHandler('onBeforeCreateWidget') || $this->hasEventHandler('onAfterCreateWidget'))) {
         return parent::createWidget($owner, $className, $properties);
     }
     $event = new WidgetEvent($this, $owner, $className, $properties);
     if ($this->hasEventHandler('onBeforeCreateWidget')) {
         $this->raiseEvent('onBeforeCreateWidget', $event);
     }
     $event->widget = parent::createWidget($owner, $className, $properties);
     if ($this->hasEventHandler('onAfterCreateWidget')) {
         $this->raiseEvent('onAfterCreateWidget', $event);
     }
     return $event->widget;
 }
예제 #3
0
<?php

$factory = new CWidgetFactory();
$widget = $factory->createWidget($this, 'application.widgets.EExcelView', array('libPath' => 'application.extensions.phpexcel.Classes.PHPExcel', 'dataProvider' => $model, 'grid_mode' => 'export', 'title' => 'sunbeltbrasil-planilha-clientes-' . date('d') . '-' . date('m') . '-' . date('Y'), 'stream' => true, 'exportType' => 'Excel5', 'columns' => array('usuario_id', 'usuario_nome_responsavel', 'usuario_email', 'usuario_tel', 'usuario_dt_criacao')));
$widget->init();
$widget->run();