Example #1
0
 for ($i = 0; $i < $module['children']; $i++) {
     $spacingString .= '<td width="5">&nbsp;</td>';
 }
 $colspan = $maxDeep - $module['children'] + 1;
 $out .= '<tr align="center">' . "\n" . $spacingString . '<td colspan="' . $colspan . '" align="left">';
 //-- if chapter head
 if ($module['contentType'] == CTLABEL_) {
     $out .= '<b>' . claro_utf8_decode($module['name'], get_conf('charset')) . '</b>';
 } else {
     if ($module['contentType'] == CTEXERCISE_) {
         $moduleImgUrl = get_icon_url('quiz', 'CLQWZ');
     } else {
         $moduleImgUrl = get_icon_url(choose_image(basename($module['path'])));
     }
     $contentType_alt = selectAlt($module['contentType']);
     $out .= '<img src="' . $moduleImgUrl . '" alt="' . $contentType_alt . '" />' . claro_utf8_decode($module['name'], get_conf('charset'));
 }
 $out .= '</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_ || $module['contentType'] == CTDOCUMENT_) {
     $session_time = $module['session_time'];
     $total_time = $module['total_time'];
 } else {
     // if no progression has been recorded for this module
     // leave
     if ($module['lesson_status'] == "") {
         $session_time = "&nbsp;";
         $total_time = "&nbsp;";
Example #2
0
         if (claro_is_user_authenticated()) {
             $is_blocked = true;
             // following modules will be unlinked
         } else {
             $atleastOne = true;
             // trick to avoid having the "no modules" msg to be displayed
             break;
         }
     }
 } else {
     if ($module['contentType'] == CTEXERCISE_) {
         $moduleImg = get_icon_url('quiz', 'CLQWZ');
     } else {
         $moduleImg = get_icon_url(choose_image(basename($module['path'])));
     }
     $out .= '<img src="' . $moduleImg . '" alt="' . $contentType_alt . '" border="0" /> ' . "\n" . claro_htmlspecialchars(claro_utf8_decode($module['name'], get_conf('charset')));
 }
 $out .= '</td>' . "\n";
 if (claro_is_user_authenticated() && $module['contentType'] != CTLABEL_) {
     // display the progress value for current module
     $out .= '<td align="right">' . claro_html_progress_bar($progress, 1) . '</td>' . "\n" . '<td align="left">' . '<small>&nbsp;' . $progress . '%</small>' . '</td>' . "\n";
 } elseif (claro_is_user_authenticated() && $module['contentType'] == CTLABEL_) {
     $out .= '<td colspan="2">&nbsp;</td>' . "\n";
 }
 //-- reset link for current module
 if (claro_is_user_authenticated() && (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit())) {
     if (getModuleProgression(claro_get_current_user_id(), $_SESSION['path_id'], $module['learnPath_module_id'])) {
         $out .= '<td><a href="' . Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=resetModuleProgression&learnPath_module_id=' . $module['learnPath_module_id'] . '&path_id=' . $_SESSION['path_id']) . '" onclick="return confirm(\'' . clean_str_for_javascript(get_lang('Do you really want to reset module ') . $module['name']) . '?\');"><img src="' . get_icon_url('delete') . '" alt="' . get_lang('Reset') . '" /></a></td>' . "\n";
     } else {
         $out .= '<td>' . get_lang('No results available') . '</td>' . "\n";
     }
Example #3
0
         } else {
             $atleastOne = true;
             // trick to avoid having the "no modules" msg to be displayed
             break;
         }
     }
 } else {
     if ($module['contentType'] == CTLABEL_) {
         $out .= '<b>' . $module['name'] . '</b>';
     } else {
         if (strlen($module['name']) > $moduleNameLength) {
             $displayedName = substr($module['name'], 0, $moduleNameLength) . '...';
         } else {
             $displayedName = $module['name'];
         }
         $out .= '<img src="' . $moduleImg . '" alt="' . $contentType_alt . '" border="0" />' . claro_utf8_decode($displayedName, get_conf('charset'));
     }
 }
 if (!isset($globalProg)) {
     $globalProg = 0;
 }
 if ($progress > 0) {
     $globalProg = $globalProg + $progress;
 }
 $out .= '</small></td>' . "\n" . '<td>';
 if ($module['contentType'] != CTLABEL_) {
     $moduleNb++;
     // increment number of modules used to compute global progression except if the module is a title
     if ($module['credit'] == 'CREDIT' || $module['lesson_status'] == 'COMPLETED' || $module['lesson_status'] == 'PASSED') {
         $out .= '<img src="' . get_icon_url('select') . '" alt="' . $module['lesson_status'] . '" />';
     } else {
Example #4
0
function elementData($parser, $data)
{
    global $element_pile;
    global $exercise_info;
    global $current_question_ident;
    global $current_answer_id;
    global $current_match_set;
    global $currentAssociableChoice;
    global $current_question_item_body;
    global $prompt;
    global $record_item_body;
    global $non_HTML_tag_to_avoid;
    global $inside_non_HTML_tag_to_avoid;
    global $current_inlinechoice_id;
    global $cardinality;
    $data = claro_utf8_decode($data);
    $current_element = end($element_pile);
    if (sizeof($element_pile) >= 2) {
        $parent_element = $element_pile[sizeof($element_pile) - 2];
    } else {
        $parent_element = "";
    }
    if ($record_item_body && $inside_non_HTML_tag_to_avoid == 0) {
        if (!in_array($current_element, $non_HTML_tag_to_avoid)) {
            $current_question_item_body .= $data;
        }
    }
    switch ($current_element) {
        case 'PROMPT':
            $prompt .= $data;
            break;
        case 'SIMPLECHOICE':
            if (!isset($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'])) {
                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] = trim($data);
            } else {
                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= ' ' . trim($data);
            }
            break;
        case 'FEEDBACKINLINE':
            if (!isset($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'])) {
                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] = trim($data);
            } else {
                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' ' . trim($data);
            }
            break;
        case 'SIMPLEASSOCIABLECHOICE':
            $exercise_info['question'][$current_question_ident]['answer'][$current_match_set][$currentAssociableChoice] = trim($data);
            break;
        case 'VALUE':
            if ($parent_element == "CORRECTRESPONSE") {
                if ($cardinality == "single") {
                    $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id] = $data;
                } else {
                    $exercise_info['question'][$current_question_ident]['correct_answers'][] = $data;
                }
            }
            break;
        case 'INLINECHOICE':
            // if this is the right answer, then we must replace the claroline tags in the FIB text bye the answer between "[" and "]" :
            $answer_identifier = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
            if ($current_inlinechoice_id == $answer_identifier) {
                $current_question_item_body = str_replace("**claroline_start**" . $current_answer_id . "**claroline_end**", "[" . $data . "]", $current_question_item_body);
            } else {
                if (!isset($exercise_info['question'][$current_question_ident]['wrong_answers'])) {
                    $exercise_info['question'][$current_question_ident]['wrong_answers'] = array();
                }
                $exercise_info['question'][$current_question_ident]['wrong_answers'][] = $data;
            }
            break;
    }
}
Example #5
0
 $spacingString = "";
 for ($i = 0; $i < $module['children']; $i++) {
     $spacingString .= "<td width='5'>&nbsp;</td>";
 }
 $colspan = $maxDeep - $module['children'] + 1;
 $out .= '<tr align="center"' . $style . '>' . "\n" . $spacingString . '<td colspan="' . $colspan . '" align="left">' . "\n";
 if ($module['contentType'] == CTLABEL_) {
     $out .= "<b>" . claro_htmlspecialchars(claro_utf8_decode($module['name'], get_conf('charset'))) . "</b>\n";
 } else {
     if ($module['contentType'] == CTEXERCISE_) {
         $moduleImg = get_icon_url('quiz', 'CLQWZ');
     } else {
         $moduleImg = get_icon_url(choose_image(basename($module['path'])));
     }
     $contentType_alt = selectAlt($module['contentType']);
     $out .= "<a href=\"" . claro_htmlspecialchars(Url::Contextualize('module.php?module_id=' . $module['module_id'])) . "\">" . "<img src=\"" . $moduleImg . "\" alt=\"" . $contentType_alt . "\" > " . claro_htmlspecialchars(claro_utf8_decode($module['name'], get_conf('charset'))) . "</a>";
 }
 $out .= "</td>";
 // end of td of module name
 // Modify command / go to other page
 $out .= "<td>\n          <a href=\"" . claro_htmlspecialchars(Url::Contextualize('module.php?module_id=' . $module['module_id'])) . "\">" . "<img src=\"" . get_icon_url('edit') . "\" alt=\"" . get_lang('Modify') . "\" />" . "</a>\n         </td>";
 // DELETE ROW
 //in case of SCORM module, the pop-up window to confirm must be different as the action will be different on the server
 $out .= "<td>\n          <a href=\"" . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . "?cmd=delModule&cmdid=" . $module['learnPath_module_id'])) . "\" " . "onclick=\"return confirmation('" . clean_str_for_javascript(get_lang('Are you sure you want to remove the following module from the learning path : ') . " " . $module['name']) . " ? ";
 if ($module['contentType'] == CTSCORM_) {
     $out .= clean_str_for_javascript(get_lang('SCORM conformant modules are definitively removed from server when deleted in their learning path.'));
 } elseif ($module['contentType'] == CTLABEL_) {
     $out .= clean_str_for_javascript(get_lang('By deleting a label you will delete all modules or label it contains.'));
 } else {
     $out .= clean_str_for_javascript(get_lang('The module will still be available in the pool of modules.'));
 }
Example #6
0
     // finalize insertion : update the empty learning path insert that was made to find its id
     $sql = "SELECT MAX(`rank`)\n                FROM `" . $TABLELEARNPATH . "`";
     $result = claro_sql_query($sql);
     list($rankMax) = mysql_fetch_row($result);
     if (isset($manifestData['packageTitle'])) {
         $lpName = $manifestData['packageTitle'];
     } else {
         array_push($okMsgs, get_lang('warning : Installation cannot find the name of the learning path and has set a default name. You should change it.'));
     }
     if (isset($manifestData['packageDesc'])) {
         $lpComment = $manifestData['packageDesc'];
     } else {
         $lpComment = get_block('blockDefaultLearningPathComment');
         array_push($okMsgs, get_lang('warning : Installation cannot find the description of the learning path and has set a default comment. You should change it'));
     }
     $sql = "UPDATE `" . $TABLELEARNPATH . "`\n                SET `rank` = " . ($rankMax + 1) . ",\n                    `name` = '" . claro_sql_escape($lpName) . "',\n                    `comment` = '" . claro_sql_escape(claro_utf8_decode($lpComment, get_conf('charset'))) . "',\n                    `visibility` = 'SHOW'\n                WHERE `learnPath_id` = " . (int) $tempPathId;
     claro_sql_query($sql);
 }
 /*--------------------------------------
    status messages
   --------------------------------------*/
 foreach ($okMsgs as $msg) {
     $out .= "\n<span class=\"correct\">v</span>&nbsp;&nbsp;&nbsp;" . $msg . "<br />";
 }
 foreach ($errorMsgs as $msg) {
     $out .= "\n<span class=\"error\">x</span>&nbsp;&nbsp;&nbsp;" . $msg . "<br />";
 }
 // installation completed or not message
 if (!$errorFound) {
     $out .= "\n<br /><center><b>" . get_lang('Learning path has been successfully imported.') . "</b></center>";
     $out .= "\n<br /><br ><center><a href=\"" . claro_htmlspecialchars(Url::Contextualize("learningPathAdmin.php?path_id=" . $tempPathId)) . "\">" . $lpName . "</a></center>";
Example #7
0
/**
 * This function is used to display the default time associated to a DOCUMENT module
 * 
 * @param string $mode display(DISPLAY_) or update(UPDATE_) mode
 * @author Anh Thao PHAM <*****@*****.**>
 */
function documentDefaultTimeBox($mode)
{
    $tbl = claro_sql_get_course_tbl();
    $tblModule = $tbl['lp_module'];
    $out = '';
    // globals
    global $is_allowedToEdit;
    $dsp = false;
    $colName = 'launch_data';
    $whereCond = '`module_id` = ' . (int) $_SESSION['module_id'];
    // update mode
    if ($mode == UPDATE_ && $is_allowedToEdit) {
        if (isset($_POST['newTime'])) {
            $sql = "SELECT `" . $colName . "`\n                      FROM `" . $tblModule . "`\n                     WHERE `" . $colName . "` = '" . claro_sql_escape($_POST['newTime']) . "'\n                       AND " . $whereCond;
            $num = claro_sql_query_get_single_value($sql);
            if ($num == 0 && (preg_match('/^\\d+$/', $_POST['newTime']) || empty($_POST['newTime']))) {
                $newTimeValue = '';
                if (preg_match('/^\\d+$/', $_POST['newTime'])) {
                    $newTimeValue = (int) $_POST['newTime'];
                }
                $sql = "UPDATE `" . $tblModule . "`\n                           SET `" . $colName . "` = '" . claro_sql_escape($newTimeValue) . "'\n                         WHERE " . $whereCond;
                claro_sql_query($sql);
                $dsp = true;
            } else {
                $dsp = true;
            }
        } else {
            $out .= '<b>' . get_lang('Document default time') . '</b><br />';
            $sql = "SELECT `" . $colName . "`\n                    FROM `" . $tblModule . "`\n                    WHERE " . $whereCond;
            $oldDefaultTime = claro_sql_query_get_single_value($sql);
            $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . '<input type="text" name="newTime" size="8" maxlength="20" value="' . claro_htmlspecialchars(claro_utf8_decode($oldDefaultTime, get_conf('charset'))) . '" />' . ' ' . get_lang('minute(s)') . '<br />' . "\n" . '<input type="hidden" name="cmd" value="updateDefaultTime" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '<br />' . "\n" . '</form>' . "<br />";
        }
    }
    // display if display mode or asked by the update
    if ($mode == DISPLAY_ || $dsp == true) {
        $sql = "SELECT `" . $colName . "`\n                  FROM `" . $tblModule . "`\n                 WHERE " . $whereCond;
        $currentDefaultTime = claro_sql_query_get_single_value($sql);
        if (is_null($currentDefaultTime) || trim($currentDefaultTime) == '') {
            $currentDefaultTime = get_conf('cllnp_documentDefaultTime');
        }
        $out .= '<b>' . get_lang('Document default time') . '</b><br />';
        $out .= claro_utf8_decode($currentDefaultTime, get_conf('charset')) . ' ' . get_lang('minute(s)');
        if ($is_allowedToEdit) {
            $out .= '<br /><a href="' . $_SERVER['PHP_SELF'] . '?cmd=updateDefaultTime">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . "\n";
        }
        $out .= "<br /><br />";
    }
    return $out;
}
Example #8
0
}
/*
 * Force headers
 */
header("Content-Type: text/xml; charset=utf-8");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Pragma: no-cache");
/*
 * Other commands
 */
if ($cmd == 'rqAdd') {
    if (!empty($msg) && claro_is_user_authenticated()) {
        $msgList = new ChatMsgList($courseId, $groupId);
        $msgList->addMsg(claro_utf8_decode($msg), claro_get_current_user_id());
    }
    // always request refresh to have a response for ajax call
    $cmd = 'rqRefresh';
}
if ($cmd == 'rqRefresh') {
    $msgList = new ChatMsgList($courseId, $groupId);
    $msgList->load($_SESSION['chat_connectionTime']);
    echo claro_utf8_encode($msgList->render());
    return;
}
if ($cmd == 'rqRefreshUserList') {
    $chatUserList = new ChatUserList($courseId, $groupId);
    // keep my user alive in user list
    $chatUserList->ping(claro_get_current_user_id());
    // delete user that have not ping recently