require_once '../../include/baseTheme.php'; require_once 'include/lib/learnPathLib.inc.php'; require_once 'modules/usage/statistics_tools_bar.php'; if (isset($_GET['from_stats']) and $_GET['from_stats'] == 1) { // if we come from statistics $toolName = $langUsage; $navigation[] = array('url' => '../usage/?course=' . $course_code, 'name' => $langUsage); $pageName = "{$langLearningPaths} - {$langTrackAllPathExplanation}"; } else { $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langLearningPaths); $pageName = $langTrackAllPathExplanation; } // display a list of user and their respective progress $sql = "SELECT U.`surname`, U.`givenname`, U.`id`\n\tFROM `user` AS U, `course_user` AS CU\n\tWHERE U.`id`= CU.`user_id`\n\tAND CU.`course_id` = {$course_id}\n\tORDER BY U.`surname` ASC"; @($tool_content .= get_limited_page_links($sql, 30, $langPreviousPage, $langNextPage)); $usersList = get_limited_list($sql, 30); if (isset($_GET['from_stats']) and $_GET['from_stats'] == 1) { // if we come from statistics statistics_tools($course_code, "detailsAll", "../usage/"); } // check if there are learning paths available $lcnt = Database::get()->querySingle("SELECT COUNT(*) AS count FROM lp_learnPath WHERE course_id = ?d", $course_id)->count; if ($lcnt == 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}&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} </th>\n </tr>\n";
header("Content-Disposition: attachment; filename=userslearningpathstats.csv"); if ($sendSep) { echo 'sep=;', $crlf; } 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` 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));