浏览代码

Nueva libreria templates email.

Nermosis 3 年前
父节点
当前提交
90cce21f69

+ 1 - 1
application/config/autoload.php 查看文件

@@ -89,7 +89,7 @@ $autoload['drivers'] = array();
89 89
 |
90 90
 |    $autoload['helper'] = array('url', 'file');
91 91
  */
92
-$autoload['helper'] = array("funciones", "url");
92
+$autoload['helper'] = array("funciones", "email_templates", "url");
93 93
 
94 94
 /*
95 95
 | -------------------------------------------------------------------

+ 56 - 0
application/helpers/email_templates_helper.php 查看文件

@@ -0,0 +1,56 @@
1
+<?php
2
+if (!function_exists("emailInicioProcesoDescarga")) {
3
+    function emailInicioProcesoDescarga($fechaInicioProceso, $arrayArchivos)
4
+    {
5
+        $asunto = "Inicio descarga y proceso de archivos de licitaciones";
6
+        $archivosEmail = "";
7
+        foreach ($arrayArchivos as $file) {
8
+            $archivosEmail .= "<p>" . $file . "</p>";
9
+        }
10
+        $cuerpo = "<!DOCTYPE html>
11
+		<html lang='en'>
12
+		<head>
13
+			<meta charset='UTF-8'>
14
+		</head>
15
+
16
+		<body style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15px;'>
17
+			<div class='contenedor' style='max-width:900px; width:100%; margin:0px auto;'>
18
+				<div class='texto-inicio'>
19
+					<p><strong>A continuación se mostraran los ficheros implicados en el proceso de descarga a fecha :" . $fechaInicioProceso . ".</strong></p>
20
+				</div>
21
+				<div class='campos'>
22
+                    $archivosEmail;
23
+				</div>
24
+			</div>
25
+		</body>
26
+		</html>";
27
+
28
+        $email = "chcalvoleon@mindden.com";
29
+        enviarEmail($asunto, $cuerpo, $email, false);
30
+    }
31
+}
32
+
33
+if (!function_exists("emailFinProcesoDescarga")) {
34
+    function emailFinProcesoDescarga($fechaInicioProceso)
35
+    {
36
+        $asunto = "Fin descarga y proceso de archivos de licitaciones";
37
+
38
+        $cuerpo = "<!DOCTYPE html>
39
+		<html lang='en'>
40
+		<head>
41
+			<meta charset='UTF-8'>
42
+		</head>
43
+
44
+		<body style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15px;'>
45
+			<div class='contenedor' style='max-width:900px; width:100%; margin:0px auto;'>
46
+				<div class='texto-inicio'>
47
+					<p><strongEl proceso de importación con fecha $fechaInicioProceso ha terminado.</strong></p>
48
+				</div>
49
+			</div>
50
+		</body>
51
+		</html>";
52
+
53
+        $email = "chcalvoleon@mindden.com";
54
+        enviarEmail($asunto, $cuerpo, $email, false);
55
+    }
56
+}

+ 4 - 5
application/helpers/funciones_helper.php 查看文件

@@ -76,13 +76,12 @@ if (!function_exists("insertBucle")) {
76 76
 
77 77
         }
78 78
 
79
-        unset($conjunto);
80 79
         gc_collect_cycles();
81 80
         /*$query = $this->db->query($sql);
82 81
         $result = $query->result();
83 82
         $query->free_result();*/
84 83
 
85
-        return $CI->db->insert_id();
84
+        return count($conjunto);
86 85
     }
87 86
 }
88 87
 
@@ -171,7 +170,7 @@ if (!function_exists("enviarEmail")) {
171 170
         $config['protocol'] = 'smtp';
172 171
         $config['smtp_host'] = 'smtp.gmail.com';
173 172
         $config['smtp_user'] = 'chcalvoleon@mindden.com';
174
-        $config['smtp_pass'] = '';
173
+        $config['smtp_pass'] = '4lb1R2014';
175 174
         $config['smtp_crypto'] = 'ssl';
176 175
         $config['smtp_port'] = 465;
177 176
         $config['mailtype'] = 'html';
@@ -194,8 +193,8 @@ if (!function_exists("enviarEmail")) {
194 193
         }
195 194
 
196 195
         if ($print_result) {
197
-            echo $CI->email->send(false);
198
-            echo $CI->email->print_debugger();
196
+            $CI->email->send(false);
197
+            $CI->email->print_debugger();
199 198
         } else {
200 199
             $CI->email->send(false);
201 200
         }