Ejemplo n.º 1
0
			<div class="row">
				<div class="col-sm-12 text-right">
					<?php 
echo GridPageSize::widget(['pjaxId' => 'user-visit-log-grid-pjax']);
?>
				</div>
			</div>

			<?php 
Pjax::begin(['id' => 'user-visit-log-grid-pjax']);
?>

			<?php 
echo GridView::widget(['id' => 'user-visit-log-grid', 'dataProvider' => $dataProvider, 'pager' => ['options' => ['class' => 'pagination pagination-sm'], 'hideOnSinglePage' => true, 'lastPageLabel' => '>>', 'firstPageLabel' => '<<'], 'layout' => '{items}<div class="row"><div class="col-sm-8">{pager}</div><div class="col-sm-4 text-right">{summary}</div></div>', 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'user_id', 'value' => function ($model) {
    return Html::a(@$model->user->username, ['view', 'id' => $model->id], ['data-pjax' => 0]);
}, 'format' => 'raw'], 'language', 'os', 'browser', array('attribute' => 'ip', 'value' => function ($model) {
    return Html::a($model->ip, "http://ipinfo.io/" . $model->ip, ["target" => "_blank"]);
}, 'format' => 'raw'), 'visit_time:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}', 'contentOptions' => ['style' => 'width:70px; text-align:center;']]]]);
?>
		
			<?php 
Pjax::end();
?>
		</div>
	</div>
</div>

<?php 
DateRangePicker::widget(['model' => $searchModel, 'attribute' => 'visit_time']);
Ejemplo n.º 2
0
 /**
  * _mergeParams 
  * 
  * @return string json array
  */
 protected function _mergeParams()
 {
     $this->_params['locale'] = ['firstDay' => 1, 'fromLabel' => DateRangePicker::t("app", "FROM"), 'toLabel' => DateRangePicker::t("app", "TO"), 'applyLabel' => DateRangePicker::t("app", "Apply"), 'cancelLabel' => DateRangePicker::t("app", "Cancel"), 'customRangeLabel' => DateRangePicker::t("app", "Custom range"), 'daysOfWeek' => [DateRangePicker::t("app", 'Su'), DateRangePicker::t("app", 'Mo'), DateRangePicker::t("app", 'Tu'), DateRangePicker::t("app", 'We'), DateRangePicker::t("app", 'Th'), DateRangePicker::t("app", 'Fr'), DateRangePicker::t("app", 'Sa')], 'monthNames' => [DateRangePicker::t("app", 'Jan'), DateRangePicker::t("app", 'Feb'), DateRangePicker::t("app", 'Mar'), DateRangePicker::t("app", 'Apr'), DateRangePicker::t("app", 'May'), DateRangePicker::t("app", 'Jun'), DateRangePicker::t("app", 'Jul'), DateRangePicker::t("app", 'Aug'), DateRangePicker::t("app", 'Sep'), DateRangePicker::t("app", 'Oct'), DateRangePicker::t("app", 'Nov'), DateRangePicker::t("app", 'Dec')]];
     if (!isset($this->pluginOptions['ranges'])) {
         $this->_params['ranges'] = [DateRangePicker::t("app", "Yesterday") => array(date('Y-m-d', strtotime('-1 day')), date('Y-m-d', time())), DateRangePicker::t("app", "Today") => array(date('Y-m-d', time()), date('Y-m-d', time()) . ' 23:59'), DateRangePicker::t("app", "7 days") => array(date('Y-m-d', strtotime('-1 week')), date('Y-m-d', time()) . ' 23:59'), DateRangePicker::t("app", "30 days") => array(date('Y-m-d', strtotime('-1 month')), date('Y-m-d', time()) . ' 23:59'), DateRangePicker::t("app", "Previous month") => array(date('Y-m-d', strtotime('first day of previous month')), date('Y-m-d', strtotime('last day of previous month')) . ' 23:59'), DateRangePicker::t("app", "This month") => array(date('Y-m-d', strtotime('first day of this month')), date('Y-m-d', time()) . ' 23:59')];
     }
     return json_encode(ArrayHelper::merge($this->_params, $this->pluginOptions));
 }