mirrored from git://git.moodle.org/moodle.git
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
config_instance.html
176 lines (158 loc) · 6.73 KB
/
config_instance.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php // $Id$ //
require_once($CFG->libdir .'/rsslib.php');
$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);
/// Print tabs at top
$currentaction = optional_param('currentaction', '', PARAM_ALPHA);
if (empty($currentaction) || $currentaction == 'configblock') {
$currentaction = 'configblock';
} else {
$currentaction = 'managefeeds';
}
include('config_instance_tabs.php');
if ($currentaction == 'configblock') {
?>
<table cellpadding="9" cellspacing="0" class="blockconfigtable">
<tr valign="top">
<td align="right" width="50%">
<?php print_string('displaydescriptionlabel', 'block_rss_client') ?>
</td>
<td width="50%">
<?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>
<tr valign="top">
<td align="right" width="50%">
<?php print_string('shownumentrieslabel', 'block_rss_client') ?>
</td>
<td width="50%">
<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>
<tr valign="top">
<td align="right" width="50%">
<?php print_string('choosefeedlabel', 'block_rss_client') ?>
</td>
<td width="50%">
<?php
$selectedarray = array();
if (isset($this->config) && isset($this->config->rssid)) {
if (is_array($this->config->rssid)) {
// rssid is an array of rssids
$selectedarray = $this->config->rssid;
} else {
// rssid is a single rssid
$selectedarray = array($this->config->rssid);
}
}
global $USER;
if ($rssfeeds = get_records_select('block_rss_client', 'userid = '.$USER->id.' OR shared = 1')) {
foreach($rssfeeds as $rssfeed) {
if (!empty($rssfeed->preferredtitle)) {
$feedtitle = stripslashes_safe($rssfeed->preferredtitle);
} else {
$feedtitle = stripslashes_safe($rssfeed->title);
}
$checked = '';
if (in_array($rssfeed->id, $selectedarray)) {
$checked = 'checked';
}
$checkbox = '<input type="checkbox" name="rssid[]" id="rssid[]" value="'. $rssfeed->id .'" '. $checked .' />';
print $checkbox . $feedtitle .'<br />'."\n";
}
} else {
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
print_string('nofeeds', 'block_rss_client');
if (has_capability('block/rss_client:createprivatefeeds', $context)
|| has_capability('block/rss_client:createsharedfeeds', $context)) {
$addrsspage = $page->url_get_full(array('instanceid' => $this->instance->id,
'sesskey' => $USER->sesskey,
'blockaction' => 'config',
'currentaction' => 'managefeeds',
'id' => $id));
print ' <a href="'.$addrsspage.'">'. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
}
}
?>
</td>
</tr>
<tr valign="top">
<td align="right" width="50%"><?php print_string('uploadlabel'); ?></td>
<?php
$title = '';
if (!empty($this->config) && !empty($this->config->title)) {
$title = $this->config->title;
}
?>
<td width="50%"><input type="text" name="title" size="30" value="<?php echo $title; ?>" />
</td>
</tr>
<tr valign="top">
<td align="right" width="50%"><?php print_string('clientshowchannellinklabel', 'block_rss_client'); ?></td>
<td width="50%">
<?php
if (isset($this->config) && isset($this->config->block_rss_client_show_channel_link)) {
$selected = $this->config->block_rss_client_show_channel_link;
} 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>
<tr valign="top">
<td align="right" width="50%"><?php print_string('clientshowimagelabel', 'block_rss_client'); ?></td>
<td width="50%">
<?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>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<?php print_string('savechanges') ?>">
</td>
</tr>
</table>
<?php
} else {
global $act, $url, $rssid, $preferredtitle, $shared;
print '<table cellpadding="9" cellspacing="0" class="blockconfigtable">';
print '<tr valign="top"><td>';
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
rss_display_feeds($id, $USER->id, '', $context);
print '</form>'; //not sure that this is needed
rss_print_form($act, $url, $rssid, $preferredtitle, $shared, $id, $context);
print '</td></tr></table>';
}
?>