Skip to content

Commit

Permalink
Merge branch 'MDL-53878_master' of https://github.com/StudiUM/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Apr 26, 2016
2 parents e1f9593 + 18daa64 commit e9eb7ca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ protected static function define_other_properties() {
'optional' => true,
'multiple' => true
),
'userhasplan' => array(
'type' => PARAM_BOOL
),
);
}

Expand Down Expand Up @@ -124,6 +127,7 @@ protected function get_other_values(renderer_base $output) {
'canmanage' => $this->persistent->can_manage(),
'filecount' => count($files),
'files' => $files,
'userhasplan' => $this->persistent->user_has_plan(),
'hasurlorfiles' => !empty($files) || !empty($url),
'urlshort' => $urlshort,
'competencycount' => count($userevidencecompetencies),
Expand Down
2 changes: 2 additions & 0 deletions admin/tool/lp/templates/user_evidence_list_page.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@
{{#pix}}t/edit{{/pix}} {{#str}}editthisuserevidence, tool_lp{{/str}}
</a>
</li>
{{#userhasplan}}
<li>
<a href="#" data-action="link-competency">
{{#pix}}t/add{{/pix}} {{#str}}linkcompetencies, tool_lp{{/str}}
</a>
</li>
{{/userhasplan}}
<li>
<a data-action="send-competencies-review" href="#">
{{#pix}}t/edit{{/pix}} {{#str}}sendcompetenciestoreview, tool_lp{{/str}}
Expand Down
2 changes: 2 additions & 0 deletions admin/tool/lp/templates/user_evidence_page.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
<div data-region="actions">
<div class="pull-right">
{{#canmanage}}
{{#userhasplan}}
<button class="btn" data-action="link-competency">{{#pix}}t/add{{/pix}} {{#str}}linkcompetencies, tool_lp{{/str}}</button>
{{/userhasplan}}
{{/canmanage}}
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions competency/classes/user_evidence.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ public function get_user_competencies() {
return user_evidence_competency::get_user_competencies_by_userevidenceid($this->get_id());
}

/**
* Return true if the user of the evidence has plan.
*
* @return bool
*/
public function user_has_plan() {
return plan::record_exists_select('userid = ?', array($this->get_userid()));
}

/**
* Return the files associated with this evidence.
*
Expand Down

0 comments on commit e9eb7ca

Please sign in to comment.