Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Checkin::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, 'user_id' => $this->user_id, 'event_id' => $this->event_id, 'created_date' => $this->created_date, 'created_by' => $this->created_by, 'updated_date' => $this->updated_date, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'user_type', $this->user_type]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     if (!isset($_GET['id'])) {
         $id = '';
     } else {
         $id = $_GET['id'];
     }
     $query = Checkin::find()->where(['event_id' => $id]);
     $query->joinWith(['event', 'users']);
     $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, 'created_date' => $this->created_date, 'created_by' => $this->created_by, 'updated_date' => $this->updated_date, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'event.title', $this->event_id]);
     $query->andFilterWhere(['or', ['like', 'user.firstname', $this->fullName], ['like', 'user.lastname', $this->fullName]]);
     //$query->andFilterWhere(['like', 'user.firstname', $this->fullName],['like', 'user.lastnam', $this->fullName]);
     $query->andFilterWhere(['like', 'user.email', $this->user_id]);
     $query->andFilterWhere(['like', 'user_type', $this->user_type]);
     return $dataProvider;
 }
 /**
  * Finds the Checkin model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Checkin the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Checkin::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCheckins()
 {
     return $this->hasMany(Checkin::className(), ['user_id' => 'id']);
 }
Exemplo n.º 5
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Checkin', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'users.username', 'filter' => \yii\helpers\ArrayHelper::map(\common\models\Users::find()->orderBy('username')->asArray()->all(), 'id', 'username')], 'event.title', ['attribute' => 'user_type', 'filter' => \yii\helpers\ArrayHelper::map(\common\models\Checkin::find()->orderBy('user_type')->asArray()->all(), 'id', 'user_type')], 'created_date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

    <?php 
// You only need add this,
$this->registerJs('
        var gridview_id = ""; // specific gridview
        var columns = [2]; // index column that will grouping, start 1

        var column_data = [];
            column_start = [];
            rowspan = [];

        for (var i = 0; i < columns.length; i++) {
            column = columns[i];
            column_data[column] = "";
Exemplo n.º 6
0
 public static function showCheckin($id)
 {
     $checkin = Checkin::find()->where('event_id=' . $id)->count();
     return '<span class="label label-danger">' . $checkin . '</span>';
 }