Skip to content

Commit

Permalink
MDL-49555 enrol_paypal: Only display icon if method available
Browse files Browse the repository at this point in the history
  • Loading branch information
ewallah authored and FMCorz committed Mar 18, 2015
1 parent 06122e4 commit 3039181
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion enrol/paypal/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,21 @@ public function get_currencies() {
* @return array of pix_icon
*/
public function get_info_icons(array $instances) {
return array(new pix_icon('icon', get_string('pluginname', 'enrol_paypal'), 'enrol_paypal'));
$found = false;
foreach ($instances as $instance) {
if ($instance->enrolstartdate != 0 && $instance->enrolstartdate > time()) {
continue;
}
if ($instance->enrolenddate != 0 && $instance->enrolenddate < time()) {
continue;
}
$found = true;
break;
}
if ($found) {
return array(new pix_icon('icon', get_string('pluginname', 'enrol_paypal'), 'enrol_paypal'));
}
return array();
}

public function roles_protected() {
Expand Down

0 comments on commit 3039181

Please sign in to comment.