Example #1
0
    $tool_content .= "<div class='alert alert-warning'>{$langNoLearningPath}</div>";
    draw($tool_content, 2, null, $head_content);
    exit;
} else {
    $tool_content .= "<div class='alert alert-info'>\n           <b>{$langDumpUserDurationToFile}: </b>1. <a href='dumpuserlearnpathdetails.php?course={$course_code}'>{$langcsvenc2}</a>\n                2. <a href='dumpuserlearnpathdetails.php?course={$course_code}&amp;enc=1253'>{$langcsvenc1}</a>          \n          </div>";
}
// display tab header
$tool_content .= "\n  <table class='table-default'>\n  <tr>\n    <th class='left'><div align='left'>{$langStudent}</div></th>\n    <th width='120'>{$langAm}</th>\n    <th>{$langGroup}</th>\n    <th colspan='2'>{$langProgress}&nbsp;&nbsp;</th>\n  </tr>\n";
// display tab content
$k = 0;
foreach ($usersList as $user) {
    // list available learning paths
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;
    $tool_content .= "  <tr>";
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    $tool_content .= '    <td><a href="detailsUser.php?course=' . $course_code . '&amp;uInfo=' . $user->id . '">' . q($user->surname) . ' ' . q($user->givenname) . '</a></td>' . '    <td class="center">' . q(uid_to_am($user->id)) . '</td>' . '    <td align="center">' . user_groups($course_id, $user->id) . '</td>' . '    <td class="right" width=\'120\'>' . disp_progress_bar($total, 1) . '</td>' . '    <td align="left" width=\'10\'>' . $total . '%</td>' . '</tr>';
    $k++;
}
// foot of table
$tool_content .= '</table>';
draw($tool_content, 2, null, $head_content);
Example #2
0
function create_zip_index($path, $id, $online = FALSE)
{
    global $charset, $m;
    $fp = fopen($path, "w");
    if (!$fp) {
        die("Unable to create assignment index file - aborting");
    }
    fputs($fp, '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
                <style type="text/css">
                .sep td, th { border: 1px solid; }
                td { border: none; }
                table { border-collapse: collapse; border: 2px solid; }
                .sep { border-top: 2px solid black; }
                </style>
	</head>
	<body>
		<table width="95%" class="tbl">
			<tr>
				<th>' . $m['username'] . '</th>
				<th>' . $m['am'] . '</th>
				<th>' . $m['filename'] . '</th>
				<th>' . $m['sub_date'] . '</th>
				<th>' . $m['grade'] . '</th>
			</tr>');
    $result = Database::get()->queryArray("SELECT a.uid, a.file_path, a.submission_date, a.grade, a.comments, a.grade_comments, a.group_id, b.deadline FROM assignment_submit a, assignment b WHERE a.assignment_id = ?d AND a.assignment_id = b.id ORDER BY a.id", $id);
    foreach ($result as $row) {
        $filename = basename($row->file_path);
        $filelink = empty($filename) ? '&nbsp;' : "<a href='{$filename}'>" . htmlspecialchars($filename) . '</a>';
        $late_sub_text = (int) $row->deadline && $row->submission_date > $row->deadline ? '<div style="color:red;">$m[late_submission]</div>' : '';
        fputs($fp, '
			<tr class="sep">
				<td>' . q(uid_to_name($row->uid)) . '</td>
				<td>' . q(uid_to_am($row->uid)) . '</td>
				<td align="center">' . $filelink . '</td>
				<td align="center">' . $row->submission_date . $late_sub_text . '</td>
				<td align="center">' . $row->grade . '</td>
			</tr>');
        if (trim($row->comments != '')) {
            fputs($fp, "\n\t\t\t<tr><td colspan='6'><b>{$m['comments']}: " . "</b>{$row->comments}</td></tr>");
        }
        if (trim($row->grade_comments != '')) {
            fputs($fp, "\n\t\t\t<tr><td colspan='6'><b>{$m['gradecomments']}: " . "</b>{$row->grade_comments}</td></tr>");
        }
        if (!empty($row->group_id)) {
            fputs($fp, "<tr><td colspan='6'>{$m['groupsubmit']} " . "{$m['ofgroup']} {$row->group_id}</td></tr>\n");
        }
    }
    fputs($fp, ' </table></body></html>');
    fclose($fp);
}
Example #3
0
if ($type == 'duration') {    
    $result = user_duration_query($course_id, $u_date_start, $u_date_end, $group_id);
} else {
    $result = Database::get()->queryArray("SELECT user_id AS id FROM group_members WHERE group_id = ?d", $group_id);
}
if (count($result) > 0) {
    foreach ($result as $row) {
        $user_id = $row->id;        
        if ($type == 'duration') {
            $value = format_time_duration(0 + $row->duration);
            $sortkey = $row->duration;
            $name = $row->surname . ' ' . $row->givenname;
            $am = $row->am;
        } elseif ($type == 'lp') {
            $name = uid_to_name($user_id);
            $am = uid_to_am($user_id);
            $iterator = 0;
            $progress = 0;
            foreach ($learningPathList as $learningPath) {
                $progress += get_learnPath_progress($learningPath->learnPath_id, $user_id);
                $iterator++;
            }
            if ($iterator > 0) {
                $total = round($progress / $iterator);
                $sortkey = $total;
                $value = disp_progress_bar($total, 1) . '&nbsp;<small>' . $total . '%</small>';
            } else {
                $value = '&mdash;';
            }
        }
        $tool_content .= "<td width='30%'>" . q($name) . "</td><td width='30%'>" . q($am) . "</td><td align='text-center'>$group_name</td>"
Example #4
0
function create_zip_index($path, $id, $online = FALSE) {
    global $charset, $m, $course_id;

    $fp = fopen($path, "w");
    if (!$fp) {
        die("Unable to create assignment index file - aborting");
    }
    fputs($fp, '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
                <style type="text/css">
                .sep td, th { border: 1px solid; }
                td { border: none; }
                table { border-collapse: collapse; border: 2px solid; }
                .sep { border-top: 2px solid black; }
                </style>
	</head>
	<body>
		<table class="table-default">
			<tr>
				<th>' . $m['username'] . '</th>
				<th>' . $m['am'] . '</th>
				<th>' . $m['filename'] . '</th>
				<th>' . $m['sub_date'] . '</th>
				<th>' . $m['grade'] . '</th>
			</tr>');

    $assign = Database::get()->querySingle("SELECT * FROM assignment WHERE id = ?d", $id);
    if ($assign->grading_scale_id) {
        $serialized_scale_data = Database::get()->querySingle('SELECT scales FROM grading_scale WHERE id = ?d AND course_id = ?d', $assign->grading_scale_id, $course_id)->scales;
        $scales = unserialize($serialized_scale_data);
        $scale_values = array_value_recursive('scale_item_value', $scales);
    }
    $result = Database::get()->queryArray("SELECT a.uid, a.file_path, a.submission_date, a.grade, a.comments, a.grade_comments, a.group_id, b.deadline FROM assignment_submit a, assignment b WHERE a.assignment_id = ?d AND a.assignment_id = b.id ORDER BY a.id", $id);
    foreach ($result as $row) {
        $filename = basename($row->file_path);
        $filelink = empty($filename) ? '&nbsp;' :
                ("<a href='$filename'>" . htmlspecialchars($filename) . '</a>');
        $late_sub_text = ((int) $row->deadline && $row->submission_date > $row->deadline) ?  "<div style='color:red;'>$m[late_submission]</div>" : '';
        if ($assign->grading_scale_id) {
            $key = closest($row->grade, $scale_values, true)['key'];
            $row->grade = $scales[$key]['scale_item_name'];
        }
        fputs($fp, '
			<tr class="sep">
				<td>' . q(uid_to_name($row->uid)) . '</td>
				<td>' . q(uid_to_am($row->uid)) . '</td>
				<td align="center">' . $filelink . '</td>
				<td align="center">' . $row->submission_date .$late_sub_text. '</td>
				<td align="center">' . $row->grade . '</td>
			</tr>');
        if (trim($row->comments != '')) {
            fputs($fp, "
			<tr><td colspan='6'><b>$m[comments]: " .
                    "</b>$row->comments</td></tr>");
        }
        if (trim($row->grade_comments != '')) {
            fputs($fp, "
			<tr><td colspan='6'><b>$m[gradecomments]: " .
                    "</b>$row->grade_comments</td></tr>");
        }
        if (!empty($row->group_id)) {
            fputs($fp, "<tr><td colspan='6'>$m[groupsubmit] " .
                    "$m[ofgroup] $row->group_id</td></tr>\n");
        }
    }
    fputs($fp, ' </table></body></html>');
    fclose($fp);
}
 $crlf;

// display a list of user and their respective progress
$sql = "SELECT U.`surname`, U.`givenname`, U.`id`
		FROM `user` AS U, `course_user` AS CU
		WHERE U.`id`= CU.`user_id`
		AND CU.`course_id` = $course_id
		ORDER BY U.`surname` ASC, U.`givenname` ASC";
$usersList = get_limited_list($sql, 500000);
foreach ($usersList as $user) {
    echo "$crlf";
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;

    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    echo csv_escape(uid_to_name($user->id)) .
    ";" . csv_escape(uid_to_am($user->id)) .
    ";" . csv_escape(user_groups($course_id, $user->id, 'csv')) .
    ";" . $total . "%";
}
echo $crlf;
Example #6
0
    header("Pragma: no-cache");
    header("Expires: 0");

    $bom = "\357\273\277";

    $crlf = "\r\n";
    $output = "$bom$langSurname\t$langName\t$langAm\t$langStart\t$langExerciseDuration\t$langYourTotalScore2$crlf";
    $output .= "$crlf";

    $result = Database::get()->queryArray("SELECT DISTINCT uid FROM `exercise_user_record` WHERE eid = ?d", $exerciseId);

    foreach ($result as $row) {
        $sid = $row->uid;
        $surname = uid_to_name($sid,'surname');
        $name = uid_to_name($sid,'givenname');
        $am = uid_to_am($sid);

        $result2 = Database::get()->queryArray("SELECT DATE_FORMAT(record_start_date, '%Y-%m-%d / %H:%i') AS record_start_date,
			record_end_date, TIME_TO_SEC(TIMEDIFF(record_end_date, record_start_date)) AS time_duration,
			total_score, total_weighting
			FROM `exercise_user_record` WHERE uid = ?d AND eid = ?d", $sid, $exerciseId);
        
        foreach ($result2 as $row2) {
            $output .= csv_escape($surname) . "\t";
            $output .= csv_escape($name) . "\t";
            $output .= csv_escape($am) . "\t";
            $recordStartDate = $row2->record_start_date;
            $output .= csv_escape($recordStartDate) . "\t";
            if ($row2->time_duration == '00:00:00' or empty($row2->time_duration)) { // for compatibility
                $output .= csv_escape($langNotRecorded) . "\t";
            } else {
require_once 'include/lib/learnPathLib.inc.php';
require_once 'modules/group/group_functions.php';
if (isset($_GET['enc']) and $_GET['enc'] == '1253') {
    $charset = 'Windows-1253';
} else {
    $charset = 'UTF-8';
}
$crlf = "\r\n";
header("Content-Type: text/csv; charset={$charset}");
header("Content-Disposition: attachment; filename=userslearningpathstats.csv");
echo join(';', array_map("csv_escape", array($langStudent, $langAm, $langGroup, $langProgress))), $crlf;
// display a list of user and their respective progress
$sql = "SELECT U.`surname`, U.`givenname`, U.`id`\n\t\tFROM `user` AS U, `course_user` AS CU\n\t\tWHERE U.`id`= CU.`user_id`\n\t\tAND CU.`course_id` = {$course_id}\n\t\tORDER BY U.`surname` ASC, U.`givenname` ASC";
$usersList = get_limited_list($sql, 500000);
foreach ($usersList as $user) {
    echo "{$crlf}";
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    echo csv_escape(uid_to_name($user->id)) . ";" . csv_escape(uid_to_am($user->id)) . ";" . csv_escape(user_groups($course_id, $user->id, 'csv')) . ";" . $total . "%";
}
echo $crlf;
Example #8
0
    // list available learning paths
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);

    $iterator = 1;
    $globalprog = 0;
    
    $tool_content .= "  <tr>";
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    $tool_content .= 
            '    <td><a href="detailsUser.php?course=' . $course_code . '&amp;uInfo=' . $user->id . '&amp;uName=' . $user->givenname . '">' .  profile_image($user->id, IMAGESIZE_SMALL, 'img-circle')."&nbsp;". q($user->surname) . ' ' . q($user->givenname) . '</a></td>'
            . '    <td class="text-center">' . q(uid_to_am($user->id)) . '</td>'
            . '    <td class="text-left">' . user_groups($course_id, $user->id) . '</td>'
            . '    <td class="text-right" width=\'120\'>'
            . disp_progress_bar($total, 1)
            . '</td>'
            . '</tr>';
    $k++;
}
// foot of table
$tool_content .= '</table></div>';

draw($tool_content, 2, null, $head_content);