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


PHP Authors::getAuthorsList方法代码示例

本文整理汇总了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();
?>
开发者ID:Cranky4,项目名称:books_test,代码行数:28,代码来源:_search.php

示例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>
开发者ID:Araused,项目名称:books,代码行数:31,代码来源:_search.php

示例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()]);
     }
 }
开发者ID:Cranky4,项目名称:books_test,代码行数:38,代码来源:BooksController.php


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