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
|
||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||
require_once "../class/mailer.php";
|
||||
class MandaCorreos{
|
||||
public const COORDINADOR = 1;
|
||||
public const SUPERVISOR = 2;
|
||||
public const JEFE = 4;
|
||||
public const PROFESOR = 8;
|
||||
private const ENVIO_CORREOS = true;
|
||||
private const PRUEBAS = false;
|
||||
|
||||
/* tipo es un acumulador de las banderas */
|
||||
public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){
|
||||
$to="";
|
||||
$correos=[];
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||
$to = "alejandro.lara@lasalle.mx";
|
||||
}else{
|
||||
if($tipo & self::COORDINADOR){
|
||||
$correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor
|
||||
where rol_id = 9 and facultad_id = :fac
|
||||
and coor.usuario_correo is not null and coor.usuario_correo != ''",
|
||||
[':fac' => $facultad]
|
||||
);
|
||||
//print_r($correos_rs);
|
||||
foreach($correos_rs as $correo){
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correos_rs);
|
||||
}
|
||||
if($tipo & self::SUPERVISOR){
|
||||
/*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo
|
||||
FROM horario_supervisor hs
|
||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||
where :id_fac = ANY(hs.facultad_id_array)
|
||||
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
||||
[':id_fac' => $facultad] );*/
|
||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo
|
||||
FROM usuario where rol_id = 7 and not estado_baja");
|
||||
foreach($correosSup_rs as $correo){
|
||||
if (!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosSup_rs);
|
||||
}
|
||||
if($tipo & self::JEFE){
|
||||
$correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo
|
||||
FROM usuario jefe
|
||||
where :id_fac = ANY(jefe.facultad_id_array) AND rol_id = 11
|
||||
and jefe.usuario_correo is not null and jefe.usuario_correo != ''",
|
||||
[':id_fac' => $facultad] );
|
||||
foreach($correosJefe_rs as $correo){
|
||||
if(!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosJefe_rs);
|
||||
}
|
||||
if($tipo & self::PROFESOR && $prof_id != NULL){
|
||||
$correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo
|
||||
FROM horario_profesor hs
|
||||
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
|
||||
and prof.usuario_correo is not null and prof.usuario_correo != ''",
|
||||
[':id_prof'=>$prof_id, ':id_fac' => $facultad] );
|
||||
foreach($correosProf_rs as $correo){
|
||||
if(!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosProf_rs);
|
||||
}
|
||||
$to .= join(",", $correos);
|
||||
}
|
||||
|
||||
if($to!= "" && self::ENVIO_CORREOS){
|
||||
//crear plantilla
|
||||
$texto = '<body >
|
||||
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
||||
'.$texto.'
|
||||
</body>';
|
||||
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||
$asunto = "PRUEBAS-".$asunto;
|
||||
}
|
||||
return Mailer::enviarCorreo($to, $asunto, $texto, true);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||
require_once "../class/mailer.php";
|
||||
class MandaCorreos{
|
||||
public const COORDINADOR = 1;
|
||||
public const SUPERVISOR = 2;
|
||||
public const JEFE = 4;
|
||||
public const PROFESOR = 8;
|
||||
private const ENVIO_CORREOS = true;
|
||||
private const PRUEBAS = false;
|
||||
|
||||
/* tipo es un acumulador de las banderas */
|
||||
public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){
|
||||
$to="";
|
||||
$correos=[];
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||
$to = "alejandro.lara@lasalle.mx";
|
||||
}else{
|
||||
if($tipo & self::COORDINADOR){
|
||||
$correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor
|
||||
where rol_id = 9 and facultad_id = :fac
|
||||
and coor.usuario_correo is not null and coor.usuario_correo != ''",
|
||||
[':fac' => $facultad]
|
||||
);
|
||||
//print_r($correos_rs);
|
||||
foreach($correos_rs as $correo){
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correos_rs);
|
||||
}
|
||||
if($tipo & self::SUPERVISOR){
|
||||
/*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo
|
||||
FROM horario_supervisor hs
|
||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||
where :id_fac = ANY(hs.facultad_id_array)
|
||||
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
||||
[':id_fac' => $facultad] );*/
|
||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo
|
||||
FROM usuario where rol_id = 7 and not estado_baja");
|
||||
foreach($correosSup_rs as $correo){
|
||||
if (!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosSup_rs);
|
||||
}
|
||||
if($tipo & self::JEFE){
|
||||
$correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo
|
||||
FROM usuario jefe
|
||||
where :id_fac = facultad_id AND rol_id = 11
|
||||
and jefe.usuario_correo is not null and jefe.usuario_correo != ''",
|
||||
[':id_fac' => $facultad] );
|
||||
foreach($correosJefe_rs as $correo){
|
||||
if(!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosJefe_rs);
|
||||
}
|
||||
if($tipo & self::PROFESOR && $prof_id != NULL){
|
||||
$correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo
|
||||
FROM horario_profesor hs
|
||||
inner join usuario prof on prof.usuario_id =hs.usuario_id
|
||||
where :id_fac = hs.facultad_id and prof.usuario_id = :id_prof
|
||||
and prof.usuario_correo is not null and prof.usuario_correo != ''",
|
||||
[':id_prof'=>$prof_id, ':id_fac' => $facultad] );
|
||||
foreach($correosProf_rs as $correo){
|
||||
if(!empty($correo["usuario_correo"]))
|
||||
array_push($correos, $correo["usuario_correo"]);
|
||||
}
|
||||
unset($correosProf_rs);
|
||||
}
|
||||
$to .= join(",", $correos);
|
||||
}
|
||||
|
||||
if($to!= "" && self::ENVIO_CORREOS){
|
||||
//crear plantilla
|
||||
$texto = '<body >
|
||||
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
||||
'.$texto.'
|
||||
</body>';
|
||||
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
|
||||
$asunto = "PRUEBAS-".$asunto;
|
||||
}
|
||||
return Mailer::enviarCorreo($to, $asunto, $texto, true);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -182,7 +182,7 @@ try{
|
||||
|
||||
//claves de carreras en el periodo
|
||||
$arreglo_claves = array_map(function ($item) {
|
||||
return $item['clave_carrera'];
|
||||
return intval($item['clave_carrera']);
|
||||
}, $carreras_rs);
|
||||
|
||||
//print_r($selectedData); exit();
|
||||
@@ -191,6 +191,9 @@ try{
|
||||
|
||||
//Recorre SGU y genera hash
|
||||
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"]){
|
||||
$carrera = $row["ClaveCarrera"];
|
||||
if(is_null($carrera) || empty($carrera))
|
||||
@@ -245,12 +248,15 @@ try{
|
||||
|
||||
//$areacomun = array();
|
||||
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;
|
||||
}
|
||||
}
|
||||
//echo "<br><hr><br>";
|
||||
|
||||
//print_r($horarios_sgu);exit();
|
||||
//print_r($horarios_sgu["hash"]);
|
||||
unset($sguHash);
|
||||
$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