/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Mail::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]); $query->andFilterWhere(['like', 'mailto', $this->mailto])->andFilterWhere(['like', 'mailfrom', $this->mailfrom])->andFilterWhere(['like', 'cc', $this->cc])->andFilterWhere(['like', 'bcc', $this->bcc])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'type', $this->type]); return $dataProvider; }
<tr id="mail_row_<?php echo $key->id; ?> "> <td><input type="checkbox" class="checkbox" name="check" value="<?php echo $key->id; ?> "></td> <td><?php echo '<a href="' . Url::toRoute(['/mail/v', 'id' => $key->id]) . '">'; echo 'Trash'; echo '</a>'; ?> </td> <td><?php echo Mail::limit_str(80, '<strong>' . $key->subject . '</strong> - ' . strip_tags($key->message)); ?> </td> <td><?php echo date_format(date_create($key->create_time), "F j, Y, g:i a"); ?> </td> </tr> <?php } ?> </tbody>
<tr id="mail_row_<?php echo $key->id; ?> "> <td><input type="checkbox" class="checkbox" name="check" value="<?php echo $key->id; ?> "></td> <td><?php echo '<a href="' . Url::toRoute(['/mail/v', 'id' => $key->id]) . '">'; echo $key->subject; echo '</a>'; ?> </td> <td><?php echo Mail::limit_str(70, strip_tags($key->message)); ?> </td> <td><?php echo date_format(date_create($key->create_time), "F j, Y, g:i a"); ?> </td> </tr> <?php } } else { echo '<tr><td colspan="4">Sorry no items.</td></tr>'; } ?>
/** * Finds the Mail model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Mail the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Mail::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<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 echo $key->name; ?> </h6> <small><?php echo Mail::limit_str(35, strip_tags($key->comment)); ?> </small> </div> <span class="when"><?php echo date_format(date_create($key->updated_at), "F j, Y, g:i a"); ?> </span> </a> </li> <?php } ?> </ul><!-- notifications --> </div><!-- tab-pane -->