find($forumId); /** @var CForumThread $threadEntity */ $threadEntity = $repoThread->find($threadId); $course = api_get_course_entity(); $session = api_get_session_entity(); $allowToQualify = false; if ($allowed_to_edit) { $allowToQualify = true; } else { $allowToQualify = $threadEntity->isThreadPeerQualify() && $forumEntity->isVisible($course, $session) && $userIdToQualify != $currentUserId; } if (!$allowToQualify) { api_not_allowed(true); } // Show max qualify in my form $maxQualify = showQualify('2', $userIdToQualify, $threadId); $score = 0; if (isset($_POST['idtextqualify'])) { $score = (float) ($_POST['idtextqualify']); if ($score <= $maxQualify) { saveThreadScore( $threadEntity, $userIdToQualify, $threadId, $score, api_get_utc_datetime(), api_get_session_id() ); header( 'Location: '.api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.api_get_cidreq().'&' .http_build_query([ 'forum' => $forumId, 'action' => 'liststd', 'content' => 'thread', 'id' => $threadId, 'list' => 'qualify', ]) ); exit; } Display::addFlash( Display::return_message(get_lang('Grade cannot exceed max score'), 'error') ); } /* Including necessary files */ $htmlHeadXtra[] = ''; $category = $forumEntity->getForumCategory(); $groupId = api_get_group_id(); if (api_is_in_gradebook()) { $interbreadcrumb[] = [ 'url' => Category::getUrl(), 'name' => get_lang('Assessments'), ]; } $search = isset($_GET['search']) ? Security::remove_XSS(urlencode($_GET['search'])) : ''; if ('learnpath' === $origin) { Display::display_reduced_header(); } else { if (!empty($groupId)) { $group_properties = GroupManager::get_group_properties($groupId); $interbreadcrumb[] = [ 'url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'), ]; $interbreadcrumb[] = [ 'url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('Group area').' ('.$group_properties['name'].')', ]; $interbreadcrumb[] = [ 'url' => 'viewforum.php?'.api_get_cidreq().'&forum='.(int) ($_GET['forum']).'&search='.$search, 'name' => prepare4display($forumEntity->getForumTitle()), ]; if ('PostDeletedSpecial' != $message) { $interbreadcrumb[] = [ 'url' => 'viewthread.php?'.api_get_cidreq().'&forum='.(int) ($_GET['forum']).'&thread='.(int) ($_GET['thread']), 'name' => prepare4display($threadEntity->getThreadTitle()), ]; } $interbreadcrumb[] = [ 'url' => '#', 'name' => get_lang('Grade thread'), ]; // the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string Display::display_header(''); api_display_tool_title($nameTools); } else { $interbreadcrumb[] = [ 'url' => 'index.php?'.api_get_cidreq().'&search='.$search, 'name' => $nameTools, ]; $interbreadcrumb[] = [ 'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$category->getIid().'&search='.$search, 'name' => prepare4display($category->getCatTitle()), ]; $interbreadcrumb[] = [ 'url' => 'viewforum.php?'.api_get_cidreq().'&forum='.$forumId.'&search='.$search, 'name' => prepare4display($forumEntity->getForumTitle()), ]; if ('PostDeletedSpecial' != $message) { $interbreadcrumb[] = [ 'url' => 'viewthread.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId, 'name' => prepare4display($threadEntity->getThreadTitle()), ]; } // the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string $interbreadcrumb[] = [ 'url' => '#', 'name' => get_lang('Grade thread'), ]; Display::display_header(''); } } /* Actions */ $action = isset($_GET['action']) ? $_GET['action'] : ''; if ('delete' === $action && isset($_GET['content']) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) ) { $message = delete_post($_GET['id']); } if (('invisible' === $action || 'visible' === $action) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) ) { $message = approve_post($_GET['id'], $action); } if ('move' === $action && isset($_GET['post'])) { $message = move_post_form(); } /* Display the action messages */ if (!empty($message)) { echo Display::return_message(get_lang($message), 'confirm'); } // 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='.$forumId.'&thread='.$threadId.'&user='.(int) ($_GET['user']).'&user_id='.(int) ($_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'), $threadEntity->getThreadTitle()); $form->addLabel(get_lang('Users in course'), $result['user_course']); $form->addLabel(get_lang('Number of posts'), $result['post']); $form->addLabel(get_lang('Number of posts for this user'), $result['user_post']); $form->addLabel( get_lang('Posts by user'), round($result['user_post'] / $result['post'], 2) ); $form->addText( 'idtextqualify', [get_lang('Score'), get_lang('Max score').' '.$maxQualify], $qualify ); $course = api_get_course_info(); $rows = get_thread_user_post($course['code'], $threadId, $_GET['user']); if (isset($rows)) { $counter = 1; foreach ($rows as $row) { if ('0' == $row['status']) { $style = " id = 'post".$post_en."' class=\"hide-me\" style=\"border:1px solid red; display:none; background-color:#F7F7F7; width:95%; margin: 0px 0px 4px 40px; \" "; } else { $style = ''; $post_en = $row['post_parent_id']; } if ('0' == $row['user_id']) { $name = prepare4display($row['poster_name']); } else { $name = api_get_person_name($row['firstname'], $row['lastname']); } if (1 == $counter) { echo Display::page_subheader($name); } echo '
| ";
echo ' '.api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG).' '; echo ' | ';
// The post title
echo "".prepare4display($row['post_title']).' | '; echo '
| ';
$realname = $attachment_list['path'];
$user_filename = $attachment_list['filename'];
echo Display::return_icon('attachment.gif', get_lang('Attachment'));
echo ' '.$user_filename.' ';
echo ''.$attachment_list['comment'].' '; echo ' |
| '.get_lang('Who changed').' | '; $table_list .= ''.get_lang('Note changed').' | '; $table_list .= ''.get_lang('Date changed').' | '; $table_list .= '
|---|---|---|
| '.$userInfo['complete_name'].' | '; $table_list .= ''.$historyList[$i]['qualify'].' | '; $table_list .= ''.api_convert_and_format_date( $historyList[$i]['qualify_time'], DATE_TIME_FORMAT_LONG ); $table_list .= ' |