本文整理汇总了PHP中app\models\Authors::getAuthorsList方法的典型用法代码示例。如果您正苦于以下问题:PHP Authors::getAuthorsList方法的具体用法?PHP Authors::getAuthorsList怎么用?PHP Authors::getAuthorsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Authors
的用法示例。
在下文中一共展示了Authors::getAuthorsList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
echo $form->field($model, 'name');
?>
<?php
echo $form->field($model, 'date_start')->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'dd.MM.yyyy', 'options' => ['class' => 'form-control']]);
?>
<?php
echo $form->field($model, 'date_end')->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => 'dd.MM.yyyy', 'options' => ['class' => 'form-control']]);
?>
<?php
echo $form->field($model, 'author_id')->dropDownList(Authors::getAuthorsList(true));
?>
<div class="form-group">
<?php
echo Html::submitButton('Search', ['class' => 'btn btn-primary']);
?>
<?php
echo Html::a('Reset', Yii::$app->getUrlManager()->createUrl('books/index'), ['class' => 'btn btn-default']);
?>
</div>
<?php
ActiveForm::end();
?>
示例2:
use kartik\date\DatePicker;
/* @var $this yii\web\View */
/* @var $model app\models\search\BooksSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="books-search">
<?php
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>
<div class="row">
<div class="col-md-6">
<?php
echo $form->field($model, 'author_id')->dropDownList(Authors::getAuthorsList(), ['prompt' => '']);
?>
</div>
<div class="col-md-6">
<?php
echo $form->field($model, 'name');
?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php
echo $form->field($model, 'dateStart')->widget(DatePicker::className(), ['language' => 'ru', 'type' => DatePicker::TYPE_INPUT, 'options' => ['class' => 'form-control'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>
</div>
示例3: actionUpdate
/**
* Updates an existing Books model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
$oldFilePath = $model->preview_image;
if ($model->load(Yii::$app->request->post())) {
$image = $model->uploadImage();
if ($image === false) {
$model->preview_image = $oldFilePath;
}
if ($model->save()) {
if ($image !== false) {
// delete old and overwrite
$path = $model->getImageFile();
$image->saveAs($path);
}
}
//сохранение параметров фильтра
$filterParams = $_GET;
if (ArrayHelper::keyExists('id', $filterParams)) {
unset($filterParams['id']);
if ($filterParams) {
$url = ['search'] + $filterParams;
return $this->redirect($url);
}
}
return $this->redirect(['index']);
} else {
return $this->render('update', ['model' => $model, 'authors' => Authors::getAuthorsList()]);
}
}