Ejemplo n.º 1
0
// and if it is, use that instead of adding it as new
// SQL Checks
// check if a module of this course already used the same document
$thisDocumentModule = Database::get()->querySingle("SELECT * FROM `lp_module` AS M, `lp_asset` AS A\n\tWHERE A.`module_id` = M.`module_id`\n\tAND M.`course_id` = ?d\n\tAND M.`contentType` = ?s", $course_id, CTCOURSE_DESCRIPTION_);
if (!$thisDocumentModule) {
    // create new module
    $insertedModule_id = Database::get()->query("INSERT INTO `lp_module`\n\t\t(`course_id`, `name`, `contentType`, `comment`, `launch_data`)\n\t\tVALUES (?d, ?s, ?s, '', '')", $course_id, $langCourseDescription, CTCOURSE_DESCRIPTION_)->lastInsertID;
    // create new asset
    $insertedAsset_id = Database::get()->query("INSERT INTO `lp_asset`\n\t\t(`path` , `module_id`, `comment` )\n\t\tVALUES ('', ?d, '' )", $insertedModule_id)->lastInsertID;
    Database::get()->query("UPDATE `lp_module`\n\tSET `startAsset_id` = ?d\n\tWHERE `module_id` = ?d\n\tAND `course_id` = ?d", $insertedAsset_id, $insertedModule_id, $course_id);
    // determine the default order of this Learning path
    $order = 1 + intval(Database::get()->querySingle("SELECT MAX(`rank`) AS max\n\t\tFROM `lp_rel_learnPath_module`\n\t\tWHERE `learnPath_id` = ?d", $_SESSION['path_id'])->max);
    // finally : insert in learning path
    Database::get()->query("INSERT INTO `lp_rel_learnPath_module`\n\t\t(`learnPath_id`, `module_id`, `rank`, `lock`, `visible`, `specificComment`)\n\t\tVALUES (?d, ?d, ?d, 'OPEN', 1, '')", $_SESSION['path_id'], $insertedModule_id, $order);
} else {
    // check if this is this LP that used this course description as a module
    $sql = "SELECT COUNT(*) AS count FROM `lp_rel_learnPath_module` AS LPM,\n\t\t`lp_module` AS M,\n\t\t`lp_asset` AS A\n\t\tWHERE M.`module_id` =  LPM.`module_id`\n\t\tAND M.`startAsset_id` = A.`asset_id`\n\t\tAND M.`course_id` = ?d\n\t\tAND LPM.`learnPath_id` = ?d\n\t\tAND M.`contentType` = ?s";
    $num = Database::get()->querySingle($sql, $course_id, $_SESSION['path_id'], CTCOURSE_DESCRIPTION_)->count;
    if ($num == 0) {
        // used in another LP but not in this one, so reuse the module id reference instead of creating a new one
        // determine the default order of this Learning path
        $order = 1 + intval(Database::get()->querySingle("SELECT MAX(`rank`) AS max\n\t\t\tFROM `lp_rel_learnPath_module`\n\t\t\tWHERE `learnPath_id` = ?d", $_SESSION['path_id'])->max);
        // finally : insert in learning path
        Database::get()->query("INSERT INTO `lp_rel_learnPath_module`\n\t\t\t(`learnPath_id`, `module_id`, `rank`, `lock`, `visible`, `specificComment`)\n\t\t\tVALUES (?d, ?d, ?d, 'OPEN', 1, '')", $_SESSION['path_id'], $thisDocumentModule->module_id, $order);
    }
}
$tool_content = "<table width='100%' class='tbl'><tr><td class='alert alert-success'>";
$tool_content .= disp_tool_title($langLinkInsertedAsModule);
$tool_content .= "</td></tr></table>";
$tool_content .= action_bar(array(array('title' => $langBack, 'url' => "learningPathAdmin.php?course={$course_code}&amp;path_id=" . (int) $_SESSION['path_id'], 'icon' => 'fa-reply', 'level' => 'primary-label')));
draw($tool_content, 2);
Ejemplo n.º 2
0
    // display title
    $titleTab['subTitle'] = htmlspecialchars($learnPathName->name);

    // 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";

    @$tool_content .= get_limited_page_links($sql, 30, $langPreviousPage, $langNextPage);

    $usersList = get_limited_list($sql, 30);

    $pageName = $langLearnPath.": ".disp_tool_title($titleTab);
    
    $tool_content .= action_bar(array(
                array('title' => $langBack,
                      'url' => "index.php",
                      'icon' => 'fa-reply',
                      'level' => 'primary-label'))); 
    
    // display tab header
    $tool_content .= '' . "\n\n"
            . '    <div class="table-responsive"><table class="table-default">' . "\n"
            . '    <tr class="list-header">' . "\n"
            . '      <th class="text-left">' . $langStudent . '</th>' . "\n"
            . '      <th width="5px">' . $langProgress . '</th>' . "\n"
            . '    </tr>' . "\n";
Ejemplo n.º 3
0
    header("Location: ./index.php?course={$course_code}");
    exit;
}
$path_id = intval($_REQUEST['path_id']);
// get infos about the learningPath
$learnPathName = Database::get()->querySingle("SELECT `name` FROM `lp_learnPath` WHERE `learnPath_id` = ?d AND `course_id` = ?d", $path_id, $course_id);
if ($learnPathName) {
    // display title
    $titleTab['subTitle'] = htmlspecialchars($learnPathName->name);
    // display a list of user and their respective progress
    $sql = "SELECT U.`surname`, U.`givenname`, U.`id`\n\t\tFROM `user` AS U,\n\t\t     `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";
    @($tool_content .= get_limited_page_links($sql, 30, $langPreviousPage, $langNextPage));
    $usersList = get_limited_list($sql, 30);
    // display tab header
    $tool_content .= '' . "\n\n" . '      <p>' . $langLearnPath . ': <b>';
    $tool_content .= disp_tool_title($titleTab);
    $tool_content .= '</b></p>' . "\n" . '    <table width="99%" class="tbl_alt">' . "\n" . '    <tr>' . "\n" . '      <th>&nbsp;</th>' . "\n" . '      <th><div align="left">' . $langStudent . '</div></th>' . "\n" . '      <th colspan="2" width="25%">' . $langProgress . '</th>' . "\n" . '    </tr>' . "\n";
    // display tab content
    $k = 0;
    foreach ($usersList as $user) {
        $lpProgress = get_learnPath_progress($path_id, $user->id);
        if ($k % 2 == 0) {
            $tool_content .= "\n    <tr class=\"even\">";
        } else {
            $tool_content .= "\n    <tr class=\"odd\">";
        }
        $tool_content .= '' . "\n" . '      <td width="1"><img src="' . $themeimg . '/arrow.png" alt="bullet" title="bullet" border="0"></td>' . "\n" . '      <td><a href="detailsUserPath.php?course=' . $course_code . '&amp;uInfo=' . $user->id . '&amp;path_id=' . $path_id . '">' . q($user->surname) . ' ' . q($user->givenname) . '</a></td>' . "\n" . '      <td align="right">' . disp_progress_bar($lpProgress, 1) . '</td>' . "\n" . '      <td align="left"><small>' . $lpProgress . '%</small></td>' . "\n" . '    </tr>' . "\n";
        $k++;
    }
    // foot of table
    $tool_content .= '    ' . "\n\n" . '    </table>' . "\n\n";