Skip to content

Commit

Permalink
Dev: array multiflexi, views
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Apr 1, 2016
1 parent dd9fa6c commit 6451859
Show file tree
Hide file tree
Showing 8 changed files with 538 additions and 317 deletions.
582 changes: 266 additions & 316 deletions application/helpers/qanda_helper.php

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions application/views/survey/questions/arrays/multiflexi/answer.php
@@ -0,0 +1,56 @@
<?php
/**
* Global container for the answer
*
* @var $answertypeclass
* @var $extraclass
* @var $answerwidth
* @var $labelans
* @var $cellwidth
* @var $right_exists
*
*/
?>
<!-- answer -->
<div class="no-more-tables">
<table class="table question subquestions-list questions-list <?php echo $answertypeclass; ?>-list <?php echo $extraclass; ?>">

<colgroup class="col-responses">
<col class="answertext" style='width: <?php echo $answerwidth;?>%;'/>

<?php foreach ($labelans as $i=>$ld):?>
<col class="<?php // TODO: array2 alternation ?>" style='width: <?php echo $cellwidth;?>%;'/>
<?php endforeach;?>

<?php if ($right_exists):?>
<col class="answertextright <?php // TODO: array2 alternation ?>" style='width: <?php echo $answerwidth;?>%;' />
<?php endif;?>
</colgroup>

<thead>
<tr class="dontread">
<th>&nbsp;</th>

<?php foreach ($labelans as $ld): ?>
<th class='th-11'>
<?php echo $ld;?>
</th>
<?php endforeach;?>

<?php if ($right_exists):?>
<th>
&nbsp;
</th>
<?php endif;?>
</tr>
</thead>

<tbody>
<?php
// Defined in answer_row view
echo $sAnswerRows;
?>
</tbody>
</table>
</div>
<!-- end of answer -->
@@ -0,0 +1,3 @@
<p class="error">
<?php eT("Error: There are no answer options for this question and/or they don't exist in this language.");?>
</p>
@@ -0,0 +1,54 @@
<?php
/**
* Generate a row for the table
*
* @var $sDisplayStyle
* @var $useAnswerWidth
* @var $answerwidth
* @var $myfname
* @var $error
* @var $row_value
* @var $answertext
* @var $answertextright
* @var $answer_tds
* @var $rightTd
*/
?>

<!-- answer_row -->
<tr id="javatbd<?php echo $myfname;?>" class="<?php //TODO: alternation ?> well subquestion-list questions-list <?php echo $sDisplayStyle;?>">
<?php if ($useAnswerWidth): ?>
<th class="answertext" style='width:<?php echo $answerwidth;?>%;' >
<?php else: ?>
<th class="answertext col-xs-12 col-sm-6">
<?php endif;?>


<?php if($error): ?>
<div class="alert alert-danger" role="alert">
<?php echo $answertext; ?>
</div>
<?php else: ?>
<?php echo $answertext; ?>
<?php endif;?>
<input
type="hidden"
name="java<?php echo $myfname;?>"
id="java<?php echo $myfname;?>"
value="<?php echo $row_value;?>"
/>
</th>

<?php
// Defined in answer_td view
echo $answer_tds;
?>

<!-- right -->
<?php if($rightTd): ?>
<td class="answertextright" style='text-align:left; width: <?php echo $answerwidth; ?>'>
<?php echo $answertextright; ?>
</td>
<?php endif;?>
</tr>
<!-- end of answer_row -->
@@ -0,0 +1,71 @@
<?php
/**
* Cell when checkbox layout is not used in advanced question attribute
*
* @var $dataTitle
* @var $ld
* @var $answertypeclass
* @var $extraclass
* @var $myfname2
* @var $answertext
* @var $error
* @var $myfname2_java_value
* @var $inputboxlayout
* @var $checkconditionFunction
* @var $minvalue
* @var $maxvalue
* @var $reverse
* @var $value
* @var $sSeparator
* @var $kpclass
* @var $maxlength
*/
?>

<!-- answer_td -->
<td data-title="<?php echo $dataTitle;?>" class="answer-cell-5 answer_cell_00<?php echo $ld;?> question-item answer-item <?php echo $answertypeclass; ?>-item <?php echo $extraclass; ?>">
<label for="answer<?php echo $myfname2;?>" class='col-xs-12 col-sm-12'>

<input
type="hidden"
name="java<?php echo $myfname2;?>"
id="java<?php echo $myfname2;?>"
value="<?php echo $value; ?>"
/>

<?php if($inputboxlayout == false):?>
<!-- InputBox Layout False -->
<select
class="multiflexiselect form-control"
name="<?php echo $myfname2; ?>"
id="answer<?php echo $myfname2;?>"
onchange="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)">

<option value="">
<?php eT('...'); ?>
</option>


<?php for($ii=$minvalue; ($reverse?$ii>=$maxvalue:$ii<=$maxvalue); $ii+=$stepvalue): ?>
<?php $selected = (isset($value) && (string) $value == (string)$ii)?'SELECTED':''; ?>
<option value="<?php echo str_replace('.',$sSeparator,$ii); ?>" <?php echo $selected;?>>
<?php echo str_replace('.',$sSeparator,$ii); ?>
</option>
<?php endfor; ?>
</select>
<?php elseif($inputboxlayout == true): ?>
<!-- InputBox Layout -->
<input
type='text'
class="multiflexitext text <?php echo $kpclass;?>"
name="<?php echo $myfname2; ?>"
id="answer<?php echo $myfname2;?>"
<?php echo $maxlength; ?>
size=5
onkeyup="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)"
value="<?php echo $value; ?>"
/>
<?php endif; ?>
</label>
</td>
<!-- end of answer_td -->
@@ -0,0 +1,62 @@
<?php
/**
* Cell when checkbox layout is used in advanced question attribute
*
* @var $dataTitle
* @var $ld
* @var $answertypeclass
* @var $value $myvalue
* @var $myfname2
* @var $setmyvalue
* @var $checkconditionFunction
* @var $extraclass
*/
?>

<!-- answer_td_checkboxes -->
<td data-title="<?php echo $dataTitle;?>" class="answer-cell-6 answer_cell_00<?php echo $ld; ?> question-item answer-item <?php echo $answertypeclass;?>-item">

<input
type="hidden"
name="java<?php echo $myfname2;?>"
id="java<?php echo $myfname2;?>"
value="<?php echo $value; ?>"
/>

<input
type="hidden"
name="<?php echo $myfname2; ?>"
id="answer<?php echo $myfname2;?>"
value="<?php echo $value; ?>"
/>

<input
type="checkbox"
class="checkbox <?php echo $extraclass;?>"
name="cbox_<?php echo $myfname2;?>"
id="cbox_<?php echo $myfname2;?>"
<?php echo $setmyvalue; ?>
onclick="
cancelBubbleThis(event);
aelt=document.getElementById('answer<?php echo $myfname2;?>');
jelt=document.getElementById('java<?php echo $myfname2;?>');
if(this.checked)
{
aelt.value=1;
jelt.value=1;
<?php echo $checkconditionFunction; ?>(1,'<?php echo $myfname2;?>',aelt.type);
else
{
aelt.value='';
jelt.value='';
<?php echo $checkconditionFunction; ?>('','<?php echo $myfname2;?>',aelt.type);
}
return true;"
onchange="checkconditions(this.value, this.name, this.type)"
/>

<label class="hide read" for="cbox_<?php echo $myfname2;?>">
<?php echo $dataTitle;?>
</label>
</td>
<!-- end of answer_td_checkboxes -->
@@ -0,0 +1,25 @@
<?php
/**
* This view is used to repeat the headers of the table (question advanced attribute)
*
* @var $labelans
* @var $right_exists
* @var $cellwidth
* @var $answerwidth
*/
?>

<!-- repeat_header -->
</tbody>

<tbody>
<tr class="dontread repeat headings hidden-xs">
<?php foreach ($labelans as $i=>$ld):?>
<col class="<?php // TODO: array2 alternation ?>" style='width: <?php echo $cellwidth;?>%;'/>
<?php endforeach;?>

<?php if ($right_exists):?>
<col class="answertextright <?php // TODO: array2 alternation ?>" style='width: <?php echo $answerwidth;?>%;' />
<?php endif;?>
</tr>
<!-- end of repeat header -->
Expand Up @@ -21,7 +21,7 @@
<col class="answertext" style='width: <?php echo $answerwidth;?>%;'/>

<?php foreach ($labelans as $i=>$ld):?>
<col class="<?php // TODO: array2 alternation ?>" style='width: <?php echo $cellwidth;?>%;'/>
<col class="<?php // TODO: array2 alternation ?> <?php echo $classes; ?>" style='width: <?php echo $cellwidth; ?>%;' />
<?php endforeach;?>

<?php if ($right_exists):?>
Expand Down

0 comments on commit 6451859

Please sign in to comment.