Skip to content

Commit

Permalink
giving to questiondatasets.html all the features of datasetdefinition…
Browse files Browse the repository at this point in the history
…s_form.php of HTML

 QuickForm
  • Loading branch information
pichetp committed Jun 12, 2007
1 parent 32993fe commit 9b0f6ae
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 21 deletions.
14 changes: 7 additions & 7 deletions question/type/datasetdependent/abstractqtype.php
Expand Up @@ -630,10 +630,10 @@ function update_dataset_options($datasetdefs, $form) {
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;
Expand All @@ -649,9 +649,9 @@ function dataset_options($form, $name) {
$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);
}
}

Expand All @@ -669,12 +669,12 @@ function dataset_options($form, $name) {
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);
}
}

Expand Down
6 changes: 5 additions & 1 deletion question/type/datasetdependent/datasetdefinitions.php
Expand Up @@ -9,8 +9,12 @@
$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");
Expand Down
64 changes: 51 additions & 13 deletions question/type/datasetdependent/questiondatasets.html
@@ -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 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/>
<td align="right">{<?php p($name) ?>}</td>
<td/>
<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>

0 comments on commit 9b0f6ae

Please sign in to comment.