Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19270

fix reverse display of hebrew (rtl) legend text in quiz overview graph

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.2, 2.5, 2.7
    • Fix Version/s: 2.6.4, 2.7.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide
      1. Set UI language to Hebrew (or any other RTL language)
      2. Open a quiz with some student attempts
      3. As a teacher, click the "attempts" link.
      4. Scroll down to view the "Overall number of students achieving grade ranges" graph.
      5. Make sure the labels are readable. (Hope you can read Hebrew or any RTL language. See attached screen capture of proper Hebrew labels)
      Show
      Set UI language to Hebrew (or any other RTL language) Open a quiz with some student attempts As a teacher, click the "attempts" link. Scroll down to view the "Overall number of students achieving grade ranges" graph. Make sure the labels are readable. (Hope you can read Hebrew or any RTL language. See attached screen capture of proper Hebrew labels)
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_25_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-19270_master

      Description

      php ImageTTFText() function does not seem to support unicode (properly)
      and when passing an hebrew (maybe other rtl language) text it is displayed in reverse.

      so, i added a short function to workaround this issue when building the "lines" graph
      at the end of the page of a quiz overview.

      patch:
      add this new function at the beginning of the file "mod/quiz/report/overview/overviewgraph.php"

      function bidi_reformat_text($anylanguage){
      if (current_language() == 'he_utf8')

      { return iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $anylanguage))); }

      else

      { return $anylanguage; }

      }

      and each time you need to pass an hebrew (rtl text) use the following syntax:

      (around line 41-42)
      $line->parameter['y_label_left'] = bidi_reformat_text($course->students);
      $line->parameter['x_label'] = bidi_reformat_text(get_string('grade'));
      (line 81)
      $line->y_format['allusers'] =
      array('colour' => graph_get_new_colour(), 'bar' => 'fill', 'shadow_offset' => 1, 'legend' => bidi_reformat_text(get_string('allparticipants')));
      (line 109)
      $line->y_format['groupusers'.$group] =
      array('colour' => graph_get_new_colour(), 'bar' => 'fill', 'shadow_offset' => 1, 'legend' => bidi_reformat_text(groups_get_group_name($group)));

        Attachments

        1. test-result-2.jpg
          test-result-2.jpg
          54 kB
        2. test-result.jpg
          test-result.jpg
          62 kB
        3. Selection_153.png
          Selection_153.png
          32 kB
        4. quiz_report_php_mode_statistics.png
          quiz_report_php_mode_statistics.png
          37 kB
        5. quiz_report_mode_overview.png
          quiz_report_mode_overview.png
          40 kB
        6. graphlib_rtl_2.0.patch.txt
          2 kB
        7. graphlib_rtl_1.9.patch.txt
          1 kB

          Issue Links

            Activity

              People

              Assignee:
              nadavkav Nadav Kavalerchik
              Reporter:
              nadavkav Nadav Kavalerchik
              Peer reviewer:
              Tim Hunt Tim Hunt
              Integrator:
              Sam Hemelryk Sam Hemelryk
              Tester:
              Michael de Raadt Michael de Raadt
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jul/14