Merge branch 'MDL-26429-master' of git://github.com/cameron1729/moodle

This commit is contained in:
Andrew Nicols
2015-11-05 12:12:43 +08:00
13 changed files with 122 additions and 12 deletions
@@ -232,6 +232,20 @@ abstract class completion_criteria extends data_object {
*/
abstract public function get_details($completion);
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
global $COMPLETION_CRITERIA_TYPES;
$criteriatype = $COMPLETION_CRITERIA_TYPES[$this->criteriatype];
return new pix_icon('i/'.$criteriatype, $alt, 'moodle', $attributes);
}
/**
* Return criteria status text for display in reports
*
@@ -288,4 +288,15 @@ class completion_criteria_activity extends completion_criteria {
return $details;
}
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
return new pix_icon('icon', $alt, 'mod_'.$this->module, $attributes);
}
}
@@ -202,4 +202,15 @@ class completion_criteria_date extends completion_criteria {
return $details;
}
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
return new pix_icon('i/calendar', $alt, 'moodle', $attributes);
}
}
@@ -248,4 +248,15 @@ class completion_criteria_grade extends completion_criteria {
return $details;
}
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
return new pix_icon('i/grades', $alt, 'moodle', $attributes);
}
}
@@ -149,4 +149,15 @@ class completion_criteria_self extends completion_criteria {
return $details;
}
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
return new pix_icon('i/completion_self', $alt, 'moodle', $attributes);
}
}
@@ -131,4 +131,15 @@ class completion_criteria_unenrol extends completion_criteria {
$details['status'] = '';
return $details;
}
/**
* Return pix_icon for display in reports.
*
* @param string $alt The alt text to use for the icon
* @param array $attributes html attributes
* @return pix_icon
*/
public function get_icon($alt, array $attributes = null) {
return new pix_icon('i/user', $alt, 'moodle', $attributes);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M5.2,10.3L0,13.1V16h16v-3l-5.2-2.7C10.3,10,10.2,9.4,10.6,9c0,0,1.4-1.8,1.4-3.8C12,2.3,10.2,0,8,0
S4,2.3,4,5.2C4,7.2,5.4,9,5.4,9C5.8,9.5,5.7,10,5.2,10.3z"/>
</svg>

After

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M8,0C3.6,0,0,3.6,0,8c0,4.4,3.6,8,8,8c4.4,0,8-3.6,8-8C16,3.6,12.4,0,8,0z M8,14c-3.3,0-6-2.7-6-6
s2.7-6,6-6s6,2.7,6,6S11.3,14,8,14z M12,8c0,0.6-0.4,1-1,1H8C7.4,9,7,8.6,7,8V4c0-0.6,0.4-1,1-1s1,0.4,1,1v3h2C11.6,7,12,7.4,12,8z"
/>
</svg>

After

Width:  |  Height:  |  Size: 899 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M5.2,10.3L0,13.1V16h16v-3l-5.2-2.7C10.3,10,10.2,9.4,10.6,9c0,0,1.4-1.8,1.4-3.8C12,2.3,10.2,0,8,0
S4,2.3,4,5.2C4,7.2,5.4,9,5.4,9C5.8,9.5,5.7,10,5.2,10.3z"/>
</svg>

After

Width:  |  Height:  |  Size: 827 B

+10 -12
View File
@@ -457,18 +457,16 @@ if (!$csv) {
foreach ($criteria as $criterion) {
// Generate icon details
$icon = '';
$iconlink = '';
$icontitle = ''; // Required if $iconlink set
$iconalt = ''; // Required
$iconattributes = array('class' => 'icon');
switch ($criterion->criteriatype) {
case COMPLETION_CRITERIA_TYPE_ACTIVITY:
// Display icon
$icon = $OUTPUT->pix_url('icon', $criterion->module);
$iconlink = $CFG->wwwroot.'/mod/'.$criterion->module.'/view.php?id='.$criterion->moduleinstance;
$icontitle = $modinfo->cms[$criterion->moduleinstance]->get_formatted_name();
$iconattributes['title'] = $modinfo->cms[$criterion->moduleinstance]->get_formatted_name();
$iconalt = get_string('modulename', $criterion->module);
break;
@@ -478,7 +476,7 @@ if (!$csv) {
// Display icon
$iconlink = $CFG->wwwroot.'/course/view.php?id='.$criterion->courseinstance;
$icontitle = format_string($crs->fullname, true, array('context' => context_course::instance($crs->id, MUST_EXIST)));
$iconattributes['title'] = format_string($crs->fullname, true, array('context' => context_course::instance($crs->id, MUST_EXIST)));
$iconalt = format_string($crs->shortname, true, array('context' => context_course::instance($crs->id)));
break;
@@ -491,16 +489,16 @@ if (!$csv) {
break;
}
// Create icon alt if not supplied
if (!$iconalt) {
$iconalt = $criterion->get_title();
}
// Print icon and cell
print '<th class="criteriaicon">';
// Create icon if not supplied
if (!$icon) {
$icon = $OUTPUT->pix_url('i/'.$COMPLETION_CRITERIA_TYPES[$criterion->criteriatype]);
}
print ($iconlink ? '<a href="'.$iconlink.'" title="'.$icontitle.'">' : '');
print '<img src="'.$icon.'" class="icon" alt="'.$iconalt.'" '.(!$iconlink ? 'title="'.$iconalt.'"' : '').' />';
print ($iconlink ? '<a href="'.$iconlink.'" title="'.$iconattributes['title'].'">' : '');
print $OUTPUT->render($criterion->get_icon($iconalt, $iconattributes));
print ($iconlink ? '</a>' : '');
print '</th>';