mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
RSS client block: users can now add their own rss feeds and pick from their feeds and admin feeds. users don't see feeds added by other nonadmin users. this is probably only useful for my moodle since they can't edit any other pages
This commit is contained in:
parent
33a9fd4745
commit
d5250d2f13
@ -103,6 +103,7 @@ define('BLOCK_RSS_SECONDARY_CACHE_ENABLED', true);
|
||||
if ( $userisloggedin && ($submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) {
|
||||
|
||||
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
||||
if ($page->user_allowed_editing()) { // for SUBMITTERS_ALL_ACCOUNT_HOLDERS we're going to run into trouble later if we show it and then they don't have write access to the page.
|
||||
if (isset($this->config)) {
|
||||
// this instance is configured - show Add/Edit feeds link
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $this->courseid));
|
||||
@ -113,6 +114,7 @@ define('BLOCK_RSS_SECONDARY_CACHE_ENABLED', true);
|
||||
$output .= '<div align="center"><a title="'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'" href="'. $script.'">'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Daryl Hawes note: if count of rssidarray is greater than 1
|
||||
// we should possibly display a drop down menu of selected feed titles
|
||||
|
@ -42,12 +42,14 @@
|
||||
$selected = '0';
|
||||
$CFG->block_rss_client_submitters = 0;
|
||||
}
|
||||
// SUBMITTERS_ALL_ACCOUNT_HOLDERS => get_string('everybody')
|
||||
|
||||
// removed everybody option for 1.5 beta
|
||||
// things are not quite working yet to allow this - revisit later
|
||||
// also 'everybody' should be 'site members' or something clearer since
|
||||
// it does not include guests
|
||||
$options = array ( SUBMITTERS_ADMIN_ONLY => get_string('administrators'),
|
||||
$options = array (
|
||||
SUBMITTERS_ALL_ACCOUNT_HOLDERS => get_string('everybody'),
|
||||
SUBMITTERS_ADMIN_ONLY => get_string('administrators'),
|
||||
SUBMITTERS_ADMIN_AND_TEACHER => get_string('administratorsandteachers') );
|
||||
|
||||
choose_from_menu ($options, 'block_rss_client_submitters', $selected);
|
||||
|
@ -74,7 +74,15 @@ if ($currentaction == 'configblock') {
|
||||
$selectedarray = array($this->config->rssid);
|
||||
}
|
||||
}
|
||||
if ($rssfeeds = get_records('block_rss_client')) {
|
||||
global $USER;
|
||||
$admins = get_admins();
|
||||
$adminsql = '';
|
||||
if (!empty($admins)) {
|
||||
foreach ($admins as $admin) {
|
||||
$adminsql = ' OR userid = '.$admin->id;
|
||||
}
|
||||
}
|
||||
if ($rssfeeds = get_records_select('block_rss_client','userid = '.$USER->id . $adminsql)) {
|
||||
foreach($rssfeeds as $rssfeed) {
|
||||
if (!empty($rssfeed->preferredtitle)) {
|
||||
$feedtitle = stripslashes_safe($rssfeed->preferredtitle);
|
||||
@ -158,7 +166,7 @@ if ($currentaction == 'configblock') {
|
||||
global $act, $url, $rssid, $preferredtitle;
|
||||
print '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
|
||||
print '<tr valign="top"><td>';
|
||||
rss_display_feeds($id);
|
||||
rss_display_feeds($id,$USER->id);
|
||||
print '</form>'; //not sure that this is needed
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
print '</td></tr></table>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user