public function actionIndex()
 {
     $this->layout = '/adminka-admin';
     $video_categoria = VideoCategoria::find()->all();
     $authors = Author::find()->all();
     return $this->render('index', ['video_categoria' => $video_categoria, 'authors' => $authors]);
 }
Exemple #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Author::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if ($this->load($params) && !$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'descr', $this->descr]);
     return $dataProvider;
 }
Exemple #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Author::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname]);
     return $dataProvider;
 }
 /**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = Author::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'is_famous' => $this->is_famous]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'biography', $this->biography])->andFilterWhere(['like', 'url_info', $this->url_info])->andFilterWhere(['like', 'url_vine', $this->url_vine])->andFilterWhere(['like', 'url_instagram', $this->url_instagram])->andFilterWhere(['like', 'url_youtube', $this->url_youtube])->andFilterWhere(['like', 'handle_twitter', $this->handle_twitter])->andFilterWhere(['like', 'handle_snapchat', $this->handle_snapchat]);
     return $dataProvider;
 }
 public function safeUp()
 {
     $authors = Author::find()->all();
     $authorsIds = [];
     foreach ($authors as $author) {
         $authorsIds[] = $author->id;
     }
     $fakerRus = Factory::create('ru_RU');
     for ($i = 0; $i < 40; $i++) {
         $time = $fakerRus->unixTime;
         $book = new Book();
         $book->name = $fakerRus->sentence(4);
         $book->date_create = $time;
         $book->date_update = $time;
         $book->date = $fakerRus->date;
         $book->author_id = $fakerRus->randomElement($authorsIds);
         $image = $fakerRus->image(Yii::getAlias('@frontend') . '/web/images');
         $book->preview = str_replace(Yii::getAlias('@frontend') . '/web', '', $image);
         $result = $book->save(false);
         if (!$result) {
             return false;
         }
     }
 }
Exemple #6
0
/* @var $this yii\web\View */
/* @var $model common\models\BookSearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="book-search">

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


    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'author_id')->label(false)->dropDownList(ArrayHelper::map(Author::find()->orderBy(['lastname' => SORT_ASC])->asArray()->all(), 'id', function ($model, $defaultValue) {
    return $model['lastname'] . ' ' . $model['firstname'];
}), ['prompt' => '---автор---']);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'name')->label(false)->textInput(['maxwidth' => true, 'placeholder' => 'название книги']);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-3">
            Дата выход книги:
            <?php 
<?php

use yii\helpers\Html;
use common\models\Category;
use common\models\Tag;
use common\models\Author;
use common\models\Meme;
use common\models\Vidmage;
use common\helpers\Tools;
$channels = Category::find()->all();
$tags = Tag::find()->orderBy(['recount' => SORT_DESC])->limit(10)->all();
$authors = Author::find()->orderBy(['recount' => SORT_DESC])->limit(5)->all();
$latestMemes = Meme::find()->orderBy(['id' => SORT_DESC])->limit(10)->all();
$latestReplicas = Vidmage::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => false])->orderBy(['id' => SORT_DESC])->limit(10)->all();
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $latestMemes, 'title' => 'Latest Memes', 'icon' => 'globe', 'divId' => 'latest-memes', 'class' => 'success']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $latestReplicas, 'title' => 'Latest Replicas', 'icon' => 'film', 'divId' => 'latest-replicas', 'class' => 'info']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $channels, 'title' => 'Channels', 'icon' => 'blackboard', 'divId' => 'channels', 'class' => 'warning']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $tags, 'title' => 'Trending Tags', 'icon' => 'tag', 'divId' => 'tags', 'class' => 'danger']);
?>
 /**
  * Creates a new Posts model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (Yii::$app->user->can('create-post')) {
         $modelPost = new Posts();
         $model = new Postt($modelPost);
         if (Yii::$app->request->isAjax && $model->load($_POST)) {
             Yii::$app->response->format = 'json';
             return ActiveForm::validate($model);
         }
         if ($model->load(Yii::$app->request->post())) {
             /*
              * get the instance of the uploaded file
              */
             //            $imagename = $model->title;
             //            $model->file = UploadedFile::getInstance($model, 'file');
             //            $model->file->saveAs('uploads/'. $imagename.'.'.$model->file->extension);
             //save the path in the db
             //            $model->logo = 'uploads/'. $imagename.'.'.$model->file->extension;
             $model->save();
             //                print_r($model->getErrors());
             //                return $this->redirect(['view', 'id' => $model->id]);
             return $this->redirect(['index']);
         } else {
             //                $model->id = Yii::$app->user->id;
             //                $model->loadDefaultValues();
             return $this->renderAjax('create', ['model' => $model, 'tags' => Tags::find()->all(), 'authors' => Author::find()->all()]);
         }
     } else {
         throw new ForbiddenHttpException();
     }
 }
 public function actionAuthor()
 {
     $slug = Yii::$app->request->get('slug');
     $models = Author::find()->where(['slug' => $slug])->one();
     $model = Video::find()->where(['author_id' => $models->id]);
     //vd($model_video);
     $countQuery = clone $model;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'defaultPageSize' => 12]);
     $model_video = $model->offset($pages->offset)->limit($pages->limit)->orderBy('created_at Desc')->all();
     return $this->render('view', ['model' => $model_video, 'pages' => $pages]);
 }
Exemple #10
0
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>


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

        <div class="row" style="margin-bottom: 20px">
            <div class="col-md-8">
                <div class="col-md-6">
                    <?php 
$authors = array_merge(['' => Yii::t('app', 'author')], ArrayHelper::map(Author::find()->all(), 'id', 'fullname'));
echo $form->field($searchModel, 'author_id')->dropDownList($authors)->label(false);
?>

                    <?php 
echo $form->field($searchModel, 'dateFrom', ['template' => "{label}\n<div class='col-md-6'>{input}</div>\n{hint}\n{error}", 'labelOptions' => ['class' => 'col-md-6']])->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => Yii::$app->params['bookSearchDateFormat'], 'options' => ['class' => 'form-control']]);
?>
                </div>
                <div class="col-md-6">

                    <?php 
echo $form->field($searchModel, 'name')->textInput(['placeholder' => Yii::t('app', 'book_name')])->label(false);
?>

                    <?php 
echo $form->field($searchModel, 'dateTo', ['template' => "{label}\n<div class='col-md-6'>{input}</div>\n{hint}\n{error}", 'labelOptions' => ['class' => 'col-md-2']])->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => Yii::$app->params['bookSearchDateFormat'], 'options' => ['class' => 'form-control']]);
Exemple #11
0
 public function actionAuthors()
 {
     return $this->render('authors', ['dataProvider' => new ActiveDataProvider(['query' => Author::find(), 'pagination' => ['pageSize' => 25]])]);
 }
<?php

use yii\helpers\Url;
use common\models\VideoCategoria;
use common\models\Author;
$model_author = Author::find()->all();
$url = Yii::$app->controller->module->id . '/' . Yii::$app->controller->action->id;
$module = Yii::$app->controller->module->id;
$file_avatar = Yii::getAlias('@frontend') . '/web/upload/user/' . Yii::$app->user->id . '/avatar/avatar.jpg';
//vd($url);
?>

<div class="container">
    <div class="row">
        <div class="span12">
            <div class="header-block clearfix">
                <div class="clearfix header-block-pad">

                    <a href="<?php 
echo Url::to('/site/index');
?>
"><h1 class="logo"><span class="red">Kot</span>monstr</h1></a><a href="<?php 
echo Url::to('/shop/index');
?>
"><span>Магазин</span></a>
                    <form id="search-form" action="<?php 
echo Url::to('/search/show-item');
?>
" method="GET" accept-charset="utf-8" class="navbar-form" >
                        <input type="text" name="item" onBlur="if (this.value == '')
                                    this.value = ''" onFocus="if (this.value == '')
Exemple #13
0
?>
    <?php 
echo $form->field($model, 'file')->fileInput();
?>

<!--    --><?php 
//= $form->field($model, 'image')->textInput(['maxlength' => true])
//= $form->field($model, 'tags')->checkboxList(
//    ArrayHelper::map($tags, 'id', 'title')
//);
?>
    <?php 
echo $form->field($model, 'category_id')->label('Category')->dropDownList(Category::find()->select(['name', 'id'])->with('posts')->indexBy('id')->column(), ['prompt' => 'List of categories'])->hint('Choose the author');
?>
    <?php 
echo $form->field($model, 'author_id')->label('Author')->dropDownList(Author::find()->select(['name', 'id'])->with('posts')->indexBy('id')->column(), ['prompt' => 'List of authors'])->hint('Choose the author');
?>

<!--    --><?php 
//= $form->field($model, 'tags')->textInput(['maxlength' => true])
?>
<!--    --><?php 
//
//    echo "<pre>";
//    print_r($model->listTags);
//    echo "</pre>";
//    die();
//
?>

    <?php 
Exemple #14
0
 public static function getAuthorList()
 {
     $droptions = Author::find()->asArray()->all();
     return Arrayhelper::map($droptions, 'id', 'lastname');
 }
Exemple #15
0
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo Html::img($model->preview);
?>
    <?php 
echo $form->field($model, 'previewFile')->fileInput();
?>

    <?php 
echo $form->field($model, 'date')->widget(DatePicker::classname(), ['language' => 'ru', 'dateFormat' => Yii::$app->params['bookSearchDateFormat'], 'options' => ['class' => 'form-control']]);
?>

    <?php 
$authors = ArrayHelper::map(Author::find()->all(), 'id', 'fullname');
echo $form->field($model, 'author_id')->dropDownList($authors);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>