Skip to content

Commit

Permalink
fix usage of mod_ratingallocate strategy namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
irinahpe committed Mar 6, 2024
1 parent 331749a commit f17cb25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private function process_action_give_rating() {
// Rating is possible...

// Suche das richtige Formular nach Strategie.
$strategyform = 'ratingallocate\\' . $this->ratingallocate->strategy . '\\mod_ratingallocate_view_form';
$strategyform = 'mod_ratingallocate\\' . $this->ratingallocate->strategy . '\\mod_ratingallocate_view_form';

$mform = new $strategyform($PAGE->url->out(), $this);
$mform->add_action_buttons();
Expand Down Expand Up @@ -2047,7 +2047,7 @@ public function get_options_titles(array $ratings) {
* Returns the strategy class for the ratingallocate
*/
private function get_strategy_class() {
$strategyclassp = 'ratingallocate\\' . $this->ratingallocate->strategy . '\\strategy';
$strategyclassp = 'mod_ratingallocate\\' . $this->ratingallocate->strategy . '\\strategy';
$allsettings = json_decode($this->ratingallocate->setting, true);
if (array_key_exists($this->ratingallocate->strategy, $allsettings)) {
return new $strategyclassp($allsettings[$this->ratingallocate->strategy]);
Expand Down
6 changes: 3 additions & 3 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function definition() {

foreach (\strategymanager::get_strategies() as $strategy) {
// Load strategy class.
$strategyclassp = 'ratingallocate\\' . $strategy . '\\strategy';
$strategyclassp = 'mod_ratingallocate\\' . $strategy . '\\strategy';
$strategyclass = new $strategyclassp();

// Add options fields.
Expand Down Expand Up @@ -218,7 +218,7 @@ public function definition_after_data() {
// Add dynamic settings fields.
foreach (\strategymanager::get_strategies() as $strategy) {
// Load strategy class.
$strategyclassp = 'ratingallocate\\' . $strategy . '\\strategy';
$strategyclassp = 'mod_ratingallocate\\' . $strategy . '\\strategy';
if (isset($allstrategyoptions) && array_key_exists($strategy, $allstrategyoptions)) {
$strategyclass = new $strategyclassp($allstrategyoptions[$strategy]);
} else {
Expand Down Expand Up @@ -276,7 +276,7 @@ public function validation($data, $files) {
// User has to select one strategy.
$errors['strategy'] = get_string('strategy_not_specified', self::MOD_NAME);
} else {
$strategyclassp = 'ratingallocate\\' . $data['strategy'] . '\\strategy';
$strategyclassp = 'mod_ratingallocate\\' . $data['strategy'] . '\\strategy';
if (array_key_exists($data['strategy'], $data['strategyopt'])) {
$strategyclass = new $strategyclassp($data['strategyopt'][$data['strategy']]);
$settingerrors = $strategyclass->validate_settings();
Expand Down

0 comments on commit f17cb25

Please sign in to comment.