A condensed table to see data items in calculated question

A condensed table to see data items in calculated question

by Pierre Pichet -
Number of replies: 0

When you edit the data items in a calculated question, the table of items appears as the following.

normal

 You could obtain a more condensed view useful when you generate a large number of items like this one.

condensed

In the question/type/datasetdependet/datasetitem.php
at line 20 you add (or the get_string() part if you modifiy accordingly the lang/eng_utf8/quiz.php)
    $strcondensedtable ="Switch to Condensed Table >>";//or get_string('condensedtable', 'quiz');
   $strnormaltable ="Switch to Normal Table >>";//or get_string('normaltable', 'quiz');

after // Set up the table showing existing datasets ( original line 217) you add
// select normal or condensed table
if(isset($form->normaltablebutton) || !isset($form->condensedtablebutton)){
 $condensedOK = FALSE;
 $datatableoption =  '<input type="submit" name="condensedtablebutton" '.'value="'.$strcondensedtable.'"/>';
}else {
 $condensedOK = TRUE;
 $datatableoption =  '<input type="submit" name="normaltablebutton" '.'value="'.$strnormaltable.'"/>';

replace   the original line 239          $columns[] = $this->comment_on_datasetitems($question, $data, $number);
by
           if ($condensedOK) $columns[] =str_replace("<br/>"," :: ",$this->comment_on_datasetitems($question, $data, $number));
          else $columns[]=$this->comment_on_datasetitems($question, $data, $number);
and add after  the original line 285     <input type=\"hidden\" name=\"wizardpage\" value=\"datasetitems\"/>";
        echo '<p align=center>'.$datatableoption.'<p>';   

The attached file should work correctly on 1.6 beta.


 

Average of ratings: -