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

Inaccessible (missing) total question numbering: definition of the problem + solution

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_23_STABLE

      Description

      NB: All of the tracker issues, posted by 'accessible_for_vip', are based on the theme 'Accessible for VIP' (https://moodle.org/plugins/view.php?plugin=theme_accessible_for_vip) which is developed for people who are blind or have a low vision. All of the (code)solutions are based on the files which belong to this specific theme and are only usable with this theme at this moment (but it is also possible to include the solution in general source code).

      In the present situation, there is no information for a blind person about the number of questions in a quiz. For example: when you are reading the heading of question 1, the screenreader will say “question 1” but give no information about the size of the whole quiz.
      We added this information so that the screenreader will say “Question 1 of 10” instead of “Question 1”. This gives the blind user of the quiz much more information and makes the usage of the quiz more accessible.

      To arrive to this solution we created an object with the number of the question and the total of questions in it. The method ‘number( )’ is changed and a language String is added. This is shown below.

      Changed method (mod/quiz/attemptlib.php):

      public function render_question($slot, $reviewing, $thispageurl = null) {   
      	$a->number = $this->quba->get_question($slot)->_number;
      	$a->totalquestions = count($this->get_slots('all'));
           
      	return $this->quba->render_question($slot,
      			$this->get_display_options_with_edit_link($reviewing, $slot, $thispageurl), 
      			$a);
      }
       
      (theme/accessible_for_vip/renderers.php):
      protected function number($number) {
      	$numbertext = '';
      	if (is_numeric($number)) {
      		$numbertext = get_string('questionx', 'question', 
      				html_writer::tag('span', $number, array('class' => 'qno')));
      	} else if ($number == 'i') {
      		$numbertext = get_string('information', 'question');
      	} else if(is_object($number)) {
      		$numbertext = get_string('question-x-of-y', 'theme_accessible_for_vip', $number);
      	}    
      	if (!$numbertext) {
      		return '';
      	}
      	return html_writer::tag('h2', $numbertext, array('class' => 'no'));
      }
      

      Added language String
      (theme/accessible_for_vip/lang/en/theme_accessible_for_vip.php):

      $string['question-x-of-y'] = 'Question <span class="qno">{$a->number}</span> of {$a->totalquestions}';
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            accessible_for_vip Larissa Klaassen
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: