Skip to content
Snippets Groups Projects
Commit 14dfe99d authored by Matti Harjula's avatar Matti Harjula
Browse files

Add some new things for the dependency checker to find.

parent bf6c579d
Branches
No related tags found
No related merge requests found
......@@ -79,6 +79,13 @@ echo $OUTPUT->single_button(
echo $OUTPUT->single_button(
new moodle_url($PAGE->url, array('script' => 1, 'sesskey' => sesskey())),
'Find "<script"');
echo $OUTPUT->single_button(
new moodle_url($PAGE->url, array('PLUGINFILE' => 1, 'sesskey' => sesskey())),
'Find "@@PLUGINFILE@@"');
echo $OUTPUT->single_button(
new moodle_url($PAGE->url, array('langs' => 1, 'sesskey' => sesskey())),
'Find "langs"');
if (data_submitted() && optional_param('includes', false, PARAM_BOOL)) {
/*
......@@ -178,6 +185,41 @@ if (data_submitted() && optional_param('script', false, PARAM_BOOL)) {
echo '</tbody></table>';
}
if (data_submitted() && optional_param('PLUGINFILE', false, PARAM_BOOL)) {
/*
* @@PLUGINFILE@@ present in the question
*/
$qs = $DB->get_recordset_sql('SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE q.id = o.questionid AND q.hidden = 0 AND ' . $DB->sql_like('o.compiledcache', ':trg') . ';', ['trg' => '%@@PLUGINFILE@@%']);
echo '<h4>Questions containing attached files handled by Moodle</h4>';
echo '<table><thead><tr><th>Question</th></thead><tbody>';
// Load the whole question, simpler to get the contexts correct that way.
foreach ($qs as $item) {
$q = question_bank::load_question($item->questionid);
list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($q);
echo "<tr><td>" . $q->name . ' ' . $OUTPUT->action_icon(question_preview_url($item->questionid, null, null, null, null, $context),
new pix_icon('t/preview', get_string('preview'))) . '</td></tr>';
}
echo '</tbody></table>';
}
if (data_submitted() && optional_param('langs', false, PARAM_BOOL)) {
/*
* Questions that have localisation.
*/
$qs = $DB->get_recordset_sql('SELECT q.id as questionid FROM {question} q, {qtype_stack_options} o WHERE q.id = o.questionid AND q.hidden = 0 AND ' . $DB->sql_like('o.compiledcache', ':trg') . ' AND NOT ' . $DB->sql_like('o.compiledcache', ':other') . ';', ['trg' => '%"langs":[%','other' => '%"langs":[]%']);
echo '<h4>Questions containing that have localisation using means we understand.</h4>';
echo '<table><thead><tr><th>Question</th><th>Langs</th></thead><tbody>';
// Load the whole question, simpler to get the contexts correct that way.
foreach ($qs as $item) {
$q = question_bank::load_question($item->questionid);
list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($q);
echo "<tr><td>" . $q->name . ' ' . $OUTPUT->action_icon(question_preview_url($item->questionid, null, null, null, null, $context),
new pix_icon('t/preview', get_string('preview'))) . '</td><td>';
echo implode(', ', $q->get_cached('langs'));
echo '</td></tr>';
}
echo '</tbody></table>';
}
echo $OUTPUT->footer();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment