当前位置: 首页>>代码示例>>PHP>>正文


PHP CController::widget方法代码示例

本文整理汇总了PHP中CController::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::widget方法的具体用法?PHP CController::widget怎么用?PHP CController::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CController的用法示例。


在下文中一共展示了CController::widget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget

 /**
  * Функция отрисовки виджета:
  *
  * @param string $className     - имя класса
  * @param mixed  $properties    - параметры
  * @param bool   $captureOutput - требуется ли "захват" вывода виджета
  *
  * @return mixed Инстанс виджета в случае, когда $captureOutput является ложным,
  * или вывод виджета, когда $captureOutput - истина
  **/
 public function widget($className, $properties = array(), $captureOutput = false)
 {
     try {
         $modulePath = explode('.', $className);
         $isModule = strpos($className, 'application.modules') !== false && !empty($modulePath[2]) && !Yii::app()->hasModule($modulePath[2]);
         if (Yii::getPathOfAlias($className) == false || $isModule) {
             $modulePath = explode('.', $className);
             if ($isModule) {
                 throw new CException(Yii::t('YupeModule.yupe', 'Widget "{widget}" was not found! Please enable "{module}" module!', array('{widget}' => $className, '{module}' => $modulePath[2])), 1);
             } elseif (class_exists($className) === false) {
                 throw new CException(Yii::t('YupeModule.yupe', 'Widget "{widget}" was not found!', array('{widget}' => $className)), 1);
             }
         }
         $widget = parent::widget($className, $properties, $captureOutput);
     } catch (CException $e) {
         echo CHtml::tag('p', array('class' => 'alert alert-error'), $e->getCode() ? $e->getMessage() : Yii::t('YupeModule.yupe', 'Error occurred during the render widget ({widget}): {error}', array('{error}' => $e->getMessage(), '{widget}' => $className)));
         return null;
     }
     return $widget;
 }
开发者ID:sherifflight,项目名称:yupe,代码行数:30,代码来源:Controller.php

示例2: widget

    /**
     * add profile information to std widget call
     *
     * @param string $className
     * @param array $properties
     * @param bool $captureOutput
     * @return mixed
     */
    public function widget($className,$properties=array(),$captureOutput=false)
    {
        $profile_id = 'Widget::'.$className;

        //profile widget
        Yii::beginProfile($profile_id);
        $res = parent::widget($className,$properties,true);
        Yii::endProfile($profile_id);

        if ($captureOutput)
        {
            return $res;
        }
        else
        {
            echo $res;
        }
    }
开发者ID:nizsheanez,项目名称:kur.ru,代码行数:26,代码来源:Controller.php

示例3: widget

    /**
     * add profile information to std widget call
     *
     * @param string $className
     * @param array  $properties
     * @param bool   $captureOutput
     *
     * @return mixed
     */
    public function widget($className, $properties = array(), $captureOutput = false)
    {
        $profile_id = 'Widget::' . $className;

        //profile widget
//        Yii::beginProfile($profile_id);
        $res = parent::widget($className, $properties, $captureOutput);
//        Yii::endProfile($profile_id);
        return $res;
    }
开发者ID:nizsheanez,项目名称:blog.ru,代码行数:19,代码来源:Controller.php

示例4: dumpRows

 /**
  * Dump variable of rows, into web or HTML I/O. rows must be from resulted
  * on sql query.
  * @param CController $controller
  * @param string[][] $rows
  */
 public static function dumpRows($controller, $rows)
 {
     if (count($rows) > 0) {
         $controller->widget('zii.widgets.grid.CGridView', array('dataProvider' => new CArrayDataProvider($rows, array('keyField' => 'Code', 'pagination' => false)), 'columns' => array_keys($rows[0])));
     }
 }
开发者ID:andryluthfi,项目名称:annotation-tools,代码行数:12,代码来源:Logger.php

示例5: array

/**
 * Created by PhpStorm.
 * User: james
 * Date: 7/14/15
 * Time: 9:58 AM
 * @var $editAccess bool
 * @var $editMode bool
 * @var $content DocPages
 * @var $this ContextController
 */
if ($editAccess) {
    $submitUrl = $this->createUrl($this->action->id);
    if (isset($_GET['id'])) {
        $submitUrl = $this->createUrl($this->action->id, ['id' => $_GET['id']]);
    }
    if (!$editMode) {
        echo CHtml::htmlButton(Yii::t('translation', 'Edit'), array('submit' => $submitUrl, 'params' => ['page' => $content->docId], 'type' => 'submit', 'style' => 'float:right;'));
    }
    if ($editMode) {
        Yii::import('ext.imperavi-redactor-widget.ImperaviRedactorWidget');
        CController::widget('ImperaviRedactorWidget', ['selector' => '#survContent', 'options' => ['lang' => 'en', 'toolbar' => true, 'buttonSource' => true, 'iframe' => false, 'placeholder' => 'Enter some text...', 'pastePlainText' => true, 'focus' => true, 'imageUpload' => 'imageUpload'], 'plugins' => ['fullscreen' => ['js' => ['fullscreen.js']], 'fontsize' => ['js' => ['fontsize.js']], 'table' => ['js' => ['table.js']], 'imagemanager' => ['js' => ['imagemanager.js']], 'fontcolor' => ['js' => ['fontcolor.js']]]]);
        echo CHtml::form($submitUrl);
        echo CHtml::textArea('survContent', $content->docData);
        echo CHtml::hiddenField('pageId', $content->docId);
        echo CHtml::submitButton(Yii::t('translation', 'Save'));
        echo CHtml::endForm();
    }
}
if (!$editMode) {
    echo urldecode($content->docData);
}
开发者ID:schrapps,项目名称:risksur,代码行数:31,代码来源:_page.php


注:本文中的CController::widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。