giving to questiondatasets.html all the features of datasetdefinitions_form.php of HTML
QuickForm
This commit is contained in:
@@ -630,10 +630,10 @@ class question_dataset_dependent_questiontype extends default_questiontype {
|
||||
return $datasetdefs;
|
||||
}
|
||||
|
||||
function dataset_options($form, $name) {
|
||||
function dataset_options($form, $name,$prefix='',$langfile='quiz') {
|
||||
|
||||
// First options - it is not a dataset...
|
||||
$options['0'] = get_string('nodataset', 'quiz');
|
||||
$options['0'] = get_string($prefix.'nodataset', $langfile);
|
||||
|
||||
// Construct question local options
|
||||
global $CFG;
|
||||
@@ -649,9 +649,9 @@ class question_dataset_dependent_questiontype extends default_questiontype {
|
||||
$key = "$type-0-$name";
|
||||
if ($currentdatasetdef->type == $type
|
||||
and $currentdatasetdef->category == 0) {
|
||||
$options[$key] = get_string("keptlocal$type", 'quiz');
|
||||
$options[$key] = get_string($prefix."keptlocal$type", $langfile);
|
||||
} else {
|
||||
$options[$key] = get_string("newlocal$type", 'quiz');
|
||||
$options[$key] = get_string($prefix."newlocal$type", $langfile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,12 +669,12 @@ class question_dataset_dependent_questiontype extends default_questiontype {
|
||||
and $categorydef = $categorydatasetdefs[$type]) {
|
||||
if ($currentdatasetdef->type == $type
|
||||
and $currentdatasetdef->id == $categorydef->id) {
|
||||
$options[$key] = get_string("keptcategory$type", 'quiz');
|
||||
$options[$key] = get_string($prefix."keptcategory$type", $langfile);
|
||||
} else {
|
||||
$options[$key] = get_string("existingcategory$type", 'quiz');
|
||||
$options[$key] = get_string($prefix."existingcategory$type", $langfile);
|
||||
}
|
||||
} else {
|
||||
$options[$key] = get_string("newcategory$type", 'quiz');
|
||||
$options[$key] = get_string($prefix."newcategory$type", $langfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,12 @@ foreach ($form->answers as $answer) {
|
||||
$mandatorydatasets += $this
|
||||
->find_dataset_names($answer);
|
||||
}
|
||||
$datasets = $this->construct_dataset_menus(
|
||||
$datasetmenus = $this->construct_dataset_menus(
|
||||
$form, $mandatorydatasets, $possibledatasets);
|
||||
// prepare shared wild card display
|
||||
$labelsharedwildcard = get_string("sharedwildcard", "qtype_datasetdependent");
|
||||
$datadefscat= array();
|
||||
$datadefscat = $this->get_dataset_definitions_category($form);
|
||||
|
||||
// Print the page
|
||||
print_heading_with_help(get_string("choosedatasetproperties", "quiz"), "questiondatasets", "quiz");
|
||||
|
||||
@@ -1,35 +1,73 @@
|
||||
<form name="theform" method="post" action="question.php">
|
||||
<center>
|
||||
<div align=\"center\"><?php print_string('datasetrole', 'qtype_datasetdependent','numerical') ;?></div>
|
||||
<div><br/></div>
|
||||
<fieldset class="clearfix" id="mandatoryhdr">
|
||||
<legend><strong><?php print_string('mandatoryhdr', 'qtype_calculated'); ?><strong></legend>
|
||||
|
||||
<table cellpadding="5">
|
||||
<?php if (!empty($datasets)) { ?>
|
||||
<?php if (!empty($mandatorydatasets)) { foreach($mandatorydatasets as $name ){?>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("wildcard", "quiz") ?> </b></td>
|
||||
<td align="right">{<?php foreach($datasets as $name => $tmp){break;} p($name) ?>}</td>
|
||||
<td><b> - <?php print_string("substitutedby", "quiz") ?></b></td>
|
||||
<td align="left"><?php echo array_shift($datasets) ?></td>
|
||||
<td align="right"><?php print_string("wildcard", "quiz") ?> </td>
|
||||
<td align="right"><strong><?php
|
||||
p($name); ?></strong></td>
|
||||
|
||||
<td align="left"><?php echo $datasetmenus[$name] ;?></td>
|
||||
</tr>
|
||||
<?php foreach ($datasets as $name => $menu) { ?>
|
||||
<?php if (isset($datadefscat[$name])){?>
|
||||
<tr valign="top">
|
||||
<td/>
|
||||
<td align="right">{<?php p($name) ?>}</td>
|
||||
<td/>
|
||||
<td align="right"><?php print_string("sharedwildcard", "qtype_datasetdependent"); ?> </td>
|
||||
<td align="right"><strong><?php
|
||||
p($name); ?></strong></td>
|
||||
|
||||
<td align="left"><?php print_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$name]) ;?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
||||
<?php unset ($datasetmenus[$name]) ;
|
||||
} ?>
|
||||
</table>
|
||||
</fieldset>
|
||||
<div><br/></div>
|
||||
|
||||
<fieldset class="clearfix" id="mandatoryhdr">
|
||||
<legend><strong><?php print_string('possiblehdr', 'qtype_calculated'); ?></strong></legend>
|
||||
|
||||
<table cellpadding="5">
|
||||
<?php foreach ($datasetmenus as $name => $menu) { ?>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("wildcard", "quiz") ?> </td>
|
||||
<td align="right"><strong><?php
|
||||
p($name); ?></strong></td>
|
||||
<td align="left"><?php echo $menu ?>
|
||||
</tr>
|
||||
<?php }
|
||||
} else { ?>
|
||||
<?php if (isset($datadefscat[$name])){?>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("sharedwildcard", "qtype_datasetdependent"); ?> </td>
|
||||
<td align="right"><strong><?php
|
||||
p($name); ?></strong></td>
|
||||
<td align="left"><?php print_string('dataitemdefined',"qtype_datasetdependent", $datadefscat[$name]) ;?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</fieldset>
|
||||
<?php } else { ?>
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
<td colspan="4"><?php print_string('nopossibledatasets', 'quiz') ?>
|
||||
<input type="hidden" name="dataset[]" value="0"/>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
|
||||
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
|
||||
<input type="hidden" name="category" value="<?php p($question->category) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<input type="hidden" name="wizardpage" value="datasetdefinitions" />
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" />
|
||||
<input type="submit" value="<?php print_string('nextpage', 'qtype_calculated') ?>" />
|
||||
</center>
|
||||
</form>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user