Untitled

 avatar
unknown
plain_text
3 days ago
3.8 kB
3
Indexable
 public function sendEmail($params)
    {
        $template_email = $params['template_email'];
        $email_attend = $params['email_attend'];
        $email_pengirim = $params['email_pengirim'];
        $status_email = $params['status_email'];
        $AttendeesName = $params['AttendeesName'];
        $TicketDetails_email = $params['TicketDetails_email'];
        $barcode = $params['barcode'];
        $domain = $params['domain'];
        $ticketNameBarcode = $params['ticketNameBarcode'];
        $no = $params['no'];
        $eventName = $params['eventName'];
        $eventvenue = $params['eventvenue'];
        $eventstartDate = $params['eventstartDate'];
        $emailSubject_att = $params['emailSubject_att'];
        $idAttend = $params['idAttend'];
        $id_last_notif_history = $params['id_last_notif_history'];
        $typeTemplate = $params['typeTemplate'];
        $logo = $params['logo'];
        if ($template_email != null && $email_attend != null && $email_pengirim != null &&  $status_email == 1) {
            $replacementDataEmail = array(
                '{{AttendeesName}}' => "$AttendeesName",
                '{{QRCodeImage}}' => "<h3 style='text-align: center; margin:0;'><b>Participant $no</b></h3>
            <h5 style='text-align: center;'></b></h5>
            <p style='text-align: center;font-size: 14px;'>$AttendeesName</p>
            $ticketNameBarcode
            <br>
            <img src='$domain/template/qrcode/$barcode.png' alt='img-qrcode' style='border: none; -ms-interpolation-mode: bicubic; max-width: 100%;  display: block; margin-left: auto; margin-right: auto; margin: auto;' alt='QR Code' >",
                '{{TicketDetail(perattendees)}}' => "$TicketDetails_email",
                '{{EventName}}' => "$eventName",
                '{{EventLocation}}' => "$eventvenue",
                '{{EventSchedule}}' => "$eventstartDate",
            );

            $template_email_update =  $template_email;
            $emailSubject_att_update = $emailSubject_att;
            foreach ($replacementDataEmail as $placeholder => $value) {
                $template_email_update = str_replace($placeholder, $value, $template_email_update);
                $emailSubject_att_update = str_replace($placeholder, $value, $emailSubject_att_update);
            }
            $details =  [
                'event_title' => $eventName,
                'template_view' => "$template_email_update",
                'typeTemplate' => $typeTemplate,
                'domain' => $domain,
                'logo' => $logo
            ];
            $send_email_organiser = EmailLib::sendEmail(
                "$email_attend",
                "$emailSubject_att_update",
                'daftarmana/free_paid',
                ['details' =>  $details],
                [$email_pengirim => "Registration - $eventName"]
            );

            if ($send_email_organiser['status']) {
                $update_order_wa = OrderAttendees::find()->where(['id' => $idAttend])->one();
                if ($update_order_wa != null) {
                    $isSentEmail = (int)$update_order_wa->isSentEmail + 1;
                    $update_order_wa->isSentEmail = $isSentEmail;
                    if (!$update_order_wa->save(false)) {
                        throw new Exception("error ExampleBarcodeAttendees isSentEmail orderId $this->orderId $isSentEmail");
                    }
                }
                $this->updateNotifHistory($AttendeesName, $idAttend, $id_last_notif_history, null, null, null, $email_attend, 1, null);
            } else {
                $this->updateNotifHistory($AttendeesName, $idAttend, $id_last_notif_history, null, null, null, $email_attend, 0, $send_email_organiser);
            }
        }
    }
Editor is loading...
Leave a Comment