Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19077 Implement the theme engines proposal
  3. MDL-19707

Need a better way to print the appropriate icon for files

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      In the change to $CFG->pixpath to $OUTPUT->old_icon_url I had to do a nasty hack for file icons.

      There is now a couple of dozen instances of code like

      str_replace(array('.gif', '.png'), '', mimeinfo_from_type('icon', $mimetype));

      I think what we need is:

      1. a new method $OUTPUT->file_icon_url($mimetype); the does the same as $OUTPUT->old_icon_url(... above search and replace ...);

      2. a new method $OUTPUT->link_to_file($file); that does the half-a-dozen lines of code we have duplicated around the place that is a link to a file, with the appropriate icon next to it. (For example, look at where it outputs forum attachements, or uploaded files in assignment.)

        Attachments

          Activity

            People

            • Assignee:
              samhemelryk Sam Hemelryk
              Reporter:
              timhunt Tim Hunt
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10