Example #1
0
 public function search($input)
 {
     $query = File::query();
     $columns = Schema::getColumnListing('files');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Example #2
0
                    });
                }
            });
        }
    });
JS
);
?>

<div class="container">
    <div class="page-header">
        <h1>Фото</h1>
    </div>


    <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => \app\models\File::query(), 'pagination' => ['pageSize' => 20]]), 'tableOptions' => ['class' => 'table table-hover'], 'columns' => ['id', ['header' => 'Картинка', 'content' => function ($item) {
    return Html::a(Html::img($item['file'], ['class' => 'thumbnail', 'width' => 80, 'style' => 'margin-bottom: 0px;']), ['admin_files/edit', 'id' => $item['id']]);
}], ['header' => 'Название', 'content' => function ($item) {
    return Html::a($item['title'], ['admin_files/edit', 'id' => $item['id']]);
}], ['header' => 'Удалить', 'content' => function ($item) {
    return Html::button('Удалить', ['class' => 'btn btn-danger btn-xs buttonDelete', 'data-id' => $item['id']]);
}]]]);
?>
    <a href="<?php 
echo Url::to(['admin_files/add']);
?>
" class="btn btn-default">Добавить</a>


</div>
Example #3
0
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
$this->title = 'Фотографии';
\app\assets\SlideShow\Asset::register($this);
?>
<div class="box">

    <h1 class="title"><?php 
echo $this->title;
?>
</h1>
    <?php 
foreach (\app\models\File::query()->all() as $foto) {
    ?>
        <div class="foto" style="display: inline-block; margin: 10px;">
            <a href="<?php 
    echo \cs\Widget\FileUpload2\FileUpload::getOriginal($foto['file']);
    ?>
" rel="lightbox[example]" class="highslide" onclick="return hs.expand(this)">
                <img src="<?php 
    echo $foto['file'];
    ?>
"  alt="Highslide JS">
            </a>
        </div>
    <?php 
}
?>
Example #4
0
 public function actionIndex()
 {
     return $this->render(['items' => File::query()->all()]);
 }