Example #1
0
    /**
     * Create files (quiz) needed in the export of this module
     *
     * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
     * @param int $quizId id of the Quiz
     * @param object $item item of the path
     * @param string $destDir path when the files need to be copied
     * @param int $deepness deepness of the destinationd directory
     * @return boolean
     */
    public function prepareFiles($quizId, &$item, $destDir, $deepness)
    {
        $completionThresold = $item->getCompletionThreshold();
        if (empty($completionThresold)) {
            $completionThresold = 50;
        }
        $quizId = (int) $quizId;
        $quiz = new Exercise();
        if (!$quiz->load($quizId)) {
            $this->error[] = get_lang('Unable to load the exercise');
            return false;
        }
        $deep = '';
        if ($deepness) {
            for ($i = $deepness; $i > 0; $i--) {
                $deep .= ' ../';
            }
        }
        // Generate standard page header
        $pageHeader = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>' . $quiz->getTitle() . '</title>
    <meta http-equiv="expires" content="Tue, 05 DEC 2000 07:00:00 GMT">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Content-Type" content="text/HTML; charset=' . get_locale('charset') . '"  />

    <link rel="stylesheet" type="text/css" href="' . $deep . get_conf('claro_stylesheet') . '/main.css" media="screen, projection, tv" />
    <script language="javascript" type="text/javascript" src="' . $deep . 'js/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="' . $deep . 'js/claroline.js"></script>
    <script language="javascript" type="text/javascript" src="' . $deep . 'js/claroline.ui.js"></script>

    <script language="javascript" type="text/javascript" src="' . $deep . 'js/APIWrapper.js"></script>
    <script language="javascript" type="text/javascript" src="' . $deep . 'js/connector13.js"></script>
    <script language="javascript" type="text/javascript" src="' . $deep . 'js/scores.js"></script>
    </head>
    ' . "\n";
        $pageBody = '<body onload="loadPage()">
    <div id="claroBody"><form id="quiz">
    <table width="100%" border="0" cellpadding="1" cellspacing="0" class="claroTable">' . "\n";
        // Get the question list
        $questionList = $quiz->getQuestionList();
        $questionCount = count($questionList);
        // Keep track of raw scores (ponderation) for each question
        $questionPonderationList = array();
        // Keep track of correct texts for fill-in type questions
        // TODO La variable $fillAnswerList n'apparaît qu'une fois
        $fillAnswerList = array();
        // Display each question
        $questionCount = 0;
        foreach ($questionList as $question) {
            // Update question number
            $questionCount++;
            // read the question, abort on error
            $scormQuestion = new ScormQuestion();
            if (!$scormQuestion->load($question['id'])) {
                $this->error[] = get_lang('Unable to load exercise\'s question');
                return false;
            }
            $questionPonderationList[] = $scormQuestion->getGrade();
            $pageBody .= '<thead>' . "\n" . '<tr>' . "\n" . '<th>' . get_lang('Question') . ' ' . $questionCount . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
            $pageBody .= '<tr>' . "\n" . '<td>' . "\n" . $scormQuestion->export() . "\n" . '</td>' . "\n" . '</tr>' . "\n";
        }
        $pageEnd = '
    <tr>
        <td align="center"><br /><input type="button" value="' . get_lang('Ok') . '" onclick="calcScore()" /></td>
    </tr>
    </table>
    </form>
    </div></body></html>' . "\n";
        /* Generate the javascript that'll calculate the score
         * We have the following variables to help us :
         * $idCounter : number of elements to check. their id are "scorm_XY"
         * $raw_to_pass : score (on 100) needed to pass the quiz
         * $fillAnswerList : a list of arrays (text, score) indexed on <input>'s names
         *
         */
        $pageHeader .= '
    <script type="text/javascript" language="javascript">
        var raw_to_pass = '******';
        var weighting = ' . array_sum($questionPonderationList) . ';
        var rawScore;
        var scoreCommited = false;
        var showScore = true;
        var fillAnswerList = new Array();' . "\n";
        // This is the actual code present in every exported exercise.
        // use claro_html_entity_decode in output to prevent double encoding errors with some languages...
        $pageHeader .= '

        function calcScore()
        {
            if( !scoreCommited )
            {
                rawScore = CalculateRawScore(document, ' . getIdCounter() . ', fillAnswerList);
                var score = Math.max(Math.round(rawScore * 100 / weighting), 0);
                var oldScore = doLMSGetValue("cmi.score.raw");
    
                doLMSSetValue("cmi.score.max", weighting);
                doLMSSetValue("cmi.score.min", 0);
    
                computeTime();
    
                if (score > oldScore) // Update only if score is better than the previous time.
                {
                    doLMSSetValue("cmi.raw", rawScore);
                }
                
                var oldStatus = doLMSGetValue( "cmi.completion_status" )
                if (score >= raw_to_pass)
                {
                    doLMSSetValue("cmi.completion_status", "completed");
                }
                else if (oldStatus != "completed" ) // If passed once, never mark it as failed.
                {
                    doLMSSetValue("cmi.completion_status", "failed");
                }
    
                doLMSCommit();
                doLMSFinish();
                scoreCommited = true;
                if(showScore) alert(\'' . clean_str_for_javascript(claro_html_entity_decode(get_lang('Score'))) . ' :\\n\' + rawScore + \'/\' + weighting );
            }
        }
    
    </script>
    ';
        // Construct the HTML file and save it.
        $filename = "quiz_" . $quizId . ".html";
        $pageContent = $pageHeader . $pageBody . $pageEnd;
        if (!($f = fopen($destDir . '/' . $filename, 'w'))) {
            $this->error = get_lang('Unable to create file : ') . $filename;
            return false;
        }
        fwrite($f, $pageContent);
        fclose($f);
        return true;
    }
Example #2
0
            ?>
" alt="<?php 
            echo get_lang('Empty');
            ?>
" />
                </a>
            </td>
            <td align="center">
                <?php 
            if (is_null($thisForum['group_id'])) {
                ?>
                <a href="<?php 
                echo get_lang(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDelForum&amp;forumId=' . $thisForum['forum_id'])));
                ?>
" onclick="return confirm_delete('<?php 
                echo clean_str_for_javascript($thisForum['forum_name']);
                ?>
');">
                <img src="<?php 
                echo get_icon_url('delete');
                ?>
" alt="<?php 
                echo get_lang('Delete');
                ?>
" />
                </a>
                <?php 
            }
            ?>
            </td>
            <td align="center">
Example #3
0
   $orderLink = $_SERVER['PHP_SELF'] . '?' . $argLink;
   if ($argLink != "") {
       $orderLink .= "&amp;";
   }
   $orderLink .= "order=" . $nextOrder . "&amp;";
   $javascriptDelete = '
   <script type="text/javascript">
 
       function deleteSelection ()
       {
          if ( $("input[@type=checkbox][@checked]").size() < 1 )
          {
              return false;
          }
       
          if (confirm("' . clean_str_for_javascript(get_lang('Are you sure to delete selected message(s) ?')) . '"))
          {
              $("input[@name=cmd]").val("exDeleteSelection");
              return true;
          }
          else
          {
              return false;
          }
       }
   </script>';
   $claroline->display->header->addHtmlHeader($javascriptDelete);
   $argDeleteSelection = makeArgLink($arguments, array('cmd'));
   $content .= '<form action="' . $_SERVER['PHP_SELF'] . '?' . $argDeleteSelection . '" method="post"
                   onsubmit="return deleteSelection(this)">' . "\n" . '<input type="hidden" name="cmd" value="rqDeleteSelection" />' . "\n\n";
   $content .= '<br />' . '<table class="claroTable emphaseLine" width="100%">' . "\n\n" . '<thead>' . '<tr>' . "\n" . '<th>&nbsp;</th>' . "\n" . '<th>' . get_lang('Subject') . '</th>' . "\n" . '<th><a href="' . $orderLink . 'fieldOrder=name">' . get_lang('Sender') . '</a></th>' . "\n" . '<th><a href="' . $orderLink . 'fieldOrder=username">' . get_lang('Username') . '</a></th>' . "\n" . '<th><a href="' . $orderLink . 'fieldOrder=date">' . get_lang('Date') . '</a></th>' . "\n" . '<th class="im_list_action">' . get_lang('Delete') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
    $courseUserProperties = course_user_get_properties($uidToEdit, $cidToEdit);
}
//------------------------------------
// PREPARE DISPLAY
//------------------------------------
// Javascript confirm pop up declaration for header
JavascriptLanguage::getInstance()->addLangVar('Are you sure you want to unregister %name ?');
JavascriptLoader::getInstance()->load('admin');
$displayBackToCU = false;
$displayBackToUC = false;
if ('culist' == $ccfrom) {
    $displayBackToCU = TRUE;
} elseif ('uclist' == $ccfrom) {
    $displayBackToUC = TRUE;
}
$cmd_menu[] = '<a class="claroCmd" href="adminuserunregistered.php' . '?cidToEdit=' . $cidToEdit . '&amp;cmd=UnReg' . '&amp;uidToEdit=' . $uidToEdit . '" ' . ' onclick="return ADMIN.confirmationUnReg(\'' . clean_str_for_javascript(claro_htmlspecialchars($courseUserProperties['firstName']) . ' ' . claro_htmlspecialchars($courseUserProperties['lastName'])) . '\');">' . get_lang('Unsubscribe') . '</a>';
$cmd_menu[] = '<a class="claroCmd" href="admin_profile.php' . '?uidToEdit=' . $uidToEdit . '">' . get_lang('User settings') . '</a>';
//link to go back to list : depend where we come from...
if ($displayBackToCU) {
    $cmd_menu[] = '<a class="claroCmd" href="admincourseusers.php' . '?cidToEdit=' . $cidToEdit . '&amp;uidToEdit=' . $uidToEdit . '">' . get_lang('Back to list') . '</a> ';
} elseif ($displayBackToUC) {
    $cmd_menu[] = '<a class="claroCmd" href="adminusercourses.php' . '?cidToEdit=' . $cidToEdit . '&amp;uidToEdit=' . $uidToEdit . '">' . get_lang('Back to list') . '</a> ';
}
//------------------------------------
// DISPLAY
//------------------------------------
$out = '';
// Display tool title
$out .= claro_html_tool_title(array('mainTitle' => $nameTools, 'subTitle' => get_lang('Course') . ' : ' . claro_htmlspecialchars($courseUserProperties['courseName']) . '<br />' . get_lang('User') . ' : ' . claro_htmlspecialchars($courseUserProperties['firstName']) . ' ' . claro_htmlspecialchars($courseUserProperties['lastName'])));
// Display Forms or dialog box(if needed)
$out .= $dialogBox->render();
                    } else {
                        if ($module['contentType'] == CTMEDIA_ || $module['contentType'] == CTMEDIALINK_) {
                            $moduleImg = "fa-film";
                        } else {
                            $moduleImg = choose_image(basename($module['path']));
                        }
                    }
                }
            }
        }
        $contentType_alt = selectAlt($module['contentType']);
        $tool_content .= "<span style=\"vertical-align: middle;\">" . icon($moduleImg, $contentType_alt) . "</span>&nbsp;<a href=\"viewer.php?course={$course_code}&amp;path_id=" . (int) $_SESSION['path_id'] . "&amp;module_id=" . $module['module_id'] . "\"" . $style . ">" . htmlspecialchars($module['name']) . "</a>";
    }
    $tool_content .= "</td>";
    // end of td of module name
    if ($module['contentType'] == CTSCORM_ || $module['contentType'] == CTSCORMASSET_) {
        $del_conf_text = clean_str_for_javascript($langAreYouSureToRemoveSCORM);
    } else {
        if ($module['contentType'] == CTLABEL_) {
            $del_conf_text = clean_str_for_javascript($langAreYouSureToRemoveLabel);
        } else {
            $del_conf_text = clean_str_for_javascript($langAreYouSureToRemoveStd);
        }
    }
    $tool_content .= "<td class='option-btn-cell'>" . action_button(array(array('title' => $langBlock, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=mkBlock&amp;cmdid=" . $module['learnPath_module_id'], 'icon' => 'fa-unlock', 'show' => $module['lock'] == 'OPEN'), array('title' => $langAltMakeNotBlocking, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=mkUnblock&amp;cmdid=" . $module['learnPath_module_id'], 'icon' => 'fa-lock', 'show' => $module['lock'] == 'CLOSE'), array('title' => $langModify, 'url' => "module.php?course={$course_code}&amp;module_id=" . $module['module_id'], 'icon' => 'fa-edit'), array('title' => $langRemove, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=delModule&amp;cmdid=" . $module['learnPath_module_id'], 'class' => 'delete', 'confirm' => $del_conf_text + " " + $module['name'], 'icon' => 'fa-times'), array('title' => $langVisible, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=mkVisibl&amp;cmdid=" . $module['module_id'], 'icon' => 'fa-eye-slash', 'show' => $module['visible'] == 0), array('title' => $langVisible, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=mkInvisibl&amp;cmdid=" . $module['module_id'], 'icon' => 'fa-eye', 'confirm' => $module['lock'] == 'CLOSE' ? $langAlertBlockingMakedInvisible : null, 'confirm_title' => "", 'confirm_button' => $langAccept, 'show' => $module['visible'] != 0), array('title' => $langMove, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=changePos&amp;cmdid=" . $module['learnPath_module_id'], 'icon' => 'fa-mail-forward'), array('title' => $langUp, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=moveUp&amp;cmdid=" . $module['learnPath_module_id'], 'level' => 'primary', 'icon' => 'fa-arrow-up', 'disabled' => !$module['up']), array('title' => $langDown, 'url' => $_SERVER['SCRIPT_NAME'] . "?course={$course_code}&amp;cmd=moveDown&amp;cmdid=" . $module['learnPath_module_id'], 'level' => 'primary', 'icon' => 'fa-arrow-down', 'disabled' => !$module['down']))) . "</td>";
    $tool_content .= "</tr>";
    $ind++;
}
// end of foreach
$tool_content .= "</table></div><br>";
draw($tool_content, 2, null, $head_content, $body_action);
Example #6
0
 /**
  * Render the HTML page header
  * @return  string
  */
 public function render()
 {
     $this->_globalVarsCompat();
     $this->addInlineJavascript(JavascriptLanguage::getInstance()->buildJavascript());
     $titlePage = '';
     if (empty($this->_toolName) && !empty($this->_nameTools)) {
         $titlePage .= $this->_nameTools . ' - ';
     } elseif (!empty($this->_toolName)) {
         $titlePage .= $this->_toolName . ' - ';
     }
     if (claro_is_in_a_course() && claro_get_current_course_data('officialCode') != '') {
         $titlePage .= claro_get_current_course_data('officialCode') . ' - ';
     }
     $titlePage .= get_conf('siteName');
     $this->assign('pageTitle', $titlePage);
     if (true === get_conf('warnSessionLost', true) && claro_get_current_user_id()) {
         $this->assign('warnSessionLost', "function claro_session_loss_countdown(sessionLifeTime){\n    var chrono = setTimeout('claro_warn_of_session_loss()', sessionLifeTime * 1000);\n}\n\nfunction claro_warn_of_session_loss() {\n    alert('" . clean_str_for_javascript(get_lang('WARNING ! You have just lost your session on the server.') . "\n" . get_lang('Copy any text you are currently writing and paste it outside the browser')) . "');\n}\n");
     } else {
         $this->assign('warnSessionLost', '');
     }
     $htmlXtraHeaders = '';
     if (!empty($this->_htmlXtraHeaders)) {
         $htmlXtraHeaders .= implode("\n", $this->_htmlXtraHeaders);
     }
     $this->assign('htmlScriptDefinedHeaders', $htmlXtraHeaders);
     return parent::render() . "\n";
 }
Example #7
0
 $out .= '<tr align="center">' . "\n" . '<td align="left">';
 if (is_image($thisFile['path'])) {
     $out .= '<a class="' . $style . ' item' . $classItem . '" href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?docView=image&amp;file=' . download_url_encode($thisFile['path']) . '&amp;cwd=' . $curDirPath . $searchCmdUrl)) . '">';
 } else {
     $out .= '<a class="' . $style . ' item' . $classItem . '" href="' . $urlFileName . '" ' . $target . ' >';
 }
 // end if is_image
 $out .= '<img src="' . get_icon_url($image) . '" alt="" /> ' . $dspFileName . '</a>' . '</td>' . "\n" . '<td><small>' . $size . '</small></td>' . "\n" . '<td><small>' . $date . '</small></td>' . "\n";
 /* NB : Before tracking implementation the url above was simply
  * "<a href=\"",$urlFileName,"\"",$style,">"
  */
 if ($is_allowedToEdit) {
     /* EDIT COMMAND */
     $out .= '<td>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqEdit&amp;file=' . $cmdFileName)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . '</td>' . "\n";
     /* DELETE COMMAND */
     $out .= '<td>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exRm&amp;file=' . $cmdFileName)) . '" ' . 'onclick="return CLDOC.confirmation(\'' . clean_str_for_javascript($dspFileName) . '\');">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a>' . '</td>' . "\n";
     /* MOVE COMMAND */
     $out .= '<td>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMv&amp;file=' . $cmdFileName)) . '">' . '<img src="' . get_icon_url('move') . '" alt="' . get_lang('Move') . '" />' . '</a>' . '</td>' . "\n" . '<td>';
     if ($groupContext) {
         /* PUBLISH COMMAND */
         if ($thisFile['type'] == A_FILE) {
             $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLWRK') . '/work.php?' . 'submitGroupWorkUrl=' . urlencode($thisFile['path']))) . '">' . '<small>' . get_lang('Publish') . '</small>' . '</a>';
         }
         // else noop
     } elseif ($courseContext) {
         /* VISIBILITY COMMAND */
         if ($thisFile['visibility'] == "i") {
             $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&amp;file=' . $cmdFileName . '&amp;vis=v')) . '">' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Make visible') . '" />' . '</a>';
         } else {
             $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&amp;file=' . $cmdFileName . '&amp;vis=i')) . '">' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Make invisible') . '" />' . '</a>';
         }
Example #8
0
            $userGrid[$userKey]['firstname'] = preg_replace('/(' . $bold_search . ')/i', '<b>\\1</b>', $user['firstname']);
            $userEmailLabel = preg_replace('/(' . $bold_search . ')/i', '<b>\\1</b>', $user['email']);
        }
        $userGrid[$userKey]['officialCode'] = empty($user['officialCode']) ? ' - ' : $user['officialCode'];
        $userGrid[$userKey]['email'] = claro_html_mailTo($user['email'], $userEmailLabel);
        $userGrid[$userKey]['isCourseCreator'] = $user['isCourseCreator'] ? get_lang('Course creator') : get_lang('User');
        if ($user['isPlatformAdmin']) {
            $userGrid[$userKey]['isCourseCreator'] .= '<br /><span class="highlight">' . get_lang('Administrator') . '</span>';
        }
        $userGrid[$userKey]['settings'] = '<a href="admin_profile.php' . '?uidToEdit=' . $user['user_id'] . '&amp;cfrom=ulist' . $addToURL . '">' . '<img src="' . get_icon_url('usersetting') . '" alt="' . get_lang('User settings') . '" />' . '</a>';
        if (get_conf("registrationRestrictedThroughCategories")) {
            $userGrid[$userKey]['qty_category'] = '<a class="showUserCategory">' . '<span class="' . $user['user_id'] . '"></span>' . "\n" . get_lang('%nb category(ies)', array('%nb' => $user['qty_category'])) . "\n" . '</a>' . "\n";
        }
        $userGrid[$userKey]['qty_class'] = '<span class="showUserClasses" ><span class="' . $user['user_id'] . '"></span>' . "\n" . get_lang('%nb class(es)', array('%nb' => $user['qty_class'])) . "\n" . '</span>' . "\n";
        $userGrid[$userKey]['qty_course'] = '<a class="showUserCourses" href="adminusercourses.php?uidToEdit=' . $user['user_id'] . '&amp;cfrom=ulist' . $addToURL . '"><span class="' . $user['user_id'] . '"></span>' . "\n" . get_lang('%nb course(s)', array('%nb' => $user['qty_course'])) . "\n" . '</a>' . "\n";
        $userGrid[$userKey]['delete'] = '<a href="' . claro_htmlspecialchars($_SERVER['PHP_SELF'] . '?cmd=exDelete&user_id=' . $user['user_id'] . '&offset=' . $offset . $addToURL) . '" ' . 'onclick="return ADMIN.confirmationDel(\'' . clean_str_for_javascript($user['firstname'] . ' ' . $user['name'] . ' (' . $user['user_id']) . ')\');">' . "\n" . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . "\n" . '</a> ' . "\n";
        if (!$user['isPlatformAdmin']) {
            $userGrid[$userKey]['login_as'] = '<a href="' . get_conf('rootWeb') . 'index.php?' . 'switchToUser='******'user_id'] . '">' . "\n" . '<img src="' . get_icon_url('login_as') . '" alt="' . get_lang('Login as') . '" />' . "\n" . '</a> ' . "\n";
        } else {
            $userGrid[$userKey]['login_as'] = ' - ';
        }
    }
}
$sortUrlList = $myPager->get_sort_url_list($_SERVER['PHP_SELF']);
// Build the list of columns' titles
$colTitleList = array('user_id' => '<a href="' . $sortUrlList['user_id'] . '">' . get_lang('Numero') . '</a>', 'name' => '<a href="' . $sortUrlList['name'] . '">' . get_lang('Last name') . '</a>', 'firstname' => '<a href="' . $sortUrlList['firstname'] . '">' . get_lang('First name') . '</a>', 'officialCode' => '<a href="' . $sortUrlList['officialCode'] . '">' . get_lang('Administrative code') . '</a>', 'email' => '<a href="' . $sortUrlList['email'] . '">' . get_lang('Email') . '</a>', 'isCourseCreator' => '<a href="' . $sortUrlList['isCourseCreator'] . '">' . get_lang('Status') . '</a>', 'settings' => get_lang('User settings'));
if (get_conf("registrationRestrictedThroughCategories")) {
    $colTitleList['qty_category'] = get_lang('Categories');
}
$colTitleList['qty_class'] = get_lang('Classes');
$colTitleList['qty_course'] = get_lang('Courses');
Example #9
0
 } else {
     $out .= strtolower($module['lesson_status']);
 }
 $out .= '</td>' . "\n";
 //-- progression
 if ($module['contentType'] != CTLABEL_) {
     // display the progress value for current module
     $out .= '<td align="right">' . claro_html_progress_bar($progress, 1) . '</td>' . "\n";
     $out .= '<td align="left"><small>&nbsp;' . $progress . '%</small></td>' . "\n";
 } else {
     $out .= '<td colspan="2">&nbsp;</td>' . "\n";
 }
 if (isAnwsersViewingSupported($module['contentType'])) {
     if (claro_get_current_user_id() != (int) $_REQUEST['uInfo']) {
         if (getModuleProgression((int) $_REQUEST['uInfo'], (int) $_REQUEST['path_id'], (int) $module['module_id'])) {
             $out .= '<td>' . "\n" . '<a href="' . get_path('clarolineRepositoryWeb') . 'learnPath/module.php?cidReset=true&cidReq=' . claro_get_current_course_id() . '&module_id=' . (int) $module['module_id'] . '&path_id=' . (int) $_REQUEST['path_id'] . '&copyFrom=' . (int) $_REQUEST['uInfo'] . '" ' . 'onclick="return confirm(\'' . clean_str_for_javascript(get_lang('This will copy the learning path user progression over your own. Do you want to proceed anyway?')) . '\');">' . "\n" . '<img src="' . get_icon_url('login_as') . '" alt="' . get_lang('Consult') . '" />' . "\n" . '</a>' . "\n" . '</td>' . "\n";
         } else {
             $out .= '<td>' . get_lang('No results available') . '</td>' . "\n";
         }
     } else {
         $out .= '<td>' . get_lang('Consulting your own results is not allowed') . '</td>' . "\n";
     }
 } else {
     $out .= '<td>' . get_lang('Unsupported module type') . '</td>' . "\n";
 }
 if ($progress > 0) {
     $globalProg += $progress;
 }
 if ($module['contentType'] != CTLABEL_) {
     $moduleNb++;
 }
Example #10
0
/**
 *This function display the bom whith option to edit or delete the categories
 *
 * @author - < Benoît Muret >
 * @param   - elem             array     : the array of each category
 * @param   - father        string     : the father of the category
 *
 * @return  - $out
 *
 * display the bom whith option to edit or delete the categories
 */
function claro_disp_tree($elem, $father, $space)
{
    $out = '';
    if ($elem) {
        $space .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $num = 0;
        foreach ($elem as $one_faculty) {
            if (!strcmp($one_faculty['code_P'], $father)) {
                $num++;
                $out .= '<tr><td>';
                $out .= $space;
                if ($one_faculty['nb_childs'] > 0) {
                    $out .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '"> ' . ($one_faculty['visible'] ? '<img src="' . get_icon_url('collapse') . '" alt="-"  />' : '<img src="' . get_icon_url('expand') . '" alt="+"  />') . '</a> ' . '&nbsp;';
                } else {
                    $out .= '&nbsp;° &nbsp;&nbsp;&nbsp;';
                }
                $out .= $one_faculty['name'] . ' (' . $one_faculty['code'] . ') &nbsp;&nbsp;&nbsp;';
                //Number of faculty in this parent
                $nb = 0;
                foreach ($elem as $one_elem) {
                    if (!strcmp($one_elem['code_P'], $one_faculty['code_P'])) {
                        $nb++;
                    }
                }
                //Display the picture to edit and delete a category
                $out .= '</td>' . '<td  align="center">' . '<a href="./admincourses.php?category=' . urlencode($one_faculty['code']) . '">' . get_node_children_count_course($one_faculty['code']) . '</a>';
                $out .= '</td>' . '<td  align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '&amp;cmd=rqEdit" >' . '<img src="' . get_icon_url('edit') . '"alt="' . get_lang('Edit') . '" /></a>' . '</td>' . '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '&amp;cmd=rqMove" >' . '<img src="' . get_icon_url('move') . '" alt="' . get_lang('Move') . '"  /></a>' . '</td>' . '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '&amp;cmd=exDelete"' . 'onclick="javascript:if(!confirm(\'' . clean_str_for_javascript(get_lang('Do you really want to delete the "%categoryCode%" category ?', array('%categoryCode%' => $one_faculty['code']))) . '\')) return false" >' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" /> </a>' . '</td>';
                //Search nbChild of the father
                $nbChild = 0;
                $father = $one_faculty['code_P'];
                foreach ($elem as $fac) {
                    if ($fac['code_P'] == $father) {
                        $nbChild++;
                    }
                }
                //If the number of child is >0, display the arrow up and down
                if ($nb > 1) {
                    $out .= '<td align="center">' . "\n";
                    //If isn't the first child, you can up
                    if ($num > 1) {
                        $out .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '&amp;cmd=exUp">' . '<img src="' . get_icon_url('move_up') . '" alt="' . get_lang('Move up') . '" /></a>';
                    } else {
                        $out .= '&nbsp;';
                    }
                    $out .= '</td>' . "\n";
                    $out .= '<td align="center">' . "\n";
                    // If isn't the last child, you can down
                    if ($num < $nbChild) {
                        $out .= '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $one_faculty['id'] . '&amp;cmd=exDown">' . '<img src="' . get_icon_url('move_down') . '" alt="' . get_lang('Move down') . '"  /> </a>';
                    } else {
                        $out .= '&nbsp;';
                    }
                    $out .= '</td>' . "\n";
                } else {
                    $out .= '<td>&nbsp;</td>' . "\n" . '<td>&nbsp;</td>' . "\n";
                }
                $out .= '</tr>' . "\n";
                //display the bom of this category
                if ($one_faculty['visible']) {
                    $out .= claro_disp_tree($elem, $one_faculty['code'], $space);
                }
            }
        }
    }
    return $out;
}
Example #11
0
            $out .= '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Individual') . '" />';
        } elseif ($anAssignment['assignment_type'] == 'GROUP') {
            $out .= '<img src="' . get_icon_url('group') . '" alt="' . get_lang('Groups (from groups tool, only group members can post)') . '" />';
        } else {
            $out .= '&nbsp;';
        }
        $out .= '</td>' . "\n" . '<td><small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), $anAssignment['start_date_unix']) . '</small></td>' . "\n" . '<td><small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), $anAssignment['end_date_unix']) . '</small></td>' . "\n";
        if (isset($_REQUEST['submitGroupWorkUrl']) && !empty($_REQUEST['submitGroupWorkUrl'])) {
            if (!isset($anAssignment['authorized_content']) || $anAssignment['authorized_content'] != 'TEXT') {
                $out .= '<td align="center">' . '<a href="' . claro_htmlspecialchars($assignmentUrl) . '">' . '<small>' . get_lang('Publish') . '</small>' . '</a>' . '</td>' . "\n";
            } else {
                $out .= '<td align="center">' . '<small>-</small>' . '</td>' . "\n";
            }
        }
        if ($is_allowedToEdit) {
            $out .= '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqEditAssig&assigId=' . $anAssignment['id'])) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" /></a>' . '</td>' . "\n" . '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exRmAssig&assigId=' . $anAssignment['id'])) . '" onclick="return WORK.confirmationDel(\'' . clean_str_for_javascript($anAssignment['title']) . '\');">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" /></a>' . '</td>' . "\n" . '<td align="center">';
            if ($anAssignment['visibility'] == "INVISIBLE") {
                $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&assigId=' . $anAssignment['id'] . '&vis=v')) . '">' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Make visible') . '" />' . '</a>';
            } else {
                $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&assigId=' . $anAssignment['id'] . '&vis=i')) . '">' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Make invisible') . '" />' . '</a>';
            }
            $out .= '</td>' . "\n" . '</tr>' . "\n\n";
        }
        $atLeastOneAssignmentToShow = true;
    }
    if (!$atLeastOneAssignmentToShow) {
        $out .= '<tr>' . "\n" . '<td colspan=' . $colspan . '>' . "\n" . get_lang('There is no assignment at the moment') . '</td>' . "\n" . '</tr>' . "\n";
    }
    $out .= '</tbody>' . "\n" . '</table>' . "\n\n";
}
if (isset($displayAssigForm) && $displayAssigForm) {
Example #12
0
$cssLoader = CssLoader::getInstance();
$cssLoader->load('clchat', 'screen');
//-- Content
$out = '';
$nameTools = get_lang('Chat');
$out .= claro_html_tool_title($nameTools);
if (claro_is_javascript_enabled() && $_uid) {
    $jsloader = JavascriptLoader::getInstance();
    $jsloader->load('jquery');
    $jsloader->load('clchat');
    // init var with values from get_conf before including tool library
    $htmlHeaders = '<script type="text/javascript">' . "\n" . 'var refreshRate = "' . get_conf('msg_list_refresh_rate', 5) * 1000 . '";' . "\n" . 'var userListRefresh = "' . get_conf('user_list_refresh_rate') * 1000 . '";' . "\n" . 'var cidReq = "' . claro_get_current_course_id() . '";' . "\n";
    if (claro_is_in_a_group()) {
        $htmlHeaders .= 'var gidReq = "' . claro_get_current_group_id() . '";' . "\n";
    }
    $htmlHeaders .= 'var lang = new Array();' . "\n" . 'lang["confirmFlush"] = "' . clean_str_for_javascript(get_lang('Are you sure to delete all logs ?')) . '";' . '</script>';
    $claroline->display->header->addHtmlHeader($htmlHeaders);
    // dialog box
    $out .= '<div id="clchat_user_list"></div>' . "\n" . '<div id="clchat_chatarea">' . "\n" . ' <div id="clchat_log"></div>' . "\n" . ' <div id="clchat_connectTime">' . get_lang('Start of this chat session (%connectTime)', array('%connectTime' => claro_html_localised_date(get_locale('dateTimeFormatLong'), $_SESSION['chat_connectionTime']))) . '</div>' . "\n" . ' <div id="clchat_text"></div>' . "\n" . '</div>' . "\n";
    // display form
    $out .= '<form action="#" id="clchat_form" method="get" >' . "\n" . claro_form_relay_context() . "\n" . '<img src="' . get_module_url('CLCHAT') . '/img/loading.gif" alt="' . get_lang('Loading...') . '" id="clchat_loading" width="16" height="16" />' . "\n" . '<input id="clchat_msg" type="text" name="message" maxlength="200" size="80" />' . "\n" . '<input type="submit" name="Submit" value=" &gt;&gt; " />' . "\n" . '</form>' . "\n" . claro_html_menu_horizontal($cmdMenu) . "\n" . '<p id="clchat_dialogBox"></p>' . "\n";
} else {
    if (!claro_is_javascript_enabled()) {
        $dialogBox = new DialogBox();
        $dialogBox->error(get_lang('Javascript must be enabled in order to use this tool.'));
        $out .= $dialogBox->render();
    } elseif (!$_uid) {
        $dialogBox = new DialogBox();
        $dialogBox->error(get_lang('Anonymous users cannot use this tool.'));
        $out .= $dialogBox->render();
    }
Example #13
0
    $out .= '<tr>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td><small>' . get_lang('<span class="required">*</span> denotes required field') . '</small></td>' . "\n" . '</tr>' . "\n\n";
    //-- buttons
    $out .= '<tr>' . "\n" . '<td>&nbsp;</td>' . "\n" . '<td>' . '<input type="submit" name="" id="" value="' . get_lang('Ok') . '" />&nbsp;&nbsp;' . claro_html_button(Url::Contextualize($_SERVER['PHP_SELF']), get_lang("Cancel")) . '</td>' . "\n" . '</tr>' . "\n\n";
    $out .= '</table>' . "\n\n" . '</form>' . "\n\n";
}
//-- pager
$out .= $myPager->disp_pager_tool_bar($_SERVER['PHP_SELF']);
//-- list
$out .= '<table class="claroTable emphaseLine" border="0" align="center" cellpadding="2" cellspacing="2" width="100%">' . "\n\n" . '<thead>' . "\n" . '<tr>' . "\n" . '<th>' . get_lang('Title') . '</th>' . "\n";
$colspan = 1;
if ($is_allowedToEdit) {
    $out .= '<th>' . get_lang('Modify') . '</th>' . "\n" . '<th>' . get_lang('Delete') . '</th>' . "\n";
    $colspan = 3;
}
$out .= '</tr>' . "\n" . '</thead>' . "\n\n" . '<tbody>' . "\n\n";
if (!empty($questionCategoryList)) {
    foreach ($questionCategoryList as $aCategory) {
        $out .= '<tr>' . "\n" . '<td>' . $aCategory['title'] . '</a>' . '</td>' . "\n";
        $out .= '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize('question_category.php?cmd=rqEdit&amp;catId=' . $aCategory['id'])) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . '</td>' . "\n";
        $confirmString = get_lang('Are you sure you want to delete this category ?');
        $out .= '<td align="center">' . '<a href="' . claro_htmlspecialchars(Url::Contextualize('question_category.php?catId=' . $aCategory['id'] . '&amp;cmd=exDel')) . '" onclick="javascript:if(!confirm(\'' . clean_str_for_javascript($confirmString) . '\')) return false;">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a>' . '</td>' . "\n";
        $out .= '</tr>' . "\n\n";
    }
} else {
    $out .= '<tr>' . "\n" . '<td colspan="' . $colspan . '">' . get_lang('Empty') . '</td>' . "\n" . '</tr>' . "\n\n";
}
$out .= '</tbody>' . "\n\n" . '</table>' . "\n\n";
//-- pager
$out .= $myPager->disp_pager_tool_bar($_SERVER['PHP_SELF']);
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Example #14
0
        } 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";
        }
    }
    if ($progress > 0) {
        $globalProg = $globalProg + $progress;
    }
    if ($module['contentType'] != CTLABEL_) {
        $moduleNb++;
    }
    // increment number of modules used to compute global progression except if the module is a title
    $out .= '</tr>' . "\n\n";
    $atleastOne = true;
}
$out .= '</tbody>' . "\n\n";
Example #15
0
                ?>
" title="<?php 
                echo get_lang('Lock');
                ?>
" />
                    </a>
                    <?php 
            }
            ?>
                </td>
                <td align="center">
                    <a href="<?php 
            echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDelTopic&amp;forum=' . $this->forumId . '&amp;topic=' . $thisTopic['topic_id']));
            ?>
" onclick="return confirmationDel('<?php 
            echo clean_str_for_javascript($thisTopic['topic_title']);
            ?>
');">
                    <img src="<?php 
            echo get_icon_url('delete');
            ?>
" alt="<?php 
            echo get_lang('Delete');
            ?>
" />
                    </a>
                </td>
                <?php 
        }
        ?>
            </tr>
Example #16
0
         $out .= '<td align="center">' . '<a href="module_list.php?courseToolId=' . $module['courseToolId'] . '&amp;cmd=mvUp">' . '<img src="' . get_icon_url('move_up') . '" alt="' . get_lang('Move up') . '" />' . '</a>' . '</td>' . "\n";
     } else {
         $out .= '<td>&nbsp;</td>' . "\n";
     }
     // Down command
     if (isset($module['rank']) && $course_tool_max_rank != $module['rank']) {
         $out .= '<td align="center">' . '<a href="module_list.php?courseToolId=' . $module['courseToolId'] . '&amp;cmd=mvDown">' . '<img src="' . get_icon_url('move_down') . '" alt="' . get_lang('Move down') . '" />' . '</a>' . '</td>' . "\n";
     } else {
         $out .= '<td>&nbsp;</td>' . "\n";
     }
 }
 // Properties link
 $out .= '<td align="center">' . '<a href="module.php?module_id=' . $module['id'] . '">' . '<img src="' . get_icon_url('settings') . '" alt="' . get_lang('Properties') . '" />' . '</a>' . '</td>' . "\n";
 // Uninstall link
 if (!in_array($module['label'], $nonuninstalable_tool_array)) {
     $out .= '<td align="center">' . '<a onclick="return ADMIN.confirmationUninstall(\'' . clean_str_for_javascript($module['name']) . '\');" ' . 'href="' . claro_htmlspecialchars('module_list.php?module_id=' . $module['id'] . '&typeReq=' . $typeReq . '&cmd=exUninstall') . '" >' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a>' . '</td>' . "\n";
 } else {
     $out .= '<td align="center">-</td>' . "\n";
 }
 // Activation link
 $out .= '<td align="center" >';
 if (in_array($module['label'], $undeactivable_tool_array)) {
     $out .= '-';
 } else {
     if ('activated' == $module['activation']) {
         $out .= '<a href="module_list.php?cmd=desactiv&amp;module_id=' . $module['id'] . '&amp;typeReq=' . $typeReq . '" ' . 'title="' . get_lang('Activated - Click to deactivate') . '">' . '<img src="' . get_icon_url('on') . '" alt="' . get_lang('Activated') . '" /></a>';
     } else {
         $out .= '<a href="module_list.php?cmd=activ&amp;module_id=' . $module['id'] . '&amp;typeReq=' . $typeReq . '" ' . 'title="' . get_lang('Deactivated - Click to activate') . '">' . '<img src="' . get_icon_url('off') . '" alt="' . get_lang('Deactivated') . '"/></a>';
     }
 }
 $out .= '</td>' . "\n";
Example #17
0
function disp_button($url, $text, $confirmMessage = '')
{
    if (is_javascript_enabled() && !preg_match('~^Mozilla/4\\.[1234567]~', $_SERVER['HTTP_USER_AGENT'])) {
        if ($confirmMessage != '') {
            $onClickCommand = "if(confirm('" . clean_str_for_javascript($confirmMessage) . "')){document.location='" . $url . "';return false}";
        } else {
            $onClickCommand = "document.location='" . $url . "';return false";
        }
        return '<button onclick="' . $onClickCommand . '">' . $text . '</button>&nbsp;' . "\n";
    } else {
        return '[ <a href="' . $url . '">' . $text . '</a> ]';
    }
}
Example #18
0
$cmdList = array();
$cmdList[] = array('name' => get_lang('Today'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '#today')));
if (count($eventList) > 0) {
    if (get_conf('enableICalInCourse')) {
        $cmdList[] = array('img' => 'calendar', 'name' => get_lang('Download'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_path('url') . '/claroline/backends/ical.php')));
    }
    if ($orderDirection == 'DESC') {
        $cmdList[] = array('img' => 'reverse', 'name' => get_lang('Oldest first'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?order=asc')));
    } else {
        $cmdList[] = array('img' => 'reverse', 'name' => get_lang('Newest first'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?order=desc')));
    }
}
if (claro_is_allowed_to_edit()) {
    $cmdList[] = array('img' => 'agenda_new', 'name' => get_lang('Add an event'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqAdd')));
    if (count($eventList) > 0) {
        $cmdList[] = array('img' => 'delete', 'name' => get_lang('Clear up event list'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDeleteAll')) . '" ' . ' onclick="javascript:if(!confirm(\'' . clean_str_for_javascript(get_lang('Clear up event list ?')) . '\')) return false;');
    }
}
// Title parts
if ('rqAdd' == $cmd) {
    $subTitle = get_lang('Add an event');
} elseif ('rqEdit' == $cmd) {
    $subTitle = get_lang('Edit Event');
} elseif ($orderDirection == 'ASC') {
    $subTitle = get_lang('Sorted in ascending order (from January to December)');
} elseif ($orderDirection == 'DESC') {
    $subTitle = get_lang('Sorted in descending order (from December to January)');
} else {
    $subTitle = '';
}
$titleParts = array('mainTitle' => $nameTools, 'subTitle' => $subTitle);
Example #19
0
/**
 * Display the tree of classes
 *
 * @author Guillaume Lederer
 * @param  list of all the classes informations of the platform
 * @param  list of the classes that must be visible
 * @return
 *
 * @see
 *
 */
function display_tree_class_in_user($class_list, $course_code, $parent_class = null, $deep = 0)
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_course = $tbl_mdb_names['course'];
    $html_form = '';
    // Get the course id with cours code
    $sql = "SELECT `C`.`cours_id`\n            FROM `" . $tbl_course . "` as C\n            WHERE `code` = '" . $course_code . "'";
    claro_sql_query_get_single_value($sql);
    foreach ($class_list as $cur_class) {
        if ($parent_class == $cur_class['class_parent_id']) {
            // Set space characters to add in name display
            $blankspace = '&nbsp;&nbsp;&nbsp;';
            for ($i = 0; $i < $deep; $i++) {
                $blankspace .= '&nbsp;&nbsp;&nbsp;';
            }
            // See if current class to display has children
            $has_children = FALSE;
            foreach ($class_list as $search_parent) {
                if ($cur_class['id'] == $search_parent['class_parent_id']) {
                    $has_children = TRUE;
                    break;
                }
            }
            // Set link to open or close current class
            if ($has_children) {
                if (isset($_SESSION['class_add_visible_class'][$cur_class['id']]) && $_SESSION['class_add_visible_class'][$cur_class['id']] == "open") {
                    $open_close_link = '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exClose&amp;class_id=' . $cur_class['id'] . '">' . "\n" . '<img src="' . get_icon_url('collapse') . '" alt="" />' . "\n" . '</a>' . "\n";
                } else {
                    $open_close_link = '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exOpen&amp;class_id=' . $cur_class['id'] . '">' . "\n" . '<img src="' . get_icon_url('expand') . '" alt="" />' . "\n" . '</a>' . "\n";
                }
            } else {
                $open_close_link = ' &deg; ';
            }
            // Display current class
            $qty_user = get_class_user_number($cur_class['id']);
            // Need some optimisation here ...
            $html_form .= '<tr>' . "\n" . '<td>' . "\n" . $blankspace . $open_close_link . " " . $cur_class['name'] . '</td>' . "\n" . '<td align="center">' . "\n" . $qty_user . '  ' . get_lang('UsersMin') . '</td>' . "\n" . '<td align="center">' . "\n";
            if (empty($cur_class['course_id'])) {
                $html_form .= '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exEnrol&amp;class_id=' . $cur_class['id'] . '"' . ' onclick="return confirmation_enrol(\'' . clean_str_for_javascript($cur_class['name']) . '\');">' . '<img src="' . get_icon_url('enroll') . '" alt="' . get_lang('Enrol to course') . '" />' . "\n" . '</a>' . "\n";
            } else {
                $html_form .= '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exUnenrol&amp;class_id=' . $cur_class['id'] . '"' . ' onclick="return confirmation_unenrol(\'' . clean_str_for_javascript($cur_class['name']) . '\');">' . '<img src="' . get_icon_url('unenroll') . '" alt="' . get_lang('Unenrol from course') . '" />' . "\n" . '</a>' . "\n";
            }
            $html_form .= '</td>' . "\n" . '</tr>' . "\n";
            // RECURSIVE CALL TO DISPLAY CHILDREN
            if (isset($_SESSION['class_add_visible_class'][$cur_class['id']]) && $_SESSION['class_add_visible_class'][$cur_class['id']] == 'open') {
                $html_form .= display_tree_class_in_user($class_list, $course_code, $cur_class['id'], $deep + 1);
            }
        }
    }
    return $html_form;
}
Example #20
0
    //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();
Example #21
0
}
//end of admin commands
//load category and forum lists
$categories = get_category_list();
$total_categories = count($categories);
$forum_list = get_forum_list();
if (claro_is_user_authenticated()) {
    $userGroupList = get_user_group_list(claro_get_current_user_id());
    $userGroupList = array_keys($userGroupList);
    $tutorGroupList = get_tutor_group_list(claro_get_current_user_id());
} else {
    $userGroupList = array();
    $tutorGroupList = array();
}
//add javascript control for "dangerous" commands (delete-empty)
$htmlHeadXtra[] = "<script type=\"text/javascript\">\n    function confirm_delete(name)\n    {\n       if(confirm('" . clean_str_for_javascript(get_lang('Are you sure to delete')) . " ' + name + ' ?'))\n       {return true;}\n       else\n       {return false;}\n    }\n    \n    function confirm_empty(name)\n    {\n       if(confirm('" . clean_str_for_javascript(get_lang('Delete all messages of')) . " ' + name + ' ?'))\n       {return true;}\n       else\n       {return false;}\n    }\n    </script>";
//prepare display
$nameTools = get_lang('Forums');
$pagetype = 'index';
$helpUrl = $is_allowedToEdit ? get_help_page_url('blockForumsHelp', 'CLFRM') : null;
$toolList = disp_forum_toolbar_array($pagetype, 0, 0, 0);
$out = '';
$out .= claro_html_tool_title($nameTools, $helpUrl, $toolList);
$out .= disp_search_box();
$out .= $dialogBox->render();
// Forum toolbar
$displayList = array();
foreach ($forum_list as $this_forum) {
    //temporary fix for 1.9 releases : avoids change in database definition (using unused 'forum_type' field)
    //TODO : use a specific enum field (field name: anonymity) in bb_forum table
    switch ($this_forum['forum_type']) {
         * Display this link if: 
         * - The user is course member already
         * - The user isn't course manager
         * - The platform's config allows it (or the current user is admin)
         * - The view's config says so
         */
    } elseif ($this->courseUserPrivilegesList->getCoursePrivileges($this->node->getCourse()->courseId)->isCourseMember() && !$this->courseUserPrivilegesList->getCoursePrivileges($this->node->getCourse()->courseId)->isCourseManager() && (get_conf('crslist_UserCanUnregFromInactiveCourses', false) || claro_is_platform_admin()) && $this->viewOptions->haveToDisplayUnenrollLink()) {
        ?>
            
            <a href="<?php 
        $urlObj = Url::buildUrl($this->viewOptions->getUnenrollLinkUrl()->toUrl(), array('course' => $this->node->getCourse()->courseId), null);
        echo $urlObj->toUrl();
        ?>
"
               onclick="javascript:if(!confirm('<?php 
        echo clean_str_for_javascript(get_lang('Are you sure you want to remove this course from your list ?'));
        ?>
')) return false;">
                <img class="enrolment" src="<?php 
        echo get_icon_url('unenroll');
        ?>
" alt="<?php 
        echo get_lang('Enroll');
        ?>
" />
            </a>
            
        <?php 
    }
    ?>
        
Example #23
0
/**
* Prepare the display of a clikcable button
*
* This function is needed because claroline buttons rely on javascript.
* The function return an optionnal behavior fo browser where javascript
* isn't  available.
*
* @author Hugues Peeters <*****@*****.**>
*
* @param string $url url inserted into the 'href' part of the tag
* @param string $text text inserted between the two <a>...</a> tags (note : it
*        could also be an image ...)
* @param string $confirmMessage (optionnal) introduce a javascript confirmation popup
* @return string the button
*/
function claro_html_button($url, $text, $confirmMessage = '')
{
    $url = secure_backlink_url($url);
    if ($confirmMessage != '') {
        $onClickCommand = "if(confirm('" . clean_str_for_javascript($confirmMessage) . "')){document.location='" . $url . "';return false}";
    } else {
        $onClickCommand = "document.location='" . $url . "';return false";
    }
    return '<a href="' . $url . '">' . '<input type="button" onclick="' . $onClickCommand . '" ' . 'value="' . $text . '" />' . '</a>' . "\n";
}
Example #24
0
">
            <img src="<?php 
            echo get_icon_url('edit');
            ?>
" alt="<?php 
            get_lang('Modify');
            ?>
" />
        </a>
        
        <a href="<?php 
            echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exDelete&amp;descId=' . (int) $description['id']));
            ?>
"
         onclick="javascript:if(!confirm('<?php 
            echo clean_str_for_javascript(get_lang('Are you sure to delete "%title" ?', array('%title' => $description['title'])));
            ?>
')) return false;">
            <img src="<?php 
            echo get_icon_url('delete');
            ?>
" alt="<?php 
            echo get_lang('Delete');
            ?>
" />
        </a>
        
        <?php 
            if ($description['visible']) {
                ?>
        <a href="<?php 
Example #25
0
        /**
         * Exports an exercise as a SCO.
         * This method is intended to be called from the prepare method.
         *
         * @note There's a lot of nearly cut-and-paste from exercise.lib.php here
         *      because of some little differences...
         *      Perhaps something that could be refactorised ?
         *
         * @see prepare
         * @param $quizId The quiz
         * @param $raw_to_pass The needed score to attain
         * @return False on error, True if everything went well.
         * @author Thanos Kyritsis <*****@*****.**>
         * @author  Amand Tihon <*****@*****.**>
         */
        function prepareQuiz($quizId, $raw_to_pass = 50) {
            global $langQuestion, $langOk, $langScore, $claro_stylesheet, $clarolineRepositorySys;
            global $charset, $langExerciseDone;
            // those two variables are needed by display_attached_file()
            global $attachedFilePathWeb;
            global $attachedFilePathSys;
            $attachedFilePathWeb = 'Exercises';
            $attachedFilePathSys = $this->destDir . '/Exercises';

// Generate standard page header
            $pageHeader = '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
<meta http-equiv="expires" content="Tue, 05 DEC 2000 07:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<link rel="stylesheet" type="text/css" href="bootstrap-custom.css" />
<link rel="stylesheet" type="text/css" href="' . $claro_stylesheet . '" media="screen, projection, tv" />
<script language="javascript" type="text/javascript" src="APIWrapper.js"></script>
<script language="javascript" type="text/javascript" src="scores.js"></script>
' . "\n";


            $pageBody = '<body onload="loadPage()">
    <div id="claroBody"><form id="quiz">
    <table class="table-default"><tr><td>' . "\n";


            // read the exercise
            $quiz = new Exercise();
            if (!$quiz->read($quizId)) {
                $this->error[] = $GLOBALS['langErrorLoadingExercise'];
                return false;
            }

            // Get the question list
            $questionList = $quiz->selectQuestionList();
            $questionCount = $quiz->selectNbrQuestions();

            // Keep track of raw scores (ponderation) for each question
            $questionPonderationList = array();

            // Keep track of correct texts for fill-in type questions
            $fillAnswerList = array();

            // Counter used to generate the elements' id. Incremented after every <input> or <select>
            $idCounter = 0;

            // Display each question
            $questionCount = 0;
            foreach ($questionList as $questionId) {
                // Update question number
                $questionCount++;

                // read the question, abort on error
                $question = new Question();
                if (!$question->read($questionId)) {
                    $this->error[] = $GLOBALS['langErrorLoadingQuestion'];
                    return false;
                }
                $qtype = $question->selectType();
                $qtitle = $question->selectTitle();
                $qdescription = $question->selectDescription();
                $questionPonderationList[$questionId] = $question->selectWeighting();

                // Generic display, valid for all kind of question
                $pageBody .= '<table class="table-default">
                <tr><th valign="top" colspan="2">' . $langQuestion . ' ' . $questionCount . '</th></tr>
                <tfoot>
                        <tr><td valign="top" colspan="2">' . $qtitle . '</td></tr>
                        <tr><td valign="top" colspan="2"><i>' . parse_user_text($qdescription) . '</i></td></tr>' . "\n";

                // Attached file, if it exists.
                //$attachedFile = $question->selectAttachedFile();
                if (!empty($attachedFile)) {
                    // copy the attached file
                    if (!claro_copy_file($this->srcDirExercise . '/' . $attachedFile, $this->destDir . '/Exercises')) {
                        $this->error[] = $GLOBALS['langErrorCopyAttachedFile'] . $attachedFile;
                        return false;
                    }

                    // Ok, if it was an mp3, we need to copy the flash mp3-player too.
                    $extension = substr(strrchr($attachedFile, '.'), 1);
                    if ($extension == 'mp3') {
                        $this->mp3Found = true;
                    }

                    $pageBody .= '<tr><td colspan="2">' . display_attached_file($attachedFile) . '</td></tr>' . "\n";
                }

                /*
                 * Display the possible answers
                 */

                $answer = new Answer($questionId);
                $answerCount = $answer->selectNbrAnswers();

                // Used for matching:
                $letterCounter = 'A';
                $choiceCounter = 1;
                $Select = array();

                for ($answerId = 1; $answerId <= $answerCount; $answerId++) {
                    $answerText = $answer->selectAnswer($answerId);
                    $answerCorrect = $answer->isCorrect($answerId);

                    // Unique answer
                    if ($qtype == UNIQUE_ANSWER || $qtype == TRUE_FALSE) {
                        // Construct the identifier
                        $htmlQuestionId = 'unique_' . $questionCount . '_x';

                        $pageBody .= '<tr><td width="5%" align="center">
                        <input type="radio" name="' . $htmlQuestionId . '"
                        id="scorm_' . $idCounter . '"
                        value="' . $answer->selectWeighting($answerId) . '"></td>
                    <td width="95%"><label for="scorm_' . $idCounter . '">' . $answerText . '</label>
                    </td></tr>';

                        $idCounter++;
                    }
                    // Multiple answers
                    elseif ($qtype == MULTIPLE_ANSWER) {
                        // Construct the identifier
                        $htmlQuestionId = 'multiple_' . $questionCount . '_' . $answerId;

                        // Compute the score modifier if this answer is checked
                        $raw = $answer->selectWeighting($answerId);

                        $pageBody .= '<tr><td width="5%" align="center">
                        <input type="checkbox" name="' . $htmlQuestionId . '"
                        id="scorm_' . $idCounter . '"
                        value="' . $raw . '"></td>
                    <td width="95%"><label for="scorm_' . $idCounter . '">' . $answerText . '</label>
                    </td></tr>';

                        $idCounter++;
                    }
                    // Fill in blanks
                    elseif ($qtype == FILL_IN_BLANKS || $qtype == FILL_IN_BLANKS_TOLERANT) {
                        $pageBody .= '<tr><td colspan="2">';

                        // We must split the text, to be able to treat each input independently
                        // separate the text and the scorings
                        $explodedAnswer = explode('::', $answerText);
                        $phrase = (isset($explodedAnswer[0])) ? $explodedAnswer[0] : '';
                        $weighting = (isset($explodedAnswer[1])) ? $explodedAnswer[1] : '';
                        $fillType = (!empty($explodedAnswer[2])) ? $explodedAnswer[2] : 1;
                        // default value if value is invalid
                        if ($fillType != TEXTFIELD_FILL && $fillType != LISTBOX_FILL) {
                            $fillType = TEXTFIELD_FILL;
                        }
                        $wrongAnswers = (!empty($explodedAnswer[3])) ? explode('[', $explodedAnswer[3]) : array();
                        // get the scorings as a list
                        $fillScoreList = explode(',', $weighting);
                        $fillScoreCounter = 0;
                        //listbox
                        if ($fillType == LISTBOX_FILL) {
                            // get the list of propositions (good and wrong) to display in lists
                            // add wrongAnswers in the list
                            $answerList = $wrongAnswers;
                            // add good answers in the list
                            // we save the answer because it will be modified
                            $temp = $phrase;
                            while (1) {
                                // quits the loop if there are no more blanks
                                if (($pos = strpos($temp, '[')) === false) {
                                    break;
                                }
                                // removes characters till '['
                                $temp = substr($temp, $pos + 1);
                                // quits the loop if there are no more blanks
                                if (($pos = strpos($temp, ']')) === false) {
                                    break;
                                }
                                // stores the found blank into the array
                                $answerList[] = substr($temp, 0, $pos);
                                // removes the character ']'
                                $temp = substr($temp, $pos + 1);
                            }
                            // alphabetical sort of the array
                            natcasesort($answerList);
                        }
                        // Split after each blank
                        $responsePart = explode(']', $phrase);
                        $acount = 0;
                        foreach ($responsePart as $part) {
                            // Split between text and (possible) blank
                            if (strpos($part, '[') !== false) {
                                list($rawtext, $blankText) = explode('[', $part);
                            } else {
                                $rawtext = $part;
                                $blankText = "";
                            }

                            $pageBody .= $rawtext;

                            // If there's a blank to fill-in after the text (this is usually not the case at the end)
                            if (!empty($blankText)) {
                                // Build the element's name
                                $name = 'fill_' . $questionCount . '_' . $acount;
                                // Keep track of the correspondance between element's name and correct value + scoring
                                $fillAnswerList[$name] = array($blankText, $fillScoreList[$fillScoreCounter]);
                                if ($fillType == LISTBOX_FILL) {// listbox
                                    $pageBody .= '<select name="' . $name . '" id="scorm_' . $idCounter . '">' . "\n"
                                            . '<option value="">&nbsp;</option>';

                                    foreach ($answerList as $answer) {
                                        $pageBody .= '<option value="' . htmlspecialchars($answer) . '">' . $answer . '</option>' . "\n";
                                    }

                                    $pageBody .= '</select>' . "\n";
                                } else {
                                    $pageBody .= '<input type="text" name="' . $name . '" size="10" id="scorm_' . $idCounter . '">';
                                }
                                $fillScoreCounter++;
                                $idCounter++;
                            }
                            $acount++;
                        }
                        $pageBody .= '</td></tr>' . "\n";
                    }
                    // Matching
                    elseif ($qtype == MATCHING) {
                        if (!$answer->isCorrect($answerId)) {
                            // Add the option as a possible answer.
                            $Select[$answerId] = $answerText;
                        } else {
                            $pageBody .= '<tr><td colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0" width="99%">
                        <tr>
                            <td width="40%" valign="top"><b>' . $choiceCounter . '.</b> ' . $answerText . '</td>
                            <td width="20%" valign="center">&nbsp;<select name="matching_' . $questionCount . '_' .
                                    $answerId . '" id="scorm_' . $idCounter . '">
                            <option value="0">--</option>';

                            $idCounter++;

                            // fills the list-box
                            $letter = 'A';
                            foreach ($Select as $key => $val) {
                                $scoreModifier = ( $key == $answer->isCorrect($answerId) ) ? $answer->selectWeighting($answerId) : 0;
                                $pageBody .= '<option value="' . $scoreModifier . '">' . $letter++ .
                                        '</option>';
                            }

                            $pageBody .= '</select></td><td width="40%" valign="top">';
                            if (isset($Select[$choiceCounter])) {
                                $pageBody .= '<b>' . $letterCounter . '.</b> ' . $Select[$choiceCounter];
                            }
                            $pageBody .= '&nbsp;</td></tr></table></td></tr>' . "\n";

                            // Done with this one
                            $letterCounter++;
                            $choiceCounter++;

                            // If the left side has been completely displayed :
                            if ($answerId == $answerCount) {
                                // Add all possibly remaining answers to the right
                                while (isset($Select[$choiceCounter])) {
                                    $pageBody .= '<tr><td colspan="2">
                                <table border="0" cellpadding="0" cellspacing="0" width="99%">
                                <tr>
                                    <td width="40%">&nbsp;</td>
                                    <td width="20%">&nbsp;</td>
                                    <td width="40%"><b>' . $letterCounter . '.</b> ' . $Select[$choiceCounter] . '</td>
                                </tr>
                                </table>
                                </td></tr>' . "\n";

                                    $letterCounter++;
                                    $choiceCounter++;
                                } // end while
                            } // end if
                        } // else
                    } // end if (MATCHING)
                } // end for each answer
                // End of the question
                $pageBody .= '</tfoot></table>' . "\n\n";
            } // foreach($questionList as $questionId)
            // No more questions, add the button.
            $pageEnd = '</td></tr>
            <tr>
                <td align="center"><br><input class="btn btn-primary" type="button" value="' . $langOk . '" onClick="calcScore()"></td>
            </tr>
            </table>
            </form>
            </div></body></html>' . "\n";

            /* Generate the javascript that'll calculate the score
             * We have the following variables to help us :
             * $idCounter : number of elements to check. their id are "scorm_XY"
             * $raw_to_pass : score (on 100) needed to pass the quiz
             * $fillAnswerList : a list of arrays (text, score) indexed on <input>'s names
             *
             */
            $pageHeader .= '
<script type="text/javascript" language="javascript">
    var raw_to_pass = '******';
    var weighting = ' . array_sum($questionPonderationList) . ';
    var rawScore;
    var scoreCommited = false;
    var showScore = true;
    var fillAnswerList = new Array();' . "\n";

            // Add the data for fillAnswerList
            foreach ($fillAnswerList as $key => $val) {
                $pageHeader .= "    fillAnswerList['" . $key . "'] = new Array('" . $val[0] . "', '" . $val[1] . "');\n";
            }

            // This is the actual code present in every exported exercise.
            $pageHeader .= '

    function calcScore()
    {
		if( !scoreCommited )
		{
	        rawScore = CalculateRawScore(document, ' . $idCounter . ', fillAnswerList);
	        var score = Math.max(Math.round(rawScore * 100 / weighting), 0);
	        var oldScore = doGetValue("cmi.score.raw");

	        doSetValue("cmi.score.max", weighting);
	        doSetValue("cmi.score.min", 0);

	        computeTime();

	        if (score > oldScore) // Update only if score is better than the previous time.
	        {
	            doSetValue("cmi.score.raw", rawScore);
	        }

			var oldStatus = doGetValue( "cmi.success_status" )
			if (score >= raw_to_pass)
			{
				doSetValue("cmi.success_status", "passed");
			}
			else if (oldStatus != "passed" ) // If passed once, never mark it as failed.
			{
				doSetValue("cmi.success_status", "failed");
			}

	        doCommit();
	        doTerminate();
	        scoreCommited = true;
	        if(showScore) alert(\'' . clean_str_for_javascript($langScore) . ' :\n\' + rawScore + \'/\' + weighting + \'\n\' + \'' . clean_str_for_javascript($langExerciseDone) . '\');
		}
    }

</script>
';

            // Construct the HTML file and save it.
            $filename = "quiz_" . $quizId . ".html";

            $pageContent = $pageHeader
                    . $pageBody
                    . $pageEnd;

            if (!$f = fopen($this->destDir . '/' . $filename, 'w')) {
                $this->error[] = $GLOBALS['langErrorCreatingFile'] . $filename;
                return false;
            }
            fwrite($f, $pageContent);
            fclose($f);

            // Went well.
            return True;
        }
Example #26
0
    } else {
        $courseDataList[$numLine]['officialCode'] = '<span class="invisible" >' . $courseLine['officialCode'] . '</span>';
    }
    // Label
    $courseDataList[$numLine]['intitule'] = '<a href="' . get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($courseLine['sysCode']) . '">' . $courseLine['intitule'] . '</a>' . (!is_null($courseLine['sourceCourseId']) ? ' [' . get_lang('Session') . ']' : '') . ($courseLine['isSourceCourse'] ? ' [' . get_lang('Source') . ']' : '');
    // Users in course
    $courseDataList[$numLine]['qty_cm'] = '<a href="admincourseusers.php' . '?cidToEdit=' . $courseLine['sysCode'] . $addToURL . '&amp;cfrom=clist">' . get_lang('%nb member(s)', array('%nb' => $courseLine['qty_stu'] + $courseLine['qty_cm'])) . '</a>' . '<br />' . "\n" . '<small><small>' . "\n" . get_lang('%nb course(s) manager(s)', array('%nb' => $courseLine['qty_cm'])) . ' - ' . get_lang('%nb student(s)', array('%nb' => $courseLine['qty_stu'])) . "\n" . '</small></small>' . "\n";
    if ($courseLine['registration'] == 'open' && !empty($courseLine['registrationKey'])) {
        $regIcon = 'key';
    } else {
        $regIcon = $courseLine['registration'];
    }
    // Course Settings
    $courseDataList[$numLine]['cmdSetting'] = '<a href="' . get_path('clarolineRepositoryWeb') . 'course/settings.php?adminContext=1' . '&amp;cidReq=' . $courseLine['sysCode'] . $addToURL . '&amp;cfrom=clist' . (!is_null($courseLine['sourceCourseId']) ? '&amp;courseType=session' : '') . '">' . '<img src="' . get_icon_url('settings') . '" alt="" />' . '&nbsp;&nbsp;&nbsp;' . '<img src="' . get_icon_url($imgVisibilityStatus[$courseLine['visibility']]) . '" alt="" /> ' . '<img src="' . get_icon_url($imgAccessStatus[$courseLine['access']]) . '" alt="" /> ' . '<img src="' . get_icon_url($imgRegistrationStatus[$regIcon]) . '" alt="" />' . '</a>';
    // Course Action Delete
    $courseDataList[$numLine]['cmdDelete'] = '<a href="' . claro_htmlspecialchars($_SERVER['PHP_SELF'] . '?cmd=exDelete&delCode=' . $courseLine['sysCode'] . $addToURL) . '" ' . 'onclick="return ADMIN.confirmationDel(\'' . clean_str_for_javascript($courseLine['intitule']) . '\');">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . "\n" . '</a>' . "\n";
}
/**
 * CONFIG DATAGRID
 */
$sortUrlList = $myPager->get_sort_url_list($_SERVER['PHP_SELF']);
$courseDataGrid = new claro_datagrid($courseDataList);
$courseDataGrid->set_colTitleList(array('officialCode' => '<a href="' . $sortUrlList['officialCode'] . '">' . get_lang('Course code') . '</a>', 'intitule' => '<a href="' . $sortUrlList['intitule'] . '">' . get_lang('Course title') . '</a>', 'qty_cm' => get_lang('Course members'), 'cmdSetting' => get_lang('Course settings'), 'cmdDelete' => get_lang('Delete')));
$courseDataGrid->set_colAttributeList(array('qty_cm' => array('align' => 'right'), 'cmdSetting' => array('align' => 'center'), 'cmdDelete' => array('align' => 'center')));
$courseDataGrid->set_idLineType('none');
$courseDataGrid->set_colHead('officialCode');
$courseDataGrid->set_noRowMessage(get_lang('There is no course matching such criteria') . '<br />' . '<a href="advanced_course_search.php' . $addtoAdvanced . '">' . get_lang('Search again (advanced)') . '</a>');
// Command list
$cmdList = array();
$cmdList[] = array('img' => 'courseadd', 'name' => get_lang('Create course'), 'url' => '../course/create.php?adminContext=1');
// Display
Example #27
0
        ?>
" />
                    </a>
                </td>
                <?php 
        if ('pool' == $this->context) {
            $confirmString = get_lang('Are you sure you want to completely delete this question ?');
            $url = 'question_pool.php?exId=' . $this->exId . '&amp;cmd=delQu&amp;quId=' . $question['id'] . '&amp;offset=' . $this->offset;
        } else {
            $confirmString = get_lang('Are you sure you want to remove the question from the exercise ?');
            $url = 'edit_exercise.php?exId=' . $this->exId . '&amp;cmd=rmQu&amp;quId=' . $question['id'];
        }
        ?>
                <td align="center">
                    <a href="<?php 
        echo claro_htmlspecialchars(Url::Contextualize($url)) . '" onclick="javascript:if(!confirm(\'' . clean_str_for_javascript($confirmString) . '\')) return false;';
        ?>
">
                        <img src="<?php 
        echo get_icon_url('delete');
        ?>
" alt="<?php 
        echo get_lang('Delete');
        ?>
" />
                    </a>
                </td>
                <?php 
        if ('pool' == $this->context) {
            ?>
                    <td align="center">
Example #28
0
        $dialogBox->error(get_lang('Changes have not been applied to the user settings'));
        foreach ($messageList as $message) {
            $dialogBox->error($message);
        }
    }
}
// if apply changes
/**
 * PREPARE DISPLAY
 */
// Prepend in reverse order !!!
if (isset($_REQUEST['cfrom']) && $_REQUEST['cfrom'] == 'ulist') {
    ClaroBreadCrumbs::getInstance()->prepend(get_lang('User list'), get_path('rootAdminWeb') . 'adminusers.php');
}
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$htmlHeadXtra[] = "<script>\n            function confirmation (name)\n            {\n                if (confirm(\"" . clean_str_for_javascript(get_lang('Are you sure to delete')) . " \"+ name + \"? \"))\n                    {return true;}\n                else\n                    {return false;}\n            }\n            </script>";
$user_data['is_admin'] = user_is_admin($userId);
$cmd_menu[] = '<a class="claroCmd" href="../auth/courses.php' . '?cmd=rqReg' . '&amp;uidToEdit=' . $userId . '&amp;fromAdmin=settings' . '&amp;category=" >' . '<img src="' . get_icon_url('enroll') . '" />' . get_lang('Enrol to a new course') . '</a>';
$cmd_menu[] = '<a class="claroCmd" href="../auth/lostPassword.php' . '?Femail=' . urlencode($user_data['email']) . '&amp;searchPassword=1" >' . '<img src="' . get_icon_url('mail_close') . '" />' . get_lang('Send account information to user by email') . '</a>';
$cmd_menu[] = '<a class="claroCmd" href="adminuserdeleted.php' . '?uidToEdit=' . $userId . '&amp;cmd=rqDelete" ' . ' id="delete" >' . '<img src="' . get_icon_url('deluser') . '" /> ' . get_lang('Delete user') . '</a>';
$cmd_menu[] = '<a class="claroCmd" href="../messaging/sendmessage.php' . '?cmd=rqMessageToUser' . '&amp;userId=' . $userId . '">' . get_lang('Send a message to the user') . '</a>';
if (isset($_REQUEST['cfrom']) && $_REQUEST['cfrom'] == 'ulist') {
    $cmd_menu[] = '<a class="claroCmd" href="adminusers.php" >' . get_lang('Back to user list') . '</a>';
}
/**
 * DISPLAY
 */
$out = '';
// Display tool title
$out .= claro_html_tool_title($nameTools) . $dialogBox->render() . '<p>' . claro_html_menu_horizontal($cmd_menu) . '</p>' . user_html_form_admin_user_profile($user_data);
if (!is_null($dgExtra)) {
Example #29
0
/web/js/jquery.js"></script>
    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    <script type="text/javascript" src="../../utils/mctabs.js"></script>
    <script type="text/javascript" src="../../utils/form_utils.js"></script>
    <script type="text/javascript" src="../../utils/validate.js"></script>
    <script type="text/javascript" src="../../utils/editable_selects.js"></script>
    <script type="text/javascript" src="js/image.js"></script>
    <script type="text/javascript" src="js/ajax.js"></script>
    <script type="text/javascript">
       var relativePath = '<?php 
echo addslashes($relativePath);
?>
';
       <?php 
if (!empty($alertMessage)) {
    echo 'alert("' . clean_str_for_javascript($alertMessage) . '");' . "\n";
}
if (!empty($imgUrl)) {
    echo 'selectImage( "' . $imgUrl . '" );' . "\n";
}
?>
    </script>
    <link href="css/advimage.css" rel="stylesheet" type="text/css" />
    <base target="_self" />
</head>
<body id="advimage" style="display: none">
    <form action="#" method="post" enctype="multipart/form-data">
        <div class="tabs">
            <ul>
                <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;"><?php 
echo get_lang('Main');
Example #30
0
$userDataGrid->set_colHead('name');
$userDataGrid->set_colTitleList(array('user_id' => '<a href="' . $sortUrlList['user_id'] . '">' . get_lang('Numero') . '</a>', 'name' => '<a href="' . $sortUrlList['name'] . '">' . get_lang('Last name') . '</a>', 'firstname' => '<a href="' . $sortUrlList['firstname'] . '">' . get_lang('First name') . '</a>', 'officialCode' => '<a href="' . $sortUrlList['officialCode'] . '">' . get_lang('Administrative code') . '</a>', 'authSource' => get_lang('Authentication source'), 'email' => '<a href="' . $sortUrlList['email'] . '">' . get_lang('Email') . '</a>', 'isCourseCreator' => '<a href="' . $sortUrlList['isCourseCreator'] . '">' . get_lang('Status') . '</a>', 'settings' => get_lang('User settings'), 'qty_course' => get_lang('Courses'), 'delete' => get_lang('Delete')));
if (count($userGrid) == 0) {
    $userDataGrid->set_noRowMessage('<center>' . get_lang('No user to display') . "\n" . '<br />' . "\n" . '<a href="advancedUserSearch.php' . $addtoAdvanced . '">' . get_lang('Search again (advanced)') . '</a></center>' . "\n");
} else {
    $userDataGrid->set_colAttributeList(array('user_id' => array('align' => 'center'), 'officialCode' => array('align' => 'center'), 'settings' => array('align' => 'center'), 'delete' => array('align' => 'center')));
}
//---------
// DISPLAY
//---------
//PREPARE
// javascript confirm pop up declaration
$htmlHeadXtra[] = '<script type="text/javascript">
        function confirmation (name)
        {
            if (confirm("' . clean_str_for_javascript(get_lang('Are you sure to delete')) . '" + name + "? "))
                {return true;}
            else
                {return false;}
        }' . "\n" . '</script>' . "\n";
$out = '';
// Display tool title
$out .= claro_html_tool_title($nameTools) . "\n\n";
//Display selectbox and advanced search link
//TOOL LINKS
//Display search form
if (!empty($isSearchedHTML)) {
    $dialogBox->info('<b>' . get_lang('Search on') . '</b> : <small>' . $isSearchedHTML . '</small>');
}
//Display Forms or dialog box(if needed)
$out .= $dialogBox->render();