MDL-15252 integrate qtype_dependent.php strings in qtype_calculated.php and replace qtype_dependent in get_string()

This commit is contained in:
Pierre Pichet
2010-04-28 03:34:38 +00:00
parent 4d56ee95e0
commit 5940864e84
4 changed files with 88 additions and 38 deletions
@@ -56,10 +56,10 @@ class question_dataset_dependent_definitions_form extends moodleform {
$datadefscat= array();
$datadefscat = $this->qtypeobj->get_dataset_definitions_category($this->question);
$datasetmenus = array();
$label = "<div class='mdl-align'>".get_string('datasetrole', 'qtype_datasetdependent','numerical')."</div>";
$label = "<div class='mdl-align'>".get_string('datasetrole', 'qtype_calculated')."</div>";
$mform->addElement('html', $label);// explaining the role of datasets so other strings can be shortened
$mform->addElement('header', 'mandatoryhdr', get_string('mandatoryhdr', $stringfile));
$labelsharedwildcard = get_string("sharedwildcard", "qtype_datasetdependent");
$labelsharedwildcard = get_string('sharedwildcard', 'qtype_calculated');
foreach ($mandatorydatasets as $datasetname) {
if (!isset($datasetmenus[$datasetname])) {
@@ -69,7 +69,7 @@ class question_dataset_dependent_definitions_form extends moodleform {
$label = get_string("wildcard", "quiz"). " <strong>$datasetname</strong> ";
$mform->addElement('select', "dataset[$key]", $label, $options);
if (isset($datadefscat[$datasetname])){
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetname </strong>", get_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$datasetname]));
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetname </strong>", get_string('dataitemdefined','qtype_calculated', $datadefscat[$datasetname]));
}
$mform->setDefault("dataset[$key]", $selected);
$datasetmenus[$datasetname]='';
@@ -87,7 +87,7 @@ class question_dataset_dependent_definitions_form extends moodleform {
$mform->addElement('select', "dataset[$key]", $label, $options);
// $mform->addRule("dataset[$key]", null, 'required', null, 'client');
if (isset($datadefscat[$datasetname])){
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetname </strong>", get_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$datasetname]));
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetname </strong>", get_string('dataitemdefined',"qtype_calculated", $datadefscat[$datasetname]));
}
// $selected ="0";
@@ -97,7 +97,7 @@ class question_dataset_dependent_definitions_form extends moodleform {
}
}
// temporary strings
$mform->addElement('header', 'synchronizehdr', get_string("Synchronize the data from shared datasets with other questions in a quiz", $stringfile));
$mform->addElement('header', 'synchronizehdr', get_string('synchronize', $stringfile));
$mform->addElement('checkbox', "synchronize", '', "For each question in a quiz using a given wild card {x..} from a <strong>shared </strong> dataset, the wild card {x..}will be substituted by the same numerical value.");
if (isset($this->question->options)&& isset($this->question->options->synchronize) ){
$mform->setDefault("synchronize", $this->question->options->synchronize);
@@ -147,7 +147,7 @@ class question_dataset_dependent_definitions_form extends moodleform {
}
if (!$countvalid){
foreach ($datasets as $key => $dataset){
$errors['dataset['.$key.']'] = get_string('atleastonerealdataset', 'qtype_datasetdependent');
$errors['dataset['.$key.']'] = get_string('atleastonerealdataset', 'qtype_calculated');
}
}
return $errors;
+21 -21
View File
@@ -67,7 +67,7 @@ class question_dataset_dependent_items_form extends moodleform {
parent::moodleform($submiturl);
}
function definition() {
$labelsharedwildcard = get_string("sharedwildcard", "qtype_datasetdependent");
$labelsharedwildcard = get_string("sharedwildcard", "qtype_calculated");
$mform =& $this->_form;
$strquestionlabel = $this->qtypeobj->comment_header($this->question);
@@ -76,14 +76,14 @@ class question_dataset_dependent_items_form extends moodleform {
} else {
$this->noofitems = 0;
}
$label = get_string("sharedwildcards", "qtype_datasetdependent");
$label = get_string("sharedwildcards", "qtype_calculated");
//
$html2 = $this->qtypeobj->print_dataset_definitions_category_shared($this->question,$this->datasetdefs);
$mform->addElement('static','listcategory',$label,$html2);
//------------------------------------------------------------------------------------------------------------------------------
$mform->addElement('submit', 'updatedatasets', get_string('updatedatasetparam', 'qtype_datasetdependent'));
$mform->addElement('submit', 'updatedatasets', get_string('updatedatasetparam', 'qtype_calculated'));
$mform->registerNoSubmitButton('updatedatasets');
$mform->addElement('header', 'additemhdr', get_string('itemtoadd', 'qtype_datasetdependent'));
$mform->addElement('header', 'additemhdr', get_string('itemtoadd', 'qtype_calculated'));
$idx = 1;
$data = array();
$j = (($this->noofitems) * count($this->datasetdefs))+1;
@@ -95,9 +95,9 @@ class question_dataset_dependent_items_form extends moodleform {
$mform->addElement('text', "number[$j]", $name);
$mform->setType("number[$j]", PARAM_NUMBER);
/* if($datasetdef->category |= 0 && $datasetdef->category == $this->category){
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetdef->name </strong>", get_string('dataitemdefined',"qtype_datasetdependent", $datasetdef->itemcount));
$mform->addElement('static', "there is a category", $labelsharedwildcard." <strong>$datasetdef->name </strong>", get_string('dataitemdefined',"qtype_calculated", $datasetdef->itemcount));
}else if($datasetdef->category |= 0 && $datasetdef->category != $this->category){
$mform->addElement('static', "BAD a category", $labelsharedwildcard." <strong>$datasetdef->name </strong>", get_string('dataitemdefined',"qtype_datasetdependent", $datasetdef->itemcount));
$mform->addElement('static', "BAD a category", $labelsharedwildcard." <strong>$datasetdef->name </strong>", get_string('dataitemdefined',"qtype_calculated", $datasetdef->itemcount));
}*/
$this->qtypeobj->custom_generator_tools_part($mform, $idx, $j);
$idx++;
@@ -110,8 +110,8 @@ class question_dataset_dependent_items_form extends moodleform {
$j++;
}
$mform->addElement('header', 'updateanswershdr', get_string('answerstoleranceparam', 'qtype_datasetdependent'));
$mform->addElement('submit', 'updateanswers', get_string('updatetolerancesparam', 'qtype_datasetdependent'));
$mform->addElement('header', 'updateanswershdr', get_string('answerstoleranceparam', 'qtype_calculated'));
$mform->addElement('submit', 'updateanswers', get_string('updatetolerancesparam', 'qtype_calculated'));
$mform->setAdvanced('updateanswers',true);
$mform->registerNoSubmitButton('updateanswers');
@@ -169,17 +169,17 @@ class question_dataset_dependent_items_form extends moodleform {
if ($this->qtypeobj->supports_dataset_item_generation()){
$radiogrp = array();
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('reuseifpossible', 'qtype_datasetdependent'), 0);
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('forceregeneration of only non shared wild cards', 'qtype_datasetdependent'), 1);
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('forceregeneration of all wild cards', 'qtype_datasetdependent'), 2);
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('reuseifpossible', 'qtype_calculated'), 0);
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('forceregeneration of only non shared wild cards', 'qtype_calculated'), 1);
$radiogrp[] =& $mform->createElement('radio', 'nextpageparam[forceregeneration]', null, get_string('forceregeneration of all wild cards', 'qtype_calculated'), 2);
$mform->addGroup($radiogrp, 'forceregenerationgrp', get_string('nextitemtoadd', 'qtype_calculated'), "<br/>", false);
}
$mform->addElement('submit', 'getnextbutton', get_string('getnextnow', 'qtype_datasetdependent'));
$mform->addElement('submit', 'getnextbutton', get_string('getnextnow', 'qtype_calculated'));
$mform->addElement('static', "dividera", '', '<hr />');
$addgrp = array();
$addgrp[] =& $mform->createElement('submit', 'addbutton', get_string('add', 'moodle'));
$addgrp[] =& $mform->createElement('select', "selectadd", get_string('additem', 'qtype_datasetdependent'), $addremoveoptions);
$addgrp[] =& $mform->createElement('select', "selectadd", get_string('additem', 'qtype_calculated'), $addremoveoptions);
$addgrp[] = & $mform->createElement('static',"stat","Items",get_string('newsetwildcardvalues', 'qtype_calculatedsimple'));
$mform->addGroup($addgrp, 'addgrp', '', ' ', false);
$mform->addElement('static', "divideradd", '', '');
@@ -188,13 +188,13 @@ class question_dataset_dependent_items_form extends moodleform {
$mform->addElement('header', 'additemhdr', get_string('delete', 'moodle'));
$deletegrp = array();
$deletegrp[] =& $mform->createElement('submit', 'deletebutton', get_string('delete', 'moodle'));
$deletegrp[] =& $mform->createElement('select', "selectdelete", get_string('deleteitem', 'qtype_datasetdependent')."1", $addremoveoptions);
$deletegrp[] =& $mform->createElement('select', "selectdelete", get_string('deleteitem', 'qtype_calculated')."1", $addremoveoptions);
$deletegrp[] = & $mform->createElement('static',"stat","Items",get_string('setwildcardvalues', 'qtype_calculatedsimple'));
$mform->addGroup($deletegrp, 'deletegrp', '', ' ', false);
// $mform->addElement('static', "dividerdelete", '', '<hr />');
// $mform->closeHeaderBefore('dividerdelete');
} else {
$mform->addElement('static','warning','','<span class="error">'.get_string('youmustaddatleastoneitem', 'qtype_datasetdependent').'</span>');
$mform->addElement('static','warning','','<span class="error">'.get_string('youmustaddatleastoneitem', 'qtype_calculated').'</span>');
}
// $mform->addElement('header', 'additemhdr', get_string('showitems', 'moodle'));
@@ -214,7 +214,7 @@ class question_dataset_dependent_items_form extends moodleform {
for ($i = $this->noofitems; $i >= 1 ; $i--){
if($k > 0 ){ //|| $this->outsidelimit || !empty($this->numbererrors )
$mform->addElement('header', '',"<b>".get_string('setno', 'qtype_calculatedsimple', $i)."</b>&nbsp;&nbsp;");
// $mform->addElement('header', '', get_string('itemno', 'qtype_datasetdependent', $i));
// $mform->addElement('header', '', get_string('itemno', 'qtype_calculated', $i));
}
foreach ($this->datasetdefs as $defkey => $datasetdef){
if($k > 0 ){ //|| $this->outsidelimit || !empty($this->numbererrors )
@@ -400,7 +400,7 @@ class question_dataset_dependent_items_form extends moodleform {
}
if ($this->outsidelimit){
$formdata['outsidelimit']= '<span class="error">'.get_string('oneanswertrueansweroutsidelimits', 'qtype_datasetdependent').'</span>';
$formdata['outsidelimit']= '<span class="error">'.get_string('oneanswertrueansweroutsidelimits', 'qtype_calculated').'</span>';
}
$formdata = $this->qtypeobj->custom_generator_set_data($this->datasetdefs, $formdata);
@@ -420,14 +420,14 @@ class question_dataset_dependent_items_form extends moodleform {
foreach ($numbers as $key => $number){
if(! is_numeric($number)){
if (stristr($number,',')){
$errors['number['.$key.']'] = get_string('The , cannot be used, use . as in 0.013 or 1.3e-2', 'qtype_datasetdependent');
$errors['number['.$key.']'] = get_string('The , cannot be used, use . as in 0.013 or 1.3e-2', 'qtype_calculated');
}else {
$errors['number['.$key.']'] = get_string('This is not a valid number', 'qtype_datasetdependent');
$errors['number['.$key.']'] = get_string('This is not a valid number', 'qtype_calculated');
}
}else if( stristr($number,'x')){
$errors['number['.$key.']'] = get_string('Hexadecimal format (i.e. 0X12d) is not allowed', 'qtype_datasetdependent');
$errors['number['.$key.']'] = get_string('Hexadecimal format (i.e. 0X12d) is not allowed', 'qtype_calculated');
} else if( is_nan($number)){
$errors['number['.$key.']'] = get_string('is a NAN number', 'qtype_datasetdependent');
$errors['number['.$key.']'] = get_string('is a NAN number', 'qtype_calculated');
}
}
return $errors;
@@ -53,3 +53,54 @@ $string['trueansweroutsidelimits'] = '<span class="error">ERROR Correct answer :
$string['updatecategory'] = 'Update the category';
$string['usedinquestion'] = 'Used in Question';
$string['youmustenteramultiplierhere'] = 'You must enter a multiplier here.';
$string['additem'] = 'Add Item';
$string['answerstoleranceparam'] = 'Answers tolerance parameters';
$string['atleastonerealdataset']='There should be at least one real dataset in question text';
$string['atleastonewildcard']='There should be at least one wild card in answer formula or question text';
$string['calcdistribution'] = 'Distribution';
$string['calclength'] = 'Decimal Places';
$string['calcmax'] = 'Maximum';
$string['calcmin'] = 'Minimum';
$string['dataitemdefined']='with $a numerical values already defined is available';
$string['datasetrole']= ' The wild cards <strong>{x..}</strong> will be substituted by a numerical value from their dataset';
$string['deletelastitem'] = 'Delete Last Item';
$string['existingcategory1'] = 'a literal from an already existing set of literals that are also used by other questions in this category';
$string['existingcategory2'] = 'a file from an already existing set of files that are also used by other questions in this category';
$string['existingcategory3'] = 'a link from an already existing set of links that are also used by other questions in this category';
$string['forceregeneration'] = 'force regeneration';
$string['getnextnow'] = 'Get New \'Item to Add\' Now';
$string['hexanotallowed'] = 'Dataset <strong>{$a->name}</strong> hexadecimal format value $a->value is not allowed' ;
$string['itemno'] = 'Item $a';
$string['item(s)'] = 'item(s)';
$string['itemscount']='Items<br />Count';
$string['itemtoadd'] = 'Item To Add';
$string['keptcategory1'] = 'a literal from the same category reusable set of literals as before';
$string['keptcategory2'] = 'a file from the same category reusable set of files as before';
$string['keptcategory3'] = 'a link from the same category reusable set of links as before';
$string['keptlocal1'] = 'a literal from the same question private set of literals as before';
$string['keptlocal2'] = 'a file from the same question private set of files as before';
$string['keptlocal3'] = 'a link from the same question private set of links as before';
$string['lastitem(s)'] = 'last items(s)';
$string['loguniform'] = 'Loguniform';
$string['minmax'] = 'Range of Values';
$string['newcategory1'] = 'a literal from a new set of literals that may also be used by other questions in this category';
$string['newcategory2'] = 'a file from a new set of files that may also be used by other questions in this category';
$string['newcategory3'] = 'a link from a new set of links that may also be used by other questions in this category';
$string['newlocal1'] = 'a literal from a new set of literals that will only be used by this question';
$string['newlocal2'] = 'a file from a new set of files that will only be used by this question';
$string['newlocal3'] = 'a link from a new set of links that will only be used by this question';
$string['nodataset'] = 'nothing - it is not a wild card';
$string['nocommaallowed'] = 'The , cannot be used, use . as in 0.013 or 1.3e-2' ;
$string['notvalidnumber'] = 'Wild card value is not a valid number ' ;
$string['oneanswertrueansweroutsidelimits'] = 'At least one correct answer outside the true value limits.<br />Modify the answers tolerance settings available as Advanced parameters';
$string['param'] = 'Param {<strong>$a</strong>}';
$string['replacewithrandom'] = 'Replace with a random value';
$string['reuseifpossible'] = 'reuse previous value if available';
$string['sharedwildcard']='Shared wild card';
$string['sharedwildcards']='Shared wild cards';
$string['synchronize']='Synchronize the data from shared datasets with other questions in a quiz';
$string['uniform'] = 'Uniform';
$string['updatetolerancesparam'] = 'Update the answers tolerance parameters';
$string['updatedatasetparam'] = 'Update the datasets parameters';
$string['youmustaddatleastoneitem'] = 'You must add at least one dataset item before you can save this question.';
+10 -11
View File
@@ -902,17 +902,17 @@ class question_calculated_qtype extends default_questiontype {
function custom_generator_tools_part(&$mform, $idx, $j){
$minmaxgrp = array();
$minmaxgrp[] =& $mform->createElement('text', "calcmin[$idx]", get_string('calcmin', 'qtype_datasetdependent'));
$minmaxgrp[] =& $mform->createElement('text', "calcmax[$idx]", get_string('calcmax', 'qtype_datasetdependent'));
$mform->addGroup($minmaxgrp, 'minmaxgrp', get_string('minmax', 'qtype_datasetdependent'), ' - ', false);
$minmaxgrp[] =& $mform->createElement('text', "calcmin[$idx]", get_string('calcmin', 'qtype_calculated'));
$minmaxgrp[] =& $mform->createElement('text', "calcmax[$idx]", get_string('calcmax', 'qtype_calculated'));
$mform->addGroup($minmaxgrp, 'minmaxgrp', get_string('minmax', 'qtype_calculated'), ' - ', false);
$mform->setType("calcmin[$idx]", PARAM_NUMBER);
$mform->setType("calcmax[$idx]", PARAM_NUMBER);
$precisionoptions = range(0, 10);
$mform->addElement('select', "calclength[$idx]", get_string('calclength', 'qtype_datasetdependent'), $precisionoptions);
$mform->addElement('select', "calclength[$idx]", get_string('calclength', 'qtype_calculated'), $precisionoptions);
$distriboptions = array('uniform' => get_string('uniform', 'qtype_datasetdependent'), 'loguniform' => get_string('loguniform', 'qtype_datasetdependent'));
$mform->addElement('select', "calcdistribution[$idx]", get_string('calcdistribution', 'qtype_datasetdependent'), $distriboptions);
$distriboptions = array('uniform' => get_string('uniform', 'qtype_calculated'), 'loguniform' => get_string('loguniform', 'qtype_calculated'));
$mform->addElement('select', "calcdistribution[$idx]", get_string('calcdistribution', 'qtype_calculated'), $distriboptions);
}
@@ -1790,9 +1790,9 @@ class question_calculated_qtype extends default_questiontype {
$namestr =get_string('name', 'quiz');
$minstr=get_string('min', 'quiz');
$maxstr=get_string('max', 'quiz');
$rangeofvaluestr=get_string('minmax','qtype_datasetdependent');
$rangeofvaluestr=get_string('minmax','qtype_calculated');
$questionusingstr = get_string('usedinquestion','qtype_calculated');
$itemscountstr = get_string('itemscount','qtype_datasetdependent');
$itemscountstr = get_string('itemscount','qtype_calculated');
$text ='';
if (!empty($form->category)) {
list($category) = explode(',', $form->category);
@@ -1857,9 +1857,9 @@ class question_calculated_qtype extends default_questiontype {
$namestr =get_string('name', 'quiz');
$minstr=get_string('min', 'quiz');
$maxstr=get_string('max', 'quiz');
$rangeofvaluestr=get_string('minmax','qtype_datasetdependent');
$rangeofvaluestr=get_string('minmax','qtype_calculated');
$questionusingstr = get_string('usedinquestion','qtype_calculated');
$itemscountstr = get_string('itemscount','qtype_datasetdependent');
$itemscountstr = get_string('itemscount','qtype_calculated');
$text ='';
if (!empty($question->category)) {
list($category) = explode(',', $question->category);
@@ -2010,7 +2010,6 @@ class question_calculated_qtype extends default_questiontype {
$status = fwrite ($bf,start_tag("CALCULATED_OPTIONS",$level,true));
//Print calculated_option contents
fwrite ($bf,full_tag("SYNCHRONIZE",$level+1,false,$calculated_option->synchronize));
fwrite ($bf,full_tag("MULTIPLECHOICE",$level+1,false,$calculated_option->multiplechoice));
fwrite ($bf,full_tag("SINGLE",$level+1,false,$calculated_option->single));
fwrite ($bf,full_tag("SHUFFLEANSWERS",$level+1,false,$calculated_option->shuffleanswers));
fwrite ($bf,full_tag("CORRECTFEEDBACK",$level+1,false,$calculated_option->correctfeedback));