本文整理汇总了PHP中forum_print_latest_discussions函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_print_latest_discussions函数的具体用法?PHP forum_print_latest_discussions怎么用?PHP forum_print_latest_discussions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_print_latest_discussions函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set_instance
/**
* Add content to a block instance. This
* method should fail gracefully. Do not
* call something like error()
*
* @param object $block Passed by refernce: this is the block instance object
* Course Module Record is $block->cm
* Module Record is $block->module
* Module Instance Record is $block->moduleinstance
* Course Record is $block->course
*
* @return boolean If an error occures, just return false and
* optionally set error message to $block->content->text
* Otherwise keep $block->content->text empty on errors
**/
function set_instance(&$block)
{
global $CFG;
require_once $CFG->dirroot . '/mod/forum/lib.php';
ob_start();
forum_print_latest_discussions($block->course, $block->moduleinstance, 0);
$block->content->text = ob_get_contents();
ob_end_clean();
return true;
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:25,代码来源:forum.php
示例2: get_string
if (!empty($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
$subtext = '';
if (forum_is_subscribed($USER->id, $newsforum)) {
if (!forum_is_forcesubscribed($newsforum)) {
$subtext = get_string('unsubscribe', 'forum');
}
} else {
$subtext = get_string('subscribe', 'forum');
}
print_heading_block($newsforum->name);
echo '<div class="subscribelink"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div>';
} else {
print_heading_block($newsforum->name);
}
forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');
}
break;
case FRONTPAGECOURSELIST:
if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
print_heading_block(get_string('mycourses'));
print_my_moodle();
} else {
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGECOURSELIMIT) {
// admin should not see list of courses when there are too many of them
print_heading_block(get_string('availablecourses'));
print_courses(0);
}
}
break;
case FRONTPAGECATEGORYNAMES:
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:index.php
示例3: forum_print_latest_discussions
case 'blog':
if (!empty($forum->intro)) {
echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
}
echo '<br />';
if (!empty($showall)) {
forum_print_latest_discussions($course, $forum, 0, 'plain', '', -1, -1, -1, 0, $cm);
} else {
forum_print_latest_discussions($course, $forum, -1, 'plain', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
}
break;
default:
if (!empty($forum->intro)) {
echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
}
echo '<br />';
if (!empty($showall)) {
forum_print_latest_discussions($course, $forum, 0, 'header', '', -1, -1, -1, 0, $cm);
} else {
forum_print_latest_discussions($course, $forum, -1, 'header', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
}
break;
}
echo $OUTPUT->footer($course);
开发者ID:ncsu-delta,项目名称:moodle,代码行数:28,代码来源:view.php
示例4: print_container_start
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo '</td>';
}
echo '<td id="middle-column">';
print_container_start();
echo skip_main_destination();
if ($forum = forum_get_course_forum($course->id, 'social')) {
print_heading_block(get_string('socialheadline'));
$cm = get_coursemodule_from_instance('forum', $forum->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
echo '<div class="subscribelink">', forum_get_subscribe_link($forum, $context), '</div>';
forum_print_latest_discussions($course, $forum, 10, 'plain', '', false);
} else {
notify('Could not find or create a social forum here');
}
print_container_end();
echo '</td>';
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width:' . $preferred_width_right . 'px" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
echo '</tr>';
echo '</table>';
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:format.php
示例5: cms_render_news
function cms_render_news($course)
{
global $CFG;
if ($course->newsitems) {
// Print forums only when needed
require_once $CFG->dirroot . '/mod/forum/lib.php';
if (!($newsforum = forum_get_course_forum($course->id, 'news'))) {
error('Could not find or create a main news forum for the course');
}
if (isset($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum->id)) {
$subtext = get_string('unsubscribe', 'forum');
} else {
$subtext = get_string('subscribe', 'forum');
}
$headertext = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>' . '<td><div class="title">' . $newsforum->name . '</div></td>' . '<td><div class="link"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div></td>' . '</tr></table>';
} else {
$headertext = $newsforum->name;
}
ob_start();
print_heading_block($headertext);
forum_print_latest_discussions($course, $newsforum, $course->newsitems, 'plain', 'p.modified DESC');
$return = ob_get_contents();
ob_end_clean();
return $return;
}
return '';
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:29,代码来源:cmslib.php
示例6: page_frontpage_settings
/**
* Called from {@link page_print_position()} and it is
* supposed to print the front page settings in the
* center column for the site course and only for
* the default page (EG: the landing page).
*
* @return boolean
**/
function page_frontpage_settings()
{
global $CFG, $SESSION, $SITE, $PAGE, $COURSE;
// Cheap check first - course ID
if ($COURSE->id != SITEID) {
return false;
}
// More expensive check - make sure we are viewing default page
$default = page_get_default_page();
$current = $PAGE->get_formatpage();
if (empty($default->id) or empty($current->id) or $default->id != $current->id) {
return false;
}
$editing = $PAGE->user_is_editing();
/// START COPY/PASTE FROM INDEX.PHP
print_container_start();
/// Print Section
if ($SITE->numsections > 0) {
if (!($section = get_record('course_sections', 'course', $SITE->id, 'section', 1))) {
delete_records('course_sections', 'course', $SITE->id, 'section', 1);
// Just in case
$section->course = $SITE->id;
$section->section = 1;
$section->summary = '';
$section->sequence = '';
$section->visible = 1;
$section->id = insert_record('course_sections', $section);
}
if (!empty($section->sequence) or !empty($section->summary) or $editing) {
print_box_start('generalbox sitetopic');
/// If currently moving a file then show the current clipboard
if (ismoving($SITE->id)) {
$stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
echo '<p><font size="2">';
echo "{$stractivityclipboard} (<a href=\"course/mod.php?cancelcopy=true&sesskey={$USER->sesskey}\">" . get_string('cancel') . '</a>)';
echo '</font></p>';
}
$options = NULL;
$options->noclean = true;
echo format_text($section->summary, FORMAT_HTML, $options);
if ($editing) {
$streditsummary = get_string('editsummary');
echo "<a title=\"{$streditsummary}\" " . " href=\"course/editsection.php?id={$section->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" " . " class=\"iconsmall\" alt=\"{$streditsummary}\" /></a><br /><br />";
}
get_all_mods($SITE->id, $mods, $modnames, $modnamesplural, $modnamesused);
print_section($SITE, $section, $mods, $modnamesused, true);
if ($editing) {
print_section_add_menus($SITE, $section->section, $modnames);
}
print_box_end();
}
}
if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) {
$frontpagelayout = $CFG->frontpageloggedin;
} else {
$frontpagelayout = $CFG->frontpage;
}
foreach (explode(',', $frontpagelayout) as $v) {
switch ($v) {
/// Display the main part of the front page.
case FRONTPAGENEWS:
if ($SITE->newsitems) {
// Print forums only when needed
require_once $CFG->dirroot . '/mod/forum/lib.php';
if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) {
error('Could not find or create a main news forum for the site');
}
if (!empty($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum)) {
$subtext = get_string('unsubscribe', 'forum');
} else {
$subtext = get_string('subscribe', 'forum');
}
print_heading_block($newsforum->name);
echo '<div class="subscribelink"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div>';
} else {
print_heading_block($newsforum->name);
}
forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');
}
break;
case FRONTPAGECOURSELIST:
if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
print_heading_block(get_string('mycourses'));
print_my_moodle();
} else {
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGECOURSELIMIT) {
// admin should not see list of courses when there are too many of them
print_heading_block(get_string('availablecourses'));
print_courses(0);
}
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php
示例7: local_my_print_latestnews_headers
/**
* Prints the news forum as simple compact list of discussion headers.
*/
function local_my_print_latestnews_headers()
{
global $PAGE, $SITE, $CFG, $OUTPUT, $USER, $SESSION;
$str = '';
if ($SITE->newsitems) {
// Print forums only when needed.
require_once $CFG->dirroot . '/mod/forum/lib.php';
if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) {
print_error('cannotfindorcreateforum', 'forum');
}
$renderer = $PAGE->get_renderer('local_my');
$renderer->print_forum_link($newforum);
if (isloggedin()) {
if (!isset($SESSION)) {
$SESSION = new StdClass();
}
$SESSION->fromdiscussion = $CFG->wwwroot;
$subtext = '';
if (forum_is_subscribed($USER->id, $newsforum)) {
if (!forum_is_forcesubscribed($newsforum)) {
$subtext = get_string('unsubscribe', 'forum');
}
} else {
$subtext = get_string('subscribe', 'forum');
}
$str .= '<div class="block block_my_newsheads">';
$str .= '<div class="header">';
$str .= '<div class="title">';
$str .= '<h2>' . $forumname . '</h2>';
$str .= '</div>';
$str .= '</div>';
$str .= '<div class="content">';
$suburl = new moodle_url('/mod/forum/subscribe.php', array('id' => $newsforum->id, 'sesskey' => sesskey()));
$str .= html_writer::tag('div', html_writer::link($suburl, $subtext), array('class' => 'subscribelink'));
$str .= '</div>';
} else {
$str .= '<div class="block block_my_newsheads">';
$str .= '<div class="header">';
$str .= '<div class="title">';
$str .= $OUTPUT->heading($forumname, 2, 'headingblock header');
$str .= '</div>';
$str .= '</div>';
}
ob_start();
forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'header', 'p.modified DESC');
$str .= ob_get_clean();
$str .= '</div>';
$str .= html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipsitenews'));
}
return $str;
}
开发者ID:vfremaux,项目名称:moodle-local_my,代码行数:54,代码来源:modules.php
示例8: print_section_fn
//.........这里部分代码省略.........
}
if ($mod->indent) {
print_spacer(12, 20 * $mod->indent, false);
}
// /// If the questionnaire is mandatory
// if (($mod->modname == 'questionnaire') && empty($mandatorypopup)) {
// $mandatorypopup = is_mod_mandatory($mod, $USER->id);
// }
if ($mod->modname == "label") {
if (empty($this->course->usemandatory) || empty($mod->mandatory)) {
if (!$mod->visible) {
echo "<span class=\"dimmed_text\">";
}
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
if (!$mod->visible) {
echo "</span>";
}
} else {
if ($isediting) {
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
$alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
echo "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font>";
}
}
} else {
if (!$isediting && $mod->modname == 'forum' && isset($this->course->expforumsec) && $this->course->expforumsec == $section->section) {
$page = optional_param('page', 0, PARAM_INT);
$changegroup = isset($_GET['group']) ? $_GET['group'] : -1;
// Group change requested?
$forum = get_record("forum", "id", $mod->instance);
$groupmode = groupmode($this->course, $mod);
// Groups are being used
$currentgroup = get_and_set_current_group($this->course, $groupmode, $changegroup);
forum_print_latest_discussions($this->course, $forum, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
} else {
// Normal activity
if (!$isteacher && !empty($this->course->activitytracking)) {
$act_compl = is_activity_complete($mod, $USER->id);
if ($act_compl === false) {
echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/incomplete.gif" ' . 'height="16" width="16" alt="Activity Not Completed" hspace="10" ' . 'title="Activity Not Completed">';
} else {
if ($act_compl === true || is_int($act_compl) && $act_compl >= 50) {
echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/completed.gif" ' . 'height="16" width="16" alt="Activity Completed" hspace="10" ' . 'title="Activity Completed">';
} else {
if (is_int($act_compl)) {
echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/completedpoor.gif" ' . 'height="16" width="16" alt="Activity Completed Poorly" hspace="10" ' . 'title="Activity Completed Poorly">';
} else {
if ($act_compl == 'submitted') {
echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/submitted.gif" ' . 'height="16" width="16" alt="Activity Submitted" hspace="10" ' . 'title="Activity Submitted">';
}
}
}
}
}
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
$alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
echo "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font>";
}
}
if ($usetracking && $mod->modname == 'forum') {
if ($unread = forum_tp_count_forum_unread_posts($mod, $this->course)) {
echo '<span class="unread"> <a href="' . $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id . '">';
if ($unread == 1) {
echo $strunreadpostsone;
} else {
print_string('unreadpostsnumber', 'forum', $unread);
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:67,代码来源:course_format_fn.class.php
注:本文中的forum_print_latest_discussions函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论