),
'recaptchapublickey' => new external_value(PARAM_RAW, 'Recaptcha public key', VALUE_OPTIONAL),
'recaptchachallengehash' => new external_value(PARAM_RAW, 'Recaptcha challenge hash', VALUE_OPTIONAL),
- 'recaptchachallengeimage' => new external_value(PARAM_URL, 'Recaptcha challenge <noscript> image', VALUE_OPTIONAL),
+ 'recaptchachallengeimage' => new external_value(PARAM_URL, 'Recaptcha challenge noscript image', VALUE_OPTIONAL),
'recaptchachallengejs' => new external_value(PARAM_URL, 'Recaptcha challenge js url', VALUE_OPTIONAL),
'warnings' => new external_warnings(),
)
*/
public static function initialise_test_instance(cache_definition $definition) {
$cache = new cachestore_dummy('Dummy store test');
- $cache->initialise($definition);
+ if ($cache->is_ready()) {
+ $cache->initialise($definition);
+ }
return $cache;
}
return ($this->definition !== null);
}
- /**
- * Returns true if this cache store instance is ready to use.
- * @return bool
- */
- public function is_ready() {
- // No set up is actually required, providing apc is installed and enabled.
- return true;
- }
-
/**
* Prepares the given key for use.
*
}
$name = 'APCu test';
$cache = new cachestore_apcu($name);
+ // No need to check if is_ready() as this has already being done by requirement check.
$cache->initialise($definition);
return $cache;
}
$name = 'File test';
$path = make_cache_directory('cachestore_file_test');
$cache = new cachestore_file($name, array('path' => $path));
- $cache->initialise($definition);
+ if ($cache->is_ready()) {
+ $cache->initialise($definition);
+ }
return $cache;
}
}
$store = new cachestore_memcache('Test memcache', $configuration);
- $store->initialise($definition);
+ if ($store->is_ready()) {
+ $store->initialise($definition);
+ }
return $store;
}
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcache', 'phpunit_test');
$instance = new cachestore_memcache('Memcache Test', cachestore_memcache::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
// Something prevented memcache store to be inited (extension, TEST_CACHESTORE_MEMCACHE_TESTSERVERS...).
$this->markTestSkipped();
}
+ $instance->initialise($definition);
$keys = array(
// Alphanumeric.
}
$store = new cachestore_memcached($name, $configuration);
- $store->initialise($definition);
+ // If store is ready then only initialise.
+ if ($store->is_ready()) {
+ $store->initialise($definition);
+ }
return $store;
}
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcached', 'phpunit_test');
$instance = new cachestore_memcached('Memcached Test', cachestore_memcached::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
// Something prevented memcached store to be inited (extension, TEST_CACHESTORE_MEMCACHED_TESTSERVERS...).
$this->markTestSkipped();
}
+ $instance->initialise($definition);
$keys = array(
// Alphanumeric.
set_config('testname', $testserver, 'cachestore_memcached');
set_config('testservers', $testserver, 'cachestore_memcached');
$checkinstance = cachestore_memcached::initialise_test_instance($definition);
- if (!$checkinstance) {
+ if (!$checkinstance->is_ready()) {
$this->markTestSkipped();
}
$checkinstances[] = $checkinstance;
// This generates a definition that has a hash starting with a number. MDL-46208.
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_mongodb', 'abc');
$instance = new cachestore_mongodb('MongoDB_Test', cachestore_mongodb::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
$this->markTestSkipped();
}
+ $instance->initialise($definition);
$this->assertTrue($instance->set(1, 'alpha'));
$this->assertTrue($instance->set(2, 'beta'));
if ($modes & cache_store::MODE_APPLICATION) {
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, $class, 'phpunit_test');
$instance = new $class($class.'_test', $class::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
$this->markTestSkipped('Could not test '.$class.'. No test instance configured for application caches.');
} else {
+ $instance->initialise($definition);
$this->run_tests($instance);
}
}
if ($modes & cache_store::MODE_SESSION) {
$definition = cache_definition::load_adhoc(cache_store::MODE_SESSION, $class, 'phpunit_test');
$instance = new $class($class.'_test', $class::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
$this->markTestSkipped('Could not test '.$class.'. No test instance configured for session caches.');
} else {
+ $instance->initialise($definition);
$this->run_tests($instance);
}
}
if ($modes & cache_store::MODE_REQUEST) {
$definition = cache_definition::load_adhoc(cache_store::MODE_REQUEST, $class, 'phpunit_test');
$instance = new $class($class.'_test', $class::unit_test_configuration());
- $instance->initialise($definition);
if (!$instance->is_ready()) {
$this->markTestSkipped('Could not test '.$class.'. No test instance configured for request caches.');
} else {
+ $instance->initialise($definition);
$this->run_tests($instance);
}
}
}
// Add search form.
-$search = html_writer::start_tag('form', array('id'=>'searchcohortquery', 'method'=>'get'));
-$search .= html_writer::start_tag('div');
-$search .= html_writer::label(get_string('searchcohort', 'cohort'), 'cohort_search_q'); // No : in form labels!
-$search .= html_writer::empty_tag('input', array('id'=>'cohort_search_q', 'type'=>'text', 'name'=>'search', 'value'=>$searchquery));
-$search .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('search', 'cohort')));
+$search = html_writer::start_tag('form', array('id'=>'searchcohortquery', 'method'=>'get', 'class' => 'form-inline'));
+$search .= html_writer::start_div('m-b-1');
+$search .= html_writer::label(get_string('searchcohort', 'cohort'), 'cohort_search_q', true,
+ array('class' => 'm-r-1')); // No : in form labels!
+$search .= html_writer::empty_tag('input', array('id' => 'cohort_search_q', 'type' => 'text', 'name' => 'search',
+ 'value' => $searchquery, 'class' => 'form-control m-r-1'));
+$search .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('search', 'cohort'),
+ 'class' => 'btn btn-secondary'));
$search .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'contextid', 'value'=>$contextid));
$search .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'showall', 'value'=>$showall));
-$search .= html_writer::end_tag('div');
+$search .= html_writer::end_div();
$search .= html_writer::end_tag('form');
echo $search;
$url = new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id, 'pageid'=>$pageid));
}
- $lessoncontent .= html_writer::link($url, get_string('reviewlesson', 'lesson'), array('class' => 'centerpadded lessonbutton standardbutton'));
+ $lessoncontent .= html_writer::link($url, get_string('reviewlesson', 'lesson'),
+ array('class' => 'centerpadded lessonbutton standardbutton p-r-1'));
} elseif ($lesson->modattempts && $canmanage) {
$lessoncontent .= $lessonoutput->paragraph(get_string("modattemptsnoteacher", "lesson"), 'centerpadded');
}
}
$url = new moodle_url('/course/view.php', array('id'=>$course->id));
- $lessoncontent .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)), array('class'=>'centerpadded lessonbutton standardbutton'));
+ $lessoncontent .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)),
+ array('class' => 'centerpadded lessonbutton standardbutton p-r-1'));
if (has_capability('gradereport/user:view', context_course::instance($course->id))
&& $course->showgrades && $lesson->grade != 0 && !$lesson->practice) {
$url = new moodle_url('/grade/index.php', array('id' => $course->id));
$lessoncontent .= html_writer::link($url, get_string('viewgrades', 'lesson'),
- array('class' => 'centerpadded lessonbutton standardbutton'));
+ array('class' => 'centerpadded lessonbutton standardbutton p-r-1'));
}
lesson_add_fake_blocks($PAGE, $cm, $lesson, $timer);
'action' => $CFG->wwwroot.'/mod/scorm/player.php'));
if ($scorm->hidebrowse == 0) {
print_string('mode', 'scorm');
- echo ': '.html_writer::empty_tag('input', array('type' => 'radio', 'id' => 'b', 'name' => 'mode', 'value' => 'browse')).
+ echo ': '.html_writer::empty_tag('input', array('type' => 'radio', 'id' => 'b', 'name' => 'mode',
+ 'value' => 'browse', 'class' => 'm-r-1')).
html_writer::label(get_string('browse', 'scorm'), 'b');
echo html_writer::empty_tag('input', array('type' => 'radio',
'id' => 'n', 'name' => 'mode',
- 'value' => 'normal', 'checked' => 'checked')).
+ 'value' => 'normal', 'checked' => 'checked',
+ 'class' => 'm-x-1')).
html_writer::label(get_string('normal', 'scorm'), 'n');
} else {
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'scoid', 'value' => $scorm->launch));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cm', 'value' => $cm->id));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'currentorg', 'value' => $orgidentifier));
- echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('enter', 'scorm')));
+ echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('enter', 'scorm'),
+ 'class' => 'btn btn-primary'));
echo html_writer::end_tag('form');
echo html_writer::end_div();
}
get_string('selectnone', 'scorm'));
echo ' ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
- 'value' => get_string('deleteselected', 'scorm')));
+ 'value' => get_string('deleteselected', 'scorm'),
+ 'class' => 'btn btn-secondary'));
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
// Close form.
echo \html_writer::end_tag('div');
get_string('selectnone', 'scorm'));
echo ' ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
- 'value' => get_string('deleteselected', 'scorm')));
+ 'value' => get_string('deleteselected', 'scorm'),
+ 'class' => 'btn btn-secondary'));
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
// Close form.
echo \html_writer::end_tag('div');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'ODS') + $displayoptions),
- get_string('downloadods'));
+ get_string('downloadods'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'Excel') + $displayoptions),
- get_string('downloadexcel'));
+ get_string('downloadexcel'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'CSV') + $displayoptions),
- get_string('downloadtext'));
+ get_string('downloadtext'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo \html_writer::end_tag('td');
get_string('selectnone', 'scorm'));
echo ' ';
echo \html_writer::empty_tag('input', array('type' => 'submit',
- 'value' => get_string('deleteselected', 'scorm')));
+ 'value' => get_string('deleteselected', 'scorm'),
+ 'class' => 'btn btn-secondary'));
echo \html_writer::end_tag('td').\html_writer::end_tag('tr').\html_writer::end_tag('table');
// Close form.
echo \html_writer::end_tag('div');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'ODS') + $displayoptions),
- get_string('downloadods'));
+ get_string('downloadods'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'Excel') + $displayoptions),
- get_string('downloadexcel'));
+ get_string('downloadexcel'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo $OUTPUT->single_button(new \moodle_url($PAGE->url,
array('download' => 'CSV') + $displayoptions),
- get_string('downloadtext'));
+ get_string('downloadtext'),
+ 'post',
+ ['class' => 'm-t-1']);
echo \html_writer::end_tag('td');
echo \html_writer::start_tag('td');
echo \html_writer::end_tag('td');
* @param moodleform $mform instance of the moodleform class
*/
public function edit_field_set_default($mform) {
- if (!empty($default)) {
+ if (!empty($this->field->defaultdata)) {
$mform->setDefault($this->inputname, $this->field->defaultdata);
}
}
$paramdesc .= html_writer::start_tag('i', array());
$paramdesc .= "//";
- $paramdesc .= $params->desc;
+ $paramdesc .= s($params->desc);
$paramdesc .= html_writer::end_tag('i');
$documentationhtml .= html_writer::start_tag('div',
array('style' => 'border:solid 1px #DEDEDE;background:#E2E0E0;
color:#222222;padding:4px;'));
- $documentationhtml .= $description->description;
+ $documentationhtml .= s($description->description);
$documentationhtml .= html_writer::end_tag('div');
$documentationhtml .= $br . $br;
$documentationhtml .= " (" . $required . ")"; // argument is required or optional ?
$documentationhtml .= $br;
$documentationhtml .= " "
- . $paramdesc->desc; // argument description
+ . s($paramdesc->desc); // Argument description.
$documentationhtml .= $br . $br;
// general structure of the argument
$documentationhtml .= $this->colored_box_with_pre_tag(