当前位置: 首页>>代码示例>>PHP>>正文


PHP rss_get_link函数代码示例

本文整理汇总了PHP中rss_get_link函数的典型用法代码示例。如果您正苦于以下问题:PHP rss_get_link函数的具体用法?PHP rss_get_link怎么用?PHP rss_get_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rss_get_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: COUNT

    $count = $DB->count_records_sql("SELECT COUNT(*) FROM {glossary_entries} WHERE (glossaryid = ? OR sourceglossaryid = ?)", array($glossary->id, $glossary->id));

    //If this glossary has RSS activated, calculate it
    if ($show_rss) {
        $rsslink = '';
        if ($glossary->rsstype and $glossary->rssarticles) {
            //Calculate the tolltip text
            $tooltiptext = get_string("rsssubscriberss","glossary",format_string($glossary->name));
            if (!isloggedin()) {
                $userid = 0;
            } else {
                $userid = $USER->id;
            }
            //Get html code for RSS link
            $rsslink = rss_get_link($context->id, $userid, 'mod_glossary', $glossary->id, $tooltiptext);
        }
    }

    if ($usesections) {
        $linedata = array ($printsection, $link, $count);
    } else {
        $linedata = array ($link, $count);
    }

    if ($show_rss) {
        $linedata[] = $rsslink;
    }

    $table->data[] = $linedata;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:30,代码来源:index.php

示例2: COUNT

        $link = "<a href=\"view.php?id=$data->coursemodule\">".format_string($data->name,true)."</a>";
    }

    // TODO: add group restricted counts here, and limit unapproved to ppl with approve cap only + link to approval page

    $numrecords = $DB->count_records_sql('SELECT COUNT(r.id) FROM {data_records} r WHERE r.dataid =?', array($data->id));

    if ($data->approval == 1) {
        $numunapprovedrecords = $DB->count_records_sql('SELECT COUNT(r.id) FROM {data_records} r WHERE r.dataid =? AND r.approved <> 1', array($data->id));
    } else {
        $numunapprovedrecords = '-';
    }

    $rsslink = '';
    if ($rss && $data->rssarticles > 0) {
        $rsslink = rss_get_link($context->id, $USER->id, 'mod_data', $data->id, 'RSS');
    }

    if ($usesections) {
        if ($data->section !== $currentsection) {
            if ($data->section) {
                $printsection = get_section_name($course, $data->section);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $data->section;
        }
        $row = array ($printsection, $link, format_text($data->intro, $data->introformat, $options), $numrecords, $numunapprovedrecords);

    } else {
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:index.php

示例3: rss_print_link

/**
 * Print the link for the RSS feed with the correct RSS icon (Theme based)
 *
 * @param stdClass    $contextid     The id of the context under which the URL should be created
 * @param int         $userid        The source of the RSS feed (site/course/group/user)
 * @param string      $componentname The name of the component for which the feed exists
 * @param string      $id            The name by which to call the RSS File
 * @param string      $tooltiptext   The tooltip to be displayed with the link
 */
function rss_print_link($contextid, $userid, $componentname, $id, $tooltiptext = '')
{
    print rss_get_link($contextid, $userid, $componentname, $id, $tooltiptext);
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:13,代码来源:rsslib.php

示例4: forum_get_subscribe_link

                    $row[] = forum_get_subscribe_link($forum, $context, array('subscribed' => $stryes, 'unsubscribed' => $strno, 'forcesubscribed' => $stryes, 'cantsubscribe' => '-'), false, false, true, $subscribed_forums);
                } else {
                    $row[] = '-';
                }
            }
            //If this forum has RSS activated, calculate it
            if ($show_rss) {
                if ($forum->rsstype and $forum->rssarticles) {
                    //Calculate the tolltip text
                    if ($forum->rsstype == 1) {
                        $tooltiptext = get_string('rsssubscriberssdiscussions', 'forum', format_string($forum->name));
                    } else {
                        $tooltiptext = get_string('rsssubscriberssposts', 'forum', format_string($forum->name));
                    }
                    //Get html code for RSS link
                    $row[] = rss_get_link($course->id, $USER->id, 'forum', $forum->id, $tooltiptext);
                } else {
                    $row[] = '&nbsp;';
                }
            }
            $learningtable->data[] = $row;
        }
    }
}
/// Output the page
$navlinks = array();
$navlinks[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');
print_header("{$course->shortname}: {$strforums}", $course->fullname, build_navigation($navlinks), "", "", true, $searchform, navmenu($course));
if (!isguest()) {
    print_box_start('subscription');
    echo '<span class="helplink">';
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:index.php

示例5: rss_print_link

function rss_print_link($courseid, $userid, $modulename, $id, $tooltiptext = '')
{
    print rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext);
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:4,代码来源:rsslib.php

示例6: get_rss_link

 /**
  * Returns a specific rss link.
  *
  * @return string HTML fragment
  */
 public function get_rss_link()
 {
     global $CFG, $USER;
     // Link to the RSS feed.
     if (!empty($CFG->enablerssfeeds) && !empty($CFG->dataform_enablerssfeeds)) {
         $dataformid = $this->df->id;
         $viewid = $this->id;
         $componentinstance = "{$dataformid}/{$viewid}";
         return rss_get_link($this->df->context->id, $USER->id, 'mod_dataform', $componentinstance);
     }
     return null;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:17,代码来源:rss.php

示例7: get_content

 function get_content()
 {
     global $CFG, $USER, $COURSE;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     if ($COURSE->newsitems) {
         // Create a nice listing of recent postings
         require_once $CFG->dirroot . '/mod/forum/lib.php';
         // We'll need this
         if (!($forum = forum_get_course_forum($COURSE->id, 'news'))) {
             return '';
         }
         $modinfo = get_fast_modinfo($COURSE);
         if (empty($modinfo->instances['forum'][$forum->id])) {
             return '';
         }
         $cm = $modinfo->instances['forum'][$forum->id];
         $context = get_context_instance(CONTEXT_MODULE, $cm->id);
         /// First work out whether we can post to this group and if so, include a link
         $groupmode = groups_get_activity_groupmode($cm);
         $currentgroup = groups_get_activity_group($cm, true);
         /// Get all the recent discussions we're allowed to see
         if (!($discussions = forum_get_discussions($cm, 'p.modified DESC', false, $currentgroup, $COURSE->newsitems))) {
             $this->content->text = '(' . get_string('nonews', 'forum') . ')';
             // add a link to add "a new news item" (nadavkav)
             if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
                 $this->content->footer = '<div class="newlink"><a href="' . $CFG->wwwroot . '/mod/forum/post.php?forum=' . $forum->id . '">' . get_string('addanewitem', 'block_news_items_scrolling') . '</a>...</div>';
             }
             return $this->content;
         }
         // add scrolling effect <marquee> (nadavkav)
         $text = '<marquee width="100%" height="120" align="right" direction="up" scrolldelay="50" scrollamount="1" onmouseout="this.start();" style="padding-top: 2px;" onmouseover="this.stop();" dir="rtl">';
         /// Actually create the listing now
         $strftimerecent = get_string('strftimerecent');
         $strmore = get_string('more', 'block_news_items_scrolling');
         /// Accessibility: markup as a list.
         $text .= "\n<ul class='unlist'>\n";
         foreach ($discussions as $discussion) {
             $discussion->subject = $discussion->name;
             $discussion->subject = format_string($discussion->subject, true, $forum->course);
             //if (! $post = forum_get_post_full($discussion->discussion)) {
             //error("Could not find the first post in this forum");
             //}
             $post = get_record("forum_posts", "discussion", $discussion->discussion);
             $text .= '<li class="post">' . '<div class="head">' . '<div class="info">' . format_text($post->message) . ' ' . '<a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->discussion . '">' . $strmore . '...</a></div>' . "</li>\n";
         }
         $text .= "</ul>\n";
         $text .= '</marquee>';
         $this->content->text = $text;
         $this->content->footer = '<a href="' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id . '">' . get_string('olditems', 'block_news_items_scrolling') . '</a> ...';
         if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
             $this->content->footer = '<div class="newlink"><a href="' . $CFG->wwwroot . '/mod/forum/post.php?forum=' . $forum->id . '">' . get_string('addanewitem', 'block_news_items_scrolling') . '</a>...</div>';
         }
         /// If RSS is activated at site and forum level and this forum has rss defined, show link
         if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) && $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype && $forum->rssarticles) {
             require_once $CFG->dirroot . '/lib/rsslib.php';
             // We'll need this
             if ($forum->rsstype == 1) {
                 $tooltiptext = get_string('rsssubscriberssdiscussions', 'forum', format_string($forum->name));
             } else {
                 $tooltiptext = get_string('rsssubscriberssposts', 'forum', format_string($forum->name));
             }
             if (empty($USER->id)) {
                 $userid = 0;
             } else {
                 $userid = $USER->id;
             }
             $this->content->footer .= '<br />' . rss_get_link($COURSE->id, $userid, 'forum', $forum->id, $tooltiptext);
         }
     }
     return $this->content;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:79,代码来源:block_news_items_scrolling.php

示例8: lightboxgallery_rss_enabled

$meta = '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/mod/lightboxgallery/css/lightbox.css" />';
$allowrssfeed = lightboxgallery_rss_enabled() && $gallery->rss;
if ($allowrssfeed) {
    $rsspath = rss_get_url($course->id, $userid, 'lightboxgallery', $gallery->id);
    $meta .= "\n" . '<link rel="alternate" href="' . $rsspath . '" type="application/rss+xml" title="' . format_string($gallery->name) . '" id="gallery" />';
}
$meta .= "\n" . '<style type="text/css">';
$meta .= "\n" . '#navbar_bg {display:none;}';
$meta .= "\n" . '#header_bg {display:none;}';
$meta .= "\n" . '#banner_bg {display:none;}';
$meta .= "\n" . '</style>';
print_header();
//$course->shortname . ': ' . $gallery->name, $course->fullname, $navigation, '', $meta, true, $update, navmenu($course, $cm));
$heading = get_string('displayinggallery', 'lightboxgallery', $gallery->name);
if ($allowrssfeed) {
    $heading .= ' ' . rss_get_link($course->id, $userid, 'lightboxgallery', $gallery->id, get_string('rsssubscribe', 'lightboxgallery'));
}
print_heading($heading);
lightboxgallery_print_js_config($gallery->autoresize);
$fobj = new object();
$fobj->para = false;
if ($gallery->description && !$editing) {
    print_simple_box(format_text($gallery->description, FORMAT_MOODLE, $fobj), 'center');
}
print_simple_box_start('center');
$dataroot = $CFG->dataroot . '/' . $course->id . '/' . $gallery->folder;
$webroot = lightboxgallery_get_image_url($gallery->id);
$allimages = lightboxgallery_directory_images($dataroot);
$images = $gallery->perpage == 0 ? $allimages : array_slice($allimages, $page * $gallery->perpage, $gallery->perpage);
$captions = array();
if ($cobjs = get_records_select('lightboxgallery_image_meta', "metatype = 'caption' AND gallery = {$gallery->id}")) {
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view-embed.php

示例9: array

    $url_params = array('id' => $id, 'page' => $page, 'editing' => $editing ? '0' : '1');
    $url = new moodle_url('/mod/lightboxgallery/view.php', $url_params);
    $strediting = get_string('turnediting' . ($editing ? 'off' : 'on'));
    $button = $OUTPUT->single_button($url, $strediting, 'get') . ' ';
}
$button .= update_module_button($cm->id, $course->id, get_string('modulename', 'lightboxgallery'));
$PAGE->set_button($button);
$PAGE->requires->css('/mod/lightboxgallery/assets/skins/sam/gallery-lightbox-skin.css');
$PAGE->requires->js('/mod/lightboxgallery/gallery-lightbox-min.js');
$PAGE->requires->js('/mod/lightboxgallery/module.js');
$allowrssfeed = lightboxgallery_rss_enabled() && $gallery->rss;
$heading = get_string('displayinggallery', 'lightboxgallery', $gallery->name);
if ($allowrssfeed) {
    rss_add_http_header($context, 'mod_lightboxgallery', $gallery->id, $gallery->name);
    $strrsssub = get_string('rsssubscribe', 'lightboxgallery');
    $heading .= ' ' . rss_get_link($context->id, $userid, 'mod_lightboxgallery', $gallery->id, $strrsssub);
}
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
if ($gallery->intro && !$editing) {
    echo $OUTPUT->box(format_module_intro('lightboxgallery', $gallery, $cm->id), 'generalbox', 'intro');
}
echo $OUTPUT->box_start('generalbox lightbox-gallery clearfix');
$fs = get_file_storage();
$stored_files = $fs->get_area_files($context->id, 'mod_lightboxgallery', 'gallery_images');
$image_count = 1;
foreach ($stored_files as $stored_file) {
    if (!$stored_file->is_valid_image()) {
        continue;
    }
    if ($gallery->perpage > 0 && ($image_count > $gallery->perpage * $page + $gallery->perpage || $image_count < $gallery->perpage * $page + 1)) {
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:view.php

示例10: html_table

$table = new html_table();
$table->head = array(get_string($course->format == 'weeks' ? 'week' : 'topic'), '&nbsp;', get_string('modulenameshort', 'lightboxgallery'), get_string('description'), 'RSS');
$table->align = array('center', 'center', 'left', 'left', 'center');
$table->width = '*';
$fobj = new object();
$fobj->para = false;
$prevsection = '';
// TODO: Put this in a renderer.
foreach ($galleries as $gallery) {
    $cm = context_module::instance($gallery->coursemodule);
    $printsection = $gallery->section !== $prevsection ? true : false;
    if ($printsection) {
        $table->data[] = 'hr';
    }
    if (lightboxgallery_rss_enabled() && $gallery->rss) {
        $rss = rss_get_link($course->id, $USER->id, 'lightboxgallery', $gallery->id, get_string('rsssubscribe', 'lightboxgallery'));
    }
    $fs = get_file_storage();
    $files = $fs->get_area_files($cm->id, 'mod_lightboxgallery', 'gallery_images');
    foreach ($files as $file) {
        if ($file->get_filename() != '.') {
            $imagecount++;
        }
    }
    $commentcount = $DB->count_records('lightboxgallery_comments', array('gallery' => $gallery->id));
    $viewurl = new moodle_url('/mod/lightboxgallery/view.php', array('id' => $gallery->coursemodule));
    $table->data[] = array($printsection ? $gallery->section : '', lightboxgallery_index_thumbnail($course->id, $gallery), html_writer::link($viewurl, $gallery->name) . '<br />' . get_string('imagecounta', 'lightboxgallery', $imagecount) . get_string('commentcount', 'lightboxgallery', $commentcount), format_text($gallery->description, FORMAT_MOODLE, $fobj), isset($rss) ? $rss : get_string('norssfeedavailable', 'lightboxgallery'));
    $prevsection = $gallery->section;
}
echo $OUTPUT->heading(get_string('modulenameplural', 'lightboxgallery'), 2);
echo html_writer::table($table);
开发者ID:ndunand,项目名称:moodle-mod_lightboxgallery,代码行数:31,代码来源:index.php

示例11: get_string

$strhead = get_string($course->format == 'weeks' ? 'week' : 'topic');
$table = new object();
$table->head = array($strhead, '&nbsp;', get_string('modulenameshort', 'lightboxgallery'), get_string('description'), 'RSS');
$table->align = array('center', 'center', 'left', 'left', 'center');
$table->width = '*';
$fobj = new object();
$fobj->para = false;
$currentsection = '';
foreach ($galleries as $gallery) {
    $printsection = '&nbsp;';
    $rss = '&nbsp;';
    $rsssubscribe = get_string('rsssubscribe', 'lightboxgallery');
    if ($currentsection !== $gallery->section) {
        $printsection = $gallery->section;
        if ($currentsection !== '') {
            $table->data[] = 'hr';
        }
        $currentsection = $gallery->section;
    }
    if (lightboxgallery_rss_enabled() && $gallery->rss) {
        $rss = rss_get_link($course->id, $USER->id, 'lightboxgallery', $gallery->id, $rsssubscribe);
    }
    $imagecount = count(lightboxgallery_directory_images($CFG->dataroot . '/' . $course->id . '/' . $gallery->folder));
    $extra = get_string('imagecounta', 'lightboxgallery', $imagecount);
    if ($commentcount = count_records('lightboxgallery_comments', 'gallery', $gallery->id)) {
        $extra .= ', ' . get_string('commentcount', 'lightboxgallery', $commentcount);
    }
    $table->data[] = array($printsection, lightboxgallery_index_thumbnail($course->id, $gallery), '<a href="' . $CFG->wwwroot . '/mod/lightboxgallery/view.php?l=' . $gallery->id . '">' . $gallery->name . '</a><br />' . $extra, format_text($gallery->description, FORMAT_MOODLE, $fobj), $rss);
}
print_table($table);
print_footer($course);
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:31,代码来源:index.php

示例12: get_content


//.........这里部分代码省略.........

            if (!$cm->uservisible) {
                return '';
            }

            $context = context_module::instance($cm->id);

        /// User must have perms to view discussions in that forum
            if (!has_capability('mod/forum:viewdiscussion', $context)) {
                return '';
            }

        /// First work out whether we can post to this group and if so, include a link
            $groupmode    = groups_get_activity_groupmode($cm);
            $currentgroup = groups_get_activity_group($cm, true);


            if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
                $text .= '<div class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
                          get_string('addanewtopic', 'forum').'</a></div>';
            }

        /// Get all the recent discussions we're allowed to see

            if (! $discussions = forum_get_discussions($cm, 'p.modified DESC', false,
                                                       $currentgroup, $this->page->course->newsitems) ) {
                $text .= '('.get_string('nonews', 'forum').')';
                $this->content->text = $text;
                return $this->content;
            }

        /// Actually create the listing now

            $strftimerecent = get_string('strftimerecent');
            $strmore = get_string('more', 'forum');

        /// Accessibility: markup as a list.
            $text .= "\n<ul class='unlist'>\n";
          
            foreach ($discussions as $discussion) {
                $discussion->subject = $discussion->name;

                $discussion->subject = format_string($discussion->subject, true, $forum->course);
                /******************code by sreekanth*****************/
                $subject1 = html_writer::tag('b',get_string('subject', 'block_site_blog'),array());
                $message = $DB->get_record_sql("SELECT * FROM {forum_posts} WHERE id = $discussion->id");
               
               
                //print_object($message);
                $text .= '<li class="post">'.
                         '<div class="head clearfix">'.
                         '<div class="date">'.userdate($discussion->modified, $strftimerecent).'</div>'.
                         '<div class="name">'.fullname($discussion).'</div></div>'.
                         '<div class="info">'.$subject1. ':  <a href="'.$CFG->wwwroot.'/mod/forum/discuss.php?d='.$discussion->discussion.'">'.$discussion->subject.'</a></div>'.
                         "</li>\n";
                 $string1= $message->message;
                 
                 //$text .= $message->message;
                 $string = strip_tags($string1);
                if (strlen($string) > 480) {
                    // truncate string
                    $stringCut = substr($string, 0, 480);
                    //print_object($stringCut);
                    // make sure it ends in a word so assassinate doesn't become ass...
                    $view = html_writer::tag('a',get_string('view', 'block_my_blog'),array('href'=>$CFG->wwwroot.'/mod/forum/discuss.php?d='.$discussion->discussion));
                    $text .= "<div class='bulletin_message'>".substr($stringCut, 0, strrpos($stringCut, ' '))."...".$view."</div>";
                } else{
                    $text .= "<div class='bulletin_message'>". $message->message ."</div>";
                }
                         
            }
            $text .= "</ul>\n";

            $this->content->text = "<div>".$text."</div>";

            $this->content->footer = '<a href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id.'">'.
                                      get_string('oldertopics', 'forum').'</a> ...';

        /// If RSS is activated at site and forum level and this forum has rss defined, show link
            if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
                $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype && $forum->rssarticles) {
                require_once($CFG->dirroot.'/lib/rsslib.php');   // We'll need this
                if ($forum->rsstype == 1) {
                    $tooltiptext = get_string('rsssubscriberssdiscussions','forum');
                } else {
                    $tooltiptext = get_string('rsssubscriberssposts','forum');
                }
                if (!isloggedin()) {
                    $userid = $CFG->siteguest;
                } else {
                    $userid = $USER->id;
                }

                $this->content->footer .= '<br />'.rss_get_link($context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);
            }

        }

        return $this->content;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:block_news_items.php

示例13: get_string

                } else {
                    $digestoptions_selector->selected = $quora->maildigest;
                }
                $row[] = $OUTPUT->render($digestoptions_selector);
            }
            //If this quora has RSS activated, calculate it
            if ($show_rss) {
                if ($quora->rsstype and $quora->rssarticles) {
                    //Calculate the tolltip text
                    if ($quora->rsstype == 1) {
                        $tooltiptext = get_string('rsssubscriberssdiscussions', 'quora');
                    } else {
                        $tooltiptext = get_string('rsssubscriberssposts', 'quora');
                    }
                    //Get html code for RSS link
                    $row[] = rss_get_link($context->id, $USER->id, 'mod_quora', $quora->id, $tooltiptext);
                } else {
                    $row[] = '&nbsp;';
                }
            }
            $learningtable->data[] = $row;
        }
    }
}
/// Output the page
$PAGE->navbar->add($strquoras);
$PAGE->set_title("{$course->shortname}: {$strquoras}");
$PAGE->set_heading($course->fullname);
$PAGE->set_button($searchform);
echo $OUTPUT->header();
// Show the subscribe all options only to non-guest, enrolled users
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:31,代码来源:index.php

示例14: get_content

 function get_content()
 {
     global $CFG, $USER;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     if ($this->page->course->newsitems) {
         // Create a nice listing of recent postings
         require_once $CFG->dirroot . '/mod/forum/lib.php';
         // We'll need this
         $text = '';
         if (!($forum = forum_get_course_forum($this->page->course->id, 'news'))) {
             return '';
         }
         $modinfo = get_fast_modinfo($this->page->course);
         if (empty($modinfo->instances['forum'][$forum->id])) {
             return '';
         }
         $cm = $modinfo->instances['forum'][$forum->id];
         if (!$cm->uservisible) {
             return '';
         }
         $context = context_module::instance($cm->id);
         /// User must have perms to view discussions in that forum
         if (!has_capability('mod/forum:viewdiscussion', $context)) {
             return '';
         }
         /// First work out whether we can post to this group and if so, include a link
         $groupmode = groups_get_activity_groupmode($cm);
         $currentgroup = groups_get_activity_group($cm, true);
         if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
             $text .= '<div class="newlink"><a href="' . $CFG->wwwroot . '/mod/forum/post.php?forum=' . $forum->id . '">' . get_string('addanewtopic', 'forum') . '</a>...</div>';
         }
         /// Get all the recent discussions we're allowed to see
         if (!($discussions = forum_get_discussions($cm, 'p.modified DESC', false, $currentgroup, $this->page->course->newsitems))) {
             $text .= '(' . get_string('nonews', 'forum') . ')';
             $this->content->text = $text;
             return $this->content;
         }
         /// Actually create the listing now
         $strftimerecent = get_string('strftimerecent');
         $strmore = get_string('more', 'forum');
         /// Accessibility: markup as a list.
         $text .= "\n<ul class='unlist'>\n";
         foreach ($discussions as $discussion) {
             $discussion->subject = $discussion->name;
             $discussion->subject = format_string($discussion->subject, true, $forum->course);
             $text .= '<li class="post">' . '<div class="head clearfix">' . '<div class="date">' . userdate($discussion->modified, $strftimerecent) . '</div>' . '<div class="name">' . fullname($discussion) . '</div></div>' . '<div class="info"><a href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->discussion . '">' . $discussion->subject . '</a></div>' . "</li>\n";
         }
         $text .= "</ul>\n";
         $this->content->text = $text;
         $this->content->footer = '<a href="' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id . '">' . get_string('oldertopics', 'forum') . '</a> ...';
         /// If RSS is activated at site and forum level and this forum has rss defined, show link
         if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) && $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype && $forum->rssarticles) {
             require_once $CFG->dirroot . '/lib/rsslib.php';
             // We'll need this
             if ($forum->rsstype == 1) {
                 $tooltiptext = get_string('rsssubscriberssdiscussions', 'forum');
             } else {
                 $tooltiptext = get_string('rsssubscriberssposts', 'forum');
             }
             if (!isloggedin()) {
                 $userid = $CFG->siteguest;
             } else {
                 $userid = $USER->id;
             }
             $this->content->footer .= '<br />' . rss_get_link($context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);
         }
     }
     return $this->content;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:77,代码来源:block_news_items.php

示例15: get_string

            }
            //If this forum has RSS activated, calculate it
            if ($show_rss and $forum->rsstype and $forum->rssarticles) {
                //Calculate the tolltip text
                if ($forum->rsstype == 1) {
                    $tooltiptext = get_string("rsssubscriberssdiscussions", "forum", format_string($forum->name));
                } else {
                    $tooltiptext = get_string("rsssubscriberssposts", "forum", format_string($forum->name));
                }
                if (empty($USER->id)) {
                    $userid = 0;
                } else {
                    $userid = $USER->id;
                }
                //Get html code for RSS link
                $row[] = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
            }
            $learningtable->data[] = $row;
        }
    }
}
/// Output the page
$navlinks = array();
$navlinks[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');
print_header("{$course->shortname}: {$strforums}", $course->fullname, build_navigation($navlinks), "", "", true, $searchform, navmenu($course));
if (!isguest()) {
    print_box_start('subscription');
    echo '<span class="helplink">';
    echo '<a href="index.php?id=' . $course->id . '&amp;subscribe=1">' . get_string('allsubscribe', 'forum') . '</a>';
    echo '</span><br /><span class="helplink">';
    echo '<a href="index.php?id=' . $course->id . '&amp;subscribe=0">' . get_string('allunsubscribe', 'forum') . '</a>';
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:index.php


注:本文中的rss_get_link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。