예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comments::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'is_approved' => $this->is_approved]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'comment', $this->comment]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comments::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, 'uid' => $this->uid, 'eid' => $this->eid, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'comment', $this->comment])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Finds the Comments model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Comments the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Comments::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comments::className(), ['share_id' => 'share_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCustomerUserName2()
 {
     return $this->hasOne(Comments::className(), ['customer_user_name' => 'customer_user_name2']);
 }
예제 #6
0
                                            <span class="when">21/01/15</span>
                                        </a></li>
                                      </ul><!-- emails-list -->
                                  </div><!-- tab-pane -->
                              </div><!-- tab-content -->
                          
                          </div><!-- sidebar-emails-container -->
                      </div><!-- tab-pane -->
                      
                      <div role="tabpanel" class="tab-pane fade" id="notifications">
                          
                          <h4>Unapproved Comments</h4>
                          <ul class="emails-list">

                          <?php 
$data = Comments::find()->where(['is_approved' => 0])->all();
$count = count($data);
foreach ($data as $key) {
    ?>
                              <li>
                                <a href="<?php 
    echo Url::toRoute(['/comments/view', 'id' => $key->id]);
    ?>
" class="clearfix">
                                  <div class="email-thumb">
                                    <?php 
    echo $key->name[0];
    ?>
                                  </div>
                                  <div class="email-short">
                                    <h6><?php