Example #1
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     $low_stock_items = Item::find()->where('quantity >= 1 AND quantity <= 10')->all();
     $empty_stock_items = Item::find()->where('quantity = 0')->all();
     $logs = Log::find()->orderBy('created_at DESC')->limit(10)->all();
     return $this->render('index', ['low_stock_items' => $low_stock_items, 'empty_stock_items' => $empty_stock_items, 'logs' => $logs]);
 }
Example #2
0
 /**
  * Displays a single Goal model.
  * @param $alias
  * @return mixed
  */
 public function actionView($alias)
 {
     $goal = $this->findModel(['alias' => $alias]);
     $id = $goal->id;
     $logRows = Log::find()->where(['goal_id' => $id])->orderBy('created_at DESC')->limit(5)->all();
     $taskQuery = Task::find()->where(['goal_id' => $id, 'closed' => 0])->orderBy('date')->limit(5);
     $taskRows = $taskQuery->all();
     $taskCount = $taskQuery->count();
     return $this->render('view', ['goal' => $goal, 'logRows' => $logRows, 'taskRows' => $taskRows, 'taskCount' => $taskCount, 'logModel' => new Log(['goal_id' => $id])]);
 }
Example #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Log::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'equipment_id' => $this->equipment_id, 'user_id' => $this->user_id, 'status_id' => $this->status_id, 'date' => $this->date, 'room_id' => $this->room_id, 'log_type_id' => $this->log_type_id]);
     $query->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
Example #4
0
 public function actionIndex()
 {
     $data = Log::find()->orderBy('time DESC');
     $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '10']);
     $model = $data->offset($pages->offset)->limit($pages->limit)->all();
     if ($page = \Yii::$app->request->get('page')) {
         if (intval(ceil($data->count() / 10)) < $page) {
             return false;
         }
         return $this->renderAjax('_list', ['model' => $model]);
     }
     return $this->render('index', ['model' => $model]);
 }
Example #5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Log::find()->orderBy(['id' => SORT_DESC]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 200]]);
     $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', 'login', $this->login])->andFilterWhere(['like', 'action', $this->action])->andFilterWhere(['like', 'date', $this->date]);
     return $dataProvider;
 }
Example #6
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Log::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, 'goal_id' => $this->goal_id]);
     $query->andFilterWhere(['like', 'data', $this->data])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'created_at', $this->created_at]);
     return $dataProvider;
 }
Example #7
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Log::find();
     $query->joinWith(['user', 'logType', 'equipment.equipmentType', 'equipment', 'location.room', 'location', 'equipmentStatus']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['user'] = ['asc' => ['user.name' => SORT_ASC], 'desc' => ['user.name' => SORT_DESC]];
     $dataProvider->sort->attributes['logType'] = ['asc' => ['log_type.type' => SORT_ASC], 'desc' => ['log_type.type' => SORT_DESC]];
     $dataProvider->sort->attributes['equipmentType'] = ['asc' => ['equipment_type.name' => SORT_ASC], 'desc' => ['equipment_type.name' => SORT_DESC]];
     $dataProvider->sort->attributes['equipment'] = ['asc' => ['equipment.inventory' => SORT_ASC], 'desc' => ['equipment.inventory' => SORT_DESC]];
     $dataProvider->sort->attributes['available'] = ['asc' => ['equipment.available' => SORT_ASC], 'desc' => ['equipment.available' => SORT_DESC]];
     $dataProvider->sort->attributes['room'] = ['asc' => ['room.name' => SORT_ASC], 'desc' => ['room.name' => SORT_DESC]];
     $dataProvider->sort->attributes['location'] = ['asc' => ['location.location' => SORT_ASC], 'desc' => ['location.location' => SORT_DESC]];
     $dataProvider->sort->attributes['equipmentStatus'] = ['asc' => ['equipment_status.status' => SORT_ASC], 'desc' => ['equipment_status.status' => SORT_DESC]];
     $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', 'user.name', $this->user])->andFilterWhere(['like', 'log_type.type', $this->logType])->andFilterWhere(['like', 'equipment_type.name', $this->equipmentType])->andFilterWhere(['like', 'equipment.inventory', $this->equipment])->andFilterWhere(['like', 'equipment.available', $this->available])->andFilterWhere(['like', 'room.name', $this->room])->andFilterWhere(['like', 'location.location', $this->location])->andFilterWhere(['like', 'date', $this->date])->andFilterWhere(['like', 'equipment_status.status', $this->equipmentStatus]);
     return $dataProvider;
 }
Example #8
0
 /**
  * Lists all Log models.
  * @return mixed
  */
 public function actionAdmin()
 {
     $dataProvider = new ActiveDataProvider(['query' => Log::find()]);
     return $this->render('admin', ['dataProvider' => $dataProvider]);
 }
Example #9
0
$form = ActiveForm::begin();
?>
        <?php 
echo $form->field($model, 'answer')->textInput(['class' => 'input'])->label('');
?>

        <div class="form-group">
            <?php 
echo Html::submitButton('отправить код', ['class' => 'button--submit']);
?>
        </div>
        <?php 
ActiveForm::end();
?>
    </div>
    <div class="answer__header">Ответ:</div>
    <div>
        <? if ($model->is_answer_activate == 1): ?>
            <img src="<?php 
echo $model->map_url;
?>
">
        <? endif; ?>
    </div>
    <div class="log__header">Лог игры:</div>
    <?php 
echo GridView::widget(['dataProvider' => new ActiveDataProvider(['query' => \app\models\Log::find()->where(['challenge_id' => $model->id])->orderBy('id DESC')]), 'layout' => "{items}", 'columns' => ['time', 'text', 'answer']]);
?>
</div>

Example #10
0
 public function run()
 {
     $dataProvider = new ActiveDataProvider(['query' => Log::find()->where(['model' => $this->model, 'model_id' => $this->model_id])->orderBy('id DESC')]);
     return $this->render('logsGridWidget', ['dataProvider' => $dataProvider]);
 }
Example #11
0
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Log::find()->orderBy('log_time desc')]);
     return $this->render('index', array('dataProvider' => $dataProvider));
 }
Example #12
0
 function actionLogs()
 {
     $logs = Log::find()->where("ip NOT IN('192.168.1.1', '127.0.0.1', '213.87.126.229')")->orderBy('id DESC')->limit(50)->all();
     return $this->renderPartial('logs', ['logs' => $logs]);
 }