Moodle
  1. Moodle
  2. MDL-15068

Translation of: Virtual question type

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Language, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      26417

      Description

      Hi Tim,

      in lang/en_utf8/question.php is a string 'novirtualquestion'. Can you explain what a virtual question is?

        Activity

        Hide
        Pierre Pichet added a comment -

        This is related to calculated question type that extends dataset_dependent_questiontype but that is also considered as a numerical question. So calculated has a virtual->qtype that is numerical.
        This new string is related to the work done to change all error() messages to print_error().
        So in datasetdependent/abstractqtype
        the default create_virtual_qtype() gives the error message
        function create_virtual_qtype()

        { print_error("novirtualquestion", 'question', '', $this->name()); }

        function get_virtual_qtype() {
        if (!$this->virtualqtype)

        { $this->virtualqtype = $this->create_virtual_qtype(); }

        return $this->virtualqtype;
        }
        but in calculated/questiontype.php the qtype is created

        function create_virtual_qtype()

        { global $CFG; require_once("$CFG->dirroot/question/type/numerical/questiontype.php"); return new question_numerical_qtype(); }
        Show
        Pierre Pichet added a comment - This is related to calculated question type that extends dataset_dependent_questiontype but that is also considered as a numerical question. So calculated has a virtual->qtype that is numerical. This new string is related to the work done to change all error() messages to print_error(). So in datasetdependent/abstractqtype the default create_virtual_qtype() gives the error message function create_virtual_qtype() { print_error("novirtualquestion", 'question', '', $this->name()); } function get_virtual_qtype() { if (!$this->virtualqtype) { $this->virtualqtype = $this->create_virtual_qtype(); } return $this->virtualqtype; } but in calculated/questiontype.php the qtype is created function create_virtual_qtype() { global $CFG; require_once("$CFG->dirroot/question/type/numerical/questiontype.php"); return new question_numerical_qtype(); }
        Hide
        Pierre Pichet added a comment -

        The error message was
        error("No vitrual question type for question type ".$this->name());
        The actual lang string is
        $string['novirtualquestion'] = 'No virtual question type for question type $a';
        the 'novirtualquestion' should be changed to 'novirtualquestiontype'

        The only occurence is in datasetdependent/abstractqtype.php

        Show
        Pierre Pichet added a comment - The error message was error("No vitrual question type for question type ".$this->name()); The actual lang string is $string ['novirtualquestion'] = 'No virtual question type for question type $a'; the 'novirtualquestion' should be changed to 'novirtualquestiontype' The only occurence is in datasetdependent/abstractqtype.php
        Hide
        Pierre Pichet added a comment -

        see MDL-14129 about this print_error conversion and the tedious but necessary work done by Dongsheng Cai.

        Show
        Pierre Pichet added a comment - see MDL-14129 about this print_error conversion and the tedious but necessary work done by Dongsheng Cai.
        Hide
        Pierre Pichet added a comment -

        the 'novirtualquestion' should be changed to 'novirtualquestiontype'
        If you agree, I could do the modifications

        Show
        Pierre Pichet added a comment - the 'novirtualquestion' should be changed to 'novirtualquestiontype' If you agree, I could do the modifications
        Hide
        Tim Hunt added a comment -

        Please do Pierre.

        Show
        Tim Hunt added a comment - Please do Pierre.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: