if (!during_initial_install()) {
$temp->add(new admin_setting_configselect('creatornewroleid', get_string('creatornewroleid', 'admin'),
- get_string('configcreatornewroleid', 'admin'), $defaultteacherid, $creatornewroles));
+ get_string('creatornewroleid_help', 'admin'), $defaultteacherid, $creatornewroles));
}
$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
$groupmembers = "";
$groupselect = "";
- $rafrom = "";
- $rawhere = "";
$params = array();
//Add this to the SQL to show only group users
$params = array_merge($params, $eparams);
$sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY $userfields
ORDER BY lastaccess DESC";
$csql = "SELECT u.id
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY u.id";
$params['courseid'] = $this->page->course->id;
$modules = array();
foreach ($allmodules as $key=>$module) {
$modname = $module->name;
+ if ($modname === 'label') {
+ continue;
+ }
$libfile = "$CFG->dirroot/mod/$modname/lib.php";
if (!file_exists($libfile)) {
continue;
$string['configcourserequestnotify'] = 'Type username of user to be notified when new course requested.';
$string['configcourserequestnotify2'] = 'Users who will be notified when a course is requested. Only users who can approve course requests are listed here.';
$string['configcoursesperpage'] = 'Enter the number of courses to be display per page in a course listing.';
-$string['configcreatornewroleid'] = 'This role is automatically assigned to creators in new courses they created. This role is not assigned if creator already has needed capabilities in parent context.';
$string['configcronclionly'] = 'If this is set, then the cron script can only be run from the command line instead of via the web. This overrides the cron password setting below.';
$string['configcronremotepassword'] = 'This means that the cron.php script cannot be run from a web browser without supplying the password using the following form of URL:<pre>
http://site.example.com/admin/cron.php?password=opensesame
$string['courses'] = 'Courses';
$string['coursesperpage'] = 'Courses per page';
$string['creatornewroleid'] = 'Creators\' role in new courses';
+$string['creatornewroleid_help'] = 'If the user does not already have the permission to manage the new course, the user is automatically enrolled using this role.';
$string['cron'] = 'Cron';
$string['cron_help'] = 'The cron.php maintenance script assists some of Moodle\'s modules to perform tasks on a scheduled basis, such as mailing out copies of new forum posts. A mechanism is required to run the script regularly e.g. every 5 minutes.';
$string['cron_link'] = 'admin/cron';
die();
}
+$roamingusers = get_users_by_capability(get_system_context(), 'moodle/site:mnetlogintoremote', 'u.id');
+if (empty($roamingusers)) {
+ $capname = get_string('site:mnetlogintoremote', 'role');
+ $url = new moodle_url('/admin/roles/manage.php');
+ echo notice(get_string('noroamingusers', 'mnetservice_enrol', $capname), $url);
+}
+unset($roamingusers);
+
// remote hosts that may publish remote enrolment service and we are subscribed to it
$hosts = $service->get_remote_publishers();
$string['hostname'] = 'Host name';
$string['hosturl'] = 'Remote host URL';
$string['nopublishers'] = 'No remote peers available.';
+$string['noroamingusers'] = 'Users require the capability \'{$a}\' in the system context to be enrolled to remote courses, however there are currently no users with this capability. Click the continue button to assign the required capability to one or more roles on your site.';
$string['otherenrolledusers'] = 'Other enrolled users';
$string['pluginname'] = 'Remote enrolment service';
$string['refetch'] = 'Re-fetch up to date state from remote hosts';
$systemcontext = get_system_context();
$userids = get_users_by_capability($systemcontext, 'moodle/site:mnetlogintoremote', 'u.id');
+ if (empty($userids)) {
+ return array();
+ }
+
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid0000');
list($wherecondition, $params) = $this->search_sql($search, 'u');
*
* @return array
*/
-function lable_get_extra_capabilities() {
+function label_get_extra_capabilities() {
return array('moodle/site:accessallgroups');
}
SELECT qg.quiz, qg.grade
FROM {quiz_grades} qg
JOIN {quiz} q ON q.id = qg.quiz
- WHERE q.course = ?',
- $course->id);
+ WHERE q.course = ? AND qg.userid = ?',
+ array($course->id, $USER->id));
}
$table = new html_table();
}
} else {
// all users who can attempt scoes and who are in the currently selected group
- if (!$groupstudents = get_users_by_capability($context, 'mod/scorm:savetrack','','','','',$currentgroup,'',false)){
+ if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack','','','','',$currentgroup,'',false)){
echo $OUTPUT->notification(get_string('nostudentsingroup'));
$nostudents = true;
$groupstudents = array();
list($answer, $wrongfeedback, $rightfeedback) =
$this->split_truefalse_comment($answertext, $question->questiontextformat);
- if ($answer == "T" OR $answer == "TRUE") {
+ if ($answer['text'] == "T" OR $answer['text'] == "TRUE") {
$question->correctanswer = 1;
$question->feedbacktrue = $rightfeedback;
$question->feedbackfalse = $wrongfeedback;
$this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
}
+ public function test_import_truefalse_true_answer1() {
+ $gift = "// name 0-11
+::2-08 TSL::TSL is blablabla.{T}";
+ $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
+
+ $importer = new qformat_gift();
+ $q = $importer->readquestion($lines);
+
+ $expectedq = (object) array(
+ 'name' => '2-08 TSL',
+ 'questiontext' => "TSL is blablabla.",
+ 'questiontextformat' => FORMAT_MOODLE,
+ 'generalfeedback' => '',
+ 'generalfeedbackformat' => FORMAT_MOODLE,
+ 'qtype' => 'truefalse',
+ 'defaultgrade' => 1,
+ 'penalty' => 1,
+ 'length' => 1,
+ 'correctanswer' => 1,
+ 'feedbacktrue' => array(
+ 'text' => '',
+ 'format' => FORMAT_MOODLE,
+ 'files' => array(),
+ ),
+ 'feedbackfalse' => array(
+ 'text' => '',
+ 'format' => FORMAT_MOODLE,
+ 'files' => array(),
+ ),
+ );
+
+ $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
+ }
+
+ public function test_import_truefalse_true_answer2() {
+ $gift = "// name 0-11
+::2-08 TSL::TSL is blablabla.{TRUE}";
+ $lines = preg_split('/[\\n\\r]/', str_replace("\r\n", "\n", $gift));
+
+ $importer = new qformat_gift();
+ $q = $importer->readquestion($lines);
+
+ $expectedq = (object) array(
+ 'name' => '2-08 TSL',
+ 'questiontext' => "TSL is blablabla.",
+ 'questiontextformat' => FORMAT_MOODLE,
+ 'generalfeedback' => '',
+ 'generalfeedbackformat' => FORMAT_MOODLE,
+ 'qtype' => 'truefalse',
+ 'defaultgrade' => 1,
+ 'penalty' => 1,
+ 'length' => 1,
+ 'correctanswer' => 1,
+ 'feedbacktrue' => array(
+ 'text' => '',
+ 'format' => FORMAT_MOODLE,
+ 'files' => array(),
+ ),
+ 'feedbackfalse' => array(
+ 'text' => '',
+ 'format' => FORMAT_MOODLE,
+ 'files' => array(),
+ ),
+ );
+
+ $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q);
+ }
+
public function test_export_truefalse() {
$qdata = (object) array(
'id' => 666 ,
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
global $QTYPES, $CFG, $USER, $OUTPUT, $PAGE;
- static $overlibdivoutput = false;
- if (!$overlibdivoutput) {
- echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
- $overlibdivoutput = true;
- }
-
$readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
$disabled = empty($options->readonly) ? '' : 'disabled="disabled"';
$formatoptions = new stdClass;