<?php


defined('BASEPATH') OR exit('No direct script access allowed');

class Template {

    public static function indicarAmigo($nome, $nomeIndicacao) {
        return '
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">body,html{
        font-family: "Verdana", serif;background-color: #d6d4d5;
    }
</style>
<table align="center" border="1" style="border-collapse: collapse;border:1px solid #888; width: 100%;max-width: 700px;">
	<tbody>
		<tr>
			<td style="background-color: #009045;padding: 6px">
			<table align="center" border="0" style="color: #fff;">
				<tbody>
					<tr style="text-align: center; font-size: 22pt; font-weight: bold;">
						<td>AMAZÔNIA CURSOS</td>
					</tr>
					<tr style="text-align: center;">
						<td style="display: table; margin: auto;padding:2px 37px;border-top: 1px solid #fff;font-size: 11pt;">CURSOS ONLINE GRÁTIS</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; background-color: #4E4C4D; font-size: 16pt; color: #fff;padding: 15px;font-family: "Verdana", serif;font-weight: bold;">
			<div style="display: table; width: 100%; max-width: 350px;margin: auto;">INDICAÇÃO DA PLATAFORMA AMAZÔNIA CURSOS</div>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; font-weight: bold; padding: 2px; font-size: 14pt; background-color: #FFF;">Um amigo lhe recomendou o Amazônia Cursos</td>
		</tr>
		<tr>
			<td style="background-color: white;padding: 25px; border-color:white;">
			<div style="display: table; margin: auto; font-family: "Verdana",serif;color: #f3f3f3;width: 100%; max-width: 350px;text-align: left;word-wrap: break-word;line-height: 25px;">
			Ol&aacute; <strong>' . $nomeIndicacao . '</strong>, seu amigo <strong>' . utf8_encode($nome) . '</strong> indicou o Amazônia Cursos para você;. Acesse e cadastre-se agora os cursos s&atilde;o gr&aacute;tis!
			</td>
		</tr>
		<tr>
			<td style="padding: 15px;background-color: white; border-color:white;">
			<table align="center" border="0" style="margin-top: 15px;">
				<tbody>
					<tr>
						<td style="padding-bottom: 15px;text-align: center;"><a href="'.base_url('').'" style="background: #009045; color: #fff;text-decoration: none;padding: 13px 20px; font-size: 18px; font-weight: bold;position:relative; top: 1px;" target="_blank">Acesse Agora</a></td>
					</tr>
                                        
					<tr style="padding-top: 2%;">
						<td style="text-align: center; background: white;"><a href="https://www.facebook.com/amazoniacursos/?fref=ts" style="text-decoration: none;"><img alt="facebook" src="https://i10.createsend1.com/static/eb/customise/13-the-blueprint-3/images/facebook.png" width="35" /> </a> <a href="https://twitter.com/AmazoniaCursos" style="text-decoration: none;"> <img alt="twitter" src="https://i1.createsend1.com/static/eb/customise/13-the-blueprint-3/images/twitter.png" width="35" /> </a></td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="background-color: #009045; text-align: center; font-size: 9pt;color:#e2e2e2; padding: 10px 0;">Copyright &copy; - Amaz&ocirc;nia Cursos<br />
			Contato: contato@amazoniacursos.com.br</td>
		</tr>
	</tbody>
</table>

                ';
    }
 public static function cadastro($nome,$email, $senha) {
        return '
					<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">body,html{
        font-family: "Verdana", serif;background-color: #d6d4d5;
    }
</style>
<table align="center" border="1" style="border-collapse: collapse;border:1px solid #888; width: 100%;max-width: 700px;">
	<tbody>
		<tr>
			<td style="background-color: #009045;padding: 6px">
			<table align="center" border="0" style="color: #fff;">
				<tbody>
					<tr style="text-align: center; font-size: 22pt; font-weight: bold;">
						<td>AMAZ&Ocirc;NIA CURSOS</td>
					</tr>
					<tr style="text-align: center;">
						<td style="display: table; margin: auto;padding:2px 37px;border-top: 1px solid #fff;font-size: 11pt;">CURSOS ONLINE GR&Aacute;TIS</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; background-color: #4E4C4D; font-size: 16pt; color: #fff;padding: 15px;font-family: "Verdana", serif;font-weight: bold;">
			<div style="display: table; width: 100%; max-width: 350px;margin: auto;">CADASTRO</div>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; font-weight: bold; padding: 2px; font-size: 14pt; background-color: #FFF;">Você se cadastrou no nosso site</td>
		</tr>
		<tr>
			<td style="background-color: white;padding: 25px; border-color:white;">
			<div style="display: table; margin: auto; font-family: "Verdana",serif;color: #f3f3f3;width: 100%; max-width: 350px;text-align: left;word-wrap: break-word;line-height: 25px;">
			Olá, <strong>' . $nome . '</strong>. Você realizou o seu cadastro no nosso site. 
			Por isso estamos enviando este email para você, seu usuário é: <strong>' . $email . '</strong> e a sua senha é: <strong>' . $senha . '</strong> 
			.Em caso de dúvida entre em contato.
			</td>
		</tr>
		<tr>
			<td style="padding: 15px;background-color: white;">
			<table align="center" border="0" style="margin-top: 15px;">
				<tbody>
					<tr>
						<td style="padding-bottom: 15px;text-align: center;"><a href="'.base_url('').'" style="background: #009045; color: #fff;text-decoration: none;padding: 13px 20px; font-size: 18px; font-weight: bold;position:relative; top: 1px;" target="_blank">Acesse Agora</a></td>
					</tr>
					<tr>
						<td style="text-align: center; background: white;"><a href="https://www.facebook.com/amazoniacursos/?fref=ts" style="text-decoration: none;"><img alt="facebook" src="https://i10.createsend1.com/static/eb/customise/13-the-blueprint-3/images/facebook.png" width="35" /> </a> <a href="https://twitter.com/AmazoniaCursos" style="text-decoration: none;"> <img alt="twitter" src="https://i1.createsend1.com/static/eb/customise/13-the-blueprint-3/images/twitter.png" width="35" /> </a></td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="background-color: #009045; text-align: center; font-size: 9pt;color:#e2e2e2; padding: 10px 0;">Copyright &copy; - Amaz&ocirc;nia Cursos<br />
			Contato: contato@amazoniacursos.com.br</td>
		</tr>
	</tbody>
</table>

				';
    }
    public static function recuperarSenha($nome, $senha) {
        return '
					<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">body,html{
        font-family: "Verdana", serif;background-color: #d6d4d5;
    }
</style>
<table align="center" border="1" style="border-collapse: collapse;border:1px solid #888; width: 100%;max-width: 700px;">
	<tbody>
		<tr>
			<td style="background-color: #009045;padding: 6px">
			<table align="center" border="0" style="color: #fff;">
				<tbody>
					<tr style="text-align: center; font-size: 22pt; font-weight: bold;">
						<td>AMAZ&Ocirc;NIA CURSOS</td>
					</tr>
					<tr style="text-align: center;">
						<td style="display: table; margin: auto;padding:2px 37px;border-top: 1px solid #fff;font-size: 11pt;">CURSOS ONLINE GR&Aacute;TIS</td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; background-color: #4E4C4D; font-size: 16pt; color: #fff;padding: 15px;font-family: "Verdana", serif;font-weight: bold;">
			<div style="display: table; width: 100%; max-width: 350px;margin: auto;">SOLICITAÇÃO DE SENHA</div>
			</td>
		</tr>
		<tr>
			<td style="text-align: center; font-weight: bold; padding: 2px; font-size: 14pt; background-color: #FFF;">Você solicitou a recuperação de sua senha</td>
		</tr>
		<tr>
			<td style="background-color: white;padding: 25px; border-color:white">
			<div style="display: table; margin: auto; font-family: "Verdana",serif;color: #f3f3f3;width: 100%; max-width: 350px;text-align: left;word-wrap: break-word;line-height: 25px;">
			Olá, <strong>' . $nome . '</strong>. Você solicitou a sua senha através do nosso site. 
			Por isso estamos enviando este email para você, sua senha é: <strong>' . $senha . '</strong> 
			.Em caso de dúvida entre em contato.
			</td>
		</tr>
		<tr>
			<td style="padding: 15px;background-color: white; border-color:white;">
			<table align="center" border="0" style="margin-top: 15px;">
				<tbody>
					<tr>
						<td style="padding-bottom: 15px;text-align: center;"><a href="'.base_url('').'" style="background: #009045; color: #fff;text-decoration: none;padding: 13px 20px; font-size: 18px; font-weight: bold;position:relative; top: 1px;" target="_blank">Acesse Agora</a></td>
					</tr>
					<tr>
						<td style="text-align: center; background: white;"><a href="https://www.facebook.com/amazoniacursos/?fref=ts" style="text-decoration: none;"><img alt="facebook" src="https://i10.createsend1.com/static/eb/customise/13-the-blueprint-3/images/facebook.png" width="35" /> </a> <a href="https://twitter.com/AmazoniaCursos" style="text-decoration: none;"> <img alt="twitter" src="https://i1.createsend1.com/static/eb/customise/13-the-blueprint-3/images/twitter.png" width="35" /> </a></td>
					</tr>
				</tbody>
			</table>
			</td>
		</tr>
		<tr>
			<td style="background-color: #009045; text-align: center; font-size: 9pt;color:#e2e2e2; padding: 10px 0;">Copyright &copy; - Amaz&ocirc;nia Cursos<br />
			Contato: contato@amazoniacursos.com.br</td>
		</tr>
	</tbody>
</table>

				';
    }

    public static function sendContato($msg) {
        $amazonia = 'Amaz&ocirc;nia';
        $amazonia = utf8_encode($amazonia);

        return '
				<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Amaz&ocirc;nia Cursos</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%">
				
	<tr>
		<td style="background-color:#00CC00;" bgcolor="#00CC00" >
			<table cellpadding="10" cellspacing="0" border="0" width="650px" align="center" style="width:650px;font-family:Verdana, Helvetica, sans-serif;color:#FFFFFF;font-size:13px;line-height:180%" >
				<tr>
					<td align="center">
						<div style="font-size:40px;font-weight:bold;text-shadow: 0.1em 0.1em #333;">' . $amazonia . ' Cursos</div>
						<div style="padding: 20px 1px 1px 1px;"></div>
					</td>
					<td align="right">
					</td>
								
				</tr>
			</table>
		</td>
	</tr>
								
								
	<tr>
								
		<td height="20px" style="background:#fff; border-bottom: #000 2px solid;box-shadow: 5px 5px 20px #000000;-webkit-box-shadow: 5px 5px 20px #00000;
-moz-box-shadow: 5px 5px 20px #00000;height:5px" bgcolor="#5F872F" align="center"></td>
								
	</tr>
	<tr>
		<td style="background-color:#EBEDE2;" bgcolor="#EBEDE2">
			<br><br> ' . $msg . '<br/><br/>
					
			<b><br/><br/>
		</td>
	</tr>
	<tr>
		<td style="background-color:#00CC00;border-bottom:2px #FFFFFF solid" bgcolor="#00CC00">
			<table cellpadding="10" cellspacing="0" border="0" width="650px" style="width:650px;color:#9D9A93;font-family:Verdana, Helvetica, sans-serif;font-size:11px" align="center">
				<tr>
					<td align="left">
						<a href="https://docs.google.com/spreadsheet/viewform?formkey=dDRuU2ZLV0gzSnJOc1Y5LUg4QzN4ZWc6MQ#gid=0" style="color: #FFFFFF"></a>
					</td>
					<td align="right">
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
			   ';
    }
    
    
        public static function certificado($certificado) {
        $template  = '';
        $template .= '
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
    body,html{
        font-family: "Verdana", serif;background-color: #d6d4d5;
    }
    #customers {
        font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
        border-collapse: collapse;
        width: 100%;
    }

    #customers td, #customers th {
        border: 1px solid #ddd;
        padding: 8px;
    }

    #customers tr:nth-child(even){background-color: #f2f2f2;}

    #customers th {
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #4CAF50;
        color: white;
    }
</style>
<table align="center" border="1" style="border-collapse: collapse;border:1px solid #888; width: 100%;max-width: 700px;">
    <tbody>
        <tr>
            <td style="background-color: #009045;padding: 6px">
                <table align="center" border="0" style="color: #fff;">
                    <tbody>
                        <tr style="text-align: center; font-size: 22pt; font-weight: bold;">
                            <td>AMAZÔNIA CURSOS</td>
                        </tr>
                        <tr style="text-align: center;">
                            <td style="display: table; margin: auto;padding:2px 37px;border-top: 1px solid #fff;font-size: 11pt;">CURSOS ONLINE GRÁTIS</td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>

        <tr>
            <td style="text-align: center; font-weight: bold; padding: 2px; font-size: 14pt; background-color: #FFF;">CERTIFICADOS</td>
        </tr>
        <tr>
            <td style="background-color: #424242;padding: 25px; color: white;">
                <div style="display: table; margin: auto; font-family: "Verdana" ;color: ;width: 100%; max-width: 350px;text-align: left;word-wrap: break-word;line-height: 25px;">
                     Ol&aacute; <strong>' . $certificado[0]->nome . '</strong> você acaba de receber os certificados dos cursos realizados no nosso site. Para visualizar o seu certificado basta clicar no link abaixo
            </td>
        </tr>
        <tr>
            <td style="padding: 15px;background-color: #C0C0C0;">
                <table align="center" border="0" style="margin-top: 15px;" id="customers">
                    <thead>
                        <tr>
                            <th>Certificados</th>
                            <th>Link</th>
                        </tr>
                    </thead>
                    <tbody>
                        ';
                        foreach ($certificado as $certificados) { 
                        $codifica = new Template();
                        $template .='        
                        <tr>
                            <td>'.$certificados->nome_curso.'</td>
                            <td><a target="_blank" href="'.base_url('certificado/'. $codifica->codifica($certificados->id_historico)).'"> '.base_url('certificado/'. $codifica->codifica($certificados->id_historico)).' </a></td>
                            
                        </tr>';
                        }
                        $template .='
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td style="background-color: #009045; text-align: center; font-size: 9pt;color:#e2e2e2; padding: 10px 0;">Copyright &copy; '.date('Y').' - Amaz&ocirc;nia Cursos<br />
                Contato: contato@amazoniacursos.com.br</td>
        </tr>
    </tbody>
</table>
                ';
                       return $template;  
    }
    
    public function codifica($string = null) {
        for ($i = 0; $i < 3; $i++) {
            $string = strrev(base64_encode(str_replace("=", "+", $string)));
        }
        return $string;
    }

}
