Merge branch 'master' of https://github.apps.lci.ulsa.mx/PAAD/paad
Some checks are pending
Deploy Pruebas / deploy (push) Waiting to run
Some checks are pending
Deploy Pruebas / deploy (push) Waiting to run
This commit is contained in:
@@ -1,90 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||||
require_once "../class/mailer.php";
|
require_once "../class/mailer.php";
|
||||||
class MandaCorreos{
|
class MandaCorreos{
|
||||||
public const COORDINADOR = 1;
|
public const COORDINADOR = 1;
|
||||||
public const SUPERVISOR = 2;
|
public const SUPERVISOR = 2;
|
||||||
public const JEFE = 4;
|
public const JEFE = 4;
|
||||||
public const PROFESOR = 8;
|
public const PROFESOR = 8;
|
||||||
private const ENVIO_CORREOS = true;
|
private const ENVIO_CORREOS = true;
|
||||||
private const PRUEBAS = false;
|
private const PRUEBAS = false;
|
||||||
|
|
||||||
/* tipo es un acumulador de las banderas */
|
/* tipo es un acumulador de las banderas */
|
||||||
public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){
|
public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){
|
||||||
$to="";
|
$to="";
|
||||||
$correos=[];
|
$correos=[];
|
||||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||||
$to = "alejandro.lara@lasalle.mx";
|
$to = "alejandro.lara@lasalle.mx";
|
||||||
}else{
|
}else{
|
||||||
if($tipo & self::COORDINADOR){
|
if($tipo & self::COORDINADOR){
|
||||||
$correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor
|
$correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor
|
||||||
where rol_id = 9 and facultad_id = :fac
|
where rol_id = 9 and facultad_id = :fac
|
||||||
and coor.usuario_correo is not null and coor.usuario_correo != ''",
|
and coor.usuario_correo is not null and coor.usuario_correo != ''",
|
||||||
[':fac' => $facultad]
|
[':fac' => $facultad]
|
||||||
);
|
);
|
||||||
//print_r($correos_rs);
|
//print_r($correos_rs);
|
||||||
foreach($correos_rs as $correo){
|
foreach($correos_rs as $correo){
|
||||||
array_push($correos, $correo["usuario_correo"]);
|
array_push($correos, $correo["usuario_correo"]);
|
||||||
}
|
}
|
||||||
unset($correos_rs);
|
unset($correos_rs);
|
||||||
}
|
}
|
||||||
if($tipo & self::SUPERVISOR){
|
if($tipo & self::SUPERVISOR){
|
||||||
/*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo
|
/*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo
|
||||||
FROM horario_supervisor hs
|
FROM horario_supervisor hs
|
||||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||||
where :id_fac = ANY(hs.facultad_id_array)
|
where :id_fac = ANY(hs.facultad_id_array)
|
||||||
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
||||||
[':id_fac' => $facultad] );*/
|
[':id_fac' => $facultad] );*/
|
||||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo
|
$correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo
|
||||||
FROM usuario where rol_id = 7 and not estado_baja");
|
FROM usuario where rol_id = 7 and not estado_baja");
|
||||||
foreach($correosSup_rs as $correo){
|
foreach($correosSup_rs as $correo){
|
||||||
if (!empty($correo["usuario_correo"]))
|
if (!empty($correo["usuario_correo"]))
|
||||||
array_push($correos, $correo["usuario_correo"]);
|
array_push($correos, $correo["usuario_correo"]);
|
||||||
}
|
}
|
||||||
unset($correosSup_rs);
|
unset($correosSup_rs);
|
||||||
}
|
}
|
||||||
if($tipo & self::JEFE){
|
if($tipo & self::JEFE){
|
||||||
$correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo
|
$correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo
|
||||||
FROM usuario jefe
|
FROM usuario jefe
|
||||||
where :id_fac = ANY(jefe.facultad_id_array) AND rol_id = 11
|
where :id_fac = facultad_id AND rol_id = 11
|
||||||
and jefe.usuario_correo is not null and jefe.usuario_correo != ''",
|
and jefe.usuario_correo is not null and jefe.usuario_correo != ''",
|
||||||
[':id_fac' => $facultad] );
|
[':id_fac' => $facultad] );
|
||||||
foreach($correosJefe_rs as $correo){
|
foreach($correosJefe_rs as $correo){
|
||||||
if(!empty($correo["usuario_correo"]))
|
if(!empty($correo["usuario_correo"]))
|
||||||
array_push($correos, $correo["usuario_correo"]);
|
array_push($correos, $correo["usuario_correo"]);
|
||||||
}
|
}
|
||||||
unset($correosJefe_rs);
|
unset($correosJefe_rs);
|
||||||
}
|
}
|
||||||
if($tipo & self::PROFESOR && $prof_id != NULL){
|
if($tipo & self::PROFESOR && $prof_id != NULL){
|
||||||
$correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo
|
$correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo
|
||||||
FROM horario_profesor hs
|
FROM horario_profesor hs
|
||||||
inner join usuario prof on prof.usuario_id =hs.usuario_id
|
inner join usuario prof on prof.usuario_id =hs.usuario_id
|
||||||
where :id_fac = ANY(hs.facultad_id_array) and prof.usuario_id = :id_prof
|
where :id_fac = hs.facultad_id and prof.usuario_id = :id_prof
|
||||||
and prof.usuario_correo is not null and prof.usuario_correo != ''",
|
and prof.usuario_correo is not null and prof.usuario_correo != ''",
|
||||||
[':id_prof'=>$prof_id, ':id_fac' => $facultad] );
|
[':id_prof'=>$prof_id, ':id_fac' => $facultad] );
|
||||||
foreach($correosProf_rs as $correo){
|
foreach($correosProf_rs as $correo){
|
||||||
if(!empty($correo["usuario_correo"]))
|
if(!empty($correo["usuario_correo"]))
|
||||||
array_push($correos, $correo["usuario_correo"]);
|
array_push($correos, $correo["usuario_correo"]);
|
||||||
}
|
}
|
||||||
unset($correosProf_rs);
|
unset($correosProf_rs);
|
||||||
}
|
}
|
||||||
$to .= join(",", $correos);
|
$to .= join(",", $correos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($to!= "" && self::ENVIO_CORREOS){
|
if($to!= "" && self::ENVIO_CORREOS){
|
||||||
//crear plantilla
|
//crear plantilla
|
||||||
$texto = '<body >
|
$texto = '<body >
|
||||||
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
||||||
'.$texto.'
|
'.$texto.'
|
||||||
</body>';
|
</body>';
|
||||||
|
|
||||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||||
$asunto = "PRUEBAS-".$asunto;
|
$asunto = "PRUEBAS-".$asunto;
|
||||||
}
|
}
|
||||||
return Mailer::enviarCorreo($to, $asunto, $texto, true);
|
return Mailer::enviarCorreo($to, $asunto, $texto, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -182,7 +182,7 @@ try{
|
|||||||
|
|
||||||
//claves de carreras en el periodo
|
//claves de carreras en el periodo
|
||||||
$arreglo_claves = array_map(function ($item) {
|
$arreglo_claves = array_map(function ($item) {
|
||||||
return $item['clave_carrera'];
|
return intval($item['clave_carrera']);
|
||||||
}, $carreras_rs);
|
}, $carreras_rs);
|
||||||
|
|
||||||
//print_r($selectedData); exit();
|
//print_r($selectedData); exit();
|
||||||
@@ -191,6 +191,9 @@ try{
|
|||||||
|
|
||||||
//Recorre SGU y genera hash
|
//Recorre SGU y genera hash
|
||||||
foreach( $selectedData as $row ){
|
foreach( $selectedData as $row ){
|
||||||
|
//if ($debug)
|
||||||
|
// echo trim($row["HoraInicio"]."|".($row["NombreMateria"])."|".(trim($row["ClaveProfesor"])==""?"000000":trim($row["ClaveProfesor"]))."|".$row["IdEspacio"]."|".$per["periodo_id"]."|".$row["Carrera"])."[{$row["ClaveCarrera"]}]|{$row["EsMateriaPorReposicion"]}*";
|
||||||
|
|
||||||
if(!$row["EsMateriaPorReposicion"]){
|
if(!$row["EsMateriaPorReposicion"]){
|
||||||
$carrera = $row["ClaveCarrera"];
|
$carrera = $row["ClaveCarrera"];
|
||||||
if(is_null($carrera) || empty($carrera))
|
if(is_null($carrera) || empty($carrera))
|
||||||
@@ -245,12 +248,15 @@ try{
|
|||||||
|
|
||||||
//$areacomun = array();
|
//$areacomun = array();
|
||||||
foreach($sguHash as $sgu){
|
foreach($sguHash as $sgu){
|
||||||
if(in_array($sgu["data"]["ClaveCarrera"] , $arreglo_claves) /*&& !in_array($sgu["data"]["ClaveMateria"], $areacomun)*/){
|
//print_r($sgu["data"]);
|
||||||
|
//echo $sgu["data"]["NombreMateria"]. "[".intval($sgu["data"]["ClaveCarrera"])."] =".in_array( intval($sgu["data"]["ClaveCarrera"]) , $arreglo_claves)." ";
|
||||||
|
if(in_array( intval($sgu["data"]["ClaveCarrera"]) , $arreglo_claves) /*&& !in_array($sgu["data"]["ClaveMateria"], $areacomun)*/){
|
||||||
$horarios_sgu[] = $sgu;
|
$horarios_sgu[] = $sgu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//echo "<br><hr><br>";
|
||||||
|
|
||||||
//print_r($horarios_sgu);exit();
|
//print_r($horarios_sgu["hash"]);
|
||||||
unset($sguHash);
|
unset($sguHash);
|
||||||
$elementos_sgu_total = array_merge($elementos_sgu_total, $horarios_sgu);
|
$elementos_sgu_total = array_merge($elementos_sgu_total, $horarios_sgu);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user