本文整理汇总了PHP中app\models\Books::getCategorys方法的典型用法代码示例。如果您正苦于以下问题:PHP Books::getCategorys方法的具体用法?PHP Books::getCategorys怎么用?PHP Books::getCategorys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Books
的用法示例。
在下文中一共展示了Books::getCategorys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/* @var $model app\models\Books */
/* @var $form yii\widgets\ActiveForm */
?>
<style>
.select2-container {
min-width:100%;
}
</style>
<div class="books-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'book_category_id')->dropDownList(Books::getCategorys());
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'authors')->listBox(Books::getAuthors(), ['class' => 'multi-select2', 'multiple' => true]);
?>
<?php
echo $form->field($model, 'annotation')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 120, 'plugins' => ['clips', 'fullscreen']]]);
?>
<?php
示例2: function
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<?php
$label = new \app\models\Books();
?>
<p>
<?php
echo Html::a('Новая запись', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['label' => $label->getAttributeLabel('book_category_id'), 'attribute' => 'book_category_id', 'format' => 'raw', 'value' => function ($data) {
return \app\models\Books::getCategorys($data->book_category_id);
}, 'filter' => \app\models\Books::getCategorys()], 'name', ['label' => $label->getAttributeLabel('authors'), 'attribute' => 'authors', 'format' => 'raw', 'value' => function ($data) {
$author = '';
foreach (\app\models\BooksAuthors::getAuthorsName($data->authors) as $key => $val) {
$author .= $val . '<BR>';
}
return $author;
}, 'filter' => \app\models\BooksAuthors::getAuthorsName()], 'year', 'views', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Кнопки действий', 'template' => '{view} {update} {delete}']]]);
?>
</div>