$tool_content .= ' <b>' . q($module['name']) . '</b>'; } //-- if user can access module else { if ($module['contentType'] == CTEXERCISE_) { $moduleImg = 'fa-pencil-square-o'; } elseif ($module['contentType'] == CTLINK_) { $moduleImg = 'fa-link'; } elseif ($module['contentType'] == CTCOURSE_DESCRIPTION_) { $moduleImg = 'fa-info-circle'; } elseif ($module['contentType'] == CTMEDIA_ or $module['contentType'] == CTMEDIALINK_) { $moduleImg = 'fa-film'; } else { $moduleImg = choose_image(basename($module['path'])); } $contentType_alt = selectAlt($module['contentType']); $tool_content .= icon($moduleImg, $contentType_alt) . q($module['name']) . '</small>'; } $tool_content .= '</td>' . "\n"; if ($module['contentType'] == CTSCORM_) { $session_time = preg_replace("/\.[0-9]{0,2}/", "", $module['session_time']); $total_time = preg_replace("/\.[0-9]{0,2}/", "", $module['total_time']); $global_time = addScormTime($global_time, $total_time); } elseif ($module['contentType'] == CTLABEL_ || $module['contentType'] == CTEXERCISE_) { $session_time = $module['session_time']; $total_time = $module['total_time']; } else { // if no progression has been recorded for this module // leave
//#####################################################################################################\\ if ($is_allowedToEdit && $module['contentType'] == CTDOCUMENT_) { if ($cmd == "updateDefaultTime") { $out .= documentDefaultTimeBox(UPDATE_); } else { $out .= documentDefaultTimeBox(DISPLAY_); } } //####################################################################################\\ //############################ PROGRESS AND START LINK #############################\\ //####################################################################################\\ /* Display PROGRESS */ if ($module['contentType'] != CTLABEL_) { if ($resultBrowsed && count($resultBrowsed) > 0 && $module['contentType'] != CTLABEL_) { $contentType_img = selectImage($resultBrowsed['contentType']); $contentType_alt = selectAlt($resultBrowsed['contentType']); if ($resultBrowsed['contentType'] == CTSCORM_) { $contentDescType = get_lang('SCORM 1.2 conformable content'); } if ($resultBrowsed['contentType'] == CTEXERCISE_) { $contentDescType = get_lang('Exercises'); } if ($resultBrowsed['contentType'] == CTDOCUMENT_) { $contentDescType = get_lang('Document'); } $out .= '<b>' . get_lang('Your progression in this module') . '</b><br /><br />' . "\n\n" . '<table align="center" class="claroTable" border="0" cellspacing="2">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Information') . '</th>' . "\n" . '<th>' . get_lang('Values') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n\n" . '<tbody>' . "\n\n"; //display type of the module $out .= '<tr>' . "\n" . '<td>' . get_lang('Module type') . '</td>' . "\n" . '<td><img src="' . $contentType_img . '" alt="' . $contentType_alt . '" /> ' . $contentDescType . '</td>' . "\n" . '</tr>' . "\n\n"; //display total time already spent in the module $out .= '<tr>' . "\n" . '<td>' . get_lang('Total time') . '</td>' . "\n" . '<td>' . $resultBrowsed['total_time'] . '</td>' . "\n" . '</tr>' . "\n\n"; //display time passed in last session
function display_path_content() { global $langModule, $course_id; $style = ''; $output = ''; $sql = "SELECT M.`name`, M.`contentType`,\n LPM.`learnPath_module_id`, LPM.`parent`,\n A.`path`\n FROM `lp_learnPath` AS LP,\n `lp_rel_learnPath_module` AS LPM,\n `lp_module` AS M\n LEFT JOIN `lp_asset` AS A\n ON M.`startAsset_id` = A.`asset_id`\n WHERE LP.`learnPath_id` = ?d\n AND LP.`learnPath_id` = LPM.`learnPath_id`\n AND LPM.`module_id` = M.`module_id`\n AND LP.`course_id` = ?d\n ORDER BY LPM.`rank`"; $moduleList = Database::get()->queryArray($sql, $_SESSION['path_id'], $course_id); $extendedList = array(); $modar = array(); foreach ($moduleList as $module) { $modar['name'] = $module->name; $modar['contentType'] = $module->contentType; $modar['learnPath_module_id'] = $module->learnPath_module_id; $modar['parent'] = $module->parent; $modar['path'] = $module->path; $extendedList[] = $modar; } // build the array of modules // build_element_list return a multi-level array, where children is an array with all nested modules // build_display_element_list return an 1-level array where children is the deep of the module $flatElementList = build_display_element_list(build_element_list($extendedList, 'parent', 'learnPath_module_id')); // look for maxDeep $maxDeep = 1; // used to compute colspan of <td> cells for ($i = 0; $i < sizeof($flatElementList); $i++) { if ($flatElementList[$i]['children'] > $maxDeep) { $maxDeep = $flatElementList[$i]['children']; } } $output .= "\n" . '<table width="99%">' . "\n\n" . '<tr align="center" valign="top">' . "\n" . '<th colspan="' . ($maxDeep + 1) . '">' . $langModule . '</th>' . "\n" . '</tr>' . "\n"; foreach ($flatElementList as $module) { $spacingString = ''; for ($i = 0; $i < $module['children']; $i++) { $spacingString .= '<td width="5"> </td>' . "\n"; } $colspan = $maxDeep - $module['children'] + 1; $output .= '<tr align="center" ' . $style . '>' . "\n" . $spacingString . '<td colspan="' . $colspan . '" align="left">'; if ($module['contentType'] == CTLABEL_) { // chapter head $output .= '<b>' . $module['name'] . '</b>'; } else { // module if ($module['contentType'] == CTEXERCISE_) { $moduleImg = 'fa-pencil-square-o'; } else { if ($module['contentType'] == CTLINK_) { $moduleImg = 'fa-link'; } else { if ($module['contentType'] == CTCOURSE_DESCRIPTION_) { $moduleImg = 'fa-info-circle'; } else { if ($module['contentType'] == CTMEDIA_ || $module['contentType'] == CTMEDIALINK_) { $moduleImg = 'fa-film'; } else { $moduleImg = choose_image(basename($module['path'])); } } } } $contentType_alt = selectAlt($module['contentType']); $output .= icon($moduleImg, $contentType_alt) . $module['name']; } $output .= '</td>' . "\n" . '</tr>' . "\n\n"; } $output .= ' </table>' . "\n\n"; return $output; }
//$tool_content .= "<div class='row'> // <div class='col-sm-3'> // <strong>$langProgInModuleTitle:</strong> // </div> // <div class='col-sm-9'>hjgfjhgf // </div> // </div> // "; //############################ PROGRESS AND START LINK #############################\\ /* Display PROGRESS */ if ($module->contentType != CTLABEL_) { // if ($resultBrowsed && $module->contentType != CTLABEL_) { $contentType_img = selectImage($resultBrowsed->contentType); $contentType_alt = selectAlt($resultBrowsed->contentType); if ($resultBrowsed->contentType == CTSCORM_ || $resultBrowsed->contentType == CTSCORMASSET_) { $contentDescType = $langSCORMTypeDesc; } if ($resultBrowsed->contentType == CTEXERCISE_) { $contentDescType = $langEXERCISETypeDesc; } if ($resultBrowsed->contentType == CTDOCUMENT_) { $contentDescType = $langDOCUMENTTypeDesc; } if ($resultBrowsed->contentType == CTLINK_) { $contentDescType = $langLINKTypeDesc; } if ($resultBrowsed->contentType == CTCOURSE_DESCRIPTION_) { $contentDescType = $langDescriptionCours;
//make update to change the comment in the database for this module case "exComment": if (isset($_REQUEST['module_id']) && isset($_REQUEST['comment'])) { $sql = "UPDATE `" . $TABLEMODULE . "`\n SET `comment` = '" . claro_sql_escape($_REQUEST['comment']) . "'\n WHERE `module_id` = " . (int) $_REQUEST['module_id']; claro_sql_query($sql); } break; } $sql = "SELECT M.*,\n count(M.`module_id`) AS timesUsed\n FROM `" . $TABLEMODULE . "` AS M\n LEFT JOIN `" . $TABLELEARNPATHMODULE . "` AS LPM ON LPM.`module_id` = M.`module_id`\n WHERE M.`contentType` != '" . CTSCORM_ . "'\n AND M.`contentType` != '" . CTLABEL_ . "'\n GROUP BY M.`module_id`\n ORDER BY M.`name` ASC, M.`contentType`ASC, M.`accessibility` ASC"; $result = claro_sql_query($sql); $atleastOne = false; $out .= '<table class="claroTable" width="100%" border="0" cellspacing="2">' . '<thead>' . "\n" . '<tr class="headerX" align="center" valign="top">' . "\n" . '<th>' . "\n" . get_lang('Module') . "\n" . '</th>' . "\n" . '<th>' . "\n" . get_lang('Delete') . "\n" . '</th>' . "\n" . '<th>' . "\n" . get_lang('Rename') . "\n" . '</th>' . "\n" . '<th>' . "\n" . get_lang('Comment') . "\n" . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n"; // Display modules of the pool of this course while ($list = mysql_fetch_array($result)) { //DELETE , RENAME, COMMENT $contentType_img = selectImage($list['contentType']); $contentType_alt = selectAlt($list['contentType']); $out .= '<tr>' . "\n" . '<td align="left">' . "\n" . '<img src="' . $contentType_img . '" alt="' . $contentType_alt . '" /> ' . $list['name'] . "\n" . '</td>' . "\n" . '<td align="center">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=eraseModule&cmdid=' . $list['module_id'])) . '"' . ' onclick="return confirmation(\'' . clean_str_for_javascript($list['name']) . '\', \'' . $list['timesUsed'] . '\');">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a>' . "\n" . '</td>' . "\n" . '<td align="center">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqRename&module_id=' . $list['module_id'])) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Rename') . '" />' . '</a>' . "\n" . '</td>' . "\n" . '<td align="center">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqComment&module_id=' . $list['module_id'])) . '">' . '<img src="' . get_icon_url('comment') . '" alt="' . get_lang('Comment') . '" />' . '</a>' . "\n" . '</td>' . "\n" . '</tr>' . "\n\n"; if (isset($list['comment'])) { $out .= '<tr>' . '<td colspan="5">' . '<small>' . $list['comment'] . '</small>' . '</td>' . '</tr>'; } $atleastOne = true; } //end while another module to display if ($atleastOne == false) { $out .= '<tr><td align="center" colspan="5">' . get_lang('No module') . '</td></tr>' . "\n"; } // Display button to add selected modules $out .= '</tbody>' . "\n" . '</table>'; $claroline->display->body->appendContent($out); echo $claroline->display->render();
// Display modules of the pool of this course if (!$num_results == 0) { $tool_content .= "<table class=\"table-default\"> <tr class='list-header'> <th colspan='2'>" . $langLearningObjects . "</th> <th class='text-center'>" . icon('fa-gears') . "</th> </tr>"; } foreach ($result as $list) { //DELETE , RENAME, COMMENT $contentType_img = selectImage($list->contentType); $contentType_alt = selectAlt($list->contentType); $tool_content .= "<tr><td width='1'>".icon($contentType_img, $contentType_alt)."</td> <td class='text-left'><b>" . q($list->name) . "</b>"; if ($list->comment) { $tool_content .= "<br /><small style=\"color: #a19b99;\"><b>$langComments</b>: " . $list->comment . "</small>"; } $tool_content .= "</td><td class='option-btn-cell'>"; $tool_content .= action_button(array( array('title' => $langRename, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&cmd=rqRename&module_id=$list->module_id", 'icon' => 'fa-pencil'), array('title' => $langComments, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&cmd=rqComment&module_id=$list->module_id", 'icon' => 'fa-comment-o'),
/** * This function allows to display the modules content of a learning path. * The function must be called from inside a learning path where the session variable path_id is known. */ function display_path_content() { $tbl_cdb_names = claro_sql_get_course_tbl(); $tbl_lp_learnPath = $tbl_cdb_names['lp_learnPath']; $tbl_lp_rel_learnPath_module = $tbl_cdb_names['lp_rel_learnPath_module']; $tbl_lp_user_module_progress = $tbl_cdb_names['lp_user_module_progress']; $tbl_lp_module = $tbl_cdb_names['lp_module']; $tbl_lp_asset = $tbl_cdb_names['lp_asset']; $style = ""; $sql = "SELECT M.`name`, M.`contentType`,\n LPM.`learnPath_module_id`, LPM.`parent`,\n A.`path`\n FROM `" . $tbl_lp_learnPath . "` AS LP,\n `" . $tbl_lp_rel_learnPath_module . "` AS LPM,\n `" . $tbl_lp_module . "` AS M\n LEFT JOIN `" . $tbl_lp_asset . "` AS A\n ON M.`startAsset_id` = A.`asset_id`\n WHERE LP.`learnPath_id` = " . (int) $_SESSION['path_id'] . "\n AND LP.`learnPath_id` = LPM.`learnPath_id`\n AND LPM.`module_id` = M.`module_id`\n ORDER BY LPM.`rank`"; $moduleList = claro_sql_query_fetch_all($sql); $extendedList = array(); foreach ($moduleList as $module) { $extendedList[] = $module; } // build the array of modules // build_element_list return a multi-level array, where children is an array with all nested modules // build_display_element_list return an 1-level array where children is the deep of the module $flatElementList = build_display_element_list(build_element_list($extendedList, 'parent', 'learnPath_module_id')); // look for maxDeep $maxDeep = 1; // used to compute colspan of <td> cells for ($i = 0; $i < sizeof($flatElementList); $i++) { if ($flatElementList[$i]['children'] > $maxDeep) { $maxDeep = $flatElementList[$i]['children']; } } $out = ''; $out .= "\n" . '<table class="claroTable" width="100%" border="0" cellspacing="2">' . "\n\n" . '<thead>' . "\n" . '<tr class="headerX" align="center" valign="top">' . "\n" . '<th colspan="' . ($maxDeep + 1) . '">' . get_lang('Module') . '</th>' . "\n" . '</tr>' . "\n\n" . '</thead>' . "\n" . '<tbody>' . "\n"; foreach ($flatElementList as $module) { $spacingString = ''; for ($i = 0; $i < $module['children']; $i++) { $spacingString .= '<td width="5" > </td>' . "\n"; } $colspan = $maxDeep - $module['children'] + 1; $out .= '<tr align="center" ' . $style . '>' . "\n" . $spacingString . '<td colspan="' . $colspan . '" align="left">'; if (CTLABEL_ == $module['contentType']) { $out .= '<b>' . $module['name'] . '</b>'; } else { if (CTEXERCISE_ == $module['contentType']) { $moduleImg = get_icon_url('quiz', 'CLQWZ'); } else { $moduleImg = get_icon_url(choose_image(basename($module['path']))); } $contentType_alt = selectAlt($module['contentType']); $out .= '<img src="' . $moduleImg . '" alt="' . $contentType_alt . '" /> ' . $module['name']; } $out .= '</td>' . "\n" . '</tr>' . "\n\n"; } $out .= '</tbody>' . "\n\n" . '</table>' . "\n\n"; return $out; }