Skip to content

Commit

Permalink
Dev: array, 10 point choice, human readable view
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Apr 1, 2016
1 parent fe107ed commit 633c0c0
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 151 deletions.
68 changes: 37 additions & 31 deletions application/helpers/qanda_helper.php
Expand Up @@ -4107,50 +4107,48 @@ function do_array_10point($ia)
$anscount = count($aSubquestions);

$fn = 1;
// => answer
$answer = Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/header', array(
'extraclass'=>$extraclass,
'answerwidth' => $answerwidth
),
true);

$odd_even = '';

$sColumns = '';
for ($xc=1; $xc<=10; $xc++)
{
$odd_even = alternation($odd_even);
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/col', array('odd_even'=>$odd_even,'cellwidth'=>$cellwidth), true);
$sColumns .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/columns/col', array('odd_even'=>$odd_even,'cellwidth'=>$cellwidth), true);
}

// => col or answer
if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory
{
$odd_even = alternation($odd_even);
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/col', array('odd_even'=>$odd_even,'cellwidth'=>$cellwidth), true);
$sColumns .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/columns/col', array('odd_even'=>$odd_even,'cellwidth'=>$cellwidth), true);
}

$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/open_table_head', array(), true);


$sHeaders = '';
for ($xc=1; $xc<=10; $xc++)
{
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/table_headers', array(
$sHeaders .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/rows/cells/thead', array(
'class'=>'th-3',
'style'=>'',
'th_content'=>$xc,
), true);
//$answer .= "\t<th class='th-3'>$xc</th>\n";
}

if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory
{
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/table_headers', array(
$sHeaders .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/rows/cells/thead', array(
'class'=>'th-4',
'style'=>'',
'th_content'=>gT('No answer'),
), true);
}

$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/close_table_head', array(), true);

$answer_t_content = '';
$trbc = '';

$sRows = '';
foreach ($aSubquestions as $j => $ansrow)
{
$myfname = $ia[1].$ansrow['title'];
Expand All @@ -4166,22 +4164,12 @@ function do_array_10point($ia)
// Value
$value = (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname])) ? $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname] : '';

$answer_t_content .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/tr_open', array(
'myfname'=>$myfname,
'answerwidth'=>$answerwidth,
'answertext'=>$answertext,
'value'=>$value,
'error'=>$error,
'sDisplayStyle'=>$sDisplayStyle,
'zebra' => 2 - ($j % 2)
), true);


$answer_tds = '';
for ($i=1; $i<=10; $i++)
{
$CHECKED = (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname]) && $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname] == $i)?'CHECKED':'';

$answer_t_content .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/td_input', array(
$answer_tds .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/rows/cells/answer_td_input', array(
'i'=>$i,
'myfname'=>$myfname,
'CHECKED'=>$CHECKED,
Expand All @@ -4193,21 +4181,39 @@ function do_array_10point($ia)
if ($ia[6] != "Y" && SHOW_NO_ANSWER == 1)
{
$CHECKED = (!isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname]) || $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$myfname] == '')?'CHECKED':'';
$answer_t_content .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/td_input', array(
$answer_tds .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/rows/cells/answer_td_input', array(
'i'=>gT("No answer"),
'myfname'=>$myfname,
'CHECKED'=>$CHECKED,
'checkconditionFunction'=>$checkconditionFunction,
'value'=>'',
), true);
}
//$answer_t_content .= "</tr>\n";
$answer_t_content .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/close_row', array(), true);

$sRows .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/rows/answer_row', array(
'myfname' => $myfname,
'answerwidth' => $answerwidth,
'answertext' => $answertext,
'value' => $value,
'error' => $error,
'sDisplayStyle' => $sDisplayStyle,
'zebra' => 2 - ($j % 2),
'answer_tds' => $answer_tds,
), true);

$inputnames[]=$myfname;
$fn++;
}
$answer .= $answer_t_content;
$answer .= Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/close_table', array(), true);


$answer = Yii::app()->getController()->renderPartial('/survey/questions/arrays/10point/answer', array(
'extraclass' => $extraclass,
'answerwidth' => $answerwidth,
'sColumns' => $sColumns,
'sHeaders' => $sHeaders,
'sRows' => $sRows,
),
true);
return array($answer, $inputnames);
}

Expand Down
43 changes: 43 additions & 0 deletions application/views/survey/questions/arrays/10point/answer.php
@@ -0,0 +1,43 @@
<?php
/**
* array 10 point choice Html : Header
*
* @var $sColumns : the columns, generated with the view columns/col.php
* @var $sHeaders : the headers, generated with the view rows/cell/thead.php
* @var $sRows : the rows, generated with the view rows/answer_row.php
* @var $extraclass
* @var $answerwidth
*/
?>
<!-- Array 10 point choice -->

<!-- answer -->
<div class="no-more-tables no-more-tables-10-point">
<table class="table question subquestion-list questions-list <?php echo $extraclass; ?>">
<colgroup class="col-responses">
<col class="col-answers" width="<?php echo $answerwidth;?>%"/>
<?php
// columns/col.php
echo $sColumns;
?>
</colgroup>
<thead>
<tr class="array1 dontread">
<th>&nbsp;</th>

<?php
// rows/cell/thead.php
echo $sHeaders;
?>

</tr>
</thead>
<tbody>
<?php
// rows/answer_row.php
echo $sRows;
?>
</tbody>
</table>
</div>
<!-- end of answer -->

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions application/views/survey/questions/arrays/10point/col.php

This file was deleted.

@@ -1,11 +1,12 @@
<?php
/**
* Array 5pointchoice, column
* Array 10pointchoice, column
*
* @var $odd_even
* @var $cellwidth
*/
?>

<!-- col.php -->
<col class="<?php //TODO: alternation ?>" style='width: <?php echo $cellwidth; ?>%;' />
<!-- end of col.php -->
<!-- col -->
<col class="<?php echo $odd_even; ?>" style='width: <?php echo $cellwidth; ?>%;' />
<!-- end of col -->
13 changes: 0 additions & 13 deletions application/views/survey/questions/arrays/10point/header.php

This file was deleted.

This file was deleted.

Expand Up @@ -11,7 +11,7 @@
?>

<!-- answer_row -->
<tr id="javatbd<?php echo $myfname;?>" class="well answers-list radio-list array<?php echo $zebra; ?>" <?php echo $sDisplayStyle; ?>>
<tr id="javatbd<?php echo $myfname;?>" class="well array<?php echo $zebra; ?> answers-list radio-list" <?php echo $sDisplayStyle; ?>>
<th class="answertext" style="width: <?php echo $answerwidth;?>%;">
<?php if($error): ?>
<div class="alert alert-danger" role="alert">
Expand Down

This file was deleted.

Expand Up @@ -8,8 +8,8 @@
*/
?>

<!-- td_input -->
<td data-title='<?php echo $i;?>' class="answer-cell-2 answer_cell_00<?php echo $i;?> answer-item radio-item">
<!-- answer_td_input -->
<td data-title='<?php echo $i;?>' class="answer-cell-1 answer_cell_00<?php echo $i;?> answer-item radio-item">
<label for="answer<?php echo $myfname;?>-<?php echo $i; ?>">
<input
class="radio"
Expand All @@ -22,4 +22,4 @@ class="radio"
/>
</label>
</td>
<!-- end of td_input -->
<!-- end of answer_td_input -->
Expand Up @@ -9,6 +9,6 @@

<!-- thead -->
<th class="<?php echo $class; ?>" style="<?php echo $style; ?>" >
<?php echo $th_content;?>
<?php echo $th_content; ?>
</th>
<!-- end of thead -->

This file was deleted.

23 changes: 0 additions & 23 deletions application/views/survey/questions/arrays/10point/td_input.php

This file was deleted.

20 changes: 0 additions & 20 deletions application/views/survey/questions/arrays/10point/tr_open.php

This file was deleted.

Expand Up @@ -38,7 +38,6 @@

<!-- Table Body -->
<tbody>

<?php
// rows/answer_row.php
echo $sRows;
Expand Down

0 comments on commit 633c0c0

Please sign in to comment.