當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。