MDL-71163 mod_feedback: remove duplicate date info

The $extradetails parameter in the constructor of the
mod_feedback\output\summary class is no longer used by any of the codes
that instantiate the class. Therefore, it is removed.
The respective template is updated as well.
This commit is contained in:
Shamim Rezaie 2021-04-26 11:34:04 +10:00
parent 0fc6bfab6c
commit 1da9d7a8c7
4 changed files with 11 additions and 32 deletions

View File

@ -46,20 +46,20 @@ class summary implements renderable, templatable {
/** @var int */
protected $mygroupid;
/** @var bool */
protected $extradetails;
/**
* Constructor.
*
* @todo MDL-71494 Final deprecation of the $extradetails parameter in Moodle 4.3
* @param mod_feedback_structure $feedbackstructure
* @param int $mygroupid currently selected group
* @param bool $extradetails display additional details (time open, time closed)
* @param bool|null $extradetails Deprecated
*/
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = false) {
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = null) {
if (isset($extradetails)) {
debugging('The $extradetails parameter is deprecated.', DEBUG_DEVELOPER);
}
$this->feedbackstructure = $feedbackstructure;
$this->mygroupid = $mygroupid;
$this->extradetails = $extradetails;
}
/**
@ -72,12 +72,6 @@ class summary implements renderable, templatable {
$r = new stdClass();
$r->completedcount = $this->feedbackstructure->count_completed_responses($this->mygroupid);
$r->itemscount = count($this->feedbackstructure->get_items(true));
if ($this->extradetails && ($timeopen = $this->feedbackstructure->get_feedback()->timeopen)) {
$r->timeopen = userdate($timeopen);
}
if ($this->extradetails && ($timeclose = $this->feedbackstructure->get_feedback()->timeclose)) {
$r->timeclose = userdate($timeclose);
}
return $r;
}

View File

@ -31,8 +31,7 @@
Example context (json):
{
"completedcount" : 15,
"itemscount" : 5,
"timeopen" : "May 15, 2016"
"itemscount" : 5
}
}}
@ -48,20 +47,3 @@
class="feedback_info">{{#str}}questions, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{itemscount}}</span>
</div>
{{#timeopen}}
<div class="feedback_info">
<span
class="feedback_info">{{#str}}feedbackopen, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{timeopen}}</span>
</div>
{{/timeopen}}
{{#timeclose}}
<div class="feedback_info">
<span
class="feedback_info">{{#str}}feedbackclose, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{timeclose}}</span>
</div>
{{/timeclose}}

View File

@ -1,3 +1,6 @@
=== 3.11 ===
The $extradetails parameter in the constructor of the mod_feedback\output\summary class has been deprecated and is not used anymore.
=== 3.8 ===
* The following functions have been finally deprecated and can not be used anymore:

View File

@ -102,7 +102,7 @@ if (has_capability('mod/feedback:edititems', $context)) {
$mygroupid = groups_get_activity_group($cm);
echo $groupselect.'<div class="clearer">&nbsp;</div>';
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid, true);
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid);
echo $OUTPUT->render_from_template('mod_feedback/summary', $summary->export_for_template($OUTPUT));
if ($pageaftersubmit = $feedbackcompletion->page_after_submit()) {