|
53 | 53 | $body = "You need to log in as a teacher to access this page";
|
54 | 54 | } else { // PERMISSIONS ARE OK, PROCEED WITH PROCESSING
|
55 | 55 |
|
56 |
| - if (isset($_POST['submit']) && $_POST['submit']=="Unenroll") { |
| 56 | + if (isset($_POST['posted']) && $_POST['posted']=="Unenroll") { |
57 | 57 | $_GET['action'] = "unenroll";
|
58 | 58 | }
|
59 |
| - if (isset($_POST['submit']) && $_POST['submit']=="Lock") { |
| 59 | + if (isset($_POST['posted']) && $_POST['posted']=="Lock") { |
60 | 60 | $_GET['action'] = "lock";
|
61 | 61 | }
|
62 | 62 | if (isset($_POST['lockinstead'])) {
|
|
192 | 192 | exit;
|
193 | 193 | }
|
194 | 194 | }
|
195 |
| - } elseif (isset($_POST['submit']) && $_POST['submit']=="Copy Emails") { |
| 195 | + } elseif (isset($_POST['posted']) && $_POST['posted']=="Copy Emails") { |
196 | 196 | $curBreadcrumb .= " <a href=\"listusers.php?cid=$cid\">Roster</a> > Copy Emails\n";
|
197 | 197 | $pagetitle = "Copy Student Emails";
|
198 | 198 | if (!empty($_POST['checked'])) {
|
|
382 | 382 |
|
383 | 383 | }
|
384 | 384 |
|
385 |
| - } elseif ((isset($_POST['submit']) && ($_POST['submit']=="E-mail" || $_POST['submit']=="Message"))|| isset($_GET['masssend'])) { |
| 385 | + } elseif ((isset($_POST['posted']) && ($_POST['posted']=="E-mail" || $_POST['posted']=="Message"))|| isset($_GET['masssend'])) { |
386 | 386 | $calledfrom='lu';
|
387 | 387 | $overwriteBody = 1;
|
388 | 388 | $fileToInclude = "masssend.php";
|
389 |
| - } elseif ((isset($_POST['submit']) && $_POST['submit']=="Make Exception") || isset($_GET['massexception'])) { |
| 389 | + } elseif ((isset($_POST['posted']) && $_POST['posted']=="Make Exception") || isset($_GET['massexception'])) { |
390 | 390 | $calledfrom='lu';
|
391 | 391 | $overwriteBody = 1;
|
392 | 392 | $fileToInclude = "massexception.php";
|
|
404 | 404 | $overwriteBody = 1;
|
405 | 405 | $fileToInclude = "lockstu.php";
|
406 | 406 |
|
| 407 | + } elseif (isset($_POST['posted']) && $_POST['posted']=="Unlock") { |
| 408 | + $calledfrom='lu'; |
| 409 | + require_once('lockstu.php'); |
| 410 | + exit; |
407 | 411 | } elseif (isset($_POST['action']) && $_POST['action']=="lockone" && is_numeric($_POST['uid'])) {
|
408 | 412 | $now = time();
|
409 | 413 | $stm = $DBH->prepare("UPDATE imas_students SET locked=:locked WHERE courseid=:courseid AND userid=:userid");
|
@@ -534,6 +538,16 @@ function postRosterForm(uid,action) {
|
534 | 538 | .append($("<input>", {name:"uid", value:uid, type:"hidden"}))
|
535 | 539 | .appendTo("body").submit();
|
536 | 540 | }
|
| 541 | + function postWithSelform(val) { |
| 542 | + $("#qform").append($("<input>", {name:"posted", value:val, type:"hidden"})).submit(); |
| 543 | + } |
| 544 | + function copyemails() { |
| 545 | + var ids = []; |
| 546 | + $("#myTable input:checkbox:checked").each(function(i) { |
| 547 | + ids.push(this.value); |
| 548 | + }); |
| 549 | + GB_show("Emails","viewemails.php?cid="+cid+"&ids="+ids.join("-"),500,500); |
| 550 | + } |
537 | 551 | </script>';
|
538 | 552 |
|
539 | 553 | require_once "../header.php";
|
@@ -617,7 +631,7 @@ function postRosterForm(uid,action) {
|
617 | 631 | <?php
|
618 | 632 | require_once "../includes/newusercommon.php";
|
619 | 633 | showNewUserValidation("pageform");
|
620 |
| - } elseif (isset($_POST['submit']) && $_POST['submit']=="Copy Emails") { |
| 634 | + } elseif (isset($_POST['posted']) && $_POST['posted']=="Copy Emails") { |
621 | 635 | if (empty($_POST['checked'])) {
|
622 | 636 | echo "No student selected. <a href=\"listusers.php?cid=$cid\">Try again</a>";
|
623 | 637 | } else {
|
@@ -767,24 +781,29 @@ function chgrmode() {
|
767 | 781 | echo '</p>';
|
768 | 782 | ?>
|
769 | 783 | <form id="qform" method=post action="listusers.php?cid=<?php echo $cid ?>">
|
770 |
| - <p>Check: <a href="#" onclick="return chkAllNone('qform','checked[]',true)">All</a> <a href="#" onclick="return chkAllNone('qform','checked[]',true,'locked')">Non-locked</a> <a href="#" onclick="return chkAllNone('qform','checked[]',false)">None</a> |
771 |
| - With Selected: |
772 |
| - <?php |
773 |
| - if (!isset($CFG['GEN']['noEmailButton'])) { |
774 |
| - echo '<input type=submit name=submit value="E-mail" title="Send e-mail to the selected students">'; |
775 |
| - } |
776 |
| - ?> |
777 |
| - <input type=submit name=submit value="Message" title="Send a message to the selected students"> |
778 |
| - <input type=submit name=submit value="Lock" title="Lock selected students out of the course"> |
779 |
| - <input type=submit name=submit value="Make Exception" title="Make due date exceptions for selected students"> |
780 |
| - <input type=submit name=submit value="Copy Emails" title="Get copyable list of email addresses for selected students"> |
781 |
| - <?php |
782 |
| - if (!isset($CFG['GEN']['noInstrUnenroll'])) { |
783 |
| - echo '<input type=submit name=submit value="Unenroll" title="Unenroll the selected students">'; |
784 |
| - } |
785 |
| - ?> |
786 |
| - </p> |
| 784 | + <?php |
| 785 | + echo _('Check:'), ' <a href="#" onclick="return chkAllNone(\'qform\',\'checked[]\',true)">', _('All'), '</a> <a href="#" onclick="return chkAllNone(\'qform\',\'checked[]\',true,\'locked\')">', _('Non-locked'), '</a> <a href="#" onclick="return chkAllNone(\'qform\',\'checked[]\',false)">', _('None'), '</a> '; |
| 786 | + echo '<span class="dropdown">'; |
| 787 | + echo ' <a tabindex=0 class="dropdown-toggle arrow-down" id="dropdownMenuWithsel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'; |
| 788 | + echo _('With Selected').'</a>'; |
| 789 | + echo '<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenuWithsel">'; |
| 790 | + echo ' <li><a href="#" onclick="postWithSelform(\'Message\');return false;" title="',_("Send a message to the selected students"),'">', _('Message'), "</a></li>"; |
| 791 | + if (!isset($CFG['GEN']['noEmailButton'])) { |
| 792 | + echo ' <li><a href="#" onclick="postWithSelform(\'E-mail\');return false;" title="',_("Send e-mail to the selected students"),'">', _('E-mail'), "</a></li>"; |
| 793 | + } |
| 794 | + echo ' <li><a href="#" onclick="copyemails();return false;" title="',_("Copy e-mail addresses of the selected students"),'">', _('Copy E-mails'), "</a></li>"; |
| 795 | + echo ' <li><a href="#" onclick="postWithSelform(\'Make Exception\');return false;" title="',_("Make due date exceptions for selected students"),'">',_('Make Exception'), "</a></li>"; |
| 796 | + echo ' <li><a href="#" onclick="postWithSelform(\'Lock\');return false;" title="',_("Lock selected students out of the course"),'">', _('Lock'), "</a></li>"; |
| 797 | + echo ' <li><a href="#" onclick="postWithSelform(\'Unlock\');return false;" title="',_("Un-Lock selected students from the course"),'">', _('Un-Lock'), "</a></li>"; |
| 798 | + |
| 799 | + if (!isset($CFG['GEN']['noInstrUnenroll'])) { |
| 800 | + echo '<li role="separator" class="divider"></li>'; |
| 801 | + echo ' <li><a href="#" onclick="postWithSelform(\'Unenroll\');return false;" title="',_("Unenroll the selected students"),'">', _('Unenroll'), "</a></li>"; |
| 802 | + } |
787 | 803 |
|
| 804 | + echo '</ul></span>'; |
| 805 | + ?> |
| 806 | + |
788 | 807 | <table class=gb id=myTable>
|
789 | 808 | <caption class="sr-only">Roster</caption>
|
790 | 809 | <thead>
|
|
0 commit comments