<?php session_start(); require_once 'models/user.php'; require_once 'models/date_picker.php'; $datePicker = new DatePicker(); $date = date('y-m-d'); # $user = new User(); # $nikitasmall = $user->get_user(1); ?> <!DOCTYPE html> <html class="full" lang="ru" xmlns="http://www.w3.org/1999/html"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Расписание</title> <!-- Bootstrap Core CSS --> <link href="/assets/css/bootstrap.css" rel="stylesheet"> <!-- Tipped CSS --> <link rel="stylesheet" type="text/css" href="/assets/css/tipped.css"/> <!-- Custom CSS --> <link href="/assets/css/full.css" rel="stylesheet"> <link href="/assets/css/custom.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
/** * Build the XHTML * * @access public * @return void **/ function buildXHTML() { $GLOBALS['app']->Layout->AddHeadLink('libraries/piwi/data/css/' . $this->_theme . '.css', 'stylesheet', 'text/css'); parent::buildXHTML(); }
$this->title = 'Wagons'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="wagon-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::button('Thêm toa', ['value' => Url::to('wagon/create'), 'class' => 'btn btn-success', 'id' => 'modalButton']); ?> </p> <?php Modal::begin(['header' => '<h4>THÊM TOA XE</h4>', 'id' => 'modal', 'size' => 'modal-lg']); echo "<div id='modalContent'></div>"; Modal::end(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'wagon_number', 'created_year', ['attribute' => 'start_date', 'value' => 'start_date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'start_date', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'wagon_status_id_status', 'value' => 'wagonStatusIdStatus.name_of_status', 'filter' => Html::activeDropDownList($searchModel, 'wagon_status_id_status', ArrayHelper::map(WagonStatus::find()->all(), 'status_id', 'name_of_status'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['attribute' => 'station_station_id', 'value' => 'stationStation.station_name', 'filter' => Html::activeDropDownList($searchModel, 'station_station_id', ArrayHelper::map(\app\models\Station::find()->all(), 'station_id', 'station_name'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['attribute' => 'kind_of_wagon_kind_id', 'value' => 'kindOfWagonKind.kind_name', 'filter' => Html::activeDropDownList($searchModel, 'kind_of_wagon_kind_id', ArrayHelper::map(\app\models\KindOfWagon::find()->all(), 'kind_id', 'kind_name'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
public function datePicker($options = []) { /* if ($this->form->type == ActiveForm::TYPE_VERTICAL) { //$options = array_merge($options, ['options' => ['style' => 'display:table-cell;']]); $options = array_merge($options, ['options' => ['class' => 'show']]); } */ $this->parts['{input}'] = DatePicker::widget(array_merge($options, ['model' => $this->model, 'attribute' => $this->attribute])); return $this; }
<h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Create Date Repair', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'begin_day', 'value' => 'begin_day', 'contentOptions' => ['style' => 'width:10%'], 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'begin_day', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'repair_day', 'contentOptions' => ['style' => 'width:10%'], 'value' => function ($data) { $date = date("d-m-Y", strtotime($data["repair_day"])); $date2 = new DateTime($date); $date2->add(new DateInterval('P20M')); return $date2->format("Y-m-d"); }, 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'repair_day', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'repair_complete_day', 'contentOptions' => ['style' => 'width:10%'], 'value' => function ($data) { $date = date("d-m-Y", strtotime($data["repair_day"])); $date2 = new DateTime($date); $date2->add(new DateInterval('P20M')); $date2 = $date2->add(new DateInterval('P10D')); return $date2->format("Y-m-d"); }, 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'repair_complete_day', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'wagon_wagon_id', 'value' => 'wagonWagon.wagon_number', 'filter' => Html::activeDropDownList($searchModel, 'wagon_wagon_id', ArrayHelper::map(Wagon::find()->all(), 'wagon_id', 'wagon_number'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['attribute' => 'brand_repair_brand_repair_id', 'value' => 'brandRepairBrandRepair.name', 'filter' => Html::activeDropDownList($searchModel, 'brand_repair_brand_repair_id', ArrayHelper::map(\app\models\BrandRepair::find()->all(), 'brand_repair_id', 'name'), ['class' => 'form-control', 'prompt' => 'Please select...'])], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
/** * Get default widget class based on input field type * @param string $type * @return string */ public static function getWidgetClassNameFromFieldType($type) { switch ($type) { case self::INPUT_DATE: $widgetClass = DatePicker::className(); break; case self::INPUT_DATETIME: $widgetClass = DateTimePicker::className(); break; case self::INPUT_COLOR: $widgetClass = ColorInput::className(); break; case self::INPUT_SELECT2_MULTI: case self::INPUT_SELECT2_TAGS: case self::INPUT_SELECT2: $widgetClass = Select2::className(); break; case self::INPUT_SELECT_PICKER: case self::INPUT_SELECT_PICKER_MULTI: $widgetClass = BootstrapSelect::className(); break; case self::INPUT_EDITOR_CK: $widgetClass = CKEditor::className(); break; case self::INPUT_EDITOR_BS_WYSIHTML5: $widgetClass = BootstrapWysihtml5::className(); break; case self::INPUT_EDITOR_BS_SUMMERNOTE: $widgetClass = BootstrapSummernote::className(); break; default: $widgetClass = ''; break; } return $widgetClass; }
public function datePicker($options) { return $this->widget(DatePicker::className(), ['options' => $options]); }
</div> <?php if ($marker != 0) { ?> <div class="col-md-12"> <div class="row"> <p>Укажите период времени, за который хотели бы получить отчет:</p> </div> </div> <div class="row"> <?php $form = ActiveForm::begin(['action' => 'second-result']); ?> <div class="col-md-9"> <?php echo DatePicker::widget(['name' => 'from', 'value' => $dateRange[0], 'type' => DatePicker::TYPE_RANGE, 'name2' => 'to', 'value2' => $dateRange[1], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd'], 'separator' => 'по']); ?> </div> <div class="col-md-3"> <div class="btn-group"> <?php echo \yii\helpers\Html::submitButton('Вывести отчет'); ?> </div> </div> <?php ActiveForm::end(); ?> <?php } ?>