Display: Update icons in gradebook links and modify GradebookTable::build_type_column() and build_type_icon_tag() (string $style instead of array $attributes)

pull/5058/head
Yannick Warnier 2 years ago
parent 73d224c36d
commit d37be2938f
  1. 34
      public/main/gradebook/lib/GradebookUtils.php
  2. 8
      public/main/gradebook/lib/fe/gradebooktable.class.php

@ -4,6 +4,8 @@
use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon; use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;
use Chamilo\CoreBundle\Component\Utils\StateIcon; use Chamilo\CoreBundle\Component\Utils\StateIcon;
/** /**
@ -146,12 +148,12 @@ class GradebookUtils
/** /**
* Builds an img tag for a gradebook item. * Builds an img tag for a gradebook item.
*/ */
public static function build_type_icon_tag($kind, $attributes = []) public static function build_type_icon_tag($kind, $style = null)
{ {
return Display::return_icon( return Display::getMdiIcon(
self::get_icon_file_name($kind), self::get_icon_file_name($kind),
' ', 'ch-tool-icon',
$attributes, $style,
ICON_SIZE_SMALL ICON_SIZE_SMALL
); );
} }
@ -167,47 +169,47 @@ class GradebookUtils
{ {
switch ($type) { switch ($type) {
case 'cat': case 'cat':
$icon = 'gradebook.png'; $icon = ToolIcon::GRADEBOOK;
break; break;
case 'evalempty': case 'evalempty':
$icon = 'empty_evaluation.png'; $icon = 'table';
break; break;
case 'evalnotempty': case 'evalnotempty':
$icon = 'no_empty_evaluation.png'; $icon = 'table-check';
break; break;
case 'exercise': case 'exercise':
case LINK_EXERCISE: case LINK_EXERCISE:
$icon = 'quiz.png'; $icon = ObjectIcon::TEST;
break; break;
case 'learnpath': case 'learnpath':
case LINK_LEARNPATH: case LINK_LEARNPATH:
$icon = 'learnpath.png'; $icon = ObjectIcon::LP;
break; break;
case 'studentpublication': case 'studentpublication':
case LINK_STUDENTPUBLICATION: case LINK_STUDENTPUBLICATION:
$icon = 'works.gif'; $icon = ObjectIcon::ASSIGNMENT;
break; break;
case 'link': case 'link':
$icon = 'link.gif'; $icon = ObjectIcon::LINK;
break; break;
case 'forum': case 'forum':
case LINK_FORUM_THREAD: case LINK_FORUM_THREAD:
$icon = 'forum.gif'; $icon = ObjectIcon::FORUM_THREAD;
break; break;
case 'attendance': case 'attendance':
case LINK_ATTENDANCE: case LINK_ATTENDANCE:
$icon = 'attendance.gif'; $icon = ObjectIcon::ATTENDANCE;
break; break;
case 'survey': case 'survey':
case LINK_SURVEY: case LINK_SURVEY:
$icon = 'survey.gif'; $icon = ObjectIcon::SURVEY;
break; break;
case 'dropbox': case 'dropbox':
case LINK_DROPBOX: case LINK_DROPBOX:
$icon = 'dropbox.gif'; $icon = ToolIcon::DROPBOX;
break; break;
default: default:
$icon = 'link.gif'; $icon = ObjectIcon::LINK;
break; break;
} }

@ -610,7 +610,7 @@ class GradebookTable extends SortableTable
} }
// Type // Type
$row[] = $this->build_type_column($item, ['style' => 'padding-left:5px']); $row[] = $this->build_type_column($item, 'padding-left:5px');
// Name. // Name.
$row[] = $invisibility_span_open.'    '. $row[] = $invisibility_span_open.'    '.
$this->build_name_link($item, $type, 4).$invisibility_span_close; $this->build_name_link($item, $type, 4).$invisibility_span_close;
@ -1192,13 +1192,13 @@ class GradebookTable extends SortableTable
/** /**
* @param $item * @param $item
* @param array $attributes * @param string $style
* *
* @return string * @return string
*/ */
private function build_type_column($item, $attributes = []) private function build_type_column($item, $style = null)
{ {
return GradebookUtils::build_type_icon_tag($item->get_icon_name(), $attributes); return GradebookUtils::build_type_icon_tag($item->get_icon_name(), $style);
} }
/** /**

Loading…
Cancel
Save