MDL-52424 tool_lp: Prevent missing table cell when viewing plans page
This commit is contained in:
@@ -3141,6 +3141,7 @@ class external extends external_api {
|
||||
new external_value(PARAM_RAW, 'HTML for a navigation item that should be on this page')
|
||||
),
|
||||
'canreaduserevidence' => new external_value(PARAM_BOOL, 'Can the current user view the user\'s evidence'),
|
||||
'canmanageuserplans' => new external_value(PARAM_BOOL, 'Can the current user manage the user\'s plans'),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ class plans_page implements renderable, templatable {
|
||||
public function __construct($userid) {
|
||||
$this->userid = $userid;
|
||||
$this->plans = api::list_user_plans($userid);
|
||||
|
||||
$this->context = context_user::instance($userid);
|
||||
|
||||
if (plan::can_manage_user($userid) || plan::can_manage_user_draft($userid)) {
|
||||
@@ -87,6 +86,7 @@ class plans_page implements renderable, templatable {
|
||||
$data->userid = $this->userid;
|
||||
$data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true);
|
||||
$data->canreaduserevidence = user_evidence::can_read_user($this->userid);
|
||||
$data->canmanageuserplans = plan::can_manage_user($this->userid);
|
||||
|
||||
// Attach standard objects as mustache can not parse \tool_lp\plan objects.
|
||||
$data->plans = array();
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
<th scope="col">{{#str}}planname, tool_lp{{/str}}</th>
|
||||
<th scope="col">{{#str}}templatebased, tool_lp{{/str}}</th>
|
||||
<th scope="col">{{#str}}status, tool_lp{{/str}}</th>
|
||||
{{#canmanageuserplans}}
|
||||
<th scope="col">{{#str}}actions, tool_lp{{/str}}</th>
|
||||
{{/canmanageuserplans}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -59,7 +61,7 @@
|
||||
{{/isbasedontemplate}}
|
||||
</td>
|
||||
<td>{{statusname}}</td>
|
||||
{{#canmanage}}
|
||||
{{#canmanageuserplans}}
|
||||
<td>
|
||||
<div style="display: inline-block;">
|
||||
<ul title="{{#str}}edit{{/str}}" class="planactions">
|
||||
@@ -100,7 +102,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
{{/canmanage}}
|
||||
{{/canmanageuserplans}}
|
||||
</tr>
|
||||
{{/plans}}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user