Exemple #1
0
 $threadId = $currentThread['thread_id'];
 // Show max qualify in my form
 $maxQualify = showQualify('2', $userIdToQualify, $threadId);
 $score = isset($_POST['idtextqualify']) ? $_POST['idtextqualify'] : '';
 if ($score > $maxQualify) {
     Display::display_error_message(get_lang('QualificationCanNotBeGreaterThanMaxScore'), false);
 }
 if (!empty($score)) {
     $saveResult = saveThreadScore($currentThread, $userIdToQualify, $threadId, $score, api_get_utc_datetime(), api_get_session_id());
 }
 // show qualifications history
 $type = isset($_GET['type']) ? $_GET['type'] : '';
 $historyList = getThreadScoreHistory($userIdToQualify, $threadId, $type);
 $counter = count($historyList);
 // Show current qualify in my form
 $qualify = current_qualify_of_thread($threadId, api_get_session_id(), $_GET['user']);
 $result = get_statistical_information($threadId, $_GET['user_id'], api_get_course_int_id());
 $url = api_get_path(WEB_CODE_PATH) . 'forum/forumqualify.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $threadId . '&user='******'user']) . '&user_id=' . intval($_GET['user']);
 $userToQualifyInfo = api_get_user_info($userIdToQualify);
 $form = new FormValidator('forum-thread-qualify', 'post', $url);
 $form->addHeader($userToQualifyInfo['complete_name']);
 $form->addLabel(get_lang('Thread'), $currentThread['thread_title']);
 $form->addLabel(get_lang('CourseUsers'), $result['user_course']);
 $form->addLabel(get_lang('PostsNumber'), $result['post']);
 $form->addLabel(get_lang('NumberOfPostsForThisUser'), $result['user_post']);
 $form->addLabel(get_lang('AveragePostPerUser'), round($result['user_post'] / $result['post'], 2));
 $form->addText('idtextqualify', array(get_lang('Qualification'), get_lang('MaxScore') . ' ' . $maxQualify), $qualify);
 include 'viewpost.inc.php';
 $form->addButtonSave(get_lang('QualifyThisThread'));
 $form->setDefaults(array('idtextqualify' => $qualify));
 $form->display();
Exemple #2
0
    if ($origin != 'learnpath') {
        echo '<span class="forum_low_description">' . prepare4display($current_forum_category['cat_title']) . ' - ';
    }
    echo prepare4display($current_forum['forum_title']) . '<br />';
    echo "</th>";
    echo "</tr>";
    echo '<span>' . prepare4display($current_thread['thread_comment']) . '</span>';
    echo "</table>";
    include_once 'viewpost.inc.php';
}
// if ($message<>'PostDeletedSpecial') // in this case the first and only post of the thread is removed
if ($allowed_to_edit) {
    $current_thread = get_thread_information($_GET['thread']);
    $threadid = $current_thread['thread_id'];
    //show current qualify in my form
    $qualify = current_qualify_of_thread($threadid, api_get_session_id());
    //show max qualify in my form
    $max_qualify = show_qualify('2', $user_id, $threadid);
    require_once 'forumbody.inc.php';
    $value_return = store_theme_qualify($user_id, $threadid, $_REQUEST['idtextqualify'], api_get_user_id(), date("Y-m-d H:i:s"), api_get_session_id());
    $url = 'cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;forum=' . Security::remove_XSS($_GET['forum']) . '&amp;thread=' . Security::remove_XSS($_GET['thread']) . '&amp;post=' . Security::remove_XSS($_GET['post']) . '&amp;origin=' . $origin . '&amp;user_id=' . Security::remove_XSS($_GET['user_id']);
    $current_qualify_thread = show_qualify('1', $user_id, $threadid);
    if ($value_return[0] != $_REQUEST['idtextqualify'] && $value_return[1] == 'update') {
        store_qualify_historical('1', '', $_GET['forum'], $user_id, $threadid, $_REQUEST['idtextqualify'], api_get_user_id());
    }
    if (!empty($_REQUEST['idtextqualify']) && $_REQUEST['idtextqualify'] > $max_qualify) {
        $return_message = get_lang('QualificationCanNotBeGreaterThanMaxScore');
        Display::display_error_message($return_message, false);
    }
    // show qualifications history
    $qualify_historic = get_historical_qualify($user_id, $threadid, $_GET['type']);