當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authors::getAuthorsName方法代碼示例

本文整理匯總了PHP中app\models\Authors::getAuthorsName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authors::getAuthorsName方法的具體用法?PHP Authors::getAuthorsName怎麽用?PHP Authors::getAuthorsName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Authors的用法示例。


在下文中一共展示了Authors::getAuthorsName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\date\DatePicker;
/* @var $this yii\web\View */
/* @var $model app\models\BooksSearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="books-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>

    <?php 
echo $form->field($model, 'author_id')->dropDownList(\app\models\Authors::getAuthorsName());
?>

    <?php 
echo $form->field($model, 'name');
?>


    <?php 
echo $form->field($model, 'date_start')->widget(DatePicker::classname(), ['language' => 'ru']);
?>

    <?php 
echo $form->field($model, 'date_end')->widget(DatePicker::classname(), ['language' => 'ru']);
?>
開發者ID:Diakonrus,項目名稱:test_zadanie,代碼行數:30,代碼來源:_search.php

示例2: actionAjax

 public function actionAjax()
 {
     $request = Yii::$app->request;
     $post = $request->post();
     $returnArray = [];
     if ($model = $this->findModel($post['id'])) {
         $returnArray['author'] = \app\models\Authors::getAuthorsName($model->author_id);
         $returnArray['name'] = $model->name;
         $returnArray['preview'] = $model->preview;
         $returnArray['date_create'] = $model->date_create;
         $returnArray['date_update'] = $model->date_update;
         $returnArray['date'] = $model->date;
     }
     echo json_encode($returnArray);
     exit;
 }
開發者ID:Diakonrus,項目名稱:test_zadanie,代碼行數:16,代碼來源:BooksController.php

示例3: function

        <?php 
echo Html::a('Новая запись', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
$label = new \app\models\Books();
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => '', 'columns' => ['id', 'name', ['label' => $label->getAttributeLabel('preview'), 'attribute' => 'preview', 'format' => 'raw', 'value' => function ($data) {
    $img_src = '/images/nophoto_100_100.jpg';
    if (!empty($data->preview) && file_exists('../web/' . $data->preview)) {
        $img_src = $data->preview;
    }
    return '
                    <a class="single_image" href="#"><img src="' . $img_src . '" style="width:100px;" alt=""/></a>';
}, 'filter' => ''], ['label' => $label->getAttributeLabel('author_id'), 'attribute' => 'author_id', 'format' => 'raw', 'value' => function ($data) {
    return \app\models\Authors::getAuthorsName($data->author_id);
}, 'filter' => ''], ['label' => $label->getAttributeLabel('date'), 'attribute' => 'date', 'format' => 'raw', 'value' => function ($data) {
    return \app\models\Books::returnDate($data->date);
}, 'filter' => ''], ['label' => $label->getAttributeLabel('date_create'), 'format' => 'raw', 'attribute' => 'date_create', 'value' => function ($data) {
    return \app\models\Books::returnDate($data->date_create);
}, 'filter' => ''], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Кнопки действий', 'template' => '{update} {view} {delete}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span data-id="' . $model->id . '" class="show_modal_books_edit glyphicon glyphicon-eye-open"></span>', $url, []);
}]]]]);
?>

</div>

開發者ID:Diakonrus,項目名稱:test_zadanie,代碼行數:29,代碼來源:index.php


注:本文中的app\models\Authors::getAuthorsName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。