Example #1
0
function accumulate_periods(&$row, &$count, &$hours, $report_start, $report_end, &$room_hash, &$breve_description_hash, $csv = "n")
{
    global $vocab, $periods_name;
    $max_periods = count($periods_name);
    if ($_GET["sumby"] == "5") {
        $temp = grr_sql_query1("SELECT type_name FROM " . TABLE_PREFIX . "_type_area WHERE type_letter = '" . $row[$_GET["sumby"]] . "'");
    } else {
        if ($_GET["sumby"] == "3" or $_GET["sumby"] == "6") {
            $temp = $row[$_GET["sumby"]];
        } else {
            $temp = grrExtractValueFromOverloadDesc($row[12], $_GET["sumby"]);
        }
    }
    if ($temp == "") {
        $temp = "(Autres)";
    }
    if ($csv == "n") {
        $breve_description = htmlspecialchars($temp);
        // Area and room separated by break:
        $room = htmlspecialchars($row[8]) . $vocab["deux_points"] . "<br />" . htmlspecialchars($row[9]);
    } else {
        // Use brief description or created by as the name:
        $breve_description = $temp;
        // Area and room separated by break:
        $room = $row[9] . " " . $row[10];
    }
    // Accumulate the number of bookings for this room and name:
    @$count[$room][$breve_description]++;
    // Accumulate hours used, clipped to report range dates:
    $dur = (min((int) $row[2], $report_end) - max((int) $row[1], $report_start)) / 60;
    if ($dur < 24 * 60) {
        @($hours[$room][$breve_description] += $dur);
    } else {
        @($hours[$room][$breve_description] += $dur % $max_periods + floor($dur / (24 * 60)) * $max_periods);
    }
    $room_hash[$room] = 1;
    $breve_description_hash[$breve_description] = 1;
}
Example #2
0
function accumulate_periods(&$row, &$count, &$hours, $report_start, $report_end,
    &$room_hash, &$breve_description_hash, $csv="n")
{
  global $vocab, $periods_name;
    $max_periods = count($periods_name);
    if ($_GET["sumby"] == "5")
        $temp = grr_sql_query1("select type_name from ".TABLE_PREFIX."_type_area where type_letter = '".$row[$_GET["sumby"]]."'");
    else if (($_GET["sumby"] == "3") or ($_GET["sumby"] == "6"))
        $temp = $row[$_GET["sumby"]];
    else
        $temp = grrExtractValueFromOverloadDesc($row[12],$_GET["sumby"]);
    if ($temp == "") $temp = "(Autres)";
    if ($csv == "n") {
        $breve_description = grr_htmlSpecialChars($temp);
        # Area and room separated by break:
        $room = grr_htmlSpecialChars($row[8]) .$vocab["deux_points"]. "<br />" . grr_htmlSpecialChars($row[9]);
    } else {
        # Use brief description or created by as the name:
        $breve_description = ($temp);
        # Area and room separated by break:
        $room = ($row[9]) . " " . ($row[10]);
    }
    # Accumulate the number of bookings for this room and name:
    @$count[$room][$breve_description]++;
    # Accumulate hours used, clipped to report range dates:
        $dur = (min((int)$row[2], $report_end) - max((int)$row[1], $report_start))/60;
    if ($dur < (24*60))
        @$hours[$room][$breve_description] += $dur;
    else
        @$hours[$room][$breve_description] += ($dur % $max_periods) + floor( $dur/(24*60) ) * $max_periods;
    $room_hash[$room] = 1;
    $breve_description_hash[$breve_description] = 1;
}