コード例 #1
0
 public function actionCompleteRegistrationAjax()
 {
     $client = new Client();
     $client->attributes = $_POST['Client'];
     if ($client->save()) {
         $drive = new Drive();
         $drive->attributes = $_POST['Drive'];
         $drive->client_id = $client->primaryKey;
         $drive->creation_date = date("Y-m-d H:i:s");
         if ($drive->save()) {
             $driv = Drive::model()->findByPk($drive->primaryKey);
             $message = new YiiMailMessage();
             $message->view = 'pruebamanejo';
             $message->setBody(array("client" => $client, "drive" => $driv), 'text/html');
             $message->setSubject('Solicitud Prueba de Manejo');
             foreach ($driv->concessioner->emails as $email) {
                 // if($email->type=="DRIVE"){
                 if ($email->type == "QUOTATION") {
                     $message->addTo($email->description);
                 }
             }
             //          		$message->addTo("*****@*****.**");
             //				$message->addTo("*****@*****.**");
             $message->addTo("*****@*****.**");
             $message->addTo("*****@*****.**");
             $message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
             Yii::app()->mail->send($message);
             echo json_encode(true);
         } else {
             echo json_encode(false);
         }
     }
 }