Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function action_import_students($idEvent)
- {
- try {
- $data["idEvent"] = $idEvent;
- $data["pageTitle"] = "Importar alunos";
- $data["header"]["title"] = SITE_NAME . $data["pageTitle"];
- $data["header"]["menuSide"] = array(
- "header" => array(
- "user-img" => STATIC_URL . "images/" . Session::get("user-img"),
- "user-name" => Session::get("user-name"),
- "user-office" => Session::get("user-office")
- ),
- array(
- "dashboard" => ADM_URL
- ),
- array(
- "Alunos" => array(
- "class-icon" => ICON_LEADER,
- "url" => ADM_URL . "aluno",
- "scd-level" => array(
- "Novo" => ADM_URL . "aluno/novo",
- "Listar" => ADM_URL . "aluno/listar"
- )
- )
- ),
- array(
- "Produtos" => array(
- "class-icon" => ICON_PRODUCT,
- "url" => ADM_URL . "produto",
- "scd-level" => array(
- "Novo" => ADM_URL . "produto/novo",
- "Listar" => ADM_URL . "produto/listar"
- )
- )
- ),
- array(
- "Análises" => array(
- "class-icon" => ICON_ANALYSIS,
- "url" => ADM_URL . "analise",
- "scd-level" => array(
- "Novo" => ADM_URL . "analise/novo",
- "Listar" => ADM_URL . "analise/listar"
- )
- )
- ),
- array(
- "Competências" => array(
- "class-icon" => ICON_SKILL,
- "url" => ADM_URL . "competencia",
- "scd-level" => array(
- "Novo" => ADM_URL . "competencia/novo",
- "Listar" => ADM_URL . "competencia/listar"
- )
- )
- ),
- array(
- "Eventos" => array(
- "class-icon" => ICON_EVENT,
- "url" => ADM_URL . "evento",
- "scd-level%in" => array(
- "Novo" => ADM_URL . "evento/novo",
- "Listar" => ADM_URL . "evento/listar"
- )
- )
- ),
- array(
- "Inscrições" => array(
- "class-icon" => ICON_INSCRIPTION,
- "url" => ADM_URL . "inscricao",
- "scd-level" => array(
- "Pendentes" => ADM_URL . "inscricao/listar/pendentes",
- "Ativas" => ADM_URL . "inscricao/listar/ativas",
- "Finalizadas" => ADM_URL . "inscricao/listar/finalizadas"
- )
- )
- ),
- array(
- "Questões Objetivas" => array(
- "class-icon" => ICON_OBJQ,
- "url" => ADM_URL . "questao-objetiva",
- "scd-level" => array(
- "Novo" => ADM_URL . "questao-objetiva/novo",
- "Listar" => ADM_URL . "questao-objetiva/listar"
- )
- )
- ),
- array(
- "Questões Subjetivas" => array(
- "class-icon" => ICON_SBJQ,
- "url" => ADM_URL . "questao-subjetiva",
- "scd-level" => array(
- "Novo" => ADM_URL . "questao-subjetiva/novo",
- "Listar" => ADM_URL . "questao-subjetiva/listar"
- )
- )
- ),
- array(
- "Usuários" => array(
- "class-icon" => ICON_USER,
- "url" => ADM_URL . "usuario",
- "scd-level" => array(
- "Novo" => ADM_URL . "usuario/novo",
- "Listar" => ADM_URL . "usuario/listar"
- )
- )
- )
- );
- $data["header"]["menuTop"] = array(
- "user-name" => Session::get("user-name")
- );
- $data["header"]["moduleTitle"] = "Eventos";
- $data["header"]["breadcrumbs"] = array(
- "Home" => ADM_URL,
- "Evento" => ADM_URL . "evento/editar/" . $idEvent,
- "Importar Alunos%active" => null
- );
- if (Common::isEmpty($idEvent)) {
- Common::redir("gestor/evento/listar");
- }
- if ((isset($_FILES) && !Common::isEmpty($_FILES)) && (isset($_POST) && !Common::isEmpty($_POST))) {
- set_time_limit(0);
- $rset = $this->event->getById($idEvent);
- if ($rset["ativo"] == "0") {
- throw new \Exception("Não é possível fazer inscrições ou importações de alunos em eventos desativados.");
- }
- if (Common::isEmpty($_FILES["inscriptions"]["tmp_name"])) {
- throw new \Exception("Por favor, faça upload de algum arquivo.");
- }
- $file = $_FILES["inscriptions"];
- $filenameEx = explode(".", $file["name"]);
- $ext = $filenameEx[1];
- if ($ext !== "csv") {
- throw new \Exception("O arquivo não possui um formato (extensão) aceito pelo sistema.");
- }
- $tmpName = $_FILES['inscriptions']['tmp_name'];
- $fileToStr = file_get_contents($tmpName);
- $csv = explode(PHP_EOL, $fileToStr);
- $count = (count($csv) - 1);
- foreach ($csv as $pos => $line) {
- if ($pos == $count) {
- unset($csv[$pos]);
- break;
- }
- if ($pos == 0) {
- if (strstr($line, ',')) {
- $delimiter = ",";
- } elseif (strstr($line, ';')) {
- $delimiter = ";";
- }
- }
- $csv[$pos] = explode($delimiter, $line);
- }
- $spreadsheetType = $_POST["type"];
- switch ($spreadsheetType) {
- case 2:{
- $addedUpColumnsLeader = array();
- $addedUpColumnsInscription = array(
- "evento_id" => $idEvent,
- "status" => "1",
- "situacao" => "1"
- );
- $cpfs = array();
- $emails = array();
- $data["log"] = array();
- foreach ($csv as $key => $row) {
- if (($key == 0)) {
- unset($csv[$key]);
- continue;
- }
- if ($key > 0) {
- $line = $key + 1;
- $data["log"][$line]["status"] = "";
- $data["log"][$line]["error"] = "";
- foreach ($row as $cn => $record) {
- switch ($cn) {
- case '8':{
- $addedUpColumnsInscription["valor"] = $record;
- break;
- }
- case '14':{
- $addedUpColumnsInscription["parcela"] = $record;
- break;
- }
- case '19':{
- $data["log"][$line]["nome"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'Nome' não foi preenchido.<br />";
- }
- $addedUpColumnsLeader["nome"] = $record;
- break;
- }
- case '20':{
- if (preg_match("/^\d{3}\.\d{3}\.\d{3}-\d{2}$/", $record)) {
- $data["log"][$line]["cpf"] = $record;
- if (!Common::validateCPF($record)) {
- $data["log"][$line]["error"] .= "CPF inválido.<br />";
- }
- if (in_array($record, $cpfs)) {
- $data["log"][$line]["error"] .= "CPF repetido.<br />";
- }
- $cpfs[$key] = $record;
- $addedUpColumnsLeader["cpf"] = $record;
- } else {
- $data["log"][$line]["cpf"] = "";
- if (preg_match("/^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/", $record)) {
- $addedUpColumnsLeader["cnpj"] = $record;
- } else {
- $addedUpColumnsLeader["rg"] = $record;
- }
- }
- break;
- }
- case '21':{
- $data["log"][$line]["email"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'Email' não foi preenchido.<br />";
- }
- if (!filter_var($record, FILTER_VALIDATE_EMAIL)) {
- $data["log"][$line]["error"] .= "Email inválido.<br />";
- }
- if (in_array($record, $emails)) {
- $data["log"][$line]["error"] .= "Email repetido.<br />";
- }
- $emails[$key] = $record;
- $addedUpColumnsLeader["email"] = $record;
- break;
- }
- case '23':{
- if (preg_match("/^([0-9]{4,5})([0-9]{4})$/", $record, $matches)) {
- $addedUpColumnsLeader["telefone"] = "(" . $row[22] . ")" . $matches[1] . "-" . $matches[2];
- }
- break;
- }
- case '37':{
- switch ($record) {
- case 'CartaoDeCredito':
- $addedUpColumnsInscription["forma_pagto"] = "CC";
- break;
- case 'DebitoBancario':
- $addedUpColumnsInscription["forma_pagto"] = "CD";
- break;
- case 'BoletoBancario':
- $addedUpColumnsInscription["forma_pagto"] = "BB";
- break;
- }
- break;
- }
- }
- }
- if ($data["log"][$line]["error"] !== "") {
- $data["log"][$line]["status"] .= "Não cadastrado";
- continue;
- }
- if (isset($addedUpColumnsLeader["cpf"]) && $addedUpColumnsLeader["cpf"] !== "") {
- $referenceColumns = array(
- "cpf" => $addedUpColumnsLeader["cpf"]
- );
- } else {
- $referenceColumns = array(
- "email" => $addedUpColumnsLeader["email"]
- );
- }
- $rset = $this->leader->get($referenceColumns);
- if ($rset) {
- $idLeader = (int) $rset["id"];
- $referenceColumns = array(
- "id" => $idLeader
- );
- $setableColumns = $addedUpColumnsLeader;
- $this->leader->update($referenceColumns, $setableColumns);
- $data["log"][$line]["status"] .= "Aluno atualizado.<br />";
- } else {
- $idLeader = $this->leader->create($addedUpColumnsLeader);
- $data["log"][$line]["status"] .= "Aluno cadastrado.<br />";
- }
- if (is_numeric($idLeader)) {
- $referenceColumns = array(
- "id" => $idLeader
- );
- $rset = $this->leader->get($referenceColumns);
- $email = $rset["email"];
- $referenceColumns = array(
- "evento_id" => $idEvent,
- "lider_id" => $idLeader
- );
- $rset = $this->inscription->get($referenceColumns);
- if ($rset) {
- $data["log"][$line]["status"] .= "Inscrição existente.<br />";
- continue;
- }
- $addedUpColumnsInscription["lider_id"] = $idLeader;
- $addedUpColumnsInscription["chave"] = md5(time() . $email);
- $addedUpColumnsInscription["observacao"] = "Hotmart";
- $id = $this->inscription->create($addedUpColumnsInscription);
- if (is_numeric($id)) {
- $data["log"][$line]["status"] .= "Inscrição cadastrada.<br />";
- $referenceColumns = array(
- "id" => $idEvent
- );
- $rset = $this->event->get($referenceColumns);
- if ($rset) {
- $analise_id = $rset["analise_id"];
- }
- $referenceColumns = array(
- "analise_id" => $analise_id,
- "categoria" => "1",
- "ativo" => "1"
- );
- $email_template = $this->email_template->get($referenceColumns);
- if ($email_template) {
- $referenceColumns = array(
- "evento_id" => $idEvent,
- "lider_id" => $idLeader,
- "analise_id" => $analise_id,
- "inscricao_id" => $id
- );
- $rset = $this->inscription->queryJoin(
- $referenceColumns,
- "SELECT
- i.chave, a.analise, l.nome, l.email, e.evento, p.produto
- FROM
- inscricoes i
- INNER JOIN
- eventos e
- ON
- e.id = i.evento_id
- INNER JOIN
- lideres l
- ON
- l.id = i.lider_id
- INNER JOIN
- analises a
- ON
- a.id = e.analise_id
- INNER JOIN
- produtos p
- ON
- p.id = a.produto_id
- WHERE
- e.id = :evento_id
- AND
- l.id = :lider_id
- AND
- a.id = :analise_id
- AND
- i.id = :inscricao_id
- "
- );
- $assunto = $email_template["assunto"];
- $mail = new \PHPMailer();
- $mail->setLanguage("pt");
- $from = MAIL_FROM;
- $fromName = MAIL_FROMNAME;
- $host = MAIL_HOST;
- $username = MAIL_USERNAME;
- $password = MAIL_PASSWORD;
- $port = MAIL_PORT;
- $secure = MAIL_SECURE;
- $mail->isSMTP();
- $mail->Host = $host;
- $mail->SMTPAuth = true;
- $mail->Username = $username;
- $mail->Password = $password;
- $mail->SMTPSecure = $secure;
- $mail->Port = $port;
- $mail->From = $from;
- $mail->FromName = $fromName;
- $mail->addReplyTo($from, $fromName);
- $mail->addAddress($rset["email"], $rset["nome"]);
- $mail->isHTML(true);
- $mail->CharSet = 'UTF-8';
- $mail->WordWrap = 70;
- $mail->Subject = $assunto;
- $src_img = STATIC_URL . "images/logo.jpg";
- $body = <<<EOD
- <style type="text/css">
- a{
- color: #FFF;
- text-decoration: none;
- }
- </style>
- <table width="785" border="0" cellpadding="0" cellspacing="0" style="background:#F1F1F1;">
- <tr>
- <td height="496" valign="top">
- <table width="570" border="0" align="center" cellpadding="0" cellspacing="0" style=" background:#FFFFFF;">
- <tr>
- <td colspan="2" style="background:#F1F1F1;"> </td>
- </tr>
- <tr>
- <td width="204" height="75" style="padding-left:5px;">
- <img src="$src_img" height="40">
- </td>
- <td width="366" align="center"><strong><span style="margin-top:20px; font-family:Tahoma, Geneva, sans-serif;font-size:14px;color:#095BA6;">{{produto}}: {{assunto}}</span></strong></td>
- </tr>
- <tr>
- <td colspan="2" style="background:#F1F1F1;"> </td>
- </tr>
- <tr>
- <td height="334" colspan="2" valign="top" style="padding-left:10px; padding-right:10px; font-family:Tahoma, Geneva, sans-serif;font-size:12px;color:#333;">
- <br/>
- EOD;
- if (strstr($body, "{{produto}}") && isset($rset["produto"])) {
- $body = str_replace("{{produto}}", $rset["produto"], $body);
- }
- if (strstr($body, "{{assunto}}") && isset($assunto)) {
- $body = str_replace("{{assunto}}", $assunto, $body);
- }
- $body .= $email_template["corpo"];
- if (strstr($body, "{{nome}}") && isset($rset["nome"])) {
- $body = str_replace("{{nome}}", $rset["nome"], $body);
- }
- if (strstr($body, "{{evento}}") && isset($rset["evento"])) {
- $body = str_replace("{{evento}}", $rset["evento"], $body);
- }
- if (strstr($body, "{{analise}}") && isset($rset["analise"])) {
- $body = str_replace("{{analise}}", $rset["analise"], $body);
- }
- if (strstr($body, "{{aceita}}") && isset($rset["chave"])) {
- $url = SITE_URL . "questionario/aluno/" . $rset["chave"];
- $buttonConfirm = <<<EOD
- <table width="170" style="text-align:center; padding:3px; background:#4D90FE; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;">
- <tr>
- <td><a href="$url" style="color:white;">Acesse aqui sua pesquisa!</a></td>
- </tr>
- </table><br/>
- EOD;
- $body = str_replace("{{aceita}}", $buttonConfirm, $body);
- }
- if (strstr($body, "{{data}}")) {
- $body = str_replace("{{data}}", date("d/m/Y"), $body);
- }
- $body .= <<<EOD
- <br/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height="20" valign="top"> </td>
- </tr>
- </table>
- EOD;
- $mail->Body = $body;
- $send = $mail->Send();
- if ($send) {
- $data["log"][$line]["status"] .= "Email enviado.<br />";
- } else {
- $data["log"][$line]["status"] .= "Email não enviado.<br />";
- }
- }
- }
- }
- }
- }
- break;
- }
- default:{
- $addedUpColumnsLeader = array();
- $addedUpColumnsInscription = array(
- "evento_id" => $idEvent,
- "status" => "1",
- "situacao" => "1"
- );
- $cpfs = array();
- $emails = array();
- $data["log"] = array();
- foreach ($csv as $key => $row) {
- if ($key <= 1) {
- unset($csv[$key]);
- continue;
- }
- if ($key > 1) {
- $line = $key + 1;
- $data["log"][$line]["status"] = "";
- $data["log"][$line]["error"] = "";
- foreach ($row as $cn => $record) {
- switch ($cn) {
- case '0':{
- $data["log"][$line]["nome"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'Nome' não foi preenchido.<br />";
- }
- $addedUpColumnsLeader["nome"] = $record;
- break;
- }
- case '1':{
- $addedUpColumnsLeader["data_nascimento"] = Common::format("localeToDate", $record);
- break;
- }
- case '2':{
- $addedUpColumnsLeader["telefone"] = $record;
- break;
- }
- case '3':{
- $addedUpColumnsLeader["celular"] = $record;
- break;
- }
- case '4':{
- $data["log"][$line]["email"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'Email' não foi preenchido.<br />";
- }
- if (!filter_var($record, FILTER_VALIDATE_EMAIL)) {
- $data["log"][$line]["error"] .= "Email inválido.<br />";
- }
- if (in_array($record, $emails)) {
- $data["log"][$line]["error"] .= "Email repetido.<br />";
- }
- $emails[$key] = $record;
- $addedUpColumnsLeader["email"] = $record;
- break;
- }
- case '5':{
- $data["log"][$line]["cpf"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'CPF' não foi preenchido.<br />";
- }
- if (!Common::validateCPF($record)) {
- $data["log"][$line]["error"] .= "CPF inválido.<br />";
- }
- if (in_array($record, $cpfs)) {
- $data["log"][$line]["error"] .= "CPF repetido.<br />";
- }
- $cpfs[$key] = $record;
- $addedUpColumnsLeader["cpf"] = $record;
- break;
- }
- case '6':{
- $addedUpColumnsLeader["rg"] = $record;
- break;
- }
- case '7':{
- $addedUpColumnsLeader["empresa"] = $record;
- break;
- }
- case '8':{
- $addedUpColumnsLeader["cnpj"] = $record;
- break;
- }
- case '9':{
- $addedUpColumnsLeader["cargo"] = $record;
- break;
- }
- case '10':{
- $data["log"][$line]["nota_fiscal"] = $record;
- if (empty($record)) {
- $data["log"][$line]["error"] .= "Campo obrigatório 'Nota Fiscal' não foi preenchido.<br />";
- }
- if (($record == "F") || ($record == "f")) {
- $addedUpColumnsInscription["nota_fiscal"] = "F";
- } elseif (($record == "J") || ($record == "j")) {
- $addedUpColumnsInscription["nota_fiscal"] = "J";
- }
- break;
- }
- }
- }
- if ($data["log"][$line]["error"] !== "") {
- $data["log"][$line]["status"] .= "Não cadastrado";
- continue;
- }
- $referenceColumns = array(
- "cpf" => $addedUpColumnsLeader["cpf"]
- );
- $rset = $this->leader->get($referenceColumns);
- if ($rset) {
- $idLeader = (int) $rset["id"];
- $referenceColumns = array(
- "id" => $idLeader
- );
- $setableColumns = $addedUpColumnsLeader;
- $this->leader->update($referenceColumns, $setableColumns);
- $data["log"][$line]["status"] .= "Aluno atualizado.<br />";
- } else {
- $idLeader = $this->leader->create($addedUpColumnsLeader);
- $data["log"][$line]["status"] .= "Aluno cadastrado.<br />";
- }
- if (is_numeric($idLeader)) {
- $referenceColumns = array(
- "id" => $idLeader
- );
- $rset = $this->leader->get($referenceColumns);
- $email = $rset["email"];
- $referenceColumns = array(
- "evento_id" => $idEvent,
- "lider_id" => $idLeader
- );
- $rset = $this->inscription->get($referenceColumns);
- if ($rset) {
- $data["log"][$line]["status"] .= "Inscrição existente.<br />";
- continue;
- }
- $addedUpColumnsInscription["lider_id"] = $idLeader;
- $addedUpColumnsInscription["chave"] = md5(time() . $email);
- $id = $this->inscription->create($addedUpColumnsInscription);
- if (is_numeric($id)) {
- $data["log"][$line]["status"] .= "Inscrição cadastrada.<br />";
- $referenceColumns = array(
- "id" => $idEvent
- );
- $rset = $this->event->get($referenceColumns);
- if ($rset) {
- $analise_id = $rset["analise_id"];
- }
- $referenceColumns = array(
- "analise_id" => $analise_id,
- "categoria" => "1",
- "ativo" => "1"
- );
- $email_template = $this->email_template->get($referenceColumns);
- if ($email_template) {
- $referenceColumns = array(
- "evento_id" => $idEvent,
- "lider_id" => $idLeader,
- "analise_id" => $analise_id,
- "inscricao_id" => $id
- );
- $rset = $this->inscription->queryJoin(
- $referenceColumns,
- "SELECT
- i.chave, a.analise, l.nome, l.email, e.evento, p.produto
- FROM
- inscricoes i
- INNER JOIN
- eventos e
- ON
- e.id = i.evento_id
- INNER JOIN
- lideres l
- ON
- l.id = i.lider_id
- INNER JOIN
- analises a
- ON
- a.id = e.analise_id
- INNER JOIN
- produtos p
- ON
- p.id = a.produto_id
- WHERE
- e.id = :evento_id
- AND
- l.id = :lider_id
- AND
- a.id = :analise_id
- AND
- i.id = :inscricao_id
- "
- );
- $assunto = $email_template["assunto"];
- $mail = new \PHPMailer();
- $mail->setLanguage("pt");
- $from = MAIL_FROM;
- $fromName = MAIL_FROMNAME;
- $host = MAIL_HOST;
- $username = MAIL_USERNAME;
- $password = MAIL_PASSWORD;
- $port = MAIL_PORT;
- $secure = MAIL_SECURE;
- $mail->isSMTP();
- $mail->Host = $host;
- $mail->SMTPAuth = true;
- $mail->Username = $username;
- $mail->Password = $password;
- $mail->SMTPSecure = $secure;
- $mail->Port = $port;
- $mail->From = $from;
- $mail->FromName = $fromName;
- $mail->addReplyTo($from, $fromName);
- $mail->addAddress($rset["email"], $rset["nome"]);
- $mail->isHTML(true);
- $mail->CharSet = 'UTF-8';
- $mail->WordWrap = 70;
- $mail->Subject = $assunto;
- $src_img = STATIC_URL . "images/logo.jpg";
- $body = <<<EOD
- <style type="text/css">
- a{
- color: #FFF;
- text-decoration: none;
- }
- </style>
- <table width="785" border="0" cellpadding="0" cellspacing="0" style="background:#F1F1F1;">
- <tr>
- <td height="496" valign="top">
- <table width="570" border="0" align="center" cellpadding="0" cellspacing="0" style=" background:#FFFFFF;">
- <tr>
- <td colspan="2" style="background:#F1F1F1;"> </td>
- </tr>
- <tr>
- <td width="204" height="75" style="padding-left:5px;">
- <img src="$src_img" height="40">
- </td>
- <td width="366" align="center"><strong><span style="margin-top:20px; font-family:Tahoma, Geneva, sans-serif;font-size:14px;color:#095BA6;">{{produto}}: {{assunto}}</span></strong></td>
- </tr>
- <tr>
- <td colspan="2" style="background:#F1F1F1;"> </td>
- </tr>
- <tr>
- <td height="334" colspan="2" valign="top" style="padding-left:10px; padding-right:10px; font-family:Tahoma, Geneva, sans-serif;font-size:12px;color:#333;">
- <br/>
- EOD;
- if (strstr($body, "{{produto}}") && isset($rset["produto"])) {
- $body = str_replace("{{produto}}", $rset["produto"], $body);
- }
- if (strstr($body, "{{assunto}}") && isset($assunto)) {
- $body = str_replace("{{assunto}}", $assunto, $body);
- }
- $body .= $email_template["corpo"];
- if (strstr($body, "{{nome}}") && isset($rset["nome"])) {
- $body = str_replace("{{nome}}", $rset["nome"], $body);
- }
- if (strstr($body, "{{evento}}") && isset($rset["evento"])) {
- $body = str_replace("{{evento}}", $rset["evento"], $body);
- }
- if (strstr($body, "{{analise}}") && isset($rset["analise"])) {
- $body = str_replace("{{analise}}", $rset["analise"], $body);
- }
- if (strstr($body, "{{aceita}}") && isset($rset["chave"])) {
- $url = SITE_URL . "questionario/aluno/" . $rset["chave"];
- $buttonConfirm = <<<EOD
- <table width="170" style="text-align:center; padding:3px; background:#4D90FE; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;">
- <tr>
- <td><a href="$url" style="color:white;">Acesse aqui sua pesquisa!</a></td>
- </tr>
- </table><br/>
- EOD;
- $body = str_replace("{{aceita}}", $buttonConfirm, $body);
- }
- if (strstr($body, "{{data}}")) {
- $body = str_replace("{{data}}", date("d/m/Y"), $body);
- }
- $body .= <<<EOD
- <br/>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td height="20" valign="top"> </td>
- </tr>
- </table>
- EOD;
- $mail->Body = $body;
- $send = $mail->Send();
- if ($send) {
- $data["log"][$line]["status"] .= "Email enviado.<br />";
- } else {
- $data["log"][$line]["status"] .= "Email não enviado.<br />";
- }
- }
- }
- }
- }
- }
- break;
- }
- }
- $this->loadView(ADM_VIEW_PATH, "event/import_log", $data);
- }
- $data["action"] = ADM_URL . "evento/importar-alunos/" . $idEvent;
- $this->loadView(ADM_VIEW_PATH, "event/import_students", $data);
- } catch (\Exception $e) {
- Session::set("error", array(
- "type" => "alert-warning",
- "msg" => $e->getMessage()
- ));
- Common::redir("gestor/evento/importar-alunos/" . $idEvent);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement