function check_unzip() { if (document.upload.unzip.checked){ document.upload.if_exists[0].disabled=true; document.upload.if_exists[1].checked=true; document.upload.if_exists[2].disabled=true; } else { document.upload.if_exists[0].checked=true; document.upload.if_exists[0].disabled=false; document.upload.if_exists[2].disabled=false; } } function setFocus() { $("#title_file").focus(); } '; // The next javascript script is to manage ajax upload file $htmlHeadXtra[] = api_get_jquery_libraries_js(['jquery-ui', 'jquery-upload']); // Recover Thread ID, will be used to generate delete attachment URL to do ajax $threadId = isset($_REQUEST['thread']) ? (int) ($_REQUEST['thread']) : 0; $forumId = isset($_REQUEST['forum']) ? (int) ($_REQUEST['forum']) : 0; $ajaxUrl = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq(); // The next javascript script is to delete file by ajax $htmlHeadXtra[] = ''; api_protect_course_script(true); $nameTools = get_lang('Forums'); $this_section = SECTION_COURSES; $message = ''; //are we in a lp ? $origin = api_get_origin(); $currentUserId = api_get_user_id(); $userIdToQualify = isset($_GET['user_id']) ? (int) ($_GET['user_id']) : null; $forumId = isset($_GET['forum']) ? (int) ($_GET['forum']) : 0; $threadId = isset($_GET['thread']) ? (int) ($_GET['thread']) : 0; api_block_course_item_locked_by_gradebook($threadId, LINK_FORUM_THREAD); $nameTools = get_lang('Forums'); $allowed_to_edit = api_is_allowed_to_edit(null, true); $repo = Container::getForumRepository(); $repoThread = Container::getForumThreadRepository(); /** @var CForum $forumEntity */ $forumEntity = $repo->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='.$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()), ]; } $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(''); Display::page_subheader2($nameTools); } else { $interbreadcrumb[] = [ 'url' => 'index.php?'.api_get_cidreq().'&search='.$search, 'name' => $nameTools, ]; $interbreadcrumb[] = [ 'url' => 'index.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(''); } } $postId = isset($_GET['id']) ? (int) ($_GET['id']) : 0; $repoPost = Container::getForumPostRepository(); $postEntity = !empty($postId) ? $repoPost->find($postId) : null; $action = isset($_GET['action']) ? $_GET['action'] : ''; $currentUrl = api_get_self().'?forum='.$forumId.'&'.api_get_cidreq().'&thread='.$threadId; if ('delete' === $action && isset($_GET['content']) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) ) { deletePost($postEntity); api_location($currentUrl); } if (('invisible' === $action || 'visible' === $action) && isset($_GET['id']) && api_is_allowed_to_edit(false, true) ) { approvePost($postEntity, $action); api_location($currentUrl); } if ('move' === $action && isset($_GET['post'])) { $message = move_post_form(); } 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 ); $rows = get_thread_user_post($course, $threadId, $_GET['user']); if (isset($rows)) { $counter = 1; foreach ($rows as $row) { $style = ''; 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 { $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 .= ' |