示例#1
0
<?php

use app\widgets\Pjax;
use app\widgets\Timeline;
use modules\wiki\assets\DiffAsset;
use modules\wiki\helpers\DiffHelper;
use yii\helpers\Html;
/** @var $this yii\web\View */
/** @var $historyProvider yii\data\ActiveDataProvider */
DiffAsset::register($this);
?>

<?php 
Pjax::begin();
echo Timeline::widget(['dataProvider' => $historyProvider, 'dateValue' => function ($model) {
    return Yii::$app->formatter->asDate($model->created_at);
}, 'timeView' => function ($model) {
    return Yii::$app->formatter->asRelativeTime($model->created_at);
}, 'itemHeaderView' => function ($model) {
    return Yii::$app->formatter->asUserlink($model->user) . ' ' . Html::tag('span', e($model->summary), ['class' => 'text-muted summary-change']);
}, 'itemView' => function ($model) {
    return Html::tag('pre', DiffHelper::diff($model));
}, 'itemFooterView' => function ($model) {
    return Html::a(Yii::t('app', 'Edit'), ['page/update', 'id' => $model->wiki_id, 'rev' => $model->id], ['class' => 'btn btn-default btn-flat btn-xs', 'data-pjax' => 0]);
}]);
Pjax::end();
示例#2
0
 /**
  * Renders tab section content.
  * @param string $section
  * @return string
  */
 protected function renderSection($section)
 {
     $configs = isset($this->_configs[$section]) ? $this->_configs[$section] : Param::getConfigsBySection($section);
     ob_start();
     ob_implicit_flush(false);
     if ($this->pjax) {
         Pjax::begin($this->pjaxOptions);
     }
     $form = ActiveForm::begin(['action' => [$this->id, 'tab' => $section], 'pjax' => $this->pjax]);
     echo Html::hiddenInput('section', $section);
     foreach ($configs as $config) {
         if (!Param::isAccess($config)) {
             continue;
         }
         $title = Yii::t('app', $config->title);
         $field = $form->field($config, "[{$config->id}]value")->hint(Yii::t('app', $config->desc));
         switch ($config->value_type) {
             case Config::TYPE_TEXT:
             case Config::TYPE_URL:
             case Config::TYPE_EMAIL:
             case Config::TYPE_INT:
             case Config::TYPE_NUM:
                 echo $field->textInput()->label($title);
                 break;
             case Config::TYPE_EDITOR:
                 echo $field->textArea()->label($title);
                 break;
             case Config::TYPE_SWITCH:
                 echo $field->widget(Check::className(), ['label' => $title])->label(false);
                 break;
             case Config::TYPE_SELECT:
                 echo $field->widget(Select2::className(), ['items' => $config->options])->label($title);
                 break;
             case Config::TYPE_PASSWORD:
                 echo $field->passwordInput()->label($title);
                 break;
         }
     }
     ActiveForm::endWithActions(['cancel' => false]);
     if ($this->pjax) {
         Pjax::end();
     }
     return ob_get_clean();
 }
示例#3
0
use app\widgets\Pjax;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/** @var $this yii\web\View */
/** @var $userProvider yii\data\ActiveDataProvider */
/** @var $register app\forms\user\Register */
$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
Box::begin([]);
?>
    <?php 
Pjax::begin(['modal' => true]);
?>
        <div class="btn-group">
            <?php 
if (Yii::$app->user->can('createUser')) {
    ?>
            <?php 
    Modal::begin(['header' => '<b>' . Yii::t('app', 'Create a new user') . '</b>', 'toggleButton' => ['label' => Yii::t('app', 'Create'), 'class' => ['btn btn-flat btn-default']]]);
    ?>
                <?php 
    echo $this->render('_create_modal', ['register' => $register]);
    ?>
            <?php 
    Modal::end();
    ?>
            <?php