Skip to content

Commit

Permalink
fixed import coding style and use html_writer whenever html tags need…
Browse files Browse the repository at this point in the history
… to be written
  • Loading branch information
dionysius committed Feb 4, 2019
1 parent 89a55c7 commit 332ba77
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions attempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once(dirname(__FILE__) . '/locallib.php');
require_once(__DIR__ . '/locallib.php');

// Get parameters.
$cmid = required_param('cmid', PARAM_INT);
Expand Down Expand Up @@ -217,7 +217,7 @@
$html .= html_writer::start_tag('form', array('method' => 'post', 'action' => $actionurl,
'enctype' => 'multipart/form-data', 'id' => 'responseform'));

$html .= '<input type="hidden" class="cmid_field" name="cmid" value="' . $cmid . '" />';
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cmid', 'value' => $cmid, 'class' => 'cmid_field'));

// Output the question.
$html .= $questionusage->render_question($slot, $options, (string)$slot);
Expand Down
6 changes: 3 additions & 3 deletions classes/question/bank/question_bank_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot.'/lib/formslib.php');
require_once($CFG->dirroot.'/user/filters/text.php');
require_once($CFG->dirroot.'/user/filters/date.php');
require_once($CFG->dirroot . '/lib/formslib.php');
require_once($CFG->dirroot . '/user/filters/text.php');
require_once($CFG->dirroot . '/user/filters/date.php');

/**
* Question bank filter form intance
Expand Down
8 changes: 4 additions & 4 deletions classes/question/bank/studentquiz_bank_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function process_actions_needing_ui() {
if (optional_param('deleteselected', false, PARAM_BOOL)) {
// Add an explanation about questions in use.
if ($inuse) {
$questionnames .= '<br />'.get_string('questionsinuse', 'question');
$questionnames .= \html_writer::empty_tag('br').get_string('questionsinuse', 'question');
}

$deleteurl = new \moodle_url($baseurl, array('deleteselected' => $questionlist, 'confirm' => md5($questionlist),
Expand All @@ -361,7 +361,7 @@ public function process_actions_needing_ui() {
} else if (optional_param('approveselected', false, PARAM_BOOL)) {
// Add an explanation about questions in use.
if ($inuse) {
$questionnames .= '<br />'.get_string('questionsinuse', 'studentquiz');
$questionnames .= \html_writer::empty_tag('br').get_string('questionsinuse', 'studentquiz');
}

$approveurl = new \moodle_url($baseurl, array('approveselected' => $questionlist, 'confirm' => md5($questionlist),
Expand Down Expand Up @@ -549,7 +549,7 @@ protected function display_question_list($contexts, $pageurl, $categoryandcontex

protected function display_question_list_rows() {
$output = '';
$output .= '<div class="categoryquestionscontainer">';
$output .= \html_writer::start_div('categoryquestionscontainer');
ob_start();
$this->start_table();
$rowcount = 0;
Expand All @@ -561,7 +561,7 @@ protected function display_question_list_rows() {
$this->end_table();
$output .= ob_get_contents();
ob_end_clean();
$output .= "</div>\n";
$output .= \html_writer::end_div();
return $output;
}

Expand Down
2 changes: 1 addition & 1 deletion db/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

defined('MOODLE_INTERNAL') || die();

require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot . '/course/lib.php');
require_once(__DIR__ . '/../lib.php');

/**
Expand Down
4 changes: 2 additions & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

defined('MOODLE_INTERNAL') || die();

require_once(dirname(__DIR__) . '/locallib.php');
require_once(__DIR__ . '/../locallib.php');

/**
* Execute StudentQuiz upgrade from the given old version
Expand Down Expand Up @@ -321,7 +321,7 @@ function xmldb_studentquiz_upgrade($oldversion) {
// Update capabilities list and permission types, to make sure the defaults are set after this upgrade.
if ($oldversion < 2017112602) {
// Load current access definition for easier iteration.
require_once(dirname(__DIR__) . '/db/access.php');
require_once(__DIR__ . '/../db/access.php');
// Load all contexts this has to be defined.
// Only system context needed, as by default it's inherited from there.
// if someone did make an override, it's intentional.
Expand Down
10 changes: 5 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__ .'/lib.php');
require_once(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/lib.php');

$id = required_param('id', PARAM_INT);
if (!$course = $DB->get_record('course', array('id' => $id))) {
Expand Down Expand Up @@ -95,10 +95,10 @@
// Link to the instance.
$class = '';
if (!$studentquiz->visible) {
$class = ' class="dimmed"';
$class = 'dimmed';
}
$data[] = "<a$class href=\"view.php?id=$studentquiz->coursemodule\">" .
format_string($studentquiz->name, true) . '</a>';
$data[] = html_writer::tag('a', format_string($studentquiz->name, true), array(
'href' => "view.php?id=" . $studentquiz->coursemodule, 'class' => $class));

$table->data[] = $data;
} // End of loop over studentquiz instances.
Expand Down
2 changes: 1 addition & 1 deletion migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/viewlib.php');
require_once(__DIR__ . '/renderer.php');

Expand Down
2 changes: 1 addition & 1 deletion preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
if ($question) {
echo html_writer::start_tag('form', array('method' => 'post', 'action' => $actionurl,
'enctype' => 'multipart/form-data', 'id' => 'responseform'));
echo '<input type="hidden" class="cmid_field" name="cmid" value="' . $cmid . '" />';
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cmid', 'value' => $cmid, 'class' => 'cmid_field'));

echo $quba->render_question($slot, $options, 'i');

Expand Down
2 changes: 1 addition & 1 deletion questionbank.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

define('AJAX_SCRIPT', true);

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__ . '/../../config.php');
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
require_once($CFG->dirroot . '/question/editlib.php');

Expand Down
6 changes: 3 additions & 3 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ public function render_progress_bar($info, $texttotal=null, $bicolor=false) {
$percentone = round(100 * ($info->one / $info->total));

if (!empty($texttotal)) {
$text = '<text xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif"'
.' font-size="12" font-weight="bold" id="svg_text" x="50%" y="50%" alignment-baseline="middle"'
.' text-anchor="middle" stroke-width="0" stroke="#000" fill="#000000">' . $texttotal . '</text>';
$text = html_writer::tag('text', $texttotal, array('xml:space' => 'preserve', 'text-anchor' => 'start', 'font-family' => 'Helvetica, Arial, sans-serif',
'font-size' => '12', 'font-weight' => 'bold', 'id' => 'svg_text', 'x' => '50%', 'y' => '50%', 'alignment-baseline' => 'middle', 'text-anchor' => 'middle',
'stroke-width' => '0', 'stroke' => '#000', 'fill' => '#000'));
} else {
$text = '';
}
Expand Down
6 changes: 3 additions & 3 deletions reportrank.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__.'/reportlib.php');
require_once(__DIR__.'/classes/event/studentquiz_report_rank_viewed.php');
require_once(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/reportlib.php');
require_once(__DIR__ . '/classes/event/studentquiz_report_rank_viewed.php');

$cmid = optional_param('id', 0, PARAM_INT);
if (!$cmid) {
Expand Down
6 changes: 3 additions & 3 deletions reportstat.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__.'/reportlib.php');
require_once(__DIR__.'/classes/event/studentquiz_report_quiz_viewed.php');
require_once(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/reportlib.php');
require_once(__DIR__ . '/classes/event/studentquiz_report_quiz_viewed.php');

$cmid = optional_param('id', 0, PARAM_INT);
if (!$cmid) {
Expand Down
6 changes: 3 additions & 3 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(dirname(dirname(__DIR__)).'/config.php');
require_once(__DIR__ . '/../../config.php');
require_once(__DIR__ . '/viewlib.php');
require_once(__DIR__.'/classes/event/studentquiz_questionbank_viewed.php');
require_once(__DIR__.'/reportlib.php');
require_once(__DIR__ . '/classes/event/studentquiz_questionbank_viewed.php');
require_once(__DIR__ . '/reportlib.php');

// Get parameters.
if (!$cmid = optional_param('cmid', 0, PARAM_INT)) {
Expand Down

0 comments on commit 332ba77

Please sign in to comment.