MDL-22795 new enrol self icons - credit goes to Rossiani Wijaya

This commit is contained in:
Petr Skoda
2010-09-20 07:43:56 +00:00
parent 43a58be792
commit 9a13c5af34
3 changed files with 29 additions and 4 deletions
+29 -4
View File
@@ -31,9 +31,36 @@
*/
class enrol_self_plugin extends enrol_plugin {
/**
* Returns optional enrolment information icons.
*
* This is used in course list for quick overview of enrolment options.
*
* We are not using single instance parameter because sometimes
* we might want to prevent icon repetition when multiple instances
* of one type exist. One instance may also produce several icons.
*
* @param array $instances all enrol instances of this type in one course
* @return array of pix_icon
*/
public function get_info_icons(array $instances) {
//TODO: we need two different self enrol icons - with and without key
return array();
$key = false;
$nokey = false;
foreach ($instances as $instance) {
if ($instance->password or $instance->customint1) {
$key = true;
} else {
$nokey = true;
}
}
$icons = array();
if ($nokey) {
$icons[] = new pix_icon('withoutkey', get_string('pluginname', 'enrol_self'), 'enrol_self');
}
if ($key) {
$icons[] = new pix_icon('withkey', get_string('pluginname', 'enrol_self'), 'enrol_self');
}
return $icons;
}
/**
@@ -223,8 +250,6 @@ class enrol_self_plugin extends enrol_plugin {
* @return int id of new instance
*/
public function add_default_instance($course) {
global $DB;
$fields = array('customint1' => $this->get_config('groupkey'),
'customint2' => $this->get_config('longtimenosee'),
'customint3' => $this->get_config('maxenrolled'),
Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B