Skip to content

Commit

Permalink
Dev: numerical question, views
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 27, 2016
1 parent 014dc9d commit 21238d8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
18 changes: 15 additions & 3 deletions application/helpers/qanda_helper.php
Expand Up @@ -3360,13 +3360,25 @@ function do_numerical($ia)
{
$kpclass = "";
}
// --> START NEW FEATURE - SAVE
$answer = "<p class='question answer-item text-item numeric-item {$extraclass}'>"
. " <label for='answer{$ia[1]}' class='hide label'>".gT('Your answer')."</label>\n$prefix\t"
. "<input class='form-control text {$answertypeclass}' type=\"text\" size=\"$tiwidth\" name=\"$ia[1]\" title=\"".gT('Only numbers may be entered in this field.')."\" "
. "id=\"answer{$ia[1]}\" value=\"{$fValue}\" onkeyup=\"{$checkconditionFunction}(this.value, this.name, this.type,'onchange',{$integeronly})\" "
. " {$maxlength} />\t{$suffix}\n</p>\n";
// --> END NEW FEATURE - SAVE

$itemDatas = array(
'extraclass'=>$extraclass,
'id'=>$ia[1],
'prefix'=>$prefix,
'answertypeclass'=>$answertypeclass,
'tiwidth'=>$tiwidth,
'fValue'=>$fValue,
'checkconditionFunction'=>$checkconditionFunction,
'integeronly'=>$integeronly,
'maxlength'=>$maxlength,
'suffix'=>$suffix,
);
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/numerical/item', $itemDatas, true);

$inputnames[]=$ia[1];
$mandatory=null;
Expand All @@ -3381,12 +3393,12 @@ function do_shortfreetext($ia)
{
global $thissurvey;


$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey!='')
{
$sGoogleMapsAPIKey='&key='.$sGoogleMapsAPIKey;
}

$extraclass ="";
$aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);

Expand Down
36 changes: 36 additions & 0 deletions application/views/survey/questions/numerical/item.php
@@ -0,0 +1,36 @@
<?php
/**
* Numerical Html
*
* @var $extraclass
* @var $id $ia[1]
* @var $prefix
* @var $answertypeclass
* @var $tiwidth
* @var $fValue
* @var $checkconditionFunction
* @var $integeronly
* @var $maxlength
* @var $suffix
*/
?>
<p class='question answer-item text-item numeric-item <?php echo $extraclass;?>'>
<label for='answer<?php echo $id;?>' class='hide label'>
<?php eT('Your answer'); ?>
</label>

<?php echo $prefix; ?>

<input
class='form-control text <?php echo $answertypeclass; ?>'
type="text"
size="<?php echo $tiwidth;?>"
name="<?php echo $id;?>"
title=<?php echo eT('Only numbers may be entered in this field.');?>"
id="answer<?php echo $id;?>"
value="<?php echo $fValue;?>"
onkeyup="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type,'onchange', <?php echo $integeronly; ?>);"
<?php echo $maxlength; ?>
/>
<?php echo $suffix;?>
</p>

0 comments on commit 21238d8

Please sign in to comment.