本文整理汇总了PHP中get_thread_information函数的典型用法代码示例。如果您正苦于以下问题:PHP get_thread_information函数的具体用法?PHP get_thread_information怎么用?PHP get_thread_information使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_thread_information函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_lang
if(document.getElementById(\'id_qualify\').style.display == \'none\') {
document.getElementById(\'id_qualify\').style.display = \'block\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\' ' . Display::return_icon('div_hide.gif', get_lang('Hide'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AdvancedParameters') . '\';
} else {
document.getElementById(\'id_qualify\').style.display = \'none\';
document.getElementById(\'img_plus_and_minus\').innerHTML=\' ' . Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AdvancedParameters') . '\';
}
}
</script>';
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum categorie information */
// We are getting all the information about the current forum and forum category.
// Note pcool: I tried to use only one sql statement (and function) for this,
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table.
$current_thread = get_thread_information($_GET['thread']);
// Note: This has to be validated that it is an existing thread.
$current_forum = get_forum_information($_GET['forum']);
// Note: This has to be validated that it is an existing forum.
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$current_post = get_post_information($_GET['post']);
api_block_course_item_locked_by_gradebook($_GET['thread'], LINK_FORUM_THREAD);
/* Header and Breadcrumbs */
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
if ($origin == 'group') {
$_clean['toolgroup'] = (int) $_SESSION['toolgroup'];
示例2: calc_score
/**
* @param int $stud_id
* @param string $type
*
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
{
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
$threadInfo = get_thread_information($this->get_ref_id());
$thread_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$sql = 'SELECT thread_qualify_max
FROM ' . Database::get_course_table(TABLE_FORUM_THREAD) . "\n \t\t\t\tWHERE c_id = " . $this->course_id . " AND thread_id = '" . $this->get_ref_id() . "'";
$query = Database::query($sql);
$assignment = Database::fetch_array($query);
$sql = "SELECT * FROM {$thread_qualify}\n\t\t\t\tWHERE c_id = " . $this->course_id . " AND thread_id = " . $this->get_ref_id();
if (isset($stud_id)) {
$sql .= ' AND user_id = ' . intval($stud_id);
}
// order by id, that way the student's first attempt is accessed first
$sql .= ' ORDER BY qualify_time DESC';
$scores = Database::query($sql);
// for 1 student
if (isset($stud_id)) {
if ($threadInfo['thread_peer_qualify'] == 0) {
// Classic way of calculate score
if ($data = Database::fetch_array($scores)) {
return array($data['qualify'], $assignment['thread_qualify_max']);
} else {
// We sent the 0/thread_qualify_max instead of null for correct calculations
return array(0, $assignment['thread_qualify_max']);
}
} else {
// Take average
$score = 0;
$counter = 0;
if (Database::num_rows($scores)) {
while ($data = Database::fetch_array($scores, 'ASSOC')) {
$score += $data['qualify'];
$counter++;
}
}
// If no result
if (empty($counter) || $counter <= 2) {
return array(0, $assignment['thread_qualify_max']);
}
return [$score / $counter, $assignment['thread_qualify_max']];
}
} else {
// All students -> get average
$students = array();
// user list, needed to make sure we only
// take first attempts into account
$counter = 0;
$sum = 0;
$bestResult = 0;
$weight = 0;
$sumResult = 0;
while ($data = Database::fetch_array($scores)) {
if (!array_key_exists($data['user_id'], $students)) {
if ($assignment['thread_qualify_max'] != 0) {
$students[$data['user_id']] = $data['qualify'];
$counter++;
$sum += $data['qualify'] / $assignment['thread_qualify_max'];
$sumResult += $data['qualify'];
if ($data['qualify'] > $bestResult) {
$bestResult = $data['qualify'];
}
$weight = $assignment['thread_qualify_max'];
}
}
}
if ($counter == 0) {
return null;
} else {
switch ($type) {
case 'best':
return array($bestResult, $weight);
break;
case 'average':
return array($sumResult / $counter, $weight);
break;
case 'ranking':
return AbstractLink::getCurrentUserRanking($stud_id, $students);
break;
default:
return array($sum, $counter);
break;
}
}
}
}
示例3: api_get_path
* @package chamilo/forum
* @author Daniel Barreto Alva <daniel.barreto@beeznest.com>
*/
require_once '../global.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
// First, protect this script
api_protect_course_script(false);
/**
* Main code
*/
// Create a default error response
$json = array('error' => true, 'errorMessage' => 'ERROR');
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
$current_forum = get_forum_information($_REQUEST['forum']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$current_thread = get_thread_information($_REQUEST['thread']);
// Check if exist action
if (!empty($action)) {
switch ($action) {
case 'upload_file':
if (!empty($_FILES) && !empty($_REQUEST['forum'])) {
// The user is not allowed here if
// 1. the forum category, forum or thread is invisible (visibility==0)
// 2. the forum category, forum or thread is locked (locked <>0)
// 3. if anonymous posts are not allowed
// The only exception is the course manager
// They are several pieces for clarity.
if (!api_is_allowed_to_edit(null, true) and ($current_forum_category && $current_forum_category['visibility'] == 0 or $current_forum['visibility'] == 0)) {
$json['errorMessage'] = '1. the forum category, forum or thread is invisible (visibility==0)';
break;
}
示例4: send_notifications
/**
* Get all the users who need to receive a notification of a new post (those subscribed to
* the forum or the thread)
*
* @param integer $forum_id the id of the forum
* @param integer $thread_id the id of the thread
* @param integer $post_id the id of the post
* @return bool
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
* @version May 2008, dokeos 1.8.5
* @since May 2008, dokeos 1.8.5
*/
function send_notifications($forum_id = 0, $thread_id = 0, $post_id = 0)
{
$_course = api_get_course_info();
// The content of the mail
$thread_link = api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&forum=' . $forum_id . '&thread=' . $thread_id;
// Users who subscribed to the forum
if ($forum_id != 0) {
$users_to_be_notified_by_forum = get_notifications('forum', $forum_id);
} else {
return false;
}
$current_thread = get_thread_information($thread_id);
$current_forum = get_forum_information($current_thread['forum_id']);
$subject = get_lang('NewForumPost') . ' - ' . $_course['official_code'] . ' - ' . $current_forum['forum_title'] . ' - ' . $current_thread['thread_title'];
// User who subscribed to the thread
if ($thread_id != 0) {
$users_to_be_notified_by_thread = get_notifications('thread', $thread_id);
}
// Merging the two
$users_to_be_notified = array_merge($users_to_be_notified_by_forum, $users_to_be_notified_by_thread);
$sender_id = api_get_user_id();
if (is_array($users_to_be_notified)) {
foreach ($users_to_be_notified as $value) {
$user_info = api_get_user_info($value['user_id']);
$email_body = get_lang('Dear') . ' ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS) . ", <br />\n\r";
$email_body .= get_lang('NewForumPost') . ": " . $current_forum['forum_title'] . ' - ' . $current_thread['thread_title'] . " <br />\n";
$email_body .= get_lang('Course') . ': ' . $_course['name'] . ' - [' . $_course['official_code'] . "] <br />\n";
$email_body .= get_lang('YouWantedToStayInformed') . "<br />\n";
$email_body .= get_lang('ThreadCanBeFoundHere') . ': <br /> <a href="' . $thread_link . '">' . $thread_link . "</a>\n";
MessageManager::send_message_simple($value['user_id'], $subject, $email_body, $sender_id);
}
}
}
示例5: return_visible_invisible_icon
}
}
if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) {
$iconEdit .= return_visible_invisible_icon('post', $row['post_id'], $row['visible'], array('forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'origin' => $origin));
$iconEdit .= "";
if ($increment > 0) {
$iconEdit .= "<a href=\"viewthread.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=move&post=" . $row['post_id'] . "&origin=" . $origin . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
}
$user_status = api_get_status_of_user_in_course($row['user_id'], api_get_course_int_id());
$current_qualify_thread = showQualify('1', $row['poster_id'], $_GET['thread']);
if (($current_thread['thread_peer_qualify'] == 1 || api_is_allowed_to_edit(null, true)) && $current_thread['thread_qualify_max'] > 0 && $origin != 'learnpath') {
$my_forum_id = $clean_forum_id;
if (isset($_GET['gradebook'])) {
$info_thread = get_thread_information($clean_thread_id);
$my_forum_id = $info_thread['forum_id'];
}
$userCanEdit = $current_thread['thread_peer_qualify'] == 1 && $row['poster_id'] != $userId;
if (api_is_allowed_to_edit(null, true)) {
$userCanEdit = true;
}
if ($increment > 0 && $locked == false && $userCanEdit) {
$iconEdit .= "<a href=\"forumqualify.php?" . api_get_cidreq() . "&forum=" . $my_forum_id . "&thread=" . $clean_thread_id . "&action=list&post=" . $row['post_id'] . "&user=" . $row['poster_id'] . "&user_id=" . $row['poster_id'] . "&origin=" . $origin . "&idtextqualify=" . $current_qualify_thread . "\" >" . Display::return_icon('quiz.gif', get_lang('Qualify')) . "</a> ";
}
}
if ($iconEdit != '') {
$html .= '<div class="tools-icons">' . $iconEdit . '</div>';
}
$html .= $closedPost;
$html .= '</div>';