diff --git a/question/type/calculated/datasetdefinitions_form.php b/question/type/calculated/datasetdefinitions_form.php index e0679dc96f8..680d19e065a 100644 --- a/question/type/calculated/datasetdefinitions_form.php +++ b/question/type/calculated/datasetdefinitions_form.php @@ -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 = "
".get_string('datasetrole', 'qtype_datasetdependent','numerical')."
"; + $label = "
".get_string('datasetrole', 'qtype_calculated')."
"; $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"). " $datasetname "; $mform->addElement('select', "dataset[$key]", $label, $options); if (isset($datadefscat[$datasetname])){ - $mform->addElement('static', "there is a category", $labelsharedwildcard." $datasetname ", get_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$datasetname])); + $mform->addElement('static', "there is a category", $labelsharedwildcard." $datasetname ", 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." $datasetname ", get_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$datasetname])); + $mform->addElement('static', "there is a category", $labelsharedwildcard." $datasetname ", 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 shared 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; diff --git a/question/type/calculated/datasetitems_form.php b/question/type/calculated/datasetitems_form.php index 5f2ef4a5875..75abf4ae5d4 100644 --- a/question/type/calculated/datasetitems_form.php +++ b/question/type/calculated/datasetitems_form.php @@ -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." $datasetdef->name ", get_string('dataitemdefined',"qtype_datasetdependent", $datasetdef->itemcount)); + $mform->addElement('static', "there is a category", $labelsharedwildcard." $datasetdef->name ", get_string('dataitemdefined',"qtype_calculated", $datasetdef->itemcount)); }else if($datasetdef->category |= 0 && $datasetdef->category != $this->category){ - $mform->addElement('static', "BAD a category", $labelsharedwildcard." $datasetdef->name ", get_string('dataitemdefined',"qtype_datasetdependent", $datasetdef->itemcount)); + $mform->addElement('static', "BAD a category", $labelsharedwildcard." $datasetdef->name ", 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'), "
", false); } - $mform->addElement('submit', 'getnextbutton', get_string('getnextnow', 'qtype_datasetdependent')); + $mform->addElement('submit', 'getnextbutton', get_string('getnextnow', 'qtype_calculated')); $mform->addElement('static', "dividera", '', '
'); $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", '', '
'); // $mform->closeHeaderBefore('dividerdelete'); } else { - $mform->addElement('static','warning','',''.get_string('youmustaddatleastoneitem', 'qtype_datasetdependent').''); + $mform->addElement('static','warning','',''.get_string('youmustaddatleastoneitem', 'qtype_calculated').''); } // $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', '',"".get_string('setno', 'qtype_calculatedsimple', $i)."  "); - // $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']= ''.get_string('oneanswertrueansweroutsidelimits', 'qtype_datasetdependent').''; + $formdata['outsidelimit']= ''.get_string('oneanswertrueansweroutsidelimits', 'qtype_calculated').''; } $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; diff --git a/question/type/calculated/lang/en/qtype_calculated.php b/question/type/calculated/lang/en/qtype_calculated.php index 7a42579b42a..d5ed28e4ae4 100644 --- a/question/type/calculated/lang/en/qtype_calculated.php +++ b/question/type/calculated/lang/en/qtype_calculated.php @@ -53,3 +53,54 @@ $string['trueansweroutsidelimits'] = '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 {x..} 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 {$a->name} hexadecimal format value $a->value is not allowed' ; +$string['itemno'] = 'Item $a'; +$string['item(s)'] = 'item(s)'; +$string['itemscount']='Items
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.
Modify the answers tolerance settings available as Advanced parameters'; +$string['param'] = 'Param {$a}'; +$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.'; + diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index 8e2051a0c08..af10e3fcc7f 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -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));