yii\base\Widget --------
423040
public function run() {

		// Execute query only if categories are not provided and search by type is enabled.
		if( count( $this->categories ) == 0 && $this->searchByType ) {

			// Generate category following parent child relationship.
			if( $this->levelList ) {

				$this->categories = $this->categoryService->getLevelListByType( $this->type );
			}
			// Generat flat list irrespective of parent child relationship.
			else {

				$this->categories = $this->categoryService->getByType( $this->type );
			}
		}

		// Configure parent type
		$this->parentType = isset( $this->parentType ) ? $this->parentType : $this->type;

		return $this->renderWidget();
	}
1355465
public function run()
    {
        /* @var $user CWebUser */
        $user = Yii::app()->getUser();
        if (count($user->getFlashes(false)) == 0) {
            return;
        }
        echo TbHtml::openTag('div', $this->htmlOptions);
        foreach ($this->alerts as $color => $alert) {
            if (isset($alert['visible']) && !$alert['visible']) {
                continue;
            }

            if ($user->hasFlash($color)) {
                $htmlOptions = TbArray::popValue('htmlOptions', $alert, array());
                TbArray::defaultValue('closeText', $this->closeText, $htmlOptions);
                TbArray::defaultValue('block', $this->block, $htmlOptions);
                TbArray::defaultValue('fade', $this->fade, $htmlOptions);
                echo TbHtml::alert($color, $user->getFlash($color), $htmlOptions);
            }
        }
        echo '</div>';
        $this->registerEvents("#{$this->htmlOptions['id']} > .alert", $this->events);
    }
687694
public function init()
	{
		parent::init();
		Yii::setPathOfAlias('gii',dirname(__FILE__));
		Yii::app()->setComponents(array(
			'errorHandler'=>array(
				'class'=>'CErrorHandler',
				'errorAction'=>$this->getId().'/default/error',
			),
			'user'=>array(
				'class'=>'CWebUser',
				'stateKeyPrefix'=>'gii',
				'loginUrl'=>Yii::app()->createUrl($this->getId().'/default/login'),
			),
			'widgetFactory' => array(
				'class'=>'CWidgetFactory',
				'widgets' => array()
			)
		), false);
		$this->generatorPaths[]='gii.generators';
		$this->controllerMap=$this->findGenerators();
	}
292335
public function run()
	{
		$id = $this->id;
		$content = array();
		$items = $this->normalizeTabs($this->tabs, $content);

		ob_start();
		if ($this->addTabsNavBar) {
			echo '<div class="navbar"><div class="navbar-inner">';
		}
		$this->controller->widget(
			'booster.widgets.TbMenu',
			array(
				'stacked' => $this->stacked,
				'type' => $this->type,
				'encodeLabel' => $this->encodeLabel,
				'items' => $items,
			)
		);
		if ($this->addTabsNavBar) {
			echo '</div></div>';
		}
		$tabs = ob_get_clean();

		ob_start();
		echo '<div class="tab-content">';
		echo implode('', $content);
		echo $this->pagerContent;
		echo '</div>';
		$content = ob_get_clean();

		echo CHtml::openTag('div', $this->htmlOptions);
		echo $this->placement === self::PLACEMENT_BELOW ? $content . $tabs : $tabs . $content;
		echo '</div>';

		/** @var CClientScript $cs */
		$cs = Yii::app()->getClientScript();

		$cs->registerPackage('bootstrap.wizard');

		// Override options
		if ($this->type && !isset($this->options['class'])) {
			$this->options['class'] = $this->type;
		}

		$options = CJavaScript::encode($this->options);

		$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').bootstrapWizard({$options});");

		foreach ($this->events as $name => $handler) {
			$handler = CJavaScript::encode($handler);
			$cs->registerScript(__CLASS__ . '#' . $id . '_' . $name, "jQuery('#{$id}').on('{$name}', {$handler});");
		}
	}
929859
protected function renderViews()
    {
        if (empty($this->_relViews))
        {
            $message = \Yii::t('dlds/rels/widgets', 'RelTabs widget cannot be generated. No related models exist. Please create at least one relation model first.');
            
            echo \yii\helpers\Html::tag('div', $message, ['class' => 'alert alert-warning']);
        }
        else
        {
            $widget = $this->relViewClass;

            echo $widget::widget(array(
                'items' => $this->_relViews,
                'options' => array(
                    'collapsible' => true,
                ),
            ));
        }
    }
1101303
public function actionView()
    {
        $view = Yii::$app->getRequest()->get('type');
        if (isset($view)) {
            Yii::$app->session['view'] = $view;
        }
        $this->goBack( Yii::$app->getRequest()->getHeaders()->get('referer') );
    }
888352
public function init() {

		parent::init();

		// Views
		$this->setViewPath( '@cmsgears/module-cms/admin/views/form' );

		// Permission
		$this->crudPermission = FormsGlobal::PERM_FORM_ADMIN;

		// Config
		$this->type			= CoreGlobal::TYPE_FORM;
		$this->templateType	= CoreGlobal::TYPE_FORM;
		$this->apixBase		= 'cms/form';

		// Services
		$this->modelService		= Yii::$app->factory->get( 'formService' );
		$this->templateService	= Yii::$app->factory->get( 'templateService' );

		$this->modelContentService	= Yii::$app->factory->get( 'modelContentService' );

		// Sidebar
		$this->sidebar = [ 'parent' => 'sidebar-form', 'child' => 'form' ];

		// Return Url
		$this->returnUrl = Url::previous( 'forms' );
		$this->returnUrl = isset( $this->returnUrl ) ? $this->returnUrl : Url::toRoute( [ '/cms/form/all' ], true );

		// Breadcrumbs
		$this->breadcrumbs	= [
			'base' => [
				[ 'label' => 'Home', 'url' => Url::toRoute( '/dashboard' ) ]
			],
			'all' => [ [ 'label' => 'Forms' ] ],
			'create' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Add' ] ],
			'update' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Update' ] ],
			'delete' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Delete' ] ],
			'gallery' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Gallery' ] ],
			'data' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Data' ] ],
			'config' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Config' ] ],
			'settings' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Settings' ] ]
		];
	}
977747
public function init()
    {
        $this->attachBehavior('TbWidget', new TbWidget);
        $this->copyId();
        TbHtml::addCssClass('collapse', $this->htmlOptions);
        if (isset($this->parent)) {
            TbArray::defaultValue('data-parent', $this->parent, $this->htmlOptions);
        }
        if (isset($this->toggle) && $this->toggle) {
            TbHtml::addCssClass('in', $this->htmlOptions);
        }
        if (isset($this->view)) {
            $controller = $this->getController();
            if (isset($controller) && $controller->getViewFile($this->view) !== false) {
                $this->content = $this->controller->renderPartial($this->view, $this->viewData, true);
            }
        }
        echo TbHtml::openTag($this->tagName, $this->htmlOptions);
        echo $this->content;
    }
1126728
public function actionDel()
    {
        $ids = \Yii::$app->request->post('ids');
        foreach (StringHelper::explode($ids, ',', true, true) as $id) {
            $obj = DpAdminMenuUrl::find()
                ->findByUrlId($id)
                ->one();
            if ($obj) {
                $obj->status = DpAdminMenuUrl::STATUS_DELETE;
                $obj->save();
            }
        }

        return $this->renderSuccess('删除成功');
    }
801860
public function init()
	{
		if($this->nextPageLabel===null)
			$this->nextPageLabel=Yii::t('yii','Next &gt;');
		if($this->prevPageLabel===null)
			$this->prevPageLabel=Yii::t('yii','&lt; Previous');
		if($this->firstPageLabel===null)
			$this->firstPageLabel=Yii::t('yii','&lt;&lt; First');
		if($this->lastPageLabel===null)
			$this->lastPageLabel=Yii::t('yii','Last &gt;&gt;');
		if($this->header===null)
			$this->header=Yii::t('yii','Go to page: ');

		if(!isset($this->htmlOptions['id']))
			$this->htmlOptions['id']=$this->getId();
		if(!isset($this->htmlOptions['class']))
			$this->htmlOptions['class']='yiiPager';
	}
121844
public function init()
    {
        parent::init();
        Yii::import('bootstrap.behaviors.TbWidget');
        $this->attachBehavior('tbWidget', new TbWidget);
        if (!isset($this->assetPath)) {
            $this->assetPath = Yii::getPathOfAlias('lib.select2');
        }
        if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) {
            $this->pluginOptions['data'] = $data = $this->normalizeData($this->data);
        }
        if (!$this->bindPlugin) {
            $this->htmlOptions['data-plugin'] = 'select2';
            $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
        }
        if (TbArray::popValue('block', $this->htmlOptions, false)) {
            TbHtml::addCssClass('input-block-level', $this->htmlOptions);
        }
    }
836456
public function init()
    {
        parent::init();
        if (!isset($this->translations['yii']) && !isset($this->translations['yii*'])) {
            $this->translations['yii'] = [
                '__class' => PhpMessageSource::class,
                'sourceLanguage' => 'en-US',
                'basePath' => '@yii/messages',
            ];
        }

        if (!isset($this->translations['app']) && !isset($this->translations['app*'])) {
            $this->translations['app'] = [
                '__class' => PhpMessageSource::class,
                'sourceLanguage' => $this->app->sourceLanguage,
                'basePath' => '@app/messages',
            ];
        }
    }
346783
public function actionEdit ()
		{
			if (Yii::$app->request->isAjax)
			{
				$setting = Setting::findOne([ 'name' => Yii::$app->request->post('name') ]);
				if ($setting !== null and $setting->fixed == 0)
				{
					$setting->setAttributes([ 'value' => Yii::$app->request->post('value'), 'description' => Yii::$app->request->post('description') ]);
					if (!$setting->save())
						echo Json::encode(current($setting->firstErrors));
					else
						echo 0;
				}
			}
			Yii::$app->end();
		}
605704
public function init()
    {
        $this->setImport(
            array(
                'auth.components.*',
                'auth.controllers.*',
                'auth.models.*',
                'auth.widgets.*',
            )
        );

        $this->registerCss();

        $this->flashKeys = array_merge(
            $this->flashKeys,
            array(
                'error' => 'error',
                'info' => 'info',
                'success' => 'success',
                'warning' => 'warning',
            )
        );

        if (isset($this->viewDir)) {
            if (strpos($this->viewDir, '.')) {
                $this->viewDir = Yii::getPathOfAlias($this->viewDir);
            }

            $this->setLayoutPath($this->viewDir . DIRECTORY_SEPARATOR . 'layouts');
            $this->setViewPath($this->viewDir);
        }
    }
665034
public function actionSwap()
    {
        if(Yii::$app->request->isAjax)
        {
            $p = Yii::$app->request->post();
            $model_b = OneFile::findOne($p['b']);
            $model_a = OneFile::findOne($p['a']);
            // swap
            $temp = $model_a->created_at;
            $model_a->created_at = $model_b->created_at;
            $model_b->created_at = $temp;
            echo $model_a->save(false, ['created_at']) && $model_b->save(false, ['created_at']);
        }
    }
185029
protected function bindFormWidgetToController()
    {
        $alias = Request::input('formWidgetAlias');
        $type = Request::input('templateType');
        $object = $this->loadTemplate($type, Request::input('templatePath'));
        $widget = $this->makeTemplateFormWidget($type, $object, $alias);

        $widget->bindToController();
    }
1047974
private function renderWidget()
    {
        $img = $this->getImageSource();

        echo "<div>$img</div>";

        if ($this->link || is_string($this->link)) {
            echo Html::a($this->link, $this->otp->getProvisioningUri());
        }

        if ($this->hasModel()
            && $this->model->hasProperty($this->attribute)
            && empty($this->model->{$this->attribute})
        ) {
            $this->model->setAttributes([$this->attribute => $this->otp->getSecret()]);
        }
        echo Html::activeHiddenInput($this->model, $this->attribute, $this->options);
    }