function updateNotificacionManualAutomatica() { include_once '../controller/cUtilerias.php'; $cUtilerias = new cUtilerias(); $fecha = $cUtilerias->getDate(); $fecha_inicio = strtotime('-1 month', strtotime($fecha)); $fecha_inicio = date('Y-m-d', $fecha_inicio); $fecha_fin = strtotime('-7 day', strtotime($fecha)); $fecha_fin = date('Y-m-d', $fecha_fin); $sql = "update notificacionpersonalizada set estatus=-1 where fecha_fin BETWEEN '{$fecha_inicio}' and '{$fecha_fin}';"; //actualizamos las notificaciones que se encuentren en su fecha limite o ya la pasaron las desactivamos // echo $sql; $this->con->Query($sql); //recuperamos las notificaciones que se encuentren con repeticion y ya pasaron $sql = "select n.id_notificacion,n.repeticion,n.fecha_cambio,n.tiempo_repetir from notificacionpersonalizada as n where n.repeticion!=-1 and n.fecha_cambio BETWEEN '{$fecha_inicio}' and '{$fecha_fin}';"; // echo $sql; $this->con->Query($sql); $datos = $this->con; include_once "../model/mConexion.php"; $DB = new Database(); while ($row = $datos->NextRow()) { $tipo_repeticion = $row['repeticion']; $fecha_cambio = $row['fecha_cambio']; $tiempo_repetir = $row['tiempo_repetir']; $id_notificacion = $row['id_notificacion']; $nueva_fecha_cambio = $this->getRepeticion($tipo_repeticion, $fecha_cambio, $tiempo_repetir); $sql = "update notificacionpersonalizada set fecha_cambio='{$nueva_fecha_cambio}' where id_notificacion={$id_notificacion};"; $DB->Query($sql); // echo $sql; } }