MDL-52424 tool_lp: Prevent missing table cell when viewing plans page

This commit is contained in:
Frederic Massart
2016-04-18 10:58:48 +08:00
parent 19456fec66
commit 92d4946e19
3 changed files with 6 additions and 3 deletions
+1
View File
@@ -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'),
));
}
+1 -1
View File
@@ -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();
+4 -2
View File
@@ -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>