123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use app\widgets\CropperjsWidget;
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\Kd::find()->andWhere(['>','order',2])->orderBy(["order"=>SORT_ASC])->limit(2),
- "pagination" => false
- ]
- );
- $sort = $newsDataProvider->getModels();
- //print_r($sort);
- $ActiveNews = new \yii\data\ActiveDataProvider();
- $models = [];
- //$models[] = \app\models\News::findOne($NH[0]->id);
- foreach( $sort as $item ){
- $models[] = \app\models\News::findOne($item->id);
- }
- $ActiveNews->setModels($models);
- print_r($ActiveNews);
- print_r($_POST);
- $form = ActiveForm::begin([
- 'id' => 'test-form',
- 'options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data']]);
- ?>
- <input type="hidden" name="test[id]" value="test">
- <style>
- #image {
- width: 300px;
- min-height: 150px;
- background: URL(/img/image.svg) no-repeat 50% 50%;
- background-size: contain;
- background-color: #fff;
- cursor: pointer;
- }
- </style>
- <img id="image" src="/img/e.gif" onClick="function(){$('#modal').modal('show');$('#inputImage').click();}">
- <?
- echo CropperjsWidget::widget(['image' => 'image', 'file' => 'photo', 'post' => 'cropping']);
- echo Html::submitButton('Send', ['class' => 'btn btn-success']);
- ActiveForm::end();
|