/** * (non-PHPdoc) * @see \Zend\ServiceManager\FactoryInterface::createService() */ public function createService(ServiceLocatorInterface $serviceLocator) { $worker = new Worker($serviceLocator->get('doctrine.entitymanager.orm_default')); $current = date('Y-m-d') . ' 00:00:00'; $selectdate = date('Y'); $sql = "SELECT mtc.id, mtc.date_start, mtc.applicant_int, mtc.applicant_ext, mtc.summary "; $sql .= "FROM mcevent_dates AS mtc "; $sql .= "WHERE mtc.publish = 'yes' "; $sql .= "AND mtc.date_start >= '" . $selectdate . "%'"; $sql .= "ORDER BY mtc.date_start ASC;"; $orders = $this->countOrders($current, $worker); $trashdates = $worker->fetchAll($sql); $options = array(); $convert = new \ContentinumComponents\Tools\ConvertMonthDayNames(); foreach ($trashdates as $row) { $num = 0; $ext = '(*)'; $int = '(*)'; if (isset($orders[$row['id']])) { $num = $orders[$row['id']]; } if ($num >= $row['applicant_ext']) { $ext = '(!)'; } if ($num >= $row['applicant_int']) { $int = '(!)'; } if ($row['date_start'] >= $current) { $datetime = new \DateTime($row['date_start']); $trashDate = $convert->get($datetime->format('N'), 'dayname') . ', ' . $datetime->format('d') . '. ' . $convert->get($datetime->format('m')) . ' ' . $datetime->format('Y'); $options[$row['id']] = $trashDate . ': ' . $row['applicant_int'] . $int . '/' . $row['applicant_ext'] . $ext . '/' . $num . ''; } } return $options; }
/** * Content query * * @param array $params * query conditions * @return multitype: */ public function fetchContent(array $params = null) { $datas = $this->fetchRow("SELECT * FROM municipal_service_appointments WHERE uniqid_id = '{$params['category']}';"); if (is_array($datas) && !empty($datas)) { $this->executeQuery("DELETE FROM municipal_service_appointments WHERE uniqid_id = '{$params['category']}';"); switch ($datas['title']) { case 'Frau': $title = 'Sehr geehrte Frau '; break; case 'Herr': $title = 'Sehr geehrter Herr '; break; default: $title = 'Sehr geehrte(r) '; } $date = new \DateTime($datas['occupancy_start']); $configuration = $this->getSl()->get('contentinum_customer'); $online = $configuration->default->municicpal->zulassungterminstornierung; $template = file_get_contents(CON_ROOT_PATH . '/data/files/emailtemplates/' . $online->template); $this->setTransport($this->getSl()->get('contentinum_smtp_transport')); $convert = new \ContentinumComponents\Tools\ConvertMonthDayNames(); $bookingdate = $convert->get($date->format('N'), 'dayname') . ', ' . $date->format('d') . '. ' . $convert->get($date->format('m')) . ' ' . $date->format('Y') . ' um ' . $date->format('H:i') . ' Uhr'; $body = str_replace('{DATETIME}', date('d.m.Y H:i'), $template); $body = str_replace('{ANREDE}', $title, $body); $body = str_replace('{NAME}', $datas['surname'] . ' ' . $datas['name'], $body); $body = str_replace('{BOOKINGLINK}', $online->bookinglink, $body); $body = str_replace('{TERMIN}', $bookingdate, $body); require CON_ROOT_PATH . '/vendor/phpmailer/phpmailer/PHPMailerAutoload.php'; $mail = new \PHPMailer(); $mail->isSMTP(); $transport = $this->getTransport()->getOptions(); $mail->Host = $transport->getHost(); $mail->SMTPAuth = true; $mail->CharSet = 'utf-8'; $creditals = $transport->getConnectionConfig(); $mail->Username = $creditals["username"]; $mail->Password = $creditals["password"]; $mail->SMTPSecure = 'ssl'; $mail->Port = $transport->getPort(); $mail->From = $online->masteremail; $mail->FromName = $online->mastername; $mail->addReplyTo($online->masteremail, $online->mastername); $mail->addAddress($datas['email'], $datas['surname'] . ' ' . $datas['name']); $mail->isHTML(false); $mail->Subject = $online->emailsubjekt; $mail->Body = $body; if (!$mail->send()) { return '<p>Der Termin wurde storniert, es konnte aber keine E-Mail versandt werden.</p>'; } else { return '<p>Der Termin wurde storniert, Sie sollten eine Bestätigung in Kürze per E-Mail erhalten.</p>'; } } else { return '<p>Der Termin konnte aufgrund fehlender Parameter nicht storniert werden, rufen Sie uns Bitte an.</p>'; } }
/** * * @param unknown $datas */ private function sendmail($datas, $configure, $ident) { $this->setTransport($this->getSl()->get('contentinum_smtp_transport')); // $configuration = $this->getSl()->get('contentinum_customer'); // $support = $configuration->default->support_mail; $ordername = $datas['surname'] . ' ' . $datas['name']; $convert = new \ContentinumComponents\Tools\ConvertMonthDayNames(); $datetime = new \DateTime($ident['date_start']); $trashDate = $convert->get($datetime->format('N'), 'dayname') . ', ' . $datetime->format('d') . '. ' . $convert->get($datetime->format('m')) . ' ' . $datetime->format('Y'); require CON_ROOT_PATH . '/vendor/phpmailer/phpmailer/PHPMailerAutoload.php'; $mail = new \PHPMailer(); $mail->isSMTP(); $transport = $this->getTransport()->getOptions(); $mail->Host = $transport->getHost(); $mail->SMTPAuth = true; $mail->CharSet = 'utf-8'; $creditals = $transport->getConnectionConfig(); $mail->Username = $creditals["username"]; $mail->Password = $creditals["password"]; $mail->SMTPSecure = 'ssl'; $mail->Port = $transport->getPort(); if ('1' === $configure['send_email_participant']) { $mail->From = $configure['contact_email']; $mail->addReplyTo($configure['contact_email']); $mail->addAddress($datas['email'], $ordername); $mail->isHTML(false); $mail->Subject = $configure['emailsubject']; $body = str_replace('{DATETIME}', date('d.m.Y H:i'), $configure['email_participant']); $body = str_replace('{NAME}', $ordername, $body); $body = str_replace('{TERMIN}', $trashDate, $body); $body = str_replace('{MPOINT}', $ident['location_addresse'] . ', ' . $ident['location_zipcode'] . ' ' . $ident['location_city'], $body); $body .= "\n\n" . $configure['emailsignature']; $mail->Body = $body; if (!$mail->send()) { $msg = array('error' => $mail->ErrorInfo); } else { $msg = array('success' => 'Ihre Anmeldung wurde registriert eine E-Mail zur Bestätigung wurde versand. Bitte prüfen Sie auch Ihr SPAM Verzeichniss.'); } } else { $msg = array('success' => 'Ihre Anmeldung wurde registriert.'); } if ('1' === $configure['send_email_organizer']) { unset($mail); $this->sendorganizer($datas, $configure, $ordername, $trashDate); } return $msg; }