コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CallMeMain::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, 'regdate' => $this->regdate]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'tel', $this->tel]);
     return $dataProvider;
 }
コード例 #2
0
 public function actionCallmemain($name, $tel)
 {
     $email = EmailTo::findOne(['id' => 1]);
     $model = new CallMeMain();
     $model->name = $name;
     $model->tel = $tel;
     if ($model->save()) {
         $to = $email->email_to;
         $subject = "Запрос на звонок";
         $message = '
             <html>
                 <head>
                     <title>Поступила новая заявка запроса на звонок</title>
                 </head>
                 <body>
                     <p>Только что поступила новая заявка запроса на звонок!</p>
                     <p>Имя' . $name . '</p>
                     <p>Телефон:' . $tel . '</p>
                 </body>
             </html>';
         $headers = "Content-type: text/html; charset=windows-utf-8 \r\n";
         $headers .= "From: TEST\r\n";
         $headers .= "Bcc:TEST1\r\n";
         mail($to, $subject, $message, $headers);
         return 'success';
     }
     return 'fail';
 }
コード例 #3
0
 /**
  * Finds the CallMeMain model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CallMeMain the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CallMeMain::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }