Ejemplo n.º 1
0
            if ($subshow >= $subshowl) {
                break;
            }
        }
    }
    $nsub = 1;
    foreach ($subs as $sub) {
        $subsn[] = $nsub % $subshow == 0 ? $nsub : '';
        $nsub++;
        $files_array = $sub->get_submitted_files();
        $files = array();
        //Used to give stack format last bar has less size
        $total_size = 0;
        foreach ($files_array as $file) {
            $size = strlen($file['data']);
            $files[$file['name']] = $size;
            $total_size += $size;
        }
        foreach ($names as $name) {
            if (isset($files[$name])) {
                $series[$name][] = $total_size;
                $total_size -= $files[$name];
            } else {
                $series[$name][] = $total_size;
            }
        }
    }
}
$user = $DB->get_record('user', array('id' => $userid));
vpl_graph::draw($vpl->get_printable_name() . ' - ' . $vpl->fullname($user, false), get_string('submissions', VPL), get_string("sizeb"), $subsn, $series, $names);
Ejemplo n.º 2
0
    $y_data = array();
    $x_data = array();
    for ($slice = 0; $slice <= $max_student_time; $slice += $time_slice) {
        $y_data[] = 0;
        $x_data[] = sprintf($x_format, $slice, $slice + $time_slice);
    }
    foreach ($times as $time) {
        $y_data[(int) ($time / $time_slice)]++;
    }
    $title = $vpl->get_printable_name();
    $n = count($times);
    $straveragetime = get_string('averagetime', VPL, sprintf('%3.1f', (double) $total_time / $n));
    $straverageperiods = get_string('averageperiods', VPL, sprintf('%3.1f', (double) $total_periods / $n));
    $strvmaximumperiod = get_string('maximumperiod', VPL, sprintf('%3.1f', (double) $max_period_time));
    $x_title = sprintf('%s - %s - %s - %s', get_string('hours'), $straveragetime, $straverageperiods, $strvmaximumperiod);
    $y_title = get_string('defaultcoursestudents');
    vpl_graph::draw($title, $x_title, $y_title, $x_data, $y_data, null, true);
} else {
    $y_data = vpl_get_working_periods($vpl, $userid);
    session_write_close();
    $x_data = array();
    $hours = 0.0;
    for ($i = 0; $i < count($y_data); $i++) {
        $x_data[] = $i + 1;
        $hours += $y_data[$i];
    }
    $user = $DB->get_record('user', array('id' => $userid));
    $title = sprintf("%s - %s", $vpl->fullname($user, false), get_string('numhours', '', sprintf('%3.2f', $hours)));
    $title_x = get_string('workingperiods', VPL) . ' - ' . $vpl->get_printable_name();
    vpl_graph::draw($title, $title_x, get_string('hours'), $x_data, $y_data, null, true);
}