Skip to content

Commit

Permalink
Upgrade: Adopt changes from MDL-82183 and use new \core\output\html_w…
Browse files Browse the repository at this point in the history
…riter
  • Loading branch information
abias committed Oct 29, 2024
1 parent 06d2e7c commit 3712879
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2024-10-14 - Upgrade: Adopt changes from MDL-82183 and use new \core\output\html_writer
* 2024-10-14 - Upgrade: Adopt changes from MDL-81960 and use new \core\url class
* 2024-10-14 - Upgrade: Adopt changes from MDL-81818 to remove old bootstrap classes
* 2024-10-14 - Upgrade: Adopt changes from MDL-81920 and use new \core\lang_string class.
Expand Down
8 changes: 5 additions & 3 deletions classes/cohort_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

namespace local_profilecohort;

use core\output\html_writer;

defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir.'/formslib.php');
Expand All @@ -43,14 +45,14 @@ protected function definition() {
$mform = $this->_form;
$cohorts = $this->_customdata['cohorts'];

$mform->addElement('html', \html_writer::tag('div', get_string('cohortsintro', 'local_profilecohort').'<br />'.
$mform->addElement('html', html_writer::tag('div', get_string('cohortsintro', 'local_profilecohort').'<br />'.
get_string('invisiblecohortsnote', 'local_profilecohort'),
['id' => 'intro', 'class' => 'box generalbox']));

if (!$cohorts) {
$cohorturl = new \core\url('/cohort/index.php');
$link = \html_writer::link($cohorturl, get_string('cohorts', 'core_cohort'));
$mform->addElement('html', \html_writer::tag('div', get_string('nocohorts', 'local_profilecohort', $link),
$link = html_writer::link($cohorturl, get_string('cohorts', 'core_cohort'));
$mform->addElement('html', html_writer::tag('div', get_string('nocohorts', 'local_profilecohort', $link),
['class' => 'alert alert-warning']));
} else {
foreach ($cohorts as $cohort) {
Expand Down
2 changes: 1 addition & 1 deletion classes/field_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace local_profilecohort;

use html_writer;
use core\output\html_writer;
use MoodleQuickForm;
use stdClass;

Expand Down
4 changes: 2 additions & 2 deletions classes/profilecohort.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace local_profilecohort;

use html_writer;
use core\output\html_writer;

/**
* Class profilecohort
Expand Down Expand Up @@ -101,7 +101,7 @@ protected function output_members() {
$tabs = $this->get_tabs();
$out .= $OUTPUT->render($tabs);

$out .= \html_writer::tag('div', get_string('membersintro', 'local_profilecohort').'<br/>'.
$out .= html_writer::tag('div', get_string('membersintro', 'local_profilecohort').'<br/>'.
get_string('invisiblecohortsnote', 'local_profilecohort'),
['id' => 'intro', 'class' => 'box generalbox']);

Expand Down
7 changes: 4 additions & 3 deletions classes/profilefields.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace local_profilecohort;

use moodleform;
use core\output\html_writer;

/**
* Class profilefields
Expand Down Expand Up @@ -204,18 +205,18 @@ public function output_form() {
$out .= $OUTPUT->render($tabs);

if ($this->action == 'view') {
$out .= \html_writer::tag('div', get_string('viewintro', 'local_profilecohort').'<br />'.
$out .= html_writer::tag('div', get_string('viewintro', 'local_profilecohort').'<br />'.
get_string('invisiblecohortsnote', 'local_profilecohort'),
['id' => 'intro', 'class' => 'box generalbox']);
} else if ($this->action == 'add') {
$out .= \html_writer::tag('div', get_string('addintro', 'local_profilecohort').
$out .= html_writer::tag('div', get_string('addintro', 'local_profilecohort').
'<br />'.get_string('invisiblecohortsnote', 'local_profilecohort'),
['id' => 'intro', 'class' => 'box generalbox']);
}

if (!$this->get_possible_fields()) {
$profilefieldsurl = new \core\url('/user/profile/index.php');
$link = \html_writer::link($profilefieldsurl, get_string('profilefields', 'core_admin'));
$link = html_writer::link($profilefieldsurl, get_string('profilefields', 'core_admin'));
$notification = new \core\output\notification(get_string('nofields', 'local_profilecohort', $link),
\core\output\notification::NOTIFY_ERROR);
$notification->set_show_closebutton(false);
Expand Down

0 comments on commit 3712879

Please sign in to comment.