mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'MDL-72424' of https://github.com/paulholden/moodle
This commit is contained in:
commit
86968a64a5
4 changed files with 20 additions and 46 deletions
7
.upgradenotes/MDL-72424-2024062113465122.yml
Normal file
7
.upgradenotes/MDL-72424-2024062113465122.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
issueNumber: MDL-72424
|
||||
notes:
|
||||
mod_feedback:
|
||||
- message: >-
|
||||
The `feedback_check_is_switchrole` method has been deprecated as it
|
||||
didn't work
|
||||
type: deprecated
|
|
@ -14,16 +14,6 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Contains class mod_feedback_completion
|
||||
*
|
||||
* @package mod_feedback
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Collects information and methods about feedback completion (either complete.php or show_entries.php)
|
||||
*
|
||||
|
@ -557,12 +547,6 @@ class mod_feedback_completion extends mod_feedback_structure {
|
|||
$feedbackcompleted = !$feedbackcompleted ? null : $feedbackcompleted;
|
||||
$feedbackcompletedtmp = $this->get_current_completed_tmp();
|
||||
|
||||
if (feedback_check_is_switchrole()) {
|
||||
// We do not actually save anything if the role is switched, just delete temporary values.
|
||||
$this->delete_completedtmp();
|
||||
return;
|
||||
}
|
||||
|
||||
// Save values.
|
||||
$completedid = feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted);
|
||||
$this->completed = $DB->get_record('feedback_completed', array('id' => $completedid));
|
||||
|
@ -584,19 +568,6 @@ class mod_feedback_completion extends mod_feedback_structure {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the temporary completed and all related temporary values
|
||||
*/
|
||||
protected function delete_completedtmp() {
|
||||
global $DB;
|
||||
|
||||
if ($completedtmp = $this->get_current_completed_tmp()) {
|
||||
$DB->delete_records('feedback_valuetmp', ['completed' => $completedtmp->id]);
|
||||
$DB->delete_records('feedback_completedtmp', ['id' => $completedtmp->id]);
|
||||
$this->completedtmp = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the last completion record for the current user
|
||||
*
|
||||
|
|
|
@ -29,3 +29,16 @@ function feedback_get_completion_state() {
|
|||
$completionclass = \mod_feedback\completion\custom_completion::class;
|
||||
throw new coding_exception(__FUNCTION__ . "() has been removed, please use the '{$completionclass}' class instead");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current role is faked by switching role feature
|
||||
*
|
||||
* @return bool
|
||||
* @deprecated since Moodle 4.5 - please do not use this function any more, {@see is_role_switched}
|
||||
*/
|
||||
#[\core\attribute\deprecated('is_role_switched', since: '4.5', mdl: 'MDL-72424')]
|
||||
function feedback_check_is_switchrole(): bool {
|
||||
global $USER;
|
||||
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
|
||||
return isset($USER->switchrole) && is_array($USER->switchrole) && count($USER->switchrole) > 0;
|
||||
}
|
||||
|
|
|
@ -926,23 +926,6 @@ function feedback_get_context() {
|
|||
throw new coding_exception('feedback_get_context() can not be used anymore.');
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if the current role is faked by switching role feature
|
||||
*
|
||||
* @global object
|
||||
* @return boolean
|
||||
*/
|
||||
function feedback_check_is_switchrole() {
|
||||
global $USER;
|
||||
if (isset($USER->switchrole) AND
|
||||
is_array($USER->switchrole) AND
|
||||
count($USER->switchrole) > 0) {
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* count users which have not completed the feedback
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue