2005-08-11 12:45:38 +00:00
|
|
|
<?php // $Id$ //
|
2005-05-15 02:47:04 +00:00
|
|
|
require_once($CFG->libdir .'/rsslib.php');
|
2005-05-17 14:43:00 +00:00
|
|
|
|
2005-08-01 14:02:46 +00:00
|
|
|
$id = optional_param('id', SITEID, PARAM_INT);
|
2005-07-31 20:04:19 +00:00
|
|
|
|
2005-05-17 14:43:00 +00:00
|
|
|
//create a page object for url_get_full()
|
|
|
|
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
|
|
|
|
2005-05-15 02:47:04 +00:00
|
|
|
/// Print tabs at top
|
2005-08-11 12:45:38 +00:00
|
|
|
$currentaction = optional_param('currentaction', '', PARAM_ALPHA);
|
2005-05-15 14:35:41 +00:00
|
|
|
if (empty($currentaction) || $currentaction == 'configblock') {
|
|
|
|
$currentaction = 'configblock';
|
2005-05-15 02:47:04 +00:00
|
|
|
} else {
|
2005-05-15 14:35:41 +00:00
|
|
|
$currentaction = 'managefeeds';
|
2005-05-15 02:47:04 +00:00
|
|
|
}
|
2005-05-17 14:43:00 +00:00
|
|
|
|
2005-05-15 02:47:04 +00:00
|
|
|
include('config_instance_tabs.php');
|
|
|
|
|
2005-05-15 14:35:41 +00:00
|
|
|
if ($currentaction == 'configblock') {
|
2005-05-15 02:47:04 +00:00
|
|
|
?>
|
2005-05-17 13:46:19 +00:00
|
|
|
<table cellpadding="9" cellspacing="0" class="blockconfigtable">
|
2004-12-14 18:09:20 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 13:46:19 +00:00
|
|
|
<td align="right" width="50%">
|
2005-05-17 15:21:32 +00:00
|
|
|
<?php print_string('displaydescriptionlabel', 'block_rss_client') ?>
|
2004-12-14 18:09:20 +00:00
|
|
|
</td>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%">
|
2004-12-14 18:09:20 +00:00
|
|
|
<?php
|
|
|
|
if(! isset($CFG->block_rss_client_display_description) ) {
|
|
|
|
$CFG->block_rss_client_display_description = '0';
|
|
|
|
}
|
|
|
|
$selected = $CFG->block_rss_client_display_description;
|
|
|
|
if (isset($this->config) && isset($this->config->display_description)) {
|
|
|
|
$selected = $this->config->display_description;
|
|
|
|
}
|
|
|
|
$options[0] = get_string('no');
|
|
|
|
$options[1] = get_string('yes');
|
|
|
|
choose_from_menu ($options, 'display_description', $selected);
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2004-12-14 18:09:20 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 13:46:19 +00:00
|
|
|
<td align="right" width="50%">
|
2005-05-17 15:21:32 +00:00
|
|
|
<?php print_string('shownumentrieslabel', 'block_rss_client') ?>
|
2004-12-14 18:09:20 +00:00
|
|
|
</td>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%">
|
2004-12-14 18:09:20 +00:00
|
|
|
<input name="shownumentries" type="text" size="5" value="<?php
|
|
|
|
if(! isset($CFG->block_rss_client_num_entries) ) {
|
|
|
|
$CFG->block_rss_client_num_entries = '5';
|
|
|
|
}
|
|
|
|
$numentries = $CFG->block_rss_client_num_entries;
|
|
|
|
if (isset($this->config) && isset($this->config->shownumentries)) {
|
|
|
|
$numentries = intval($this->config->shownumentries);
|
|
|
|
}
|
|
|
|
|
|
|
|
p($numentries);
|
|
|
|
?>" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2004-12-14 18:09:20 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 13:46:19 +00:00
|
|
|
<td align="right" width="50%">
|
2005-05-17 15:21:32 +00:00
|
|
|
<?php print_string('choosefeedlabel', 'block_rss_client') ?>
|
2004-12-14 18:09:20 +00:00
|
|
|
</td>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%">
|
2004-12-14 18:09:20 +00:00
|
|
|
<?php
|
2004-12-31 02:22:30 +00:00
|
|
|
$selectedarray = array();
|
2004-12-14 18:09:20 +00:00
|
|
|
if (isset($this->config) && isset($this->config->rssid)) {
|
2004-12-31 02:22:30 +00:00
|
|
|
if (is_array($this->config->rssid)) {
|
2004-12-30 18:08:38 +00:00
|
|
|
// rssid is an array of rssids
|
|
|
|
$selectedarray = $this->config->rssid;
|
|
|
|
} else {
|
|
|
|
// rssid is a single rssid
|
|
|
|
$selectedarray = array($this->config->rssid);
|
|
|
|
}
|
2004-12-14 18:09:20 +00:00
|
|
|
}
|
2006-01-16 03:02:42 +00:00
|
|
|
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)) {
|
2005-05-17 14:43:00 +00:00
|
|
|
foreach($rssfeeds as $rssfeed) {
|
2005-01-28 01:21:08 +00:00
|
|
|
if (!empty($rssfeed->preferredtitle)) {
|
2005-01-29 03:01:18 +00:00
|
|
|
$feedtitle = stripslashes_safe($rssfeed->preferredtitle);
|
2005-01-28 01:21:08 +00:00
|
|
|
} else {
|
2005-01-29 03:01:18 +00:00
|
|
|
$feedtitle = stripslashes_safe($rssfeed->title);
|
2005-01-28 01:21:08 +00:00
|
|
|
}
|
2005-05-18 20:09:29 +00:00
|
|
|
$checked = '';
|
|
|
|
if (in_array($rssfeed->id, $selectedarray)) {
|
|
|
|
$checked = 'checked';
|
2004-12-31 02:22:30 +00:00
|
|
|
}
|
2005-05-18 20:09:29 +00:00
|
|
|
$checkbox = '<input type="checkbox" name="rssid[]" id="rssid[]" value="'. $rssfeed->id .'" '. $checked .' />';
|
|
|
|
print $checkbox . $feedtitle .'<br />'."\n";
|
2004-12-30 18:08:38 +00:00
|
|
|
}
|
2004-12-14 18:09:20 +00:00
|
|
|
} else {
|
2005-05-17 15:21:32 +00:00
|
|
|
print_string('nofeeds', 'block_rss_client');
|
2005-05-17 14:43:00 +00:00
|
|
|
if ( isadmin() ) {
|
2005-10-06 08:21:14 +00:00
|
|
|
$addrsspage = $page->url_get_full(array('instanceid' => $this->instance->id,
|
|
|
|
'sesskey' => $USER->sesskey, 'blockaction' => 'config',
|
|
|
|
'currentaction' => 'managefeeds', 'id' => $id));
|
2005-10-06 08:21:55 +00:00
|
|
|
print ' <a href="'.$addrsspage.'">'. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
|
2004-12-14 18:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2004-12-14 18:09:20 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 13:46:19 +00:00
|
|
|
<td align="right" width="50%"><?php print_string('uploadlabel'); ?></td>
|
2004-12-30 18:08:38 +00:00
|
|
|
<?php
|
|
|
|
$title = '';
|
|
|
|
if (!empty($this->config) && !empty($this->config->title)) {
|
|
|
|
$title = $this->config->title;
|
|
|
|
}
|
|
|
|
?>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%"><input type="text" name="title" size="30" value="<?php echo $title; ?>" />
|
2004-12-14 18:09:20 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2005-01-27 22:47:13 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 15:21:32 +00:00
|
|
|
<td align="right" width="50%"><?php print_string('clientshowchannellinklabel', 'block_rss_client'); ?></td>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%">
|
2005-01-29 03:01:18 +00:00
|
|
|
<?php
|
|
|
|
if (isset($this->config) && isset($this->config->block_rss_client_show_channel_link)) {
|
|
|
|
$selected = $this->config->block_rss_client_show_channel_link;
|
2005-01-27 22:47:13 +00:00
|
|
|
} else {
|
|
|
|
$selected = '0';
|
|
|
|
}
|
|
|
|
$options = array ( '0' => get_string('no'),
|
|
|
|
'1' => get_string('yes') );
|
|
|
|
|
|
|
|
choose_from_menu ($options, 'block_rss_client_show_channel_link', $selected);
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2005-01-29 03:01:18 +00:00
|
|
|
<tr valign="top">
|
2005-05-17 15:21:32 +00:00
|
|
|
<td align="right" width="50%"><?php print_string('clientshowimagelabel', 'block_rss_client'); ?></td>
|
2005-05-17 13:46:19 +00:00
|
|
|
<td width="50%">
|
2005-01-29 03:01:18 +00:00
|
|
|
<?php
|
|
|
|
if (isset($this->config) && isset($this->config->block_rss_client_show_channel_image)) {
|
|
|
|
$selected = $this->config->block_rss_client_show_channel_image;
|
|
|
|
} else {
|
|
|
|
$selected = '0';
|
|
|
|
}
|
|
|
|
$options = array ( '0' => get_string('no'),
|
|
|
|
'1' => get_string('yes') );
|
|
|
|
|
|
|
|
choose_from_menu ($options, 'block_rss_client_show_channel_image', $selected);
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-11 12:45:38 +00:00
|
|
|
|
2004-12-14 18:09:20 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center">
|
|
|
|
<input type="submit" value="<?php print_string('savechanges') ?>">
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-02-08 18:33:08 +00:00
|
|
|
</table>
|
2005-05-15 02:47:04 +00:00
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
global $act, $url, $rssid, $preferredtitle;
|
2005-05-17 14:43:00 +00:00
|
|
|
print '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
|
|
|
|
print '<tr valign="top"><td>';
|
2006-01-16 03:02:42 +00:00
|
|
|
rss_display_feeds($id,$USER->id);
|
2005-05-17 14:43:00 +00:00
|
|
|
print '</form>'; //not sure that this is needed
|
2005-08-01 14:02:46 +00:00
|
|
|
rss_print_form($act, $url, $rssid, $preferredtitle, $id);
|
2005-05-17 14:43:00 +00:00
|
|
|
print '</td></tr></table>';
|
2005-10-06 08:21:14 +00:00
|
|
|
} ?>
|