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


PHP rss_get_url函数代码示例

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


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

示例1: rss_get_link

/**
 * Print the link for the RSS feed with the correct RSS icon
 *
 * @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
 * @return string HTML output for the RSS link
 */
function rss_get_link($contextid, $userid, $componentname, $id, $tooltiptext = '')
{
    global $OUTPUT;
    static $rsspath = '';
    $rsspath = rss_get_url($contextid, $userid, $componentname, $id);
    $rsspix = $OUTPUT->pix_url('i/rss');
    return '<a href="' . $rsspath . '"><img src="' . $rsspix . '" title="' . strip_tags($tooltiptext) . '" alt="' . get_string('rss') . '" /></a>';
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:18,代码来源:rsslib.php

示例2: rss_get_link

/**
 * This function returns the icon (from theme) with the link to rss/file.php
 *
 * @global object
 * @global object
 */
function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext = '')
{
    global $OUTPUT;
    static $rsspath = '';
    //In site course, if no logged (userid), use admin->id. Bug 2048.
    if ($courseid == SITEID and empty($userid)) {
        $admin = get_admin();
        $userid = $admin->id;
    }
    $rsspath = rss_get_url($courseid, $userid, $modulename, $id);
    $rsspix = $OUTPUT->old_icon_url('i/rss');
    return '<a href="' . $rsspath . '"><img src="' . $rsspix . '" title="' . strip_tags($tooltiptext) . '" alt="' . get_string('rss') . '" /></a>';
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:19,代码来源:rsslib.php

示例3: blog_rss_get_url

/**
 * Build the URL for the RSS feed
 *
 * @param int    $contextid    The context under which the URL should be created
 * @param int    $userid       The id of the user requesting the RSS Feed
 * @param string $filtertype   The source of the RSS feed (site/course/group/user)
 * @param int    $filterselect The id of the item defined by $filtertype
 * @param int    $tagid        The id of the row in the tag table that identifies the RSS Feed
 * @return string
 */
function blog_rss_get_url($contextid, $userid, $filtertype, $filterselect = 0, $tagid = 0)
{
    $componentname = 'blog';
    $additionalargs = null;
    switch ($filtertype) {
        case 'site':
            $additionalargs = 'site/' . SITEID;
            break;
        case 'course':
            $additionalargs = 'course/' . $filterselect;
            break;
        case 'group':
            $additionalargs = 'group/' . $filterselect;
            break;
        case 'user':
            $additionalargs = 'user/' . $filterselect;
            break;
    }
    if ($tagid) {
        $additionalargs .= '/' . $tagid;
    }
    return rss_get_url($contextid, $userid, $componentname, $additionalargs);
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:33,代码来源:rsslib.php

示例4: redirect

        redirect($CFG->wwwroot . '/mod/data/field.php?d=' . $data->id);
        // Redirect to field entry
    }
}
if ($rid) {
    // So do you have access?
    if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey()) {
        print_error('noaccess', 'data');
    }
}
if ($cancel) {
    redirect('view.php?d=' . $data->id);
}
/// RSS and CSS and JS meta
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
    $rsspath = rss_get_url($context->id, $USER->id, 'mod_data', $data->id);
    $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
    $PAGE->add_alternate_version($courseshortname . ': %fullname%', $rsspath, 'application/rss+xml');
}
if ($data->csstemplate) {
    $PAGE->requires->css('/mod/data/css.php?d=' . $data->id);
}
if ($data->jstemplate) {
    $PAGE->requires->js('/mod/data/js.php?d=' . $data->id, true);
}
$possiblefields = $DB->get_records('data_fields', array('dataid' => $data->id), 'id');
foreach ($possiblefields as $field) {
    if ($field->type == 'file' || $field->type == 'picture') {
        require_once $CFG->dirroot . '/repository/lib.php';
        break;
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:31,代码来源:edit.php

示例5: forum_extend_settings_navigation


//.........这里部分代码省略.........
    if ($canmanage) {
        $mode = $forumnode->add(get_string('subscriptionmode', 'forum'), null, navigation_node::TYPE_CONTAINER);

        $allowchoice = $mode->add(get_string('subscriptionoptional', 'forum'), new moodle_url('/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'mode'=>FORUM_CHOOSESUBSCRIBE, 'sesskey'=>sesskey())), navigation_node::TYPE_SETTING);
        $forceforever = $mode->add(get_string("subscriptionforced", "forum"), new moodle_url('/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'mode'=>FORUM_FORCESUBSCRIBE, 'sesskey'=>sesskey())), navigation_node::TYPE_SETTING);
        $forceinitially = $mode->add(get_string("subscriptionauto", "forum"), new moodle_url('/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'mode'=>FORUM_INITIALSUBSCRIBE, 'sesskey'=>sesskey())), navigation_node::TYPE_SETTING);
        $disallowchoice = $mode->add(get_string('subscriptiondisabled', 'forum'), new moodle_url('/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'mode'=>FORUM_DISALLOWSUBSCRIBE, 'sesskey'=>sesskey())), navigation_node::TYPE_SETTING);

        switch ($subscriptionmode) {
            case FORUM_CHOOSESUBSCRIBE : // 0
                $allowchoice->action = null;
                $allowchoice->add_class('activesetting');
                break;
            case FORUM_FORCESUBSCRIBE : // 1
                $forceforever->action = null;
                $forceforever->add_class('activesetting');
                break;
            case FORUM_INITIALSUBSCRIBE : // 2
                $forceinitially->action = null;
                $forceinitially->add_class('activesetting');
                break;
            case FORUM_DISALLOWSUBSCRIBE : // 3
                $disallowchoice->action = null;
                $disallowchoice->add_class('activesetting');
                break;
        }

    } else if ($activeenrolled) {

        switch ($subscriptionmode) {
            case FORUM_CHOOSESUBSCRIBE : // 0
                $notenode = $forumnode->add(get_string('subscriptionoptional', 'forum'));
                break;
            case FORUM_FORCESUBSCRIBE : // 1
                $notenode = $forumnode->add(get_string('subscriptionforced', 'forum'));
                break;
            case FORUM_INITIALSUBSCRIBE : // 2
                $notenode = $forumnode->add(get_string('subscriptionauto', 'forum'));
                break;
            case FORUM_DISALLOWSUBSCRIBE : // 3
                $notenode = $forumnode->add(get_string('subscriptiondisabled', 'forum'));
                break;
        }
    }

    if ($cansubscribe) {
        if (forum_is_subscribed($USER->id, $forumobject)) {
            $linktext = get_string('unsubscribe', 'forum');
        } else {
            $linktext = get_string('subscribe', 'forum');
        }
        $url = new moodle_url('/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'sesskey'=>sesskey()));
        $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
    }

    if (has_capability('mod/forum:viewsubscribers', $PAGE->cm->context)){
        $url = new moodle_url('/mod/forum/subscribers.php', array('id'=>$forumobject->id));
        $forumnode->add(get_string('showsubscribers', 'forum'), $url, navigation_node::TYPE_SETTING);
    }

    if ($enrolled && forum_tp_can_track_forums($forumobject)) { // keep tracking info for users with suspended enrolments
        if ($forumobject->trackingtype != FORUM_TRACKING_OPTIONAL) {
            //tracking forced on or off in forum settings so dont provide a link here to change it
            //could add unclickable text like for forced subscription but not sure this justifies adding another menu item
        } else {
            if (forum_tp_is_tracked($forumobject)) {
                $linktext = get_string('notrackforum', 'forum');
            } else {
                $linktext = get_string('trackforum', 'forum');
            }
            $url = new moodle_url('/mod/forum/settracking.php', array('id'=>$forumobject->id));
            $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
        }
    }

    if (!isloggedin() && $PAGE->course->id == SITEID) {
        $userid = guest_user()->id;
    } else {
        $userid = $USER->id;
    }

    $hascourseaccess = ($PAGE->course->id == SITEID) || can_access_course($PAGE->course, $userid);
    $enablerssfeeds = !empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds);

    if ($enablerssfeeds && $forumobject->rsstype && $forumobject->rssarticles && $hascourseaccess) {

        if (!function_exists('rss_get_url')) {
            require_once("$CFG->libdir/rsslib.php");
        }

        if ($forumobject->rsstype == 1) {
            $string = get_string('rsssubscriberssdiscussions','forum');
        } else {
            $string = get_string('rsssubscriberssposts','forum');
        }

        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $userid, "mod_forum", $forumobject->id));
        $forumnode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
    }
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:lib.php

示例6: data_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $datanode The node to add module settings to
 */
function data_extend_settings_navigation(settings_navigation $settings, navigation_node $datanode) {
    global $PAGE, $DB, $CFG, $USER;

    $data = $DB->get_record('data', array("id" => $PAGE->cm->instance));

    $currentgroup = groups_get_activity_group($PAGE->cm);
    $groupmode = groups_get_activity_groupmode($PAGE->cm);

    if (data_user_can_add_entry($data, $currentgroup, $groupmode, $PAGE->cm->context)) { // took out participation list here!
        if (empty($editentry)) { //TODO: undefined
            $addstring = get_string('add', 'data');
        } else {
            $addstring = get_string('editentry', 'data');
        }
        $datanode->add($addstring, new moodle_url('/mod/data/edit.php', array('d'=>$PAGE->cm->instance)));
    }

    if (has_capability(DATA_CAP_EXPORT, $PAGE->cm->context)) {
        // The capability required to Export database records is centrally defined in 'lib.php'
        // and should be weaker than those required to edit Templates, Fields and Presets.
        $datanode->add(get_string('exportentries', 'data'), new moodle_url('/mod/data/export.php', array('d'=>$data->id)));
    }
    if (has_capability('mod/data:manageentries', $PAGE->cm->context)) {
        $datanode->add(get_string('importentries', 'data'), new moodle_url('/mod/data/import.php', array('d'=>$data->id)));
    }

    if (has_capability('mod/data:managetemplates', $PAGE->cm->context)) {
        $currenttab = '';
        if ($currenttab == 'list') {
            $defaultemplate = 'listtemplate';
        } else if ($currenttab == 'add') {
            $defaultemplate = 'addtemplate';
        } else if ($currenttab == 'asearch') {
            $defaultemplate = 'asearchtemplate';
        } else {
            $defaultemplate = 'singletemplate';
        }

        $templates = $datanode->add(get_string('templates', 'data'));

        $templatelist = array ('listtemplate', 'singletemplate', 'asearchtemplate', 'addtemplate', 'rsstemplate', 'csstemplate', 'jstemplate');
        foreach ($templatelist as $template) {
            $templates->add(get_string($template, 'data'), new moodle_url('/mod/data/templates.php', array('d'=>$data->id,'mode'=>$template)));
        }

        $datanode->add(get_string('fields', 'data'), new moodle_url('/mod/data/field.php', array('d'=>$data->id)));
        $datanode->add(get_string('presets', 'data'), new moodle_url('/mod/data/preset.php', array('d'=>$data->id)));
    }

    if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
        require_once("$CFG->libdir/rsslib.php");

        $string = get_string('rsstype','forum');

        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_data', $data->id));
        $datanode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
    }
}
开发者ID:nottmoo,项目名称:moodle,代码行数:64,代码来源:lib.php

示例7: forum_extend_settings_navigation


//.........这里部分代码省略.........
                // 0
                $allowchoice->action = null;
                $allowchoice->add_class('activesetting');
                $allowchoice->icon = new pix_icon('t/selected', '', 'mod_forum');
                break;
            case FORUM_FORCESUBSCRIBE:
                // 1
                $forceforever->action = null;
                $forceforever->add_class('activesetting');
                $forceforever->icon = new pix_icon('t/selected', '', 'mod_forum');
                break;
            case FORUM_INITIALSUBSCRIBE:
                // 2
                $forceinitially->action = null;
                $forceinitially->add_class('activesetting');
                $forceinitially->icon = new pix_icon('t/selected', '', 'mod_forum');
                break;
            case FORUM_DISALLOWSUBSCRIBE:
                // 3
                $disallowchoice->action = null;
                $disallowchoice->add_class('activesetting');
                $disallowchoice->icon = new pix_icon('t/selected', '', 'mod_forum');
                break;
        }
    } else {
        if ($activeenrolled) {
            switch ($subscriptionmode) {
                case FORUM_CHOOSESUBSCRIBE:
                    // 0
                    $notenode = $forumnode->add(get_string('subscriptionoptional', 'forum'));
                    break;
                case FORUM_FORCESUBSCRIBE:
                    // 1
                    $notenode = $forumnode->add(get_string('subscriptionforced', 'forum'));
                    break;
                case FORUM_INITIALSUBSCRIBE:
                    // 2
                    $notenode = $forumnode->add(get_string('subscriptionauto', 'forum'));
                    break;
                case FORUM_DISALLOWSUBSCRIBE:
                    // 3
                    $notenode = $forumnode->add(get_string('subscriptiondisabled', 'forum'));
                    break;
            }
        }
    }
    if ($cansubscribe) {
        if (\mod_forum\subscriptions::is_subscribed($USER->id, $forumobject, null, $PAGE->cm)) {
            $linktext = get_string('unsubscribe', 'forum');
        } else {
            $linktext = get_string('subscribe', 'forum');
        }
        $url = new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'sesskey' => sesskey()));
        $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
        if (isset($discussionid)) {
            if (\mod_forum\subscriptions::is_subscribed($USER->id, $forumobject, $discussionid, $PAGE->cm)) {
                $linktext = get_string('unsubscribediscussion', 'forum');
            } else {
                $linktext = get_string('subscribediscussion', 'forum');
            }
            $url = new moodle_url('/mod/forum/subscribe.php', array('id' => $forumobject->id, 'sesskey' => sesskey(), 'd' => $discussionid, 'returnurl' => $PAGE->url->out()));
            $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
        }
    }
    if (has_capability('mod/forum:viewsubscribers', $PAGE->cm->context)) {
        $url = new moodle_url('/mod/forum/subscribers.php', array('id' => $forumobject->id));
        $forumnode->add(get_string('showsubscribers', 'forum'), $url, navigation_node::TYPE_SETTING);
    }
    if ($enrolled && forum_tp_can_track_forums($forumobject)) {
        // keep tracking info for users with suspended enrolments
        if ($forumobject->trackingtype == FORUM_TRACKING_OPTIONAL || !$CFG->forum_allowforcedreadtracking && $forumobject->trackingtype == FORUM_TRACKING_FORCED) {
            if (forum_tp_is_tracked($forumobject)) {
                $linktext = get_string('notrackforum', 'forum');
            } else {
                $linktext = get_string('trackforum', 'forum');
            }
            $url = new moodle_url('/mod/forum/settracking.php', array('id' => $forumobject->id, 'sesskey' => sesskey()));
            $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
        }
    }
    if (!isloggedin() && $PAGE->course->id == SITEID) {
        $userid = guest_user()->id;
    } else {
        $userid = $USER->id;
    }
    $hascourseaccess = $PAGE->course->id == SITEID || can_access_course($PAGE->course, $userid);
    $enablerssfeeds = !empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds);
    if ($enablerssfeeds && $forumobject->rsstype && $forumobject->rssarticles && $hascourseaccess) {
        if (!function_exists('rss_get_url')) {
            require_once "{$CFG->libdir}/rsslib.php";
        }
        if ($forumobject->rsstype == 1) {
            $string = get_string('rsssubscriberssdiscussions', 'forum');
        } else {
            $string = get_string('rsssubscriberssposts', 'forum');
        }
        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $userid, "mod_forum", $forumobject->id));
        $forumnode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
    }
}
开发者ID:rezaies,项目名称:moodle,代码行数:101,代码来源:lib.php

示例8: blog_get_options_for_user

/**
 * Get all of the blog options that relate to the passed user.
 *
 * If no user is passed the current user is assumed.
 *
 * @staticvar array $useroptions Cache so we don't have to regenerate multiple times
 * @param stdClass $user
 * @return array The array of options for the requested user
 */
function blog_get_options_for_user(stdClass $user = null)
{
    global $CFG, $USER;
    // Cache
    static $useroptions = array();
    $options = array();
    // Blogs must be enabled and the user must be logged in
    if (!blog_is_enabled_for_user()) {
        return $options;
    }
    // Sort out the user var
    if ($user === null || $user->id == $USER->id) {
        $user = $USER;
        $iscurrentuser = true;
    } else {
        $iscurrentuser = false;
    }
    // If we've already generated serve from the cache
    if (array_key_exists($user->id, $useroptions)) {
        return $useroptions[$user->id];
    }
    $sitecontext = get_context_instance(CONTEXT_SYSTEM);
    $canview = has_capability('moodle/blog:view', $sitecontext);
    if (!$iscurrentuser && $canview && $CFG->bloglevel >= BLOG_SITE_LEVEL) {
        // Not the current user, but we can view and its blogs are enabled for SITE or GLOBAL
        $options['userentries'] = array('string' => get_string('viewuserentries', 'blog', fullname($user)), 'link' => new moodle_url('/blog/index.php', array('userid' => $user->id)));
    } else {
        // It's the current user
        if ($canview) {
            // We can view our own blogs .... BIG surprise
            $options['view'] = array('string' => get_string('viewallmyentries', 'blog'), 'link' => new moodle_url('/blog/index.php', array('userid' => $USER->id)));
        }
        if (has_capability('moodle/blog:create', $sitecontext)) {
            // We can add to our own blog
            $options['add'] = array('string' => get_string('addnewentry', 'blog'), 'link' => new moodle_url('/blog/edit.php', array('action' => 'add')));
        }
    }
    if ($canview && $CFG->enablerssfeeds) {
        $options['rss'] = array('string' => get_string('rssfeed', 'blog'), 'link' => new moodle_url(rss_get_url($sitecontext->id, $USER->id, 'blog', 'user/' . $user->id)));
    }
    // Cache the options
    $useroptions[$user->id] = $options;
    // Return the options
    return $options;
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:54,代码来源:lib.php

示例9: error

        // Redirect to field entry
    }
}
if ($rid) {
    // So do you have access?
    if (!(has_capability('mod/data:manageentries', $context) or data_isowner($rid)) or !confirm_sesskey()) {
        error(get_string('noaccess', 'data'));
    }
}
if ($cancel) {
    redirect('view.php?d=' . $data->id);
}
/// RSS and CSS and JS meta
$meta = '';
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
    $rsspath = rss_get_url($course->id, $USER->id, 'data', $data->id);
    $meta .= '<link rel="alternate" type="application/rss+xml" ';
    $meta .= 'title ="' . format_string($course->shortname) . ': %fullname%" href="' . $rsspath . '" />';
}
if ($data->csstemplate) {
    $meta .= '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/mod/data/css.php?d=' . $data->id . '" /> ';
}
if ($data->jstemplate) {
    $meta .= '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/data/js.php?d=' . $data->id . '"></script>';
}
/// Print the page header
$strdata = get_string('modulenameplural', 'data');
$navlinks = array();
$navlinks[] = array('name' => $strdata, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($data->name), 'link' => '', 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:edit.php

示例10: glossary_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $glossarynode The node to add module settings to
 */
function glossary_extend_settings_navigation(settings_navigation $settings, navigation_node $glossarynode) {
    global $PAGE, $DB, $CFG, $USER;

    $mode = optional_param('mode', '', PARAM_ALPHA);
    $hook = optional_param('hook', 'ALL', PARAM_CLEAN);

    if (has_capability('mod/glossary:import', $PAGE->cm->context)) {
        $glossarynode->add(get_string('importentries', 'glossary'), new moodle_url('/mod/glossary/import.php', array('id'=>$PAGE->cm->id)));
    }

    if (has_capability('mod/glossary:export', $PAGE->cm->context)) {
        $glossarynode->add(get_string('exportentries', 'glossary'), new moodle_url('/mod/glossary/export.php', array('id'=>$PAGE->cm->id, 'mode'=>$mode, 'hook'=>$hook)));
    }

    if (has_capability('mod/glossary:approve', $PAGE->cm->context) && ($hiddenentries = $DB->count_records('glossary_entries', array('glossaryid'=>$PAGE->cm->instance, 'approved'=>0)))) {
        $glossarynode->add(get_string('waitingapproval', 'glossary'), new moodle_url('/mod/glossary/view.php', array('id'=>$PAGE->cm->id, 'mode'=>'approval')));
    }

    if (has_capability('mod/glossary:write', $PAGE->cm->context)) {
        $glossarynode->add(get_string('addentry', 'glossary'), new moodle_url('/mod/glossary/edit.php', array('cmid'=>$PAGE->cm->id)));
    }

    $glossary = $DB->get_record('glossary', array("id" => $PAGE->cm->instance));

    if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds) && $glossary->rsstype && $glossary->rssarticles  && can_access_course($PAGE->course, $USER)) {
        require_once("$CFG->libdir/rsslib.php");

        $string = get_string('rsstype','forum');

        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_glossary', $glossary->id));
        $glossarynode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
    }
}
开发者ID:rolandovanegas,项目名称:moodle,代码行数:39,代码来源:lib.php

示例11: dataform_extend_navigation

/**
 *
 */
function dataform_extend_navigation($navigation, $course, $module, $cm)
{
    global $PAGE, $USER, $CFG;
    $df = mod_dataform_dataform::instance($cm->instance);
    if ($views = $df->view_manager->views_navigation_menu) {
        foreach ($views as $viewid => $name) {
            $navigation->add($name, new moodle_url('/mod/dataform/view.php', array('d' => $df->id, 'view' => $viewid)));
        }
    }
    // RSS links.
    if (!empty($CFG->enablerssfeeds) and !empty($CFG->dataform_enablerssfeeds)) {
        if ($rssviews = $df->get_rss_views()) {
            require_once "{$CFG->libdir}/rsslib.php";
            $rssstr = get_string('rss');
            foreach ($rssviews as $viewid => $view) {
                $feedname = $view->name;
                $componentinstance = "{$df->id}/{$viewid}";
                $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $USER->id, 'mod_dataform', $componentinstance));
                $navigation->add($feedname, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', $rssstr));
            }
        }
    }
}
开发者ID:parksandwildlife,项目名称:learning,代码行数:26,代码来源:lib.php

示例12: display_homepage


//.........这里部分代码省略.........
         $ratingoptions->ratingarea = 'featured';
         $rm = new rating_manager();
         $courses = $rm->get_ratings($ratingoptions);
         //this function return $ratingoptions->items with information about the ratings
         foreach ($courses as $course) {
             $course->rating->settings->permissions->viewany = 1;
         }
         require_once $CFG->dirroot . '/comment/lib.php';
         foreach ($courses as $course) {
             $commentoptions = new stdClass();
             $commentoptions->context = context_course::instance(SITEID);
             $commentoptions->area = 'local_hub';
             $commentoptions->itemid = $course->id;
             $commentoptions->showcount = true;
             $commentoptions->component = 'local_hub';
             $course->comment = new comment($commentoptions);
             $course->comment->set_view_permission(true);
         }
     }
     //create rss feed link
     $enablerssfeeds = get_config('local_hub', 'enablerssfeeds');
     if (!empty($enablerssfeeds)) {
         require $CFG->libdir . '/rsslib.php';
         $audience = key_exists('audience', $options) ? $options['audience'] : 'all';
         $educationallevel = key_exists('educationallevel', $options) ? $options['educationallevel'] : 'all';
         if (key_exists('downloadable', $options)) {
             $downloadable = empty($options['downloadable']) ? 0 : 1;
         } else {
             $downloadable = 'all';
         }
         $subject = key_exists('subject', $options) ? $options['subject'] : 'all';
         $licence = key_exists('licence', $options) ? $options['licence'] : 'all';
         $language = key_exists('language', $options) ? $options['language'] : 'all';
         $audience = key_exists('audience', $options) ? $options['audience'] : 'all';
         $orderby = key_exists('orderby', $options) ? $options['orderby'] : 'newest';
         $search = empty($search) ? 0 : urlencode($search);
         //retrieve guest user if user not logged in
         $userid = empty($USER->id) ? $CFG->siteguest : $USER->id;
         $ctx = context_course::instance(SITEID);
         //add the link tage to the header
         $rsslink = rss_get_url($ctx->id, $userid, 'local_hub', $downloadable . '/' . $audience . '/' . $educationallevel . '/' . $subject . '/' . $licence . '/' . $language . '/' . $search . '/');
         $PAGE->add_alternate_version('RSS', $rsslink, 'application/rss+xml');
         //create the rss icon
         $rssicon = rss_get_link($ctx->id, $userid, 'local_hub', $downloadable . '/' . $audience . '/' . $educationallevel . '/' . $subject . '/' . $licence . '/' . $language . '/' . $search . '/' . $orderby . '/', get_string('rsstooltip', 'local_hub'));
     }
     /// OUTPUT
     echo $OUTPUT->header();
     //notification message sent to publisher
     if (optional_param('messagesent', 0, PARAM_INTEGER)) {
         echo $OUTPUT->notification(get_string('messagesentsuccess', 'local_hub'), 'notifysuccess');
     }
     //search form
     $coursesearchform->display();
     //Course listing
     $options['submitbutton'] = 1;
     //need to set up the submitbutton to 1 for the paging bar (simulate search)
     //and paramlink
     //set language value back to 'all'
     if (!key_exists('language', $options)) {
         $options['language'] = 'all';
     }
     if (isset($courses) and empty($courseid)) {
         if (empty($coursetotal)) {
             $coursetotalhtml = get_string('nocourse', 'local_hub');
         } else {
             $coursetotalhtml = get_string('coursetotal', 'local_hub', $coursetotal);
         }
         echo html_writer::tag('div', $coursetotalhtml, array('class' => 'hubcoursetotal'));
     }
     if (!empty($courses)) {
         //paging bar
         if ($coursetotal > HUB_COURSE_PER_PAGE) {
             $baseurl = new moodle_url('', $options);
             $pagingbarhtml = $OUTPUT->paging_bar($coursetotal, $page, HUB_COURSE_PER_PAGE, $baseurl);
             $pagingbarhtml = html_writer::tag('div', $pagingbarhtml, array('class' => 'pagingbar'));
             echo $pagingbarhtml;
         }
         echo highlight($search, $renderer->course_list($courses));
         if (!empty($pagingbarhtml)) {
             echo $pagingbarhtml;
         }
     }
     //rss icon
     if (!empty($enablerssfeeds)) {
         echo html_writer::tag('div', $rssicon, array('class' => 'hubrsslink'));
     }
     //permalink
     if (!empty($courses)) {
         $permalinkparams = array();
         //special case: course list is a unique course for a given ID
         if (!empty($courseid)) {
             $permalinkparams['courseid'] = $courseid;
         } else {
             $permalinkparams = $options;
         }
         $permalink = html_writer::tag('div', html_writer::tag('a', get_string('permalink', 'local_hub'), array('href' => new moodle_url('', $permalinkparams))), array('class' => 'hubcoursepermalink'));
         echo $permalink;
     }
     echo $OUTPUT->footer();
 }
开发者ID:k-holland,项目名称:moodle-local_hub,代码行数:101,代码来源:lib.php

示例13: get_context_instance

$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if ($editing) {
    require_capability('mod/lightboxgallery:edit', $context);
}
add_to_log($course->id, 'lightboxgallery', 'view', 'view.php?id=' . $cm->id . '&page=' . $page, $gallery->id, $cm->id, $userid);
require_js(array('js/prototype.js', 'js/scriptaculous.js', 'js/effects.js', 'js/lightbox.js'));
$navigation = build_navigation('', $cm);
$update = update_module_button($cm->id, $course->id, get_string('modulenameshort', 'lightboxgallery'));
if (has_capability('mod/lightboxgallery:edit', $context)) {
    $options = array('id' => $cm->id, 'page' => $page, 'editing' => $editing ? '0' : '1');
    $update = print_single_button($CFG->wwwroot . '/mod/lightboxgallery/view.php', $options, get_string('turnediting' . ($editing ? 'off' : 'on')), 'get', '', true) . $update;
}
$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);
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:view-embed.php

示例14: hsuforum_extend_settings_navigation


//.........这里部分代码省略.........
        $mode = $forumnode->add(get_string('subscriptionmode', 'hsuforum'), null, navigation_node::TYPE_CONTAINER);
        $allowchoice = $mode->add(get_string('subscriptionoptional', 'hsuforum'), new moodle_url('/mod/hsuforum/subscribe.php', array('id' => $forumobject->id, 'mode' => HSUFORUM_CHOOSESUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $forceforever = $mode->add(get_string("subscriptionforced", "hsuforum"), new moodle_url('/mod/hsuforum/subscribe.php', array('id' => $forumobject->id, 'mode' => HSUFORUM_FORCESUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $forceinitially = $mode->add(get_string("subscriptionauto", "hsuforum"), new moodle_url('/mod/hsuforum/subscribe.php', array('id' => $forumobject->id, 'mode' => HSUFORUM_INITIALSUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        $disallowchoice = $mode->add(get_string('subscriptiondisabled', 'hsuforum'), new moodle_url('/mod/hsuforum/subscribe.php', array('id' => $forumobject->id, 'mode' => HSUFORUM_DISALLOWSUBSCRIBE, 'sesskey' => sesskey())), navigation_node::TYPE_SETTING);
        switch ($subscriptionmode) {
            case HSUFORUM_CHOOSESUBSCRIBE:
                // 0
                $allowchoice->action = null;
                $allowchoice->add_class('activesetting');
                break;
            case HSUFORUM_FORCESUBSCRIBE:
                // 1
                $forceforever->action = null;
                $forceforever->add_class('activesetting');
                break;
            case HSUFORUM_INITIALSUBSCRIBE:
                // 2
                $forceinitially->action = null;
                $forceinitially->add_class('activesetting');
                break;
            case HSUFORUM_DISALLOWSUBSCRIBE:
                // 3
                $disallowchoice->action = null;
                $disallowchoice->add_class('activesetting');
                break;
        }
    } else {
        if ($activeenrolled) {
            switch ($subscriptionmode) {
                case HSUFORUM_CHOOSESUBSCRIBE:
                    // 0
                    $notenode = $forumnode->add(get_string('subscriptionoptional', 'hsuforum'));
                    break;
                case HSUFORUM_FORCESUBSCRIBE:
                    // 1
                    $notenode = $forumnode->add(get_string('subscriptionforced', 'hsuforum'));
                    break;
                case HSUFORUM_INITIALSUBSCRIBE:
                    // 2
                    $notenode = $forumnode->add(get_string('subscriptionauto', 'hsuforum'));
                    break;
                case HSUFORUM_DISALLOWSUBSCRIBE:
                    // 3
                    $notenode = $forumnode->add(get_string('subscriptiondisabled', 'hsuforum'));
                    break;
            }
        }
    }
    if ($cansubscribe) {
        if (hsuforum_is_subscribed($USER->id, $forumobject)) {
            $linktext = get_string('unsubscribe', 'hsuforum');
        } else {
            $linktext = get_string('subscribe', 'hsuforum');
        }
        $url = new moodle_url('/mod/hsuforum/subscribe.php', array('id' => $forumobject->id, 'sesskey' => sesskey()));
        $forumnode->add($linktext, $url, navigation_node::TYPE_SETTING);
    }
    if ($viewingdiscussion) {
        require_once __DIR__ . '/lib/discussion/subscribe.php';
        $subscribe = new hsuforum_lib_discussion_subscribe($forumobject, $PAGE->cm->context);
        if ($subscribe->can_subscribe()) {
            $subscribeurl = new moodle_url('/mod/hsuforum/route.php', array('contextid' => $PAGE->cm->context->id, 'action' => 'subscribedisc', 'discussionid' => $discussionid, 'sesskey' => sesskey(), 'returnurl' => $PAGE->url));
            if ($subscribe->is_subscribed($discussionid)) {
                $linktext = get_string('unsubscribedisc', 'hsuforum');
            } else {
                $linktext = get_string('subscribedisc', 'hsuforum');
            }
            $forumnode->add($linktext, $subscribeurl, navigation_node::TYPE_SETTING);
        }
    }
    if (has_capability('mod/hsuforum:viewsubscribers', $PAGE->cm->context)) {
        $url = new moodle_url('/mod/hsuforum/subscribers.php', array('id' => $forumobject->id));
        $forumnode->add(get_string('showsubscribers', 'hsuforum'), $url, navigation_node::TYPE_SETTING);
        $discsubscribers = ($viewingdiscussion or optional_param('action', '', PARAM_ALPHA) == 'discsubscribers');
        if ($discsubscribers && !hsuforum_is_forcesubscribed($forumobject) && $discussionid) {
            $url = new moodle_url('/mod/hsuforum/route.php', array('contextid' => $PAGE->cm->context->id, 'action' => 'discsubscribers', 'discussionid' => $discussionid));
            $forumnode->add(get_string('showdiscussionsubscribers', 'hsuforum'), $url, navigation_node::TYPE_SETTING, null, 'discsubscribers');
        }
    }
    if (!isloggedin() && $PAGE->course->id == SITEID) {
        $userid = guest_user()->id;
    } else {
        $userid = $USER->id;
    }
    $hascourseaccess = $PAGE->course->id == SITEID || can_access_course($PAGE->course, $userid);
    $enablerssfeeds = !empty($config->enablerssfeeds) && !empty($config->enablerssfeeds);
    if ($enablerssfeeds && $forumobject->rsstype && $forumobject->rssarticles && $hascourseaccess) {
        if (!function_exists('rss_get_url')) {
            require_once "{$CFG->libdir}/rsslib.php";
        }
        if ($forumobject->rsstype == 1) {
            $string = get_string('rsssubscriberssdiscussions', 'hsuforum');
        } else {
            $string = get_string('rsssubscriberssposts', 'hsuforum');
        }
        $url = new moodle_url(rss_get_url($PAGE->cm->context->id, $userid, "mod_hsuforum", $forumobject->id));
        $forumnode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
    }
}
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:101,代码来源:lib.php

示例15: array

}
// OK, the use should be able to see the feed, generate the .pcast file
$pcast = $DB->get_record('pcast', array('id' => $pcastid), '*', MUST_EXIST);
// Check to se if RSS is enabled
// NOTE: cannot use the rss_enabled_for_mod() function due to the functions internals and naming conflicts
if ($pcast->rssepisodes == 0 || empty($pcast->rssepisodes)) {
    pcast_rss_error();
}
$sql = pcast_rss_get_sql($pcast);
$filename = rss_get_file_name($pcast, $sql);
//Append the GroupID to the end of the filename
$filename .= '_' . $groupid;
$cachedfilepath = pcast_rss_get_file_full_name('mod_pcast', $filename);
// Figure out the URL for the podcast based on the user info
$args = $pcast->id . '/' . $userid . '/' . $groupid;
$url = new moodle_url(rss_get_url($context->id, $userid, 'pcast', $args));
// Build the .pcast file
$rss = pcast_build_pcast_file($pcast, $url);
//Save the XML contents to file.
$status = pcast_rss_save_file('mod_pcast', $filename, $rss);
if (!$status) {
    $cachedfilepath = null;
}
// Check that file exists
if (empty($cachedfilepath) || !file_exists($cachedfilepath)) {
    die($cachedfilepath);
    pcast_rss_error();
}
// Send the .pcast file to the user!
send_file($cachedfilepath, 'rss.pcast', 0, 0, 0, 1);
// DO NOT CACHE
开发者ID:rtsfc,项目名称:moodle-mod_pcast,代码行数:31,代码来源:subscribe.php


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