mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
should be fix for bug 3478
This commit is contained in:
parent
6bcfd67887
commit
d396889452
6 changed files with 61 additions and 45 deletions
|
@ -3,6 +3,7 @@
|
|||
/*******************************************************************
|
||||
* This file contains one class which...
|
||||
*
|
||||
* @todo Finish documenting this file
|
||||
* @author Daryl Hawes
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
|
@ -11,6 +12,7 @@
|
|||
|
||||
/**
|
||||
* This class is for a block which....
|
||||
* @todo Finish documenting this class
|
||||
*/
|
||||
|
||||
// Developer's debug assistant - if true then the display string will not cache, only
|
||||
|
@ -103,11 +105,11 @@ class block_rss_client extends block_base {
|
|||
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
||||
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'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $this->courseid));
|
||||
$output .= '<div align="center"><a title="'. get_string('feedsaddedit', 'block_rss_client') .'" href="'. $script .'">'. get_string('feedsaddedit', 'block_rss_client') .'</a></div>';
|
||||
} else {
|
||||
// this instance has not been configured yet - show configure link
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $this->courseid));
|
||||
$output .= '<div align="center"><a title="'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'" href="'. $script.'">'. get_string('feedsconfigurenewinstance', 'block_rss_client') .'</a></div>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
if (isguest()) {
|
||||
error(get_string('noguestpost', 'forum'), $referrer);
|
||||
}
|
||||
|
||||
|
||||
$act = optional_param('act', 'none' );
|
||||
$rssid = optional_param('rssid', 'none' );
|
||||
$courseid = optional_param('courseid', SITEID, PARAM_INT);
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
$url = optional_param('url');
|
||||
$preferredtitle = optional_param('preferredtitle', '');
|
||||
$item = optional_param('item');
|
||||
|
@ -37,8 +37,10 @@
|
|||
define('MAGPIE_OUTPUT_ENCODING', get_string('thischarset')); // see bug 3107
|
||||
}
|
||||
|
||||
if (!empty($courseid)) {
|
||||
$course = get_record('course', 'id', $courseid, '', '', '', '', 'shortname');
|
||||
if (!empty($id)) {
|
||||
// we get the complete $course object here because print_header assumes this is
|
||||
// a complete object (needed for proper course theme settings)
|
||||
$course = get_record('course', 'id', $id);
|
||||
}
|
||||
|
||||
$straddedit = get_string('feedsaddedit', 'block_rss_client');
|
||||
|
@ -48,7 +50,7 @@
|
|||
$navigation = "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradmin</a> -> ".
|
||||
"<a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> $straddedit";
|
||||
} else if (!empty($course)) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> -> $straddedit";
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$id\">$course->shortname</a> -> $straddedit";
|
||||
} else {
|
||||
$navigation = $straddedit;
|
||||
}
|
||||
|
@ -61,18 +63,22 @@
|
|||
$submitters = $CFG->block_rss_client_submitters;
|
||||
$isteacher = false;
|
||||
if (!empty($course)) {
|
||||
$isteacher = isteacher($course->id);
|
||||
$isteacher = isteacher($id);
|
||||
}
|
||||
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
|
||||
//if the user is an admin or course teacher then allow the user to
|
||||
//assign categories to other uses than personal
|
||||
if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ) ) {
|
||||
if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS ||
|
||||
($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ||
|
||||
( ($act == 'rss_edit' || $act == 'delfeed') && $USER->id == $rss_record->userid) ) ) {
|
||||
error(get_string('noguestpost', 'forum').' You are not allowed to make modifications to this RSS feed at this time.', $referrer);
|
||||
}
|
||||
|
||||
if ($act == 'none') {
|
||||
rss_display_feeds();
|
||||
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
|
||||
} else if ($act == 'updfeed') {
|
||||
if (empty($url)) {
|
||||
|
@ -154,19 +160,18 @@
|
|||
}
|
||||
redirect($referrer, $message);
|
||||
/*
|
||||
rss_display_feeds();
|
||||
rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle, $courseid);
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle, $id);
|
||||
*/
|
||||
} else if ( $act == 'rss_edit') {
|
||||
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
|
||||
$preferredtitle = stripslashes_safe($rss_record->preferredtitle);
|
||||
if (empty($preferredtitle)) {
|
||||
$preferredtitle = stripslashes_safe($rss_record->title);
|
||||
}
|
||||
$url = stripslashes_safe($rss_record->url);
|
||||
rss_display_feeds('', $rssid);
|
||||
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
|
||||
rss_display_feeds($id, '', $rssid);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
|
||||
} else if ($act == 'delfeed') {
|
||||
|
||||
|
@ -185,7 +190,6 @@
|
|||
} else if ($act == 'view') {
|
||||
// echo $sql; //debug
|
||||
// print_object($res); //debug
|
||||
$rss_record = get_record('block_rss_client', 'id', $rssid);
|
||||
if (!$rss_record->id) {
|
||||
print '<strong>'. get_string('couldnotfindfeed', 'block_rss_client') .': '. $rssid .'</strong>';
|
||||
} else {
|
||||
|
@ -233,8 +237,8 @@
|
|||
print '</table>'."\n";
|
||||
}
|
||||
} else {
|
||||
rss_display_feeds();
|
||||
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
|
||||
rss_display_feeds($id);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
}
|
||||
|
||||
print_footer();
|
||||
|
|
|
@ -63,11 +63,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
|
||||
<td colspan="3" align="center"><a href=" <?php echo $CFG->wwwroot; ?>/blocks/rss_client/block_rss_client_action.php?courseid=<?php
|
||||
if (!isset($courseid)) {
|
||||
$courseid = '';
|
||||
<td colspan="3" align="center"><a href=" <?php echo $CFG->wwwroot; ?>/blocks/rss_client/block_rss_client_action.php?id=<?php
|
||||
if (!isset($id)) {
|
||||
$id = '';
|
||||
}
|
||||
echo $courseid; ?>"><?php print_string('feedsaddedit', 'block_rss_client')?></a></center><br /><br />
|
||||
echo $id; ?>"><?php print_string('feedsaddedit', 'block_rss_client')?></a></center><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once($CFG->libdir .'/rsslib.php');
|
||||
|
||||
$courseid = optional_param('courseid', SITEID, PARAM_INT);
|
||||
$id = optional_param('id', SITEID, PARAM_INT);
|
||||
|
||||
//create a page object for url_get_full()
|
||||
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
||||
|
@ -89,7 +89,7 @@ if ($currentaction == 'configblock') {
|
|||
} else {
|
||||
print_string('nofeeds', 'block_rss_client');
|
||||
if ( isadmin() ) {
|
||||
print ' <a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?courseid='. $courseid .'"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
|
||||
print ' <a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?id='. $id .'"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -149,8 +149,8 @@ if ($currentaction == 'configblock') {
|
|||
global $act, $url, $rssid, $preferredtitle;
|
||||
print '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
|
||||
print '<tr valign="top"><td>';
|
||||
rss_display_feeds();
|
||||
rss_display_feeds($id);
|
||||
print '</form>'; //not sure that this is needed
|
||||
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
|
||||
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
||||
print '</td></tr></table>';
|
||||
} ?>
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
global $USER;
|
||||
$tabs = $row = array();
|
||||
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id));
|
||||
$row[] = new tabobject('configblock', $script,
|
||||
get_string('configblock', 'block_rss_client'));
|
||||
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds'));
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id));
|
||||
$row[] = new tabobject('managefeeds', $script,
|
||||
get_string('managefeeds', 'block_rss_client'));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue