Esempio n. 1
0
  <?php 
echo Html::a('<span class="glyphicon glyphicon-list"></span> ' . Yii::t('app', 'List All') . ' Videos', ['video/index'], ['class' => 'btn text-muted btn-xs']);
?>
  <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Yii::t('app', 'New') . ' Video', ['video/create', 'Video' => ['video_gallery_id' => $model->id]], ['class' => 'btn btn-success btn-xs']);
?>
</p><div class='clearfix'></div>
<?php 
Pjax::begin(['id' => 'pjax-Videos', 'linkSelector' => '#pjax-Videos ul.pagination a']);
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $model->getVideos(), 'pagination' => ['pageSize' => 10]]), 'columns' => ['id', 'title', 'youtube_url:url', 'published_at', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update}', 'contentOptions' => ['nowrap' => 'nowrap'], 'urlCreator' => function ($action, $model, $key, $index) {
    // using the column name as key, not mapping to 'id' like the standard generator
    $returnUrl = \Yii::$app->request->url;
    if (strpos($returnUrl, 'returnUrl') !== false) {
        $returnUrl = urldecode(substr($returnUrl, strpos($returnUrl, 'returnUrl') + 10, strlen($returnUrl)));
    } else {
        $returnUrl = Tabs::getParentRelationRoute(\Yii::$app->controller->id) !== null ? Tabs::getParentRelationRoute(\Yii::$app->controller->id) : null;
    }
    $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key, 'returnUrl' => $returnUrl];
    $params[0] = 'video' . '/' . $action;
    return Url::toRoute($params);
}, 'buttons' => [], 'controller' => 'video']]]);
Pjax::end();
$this->endBlock();
?>


    <?php 
echo Tabs::widget(['id' => 'relation-tabs', 'encodeLabels' => false, 'items' => [['label' => '<span class="glyphicon glyphicon-asterisk"></span> VideoGallery', 'content' => $this->blocks['dmstr\\modules\\news\\models\\VideoGallery'], 'active' => true], ['label' => '<small><span class="glyphicon glyphicon-paperclip"></span> Videos</small>', 'content' => $this->blocks['Videos'], 'active' => false]]]);
?>
</div>