Permalink
Browse files

Editing teacher can now subscribe users to a forum, see http://moodle…

  • Loading branch information...
1 parent b3d3ca5 commit 90e7063e45d7a049c5ba2e47e59a9abc8fbe7728 gustav_delius committed Aug 15, 2004
Showing with 323 additions and 70 deletions.
  1. +2 −0 lang/en/forum.php
  2. +19 −0 mod/forum/lib.php
  3. +80 −0 mod/forum/subscriber.html
  4. +222 −70 mod/forum/subscribers.php
View
@@ -43,6 +43,7 @@
$string['emptymessage'] = 'Something was wrong with your post. Perhaps you left it blank, or the attachment was too big. Your changes have NOT been saved.';
$string['everyonecanchoose'] = 'Everyone can choose to be subscribed';
$string['everyoneissubscribed'] = 'Everyone is subscribed to this forum';
+$string['existingsubscribers'] = 'Existing subscribers';
$string['forcesubscribe'] = 'Force everyone to be subscribed';
$string['forcesubscribeq'] = 'Force everyone to be subscribed?';
$string['forum'] = 'Forum';
@@ -101,6 +102,7 @@
$string['posts'] = 'Posts';
$string['posttoforum'] = 'Post to forum';
$string['postupdated'] = 'Your post was updated';
+$string['potentialsubscribers'] = 'Potential subscribers';
$string['processingpost'] = 'Processing post $a';
$string['processingdigest'] = 'Processing email digest for user $a';
$string['prune'] = 'Split';
View
@@ -2809,4 +2809,23 @@ function forum_change_discussionid($postid, $discussionid) {
return true;
}
+function forum_update_subscriptions_button($courseid, $forumid) {
+// Prints the editing button on subscribers page
+ global $CFG, $USER;
+
+ if (isteacheredit($courseid)) {
+ if (!empty($USER->subscriptionsediting)) {
+ $string = get_string("turneditingoff");
+ $edit = "off";
+ } else {
+ $string = get_string("turneditingon");
+ $edit = "on";
+ }
+ return "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/mod/forum/subscribers.php\">".
+ "<input type=\"hidden\" name=\"id\" value=\"$forumid\" />".
+ "<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
+ "<input type=\"submit\" value=\"$string\" /></form>";
+ }
+}
+
?>
@@ -0,0 +1,80 @@
+
+<form name="subscriberform" id="subscriberform" method="post" action="subscribers.php">
+<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>">
+<input type="hidden" name="id" value="<?php echo $id?>">
+ <table align="center" border="0" cellpadding="5" cellspacing="0">
+ <tr>
+ <td valign="top">
+ <?php echo count($subscribers) . " ". $strexistingsubscribers ?>
+ </td>
+ <td></td>
+ <td valign="top">
+ <?php echo $usercount . " " . $strpotentialsubscribers ?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <select name="removeselect[]" size="20" id="removeselect" multiple
+ onFocus="document.subscriberform.add.disabled=true;
+ document.subscriberform.remove.disabled=false;
+ document.subscriberform.addselect.selectedIndex=-1;">
+ <?php
+ foreach ($subscribers as $subscriber) {
+ $fullname = fullname($subscriber, true);
+ echo "<option value=\"$subscriber->id\">".$fullname.", ".$subscriber->email."</option>\n";
+ }
+ ?>
+
+ </select></td>
+ <td valign="top">
+ <br />
+ <input name="add" type="submit" id="add" value="&larr;" />
+ <br />
+ <input name="remove" type="submit" id="remove" value="&rarr;" />
+ <br />
+ </td>
+ <td valign="top">
+ <select name="addselect[]" size="20" id="addselect" multiple
+ onFocus="document.subscriberform.add.disabled=false;
+ document.subscriberform.remove.disabled=true;
+ document.subscriberform.removeselect.selectedIndex=-1;">
+ <?php
+ if (!empty($searchusers)) {
+ echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
+ foreach ($searchusers as $user) {
+ $fullname = fullname($user, true);
+ echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+ }
+ echo "</optgroup>\n";
+ }
+ if (!empty($users)) {
+ foreach ($users as $user) {
+ $fullname = fullname($user, true);
+ echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+ }
+ }
+ ?>
+ </select>
+ <br />
+ <input type="text" name="searchtext" size="30" value="<?php echo $searchtext ?>"
+ onFocus ="document.subscriberform.add.disabled=true;
+ document.subscriberform.remove.disabled=true;
+ document.subscriberform.removeselect.selectedIndex=-1;
+ document.subscriberform.addselect.selectedIndex=-1;"
+ onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
+ if (keyCode == 13) {
+ document.subscriberform.previoussearch.value=1;
+ document.subscriberform.submit();
+ } " />
+ <input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
+ <?php
+ if (!empty($searchusers)) {
+ echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+</form>
+
+
Oops, something went wrong. Retry.

0 comments on commit 90e7063

Please sign in to comment.