Example #1
0
    $year = $event['y'];
} elseif ($_GET['d']) {
    $eid = "";
    $month = (int) $_GET['m'];
    $day = (int) $_GET['d'];
    $year = (int) $_GET['y'];
} else {
    // set month and year to present if month
    // and year not received from query string
    $eid = "";
    $month = date("n", gmmktime() + $t_offset);
    $day = date("j", gmmktime() + $t_offset);
    $year = date("Y", gmmktime() + $t_offset);
}
$prevDay = dateadd($month, $day, $year, "-1", "day");
$nextDay = dateadd($month, $day, $year, "1", "day");
////// Get other events happening this day
$skipme = reset_event_names();
$dayEvents = array();
//First get the ones without a start time
$sql = "SELECT id, title, start AS start_time, DATE_ADD(`start`, INTERVAL `duration` MINUTE) AS `end_time`, ";
$sql .= "creator, type, duration, `description`, minlevel, maxlevel, limits, maxattend, ";
if ($addon['config']['TIME_DISPLAY_FORMAT'] == "12hr") {
    $sql .= "TIME_FORMAT(`start`, '%l:%i%p') AS stime, ";
    $sql .= "TIME_FORMAT(DATE_ADD(`start`, INTERVAL `duration` MINUTE), '%l:%i%p') AS etime, ";
} elseif ($addon['config']['TIME_DISPLAY_FORMAT'] == "24hr") {
    $sql .= "TIME_FORMAT(`start`, '%H:%i') AS stime, ";
    $sql .= "TIME_FORMAT(DATE_ADD(`start`, INTERVAL `duration` MINUTE), '%H:%i') AS etime, ";
} else {
    echo "Bad time display format, check your configuration.";
}
Example #2
0
function datesubtract($mon, $day, $year, $val = 1, $type = "day")
{
    $type = strtolower($type);
    if ($val < 0) {
        return dateadd($mon, $day, $year, $val * -1, $type);
    }
    if ($type == "week") {
        $type = "day";
        $val = $val * 7;
    }
    switch ($type) {
        case "day":
            $day -= $val;
            while ($day < 1) {
                $mon--;
                if ($mon == 0) {
                    $mon = 12;
                    $year--;
                }
                $maxdays = 31 - (($mon - ($mon < 8 ? 1 : 0)) % 2 + ($mon == 2 ? !($year % (!($year % 100) ? 400 : 4)) ? 1 : 2 : 0));
                $day += $maxdays;
            }
            break;
        case "month":
            $mon -= $val;
            while ($mon < 1) {
                $year--;
                $mon += 12;
            }
            $maxdays = 31 - (($mon - ($mon < 8 ? 1 : 0)) % 2 + ($mon == 2 ? !($year % (!($year % 100) ? 400 : 4)) ? 1 : 2 : 0));
            if ($day > $maxdays) {
                $day = $maxdays;
            }
            break;
        case "year":
            $year -= $val;
            $maxdays = 31 - (($mon - ($mon < 8 ? 1 : 0)) % 2 + ($mon == 2 ? !($year % (!($year % 100) ? 400 : 4)) ? 1 : 2 : 0));
            if ($day > $maxdays) {
                $day = $maxdays;
            }
            break;
    }
    return array("mon" => $mon, "day" => $day, "year" => $year);
}
Example #3
0
$data = array('id' => $id);
$db = new DB("root", "110992", "localhost", "centrospokemon");
$regis = $db->findAll('vista_registroestatus', $data);
foreach ($regis as $r) {
    echo $r['fecha_entrada'];
    $hit_points = $r['hit_points'];
    $estatus = $r['estatus'];
    $tiempo = $r['tiempo'];
    $desaparece = $r['desaparece_a'];
    function dateadd($date, $dd = 0, $mm = 0, $yy = 0, $hh = 0, $mn = 0, $ss = 0)
    {
        $date_r = getdate(strtotime($date));
        $date_result = date("Y-m-d", mktime($date_r["hours"] + $hh, $date_r["minutes"] + $mn, $date_r["seconds"] + $ss, $date_r["mon"] + $mm, $date_r["mday"] + $dd, $date_r["year"] + $yy));
        return $date_result;
    }
    $fecha_estimada = dateadd($r['fecha_entrada'], 8, 0, 0, 0, 0, $segundos);
    $hit_points = 100 - $hit_points;
    $minutos = $hit_points / 10 * 2.5;
    $segundos = $minutos * 60;
    if ($estatus == 1) {
        $segundos += $tiempo;
        for ($i = 0; $i >= $segundos; $i++) {
            if ($i == $segundos) {
                $suspendido = 0;
            }
        }
    } else {
        if ($estatus == 7 or $estatus == 8) {
            $segundos += $tiempo;
            for ($i = 0; $i >= $segundos; $i++) {
                if ($i == $segundos) {
 $db = new DB("root", "110992", "localhost", "centrospokemon");
 $regis = $db->findAll('vista_registroestatus', $data);
 foreach ($regis as $r) {
     $fecha = $r['fecha_entrada'];
     $hit_points = $r['hit_points'];
     $estatus = $r['estatus'];
     $tiempo = $r['tiempo'];
     $desaparece = $r['desaparece_a'];
 }
 function dateadd($date, $dd = 0, $mm = 0, $yy = 0, $hh = 0, $mn = 0, $ss = 0)
 {
     $date_r = getdate(strtotime($date));
     $date_result = date("Y-m-d", mktime($date_r["hours"] + $hh, $date_r["minutes"] + $mn, $date_r["seconds"] + $ss, $date_r["mon"] + $mm, $date_r["mday"] + $dd, $date_r["year"] + $yy));
     return $date_result;
 }
 $fecha_estimada = dateadd($fecha, 8, 0, 0, 0, 0, $segundos);
 $minutos = $hit_points / 10 * 2.5;
 $segundos = $minutos * 60;
 if ($estatus == 1) {
     $segundos += $tiempo;
     $suspendido = 0;
 } else {
     if ($estatus == 7 or $estatus == 8) {
         $segundos += $tiempo;
         $suspendido = 0;
     } else {
         if ($estatus == 2 or $estatus == 3) {
             $segundos += $tiempo;
             $suspendido = 0;
         } else {
             if ($estatus == 4 or $estatus == 5) {