本文整理汇总了PHP中get_forum_information函数的典型用法代码示例。如果您正苦于以下问题:PHP get_forum_information函数的具体用法?PHP get_forum_information怎么用?PHP get_forum_information使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_forum_information函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_user_id
// Are we in a lp ?
$origin = '';
$origin_string = '';
if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
$origin_string = '&origin=' . $origin;
}
/* Including necessary files */
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
$userid = api_get_user_id();
/* MAIN DISPLAY SECTION */
$groupId = api_get_group_id();
$my_forum = isset($_GET['forum']) ? $_GET['forum'] : '';
// Note: This has to be validated that it is an existing forum.
$current_forum = get_forum_information($my_forum);
if (empty($current_forum)) {
api_not_allowed();
}
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$is_group_tutor = false;
if (!empty($groupId)) {
//Group info & group category info
$group_properties = GroupManager::get_group_properties($groupId);
//User has access in the group?
$user_has_access_in_group = GroupManager::user_has_access($userid, $groupId, GroupManager::GROUP_TOOL_FORUM);
$is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $groupId);
//Course
if (!api_is_allowed_to_edit(false, true) and ($current_forum_category && $current_forum_category['visibility'] == 0 or $current_forum['visibility'] == 0 or !$user_has_access_in_group)) {
api_not_allowed();
}
示例2: api_get_path
$forumUrl = api_get_path(WEB_CODE_PATH) . 'forum/';
// Are we in a lp ?
$origin = '';
if (isset($_GET['origin'])) {
$origin = Security::remove_XSS($_GET['origin']);
}
$my_search = null;
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum category 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 category are stored in the item_property table.
// Note: This has to be validated that it is an existing thread
$current_thread = get_thread_information($_GET['thread']);
// Note: This has to be validated that it is an existing forum.
$current_forum = get_forum_information($current_thread['forum_id']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$whatsnew_post_info = isset($_SESSION['whatsnew_post_info']) ? $_SESSION['whatsnew_post_info'] : null;
/* Header and Breadcrumbs */
if (api_is_in_gradebook()) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/index.php?' . api_get_cidreq(), 'name' => get_lang('ToolGradebook'));
}
$groupId = api_get_group_id();
$sessionId = api_get_session_id();
if ($origin == 'group') {
$group_properties = GroupManager::get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'forum/viewforum.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq() . "&search=" . Security::remove_XSS(urlencode($my_search)), 'name' => Security::remove_XSS($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq() . '&thread=' . intval($_GET['thread']), 'name' => Security::remove_XSS($current_thread['thread_title']));
Display::display_header('');
示例3: get_lang
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'];
$group_properties = GroupManager::get_group_properties($_clean['toolgroup']);
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
示例4: fill_db_course
//.........这里部分代码省略.........
if ($path_documents . $value['file'] == '/certificates/default.html') {
$example_cert_id = $image_id;
}
Database::query("INSERT INTO {$TABLEITEMPROPERTY} (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)\n VALUES ({$course_id},'document',1,'{$now}','{$now}',{$image_id},'DocumentAdded',1,NULL,NULL,1)");
$docId = Database::insert_id();
if ($docId) {
$sql = "UPDATE {$TABLEITEMPROPERTY} SET id = iid WHERE iid = {$docId}";
Database::query($sql);
}
}
}
}
}
}
}
}
$agenda = new Agenda();
$agenda->setType('course');
$agenda->set_course($courseInfo);
$agenda->addEvent($now, $now, 0, get_lang('AgendaCreationTitle'), get_lang('AgendaCreationContenu'));
/* Links tool */
$link = new Link();
$link->setCourse($courseInfo);
$links = [['c_id' => $course_id, 'url' => 'http://www.google.com', 'title' => 'Google', 'description' => get_lang('Google'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0], ['c_id' => $course_id, 'url' => 'http://www.wikipedia.org', 'title' => 'Wikipedia', 'description' => get_lang('Wikipedia'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0]];
foreach ($links as $params) {
$link->save($params);
}
/* Announcement tool */
AnnouncementManager::add_announcement(get_lang('AnnouncementExampleTitle'), get_lang('AnnouncementEx'), ['everyone' => 'everyone'], null, null, $now);
$manager = Database::getManager();
/* Introduction text */
$intro_text = '<p style="text-align: center;">
<img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
<h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2>
</p>';
$toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
$toolIntro->setCId($course_id)->setId(TOOL_COURSE_HOMEPAGE)->setSessionId(0)->setIntroText($intro_text);
$manager->persist($toolIntro);
$toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
$toolIntro->setCId($course_id)->setId(TOOL_STUDENTPUBLICATION)->setSessionId(0)->setIntroText(get_lang('IntroductionTwo'));
$manager->persist($toolIntro);
$toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
$toolIntro->setCId($course_id)->setId(TOOL_WIKI)->setSessionId(0)->setIntroText(get_lang('IntroductionWiki'));
$manager->persist($toolIntro);
$manager->flush();
/* Exercise tool */
$exercise = new Exercise($course_id);
$exercise->exercise = get_lang('ExerciceEx');
$html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="110" valign="top" align="left">
<img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_dokeos/thinking.jpg">
</td>
<td valign="top" align="left">' . get_lang('Antique') . '</td></tr>
</table>';
$exercise->type = 1;
$exercise->setRandom(0);
$exercise->active = 1;
$exercise->results_disabled = 0;
$exercise->description = $html;
$exercise->save();
$exercise_id = $exercise->id;
$question = new MultipleAnswer();
$question->question = get_lang('SocraticIrony');
$question->description = get_lang('ManyAnswers');
$question->weighting = 10;
$question->position = 1;
$question->course = $courseInfo;
$question->save($exercise_id);
$questionId = $question->id;
$answer = new Answer($questionId, $courseInfo['real_id']);
$answer->createAnswer(get_lang('Ridiculise'), 0, get_lang('NoPsychology'), -5, 1);
$answer->createAnswer(get_lang('AdmitError'), 0, get_lang('NoSeduction'), -5, 2);
$answer->createAnswer(get_lang('Force'), 1, get_lang('Indeed'), 5, 3);
$answer->createAnswer(get_lang('Contradiction'), 1, get_lang('NotFalse'), 5, 4);
$answer->save();
/* Forum tool */
require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
$params = ['forum_category_title' => get_lang('ExampleForumCategory'), 'forum_category_comment' => ''];
$forumCategoryId = store_forumcategory($params, $courseInfo, false);
$params = ['forum_category' => $forumCategoryId, 'forum_title' => get_lang('ExampleForum'), 'forum_comment' => '', 'default_view_type_group' => ['default_view_type' => 'flat']];
$forumId = store_forum($params, $courseInfo, true);
$forumInfo = get_forum_information($forumId, $courseInfo['real_id']);
$params = ['post_title' => get_lang('ExampleThread'), 'forum_id' => $forumId, 'post_text' => get_lang('ExampleThreadContent'), 'calification_notebook_title' => '', 'numeric_calification' => '', 'weight_calification' => '', 'forum_category' => $forumCategoryId, 'thread_peer_qualify' => 0];
store_thread($forumInfo, $params, $courseInfo, false);
/* Gradebook tool */
$course_code = $courseInfo['code'];
// father gradebook
Database::query("INSERT INTO {$TABLEGRADEBOOK} (name, description, user_id, course_code, parent_id, weight, visible, certif_min_score, session_id, document_id)\n VALUES ('{$course_code}','',1,'{$course_code}',0,100,0,75,NULL,{$example_cert_id})");
$gbid = Database::insert_id();
Database::query("INSERT INTO {$TABLEGRADEBOOK} (name, description, user_id, course_code, parent_id, weight, visible, certif_min_score, session_id, document_id)\n VALUES ('{$course_code}','',1,'{$course_code}',{$gbid},100,1,75,NULL,{$example_cert_id})");
$gbid = Database::insert_id();
Database::query("INSERT INTO {$TABLEGRADEBOOKLINK} (type, ref_id, user_id, course_code, category_id, created_at, weight, visible, locked)\n VALUES (1,{$exercise_id},1,'{$course_code}',{$gbid},'{$now}',100,1,0)");
}
//Installing plugins in course
$app_plugin = new AppPlugin();
$app_plugin->install_course_plugins($course_id);
$language_interface = $language_interface_original;
return true;
}
示例5: 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);
}
}
}
示例6: createForumTthread
/**
* Create a forum thread for this learning path item
* @param int $currentForumId The forum ID to add the new thread
* @return int The forum thread if was created. Otherwise return false
*/
public function createForumTthread($currentForumId)
{
require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
$forumInfo = get_forum_information($currentForumId);
$threadId = store_thread($forumInfo, ['forum_id' => intval($currentForumId), 'thread_id' => 0, 'gradebook' => 0, 'post_title' => $this->name, 'post_text' => $this->description, 'category_id' => 1, 'numeric_calification' => 0, 'calification_notebook_title' => 0, 'weight_calification' => 0.0, 'thread_peer_qualify' => 0, 'lp_item_id' => $this->db_id], [], false);
return $threadId;
}
示例7: api_get_path
/**
* Responses to AJAX calls for forum attachments
* @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)';
示例8: createForumThread
/**
* Create a forum thread for this learning path item
* @param int $currentForumId The forum ID to add the new thread
* @return int The forum thread if was created. Otherwise return false
*/
public function createForumThread($currentForumId)
{
require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
$em = Database::getManager();
$threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread');
$forumThread = $threadRepo->findOneBy(['threadTitle' => "{$this->title} - {$this->db_id}", 'forumId' => intval($currentForumId)]);
if (!$forumThread) {
$forumInfo = get_forum_information($currentForumId);
store_thread($forumInfo, ['forum_id' => intval($currentForumId), 'thread_id' => 0, 'gradebook' => 0, 'post_title' => "{$this->name} - {$this->db_id}", 'post_text' => $this->description, 'category_id' => 1, 'numeric_calification' => 0, 'calification_notebook_title' => 0, 'weight_calification' => 0.0, 'thread_peer_qualify' => 0, 'lp_item_id' => $this->db_id], [], false);
return;
}
$forumThread->setLpItemId($this->db_id);
$em->persist($forumThread);
$em->flush();
}