Ejemplo n.º 1
0
 /**
  * Deletes an existing Clients model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param string $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     if ($this->findModel($id)->delete()) {
         Tasks::deleteAll('client = :client', [':client' => $id]);
         Contacts::deleteAll('client = :client', [':client' => $id]);
     }
     return $this->redirect(['index']);
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contacts::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, 'client' => $this->client]);
     $query->andFilterWhere(['like', 'fio', $this->fio])->andFilterWhere(['like', 'dolg', $this->dolg])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'email', $this->email]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contacts::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(['contact_id' => $this->contact_id, 'datetime' => $this->datetime, 'user_id' => $this->user_id, 'organization_id' => $this->organization_id, 'person_id' => $this->person_id]);
     $query->andFilterWhere(['like', 'topic', $this->topic])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'result', $this->result])->andFilterWhere(['like', 'result_description', $this->result_description]);
     return $dataProvider;
 }
Ejemplo n.º 4
0
 public function record()
 {
     global $mail;
     $result = Contacts::recordContact($_POST);
     if ($result) {
         $message = "Nome: {$_POST['name']}\nAssunto: {$_POST['subject']}\nComentário:\n{$_POST['comment']}";
         mail($mail['email'], $mail['subject'], $message);
     }
     if ($result) {
         $this->view('success');
     } else {
         $this->view('error');
     }
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContacts()
 {
     return $this->hasMany(Contacts::className(), ['organization_id' => 'organization_id']);
 }
Ejemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContacts()
 {
     return $this->hasMany(Contacts::className(), ['C_ID' => 'C_ID']);
 }
 /**
  * Finds the Contacts model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Contacts the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Contacts::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 8
0
 /**
  * Finds the Contacts model based on its primary key value.
  * @param integer $id
  * @return Contacts the loaded model
  */
 protected function findModel($id)
 {
     if (($model = Contacts::find()->where(['idContact' => $id])->one()) !== null) {
         return $model;
     } else {
         return false;
     }
 }
Ejemplo n.º 9
0
 public function delete($idContact)
 {
     $result = Contacts::deleteContact($idContact);
     $this->view('admin');
 }
Ejemplo n.º 10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getResultedInContact()
 {
     return $this->hasOne(Contacts::className(), ['contact_id' => 'resulted_in_contact_id']);
 }
Ejemplo n.º 11
0
 public function getContacts()
 {
     return $this->hasMany(Contacts::className(), ['client' => 'id']);
 }