Skip to content

Commit

Permalink
Dev Moved language-dependent settings in group/question/answers to su…
Browse files Browse the repository at this point in the history
…btables
  • Loading branch information
c-schmitz committed Jan 9, 2018
1 parent f8f8b45 commit 129f5fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion application/controllers/admin/statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function run($surveyid = 0, $subaction = null)
switch ($flt[2]) {
case "K": // Multiple Numerical
//get answers
$result = Question::model()->getQuestionsForStatistics('title as code, question as answer', "parent_qid=$flt[0] ", 'question_order');
$result = Question::model()->getQuestionsForStatistics('title, question', "parent_qid=$flt[0] ", 'question_order');
$aData['result'][$key1]['key1'] = $result;
break;

Expand Down
41 changes: 17 additions & 24 deletions application/views/admin/export/statistics_subviews/_question.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,32 @@

foreach($row1 as $row)
{
$row = array_values($row);
/*
* filter form for numerical input
* - checkbox
* - greater than
* - less than
*/

$myfield1="K".$myfield.$row[0];
$myfield2="K{$myfield}".$row[0]."G";
$myfield3="K{$myfield}".$row[0]."L";
$myfield1="K".$myfield.$row->title;
$myfield2="K{$myfield}".$row->title."G";
$myfield3="K{$myfield}".$row->title."L";
if ($counter2 == 4) { echo "\t</tr>\n\t<tr>\n"; $counter2=0;}

//checkbox
echo '<div class="statistics-responses-label-group ls-space padding bottom-5 top-15 ls-flex-item">';
echo "<input type='checkbox' name='summary[]' value='$myfield1'";

//check SGQA -> do we want to pre-check the checkbox?
if (isset($summary) && (array_search("K{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}", $summary) !== FALSE))
if (isset($summary) && (array_search("K{$surveyid}X{$flt[1]}X{$flt[0]}{$row->title}", $summary) !== FALSE))
{
echo " checked='checked'";
}

echo " />&nbsp;";

//show speaker
echo $oStatisticsHelper::_showSpeaker($flt[3]." - ".flattenText($row[1],true))
echo $oStatisticsHelper::_showSpeaker($flt[3]." - ".flattenText($row->questionL10ns[$language]->question,true))
."</div>\n";?>

<span class='smalltext'><?php eT("Number greater than");?>:</span><br />
Expand All @@ -101,7 +100,7 @@
case "Q": // Multiple Short Text
echo '<h4 class="question-selector-title">'.$oStatisticsHelper::_showSpeaker($niceqtext).'</h4><br/>';
//get subqestions
$result[$key1] = Question::model()->getQuestionsForStatistics('title as code, question as answer', "parent_qid='$flt[0]' AND language = '{$language}'", 'question_order');
$result[$key1] = Question::model()->getQuestionsForStatistics('title, question', "parent_qid='$flt[0]'", 'question_order');
//$counter2=0;

//loop through all answers
Expand All @@ -110,20 +109,17 @@
{
echo '<div class="row"><div class="col-sm-12">';

$row = array_values($row);
//collecting data for output, for details see above (question type "N")

//we have one input field for each answer
$myfield2 = "Q".$myfield."$row[0]";
$myfield2 = "Q".$myfield.$row->title;
echo "&nbsp;&nbsp; <input type='checkbox' name='summary[]' value='$myfield2'";

if (isset($summary) && (array_search("Q{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}", $summary) !== FALSE))
if (isset($summary) && (array_search("Q{$surveyid}X{$flt[1]}X{$flt[0]}{$row->title}", $summary) !== FALSE))
{
echo " checked='checked'";
}

echo " />&nbsp;";
echo $oStatisticsHelper::_showSpeaker($flt[3]." - ".flattenText($row[1],true))
echo $oStatisticsHelper::_showSpeaker($flt[3]." - ".flattenText($row->questionL10ns[$language]->question,true))
."<br /><p style='padding: 1em;'>\n"
."\t<span class='smalltext'>".gT("Responses containing").":</span><br />\n";
echo CHtml::textField($myfield2,isset($_POST[$myfield2])?$_POST[$myfield2]:'',array());
Expand Down Expand Up @@ -389,8 +385,7 @@
echo '<h4 class="question-selector-title">'.$oStatisticsHelper::_showSpeaker($niceqtext).'</h4><br/>';
foreach($result[$key1] as $row)
{
$row=array_values($row);
$myfield2 = $myfield . "$row[0]";
$myfield2 = $myfield . $row->title;
echo "<!-- $myfield2 - ";

if (isset($_POST[$myfield2])) {echo htmlspecialchars($_POST[$myfield2]);}
Expand All @@ -403,9 +398,9 @@
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {echo " checked='checked'";}

echo " />&nbsp;"
.'<strong>'.$oStatisticsHelper::_showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3]).'</strong>'
.'<strong>'.$oStatisticsHelper::_showSpeaker($niceqtext." ".str_replace("'", "`", $row->questionL10ns[$language]->question)." - # ".$flt[3]).'</strong>'
."</div>\n"
."\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple' class='form-control'>\n";
."\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row->title}[]' multiple='multiple' class='form-control'>\n";

//here wo loop through 10 entries to create a larger output form
for ($i=1; $i<=10; $i++)
Expand Down Expand Up @@ -518,18 +513,17 @@
echo '<h4 class="question-selector-title">'.$oStatisticsHelper::_showSpeaker($niceqtext).'</h4><br/>';
foreach($result[$key1] as $key => $row)
{
$row = array_values($row);
$fresult = $fresults[$key1][$key];
foreach($fresult as $frow)
{
$myfield2 = "T".$myfield . $row[0] . "_" . $frow['title'];
$myfield2 = "T".$myfield . $row->title . "_" . $frow['title'];
echo "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {echo htmlspecialchars($_POST[$myfield2]);}
echo " -->\n";
echo "<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {echo " checked='checked'";}
echo " />&nbsp;<strong>"
.$oStatisticsHelper::_showSpeaker($niceqtext." ".str_replace("'", "`", $row[1]." [".$frow['question']."]")." - ".$row[0]."/".$frow['title'])
.$oStatisticsHelper::_showSpeaker($niceqtext." ".str_replace("'", "`", $row->questionL10ns[$language]->question." [".$frow->questionL10ns[$language]->question."]")." - ".$row->title."/".$frow['title'])
."</strong><br />\n";
echo "\t<span class='smalltext'>".gT("Responses containing").":</span><br />\n"
.CHtml::textField($myfield2,isset($_POST[$myfield2])?$_POST[$myfield2]:'',array() );
Expand Down Expand Up @@ -576,10 +570,9 @@
}
foreach($result[$key1] as $row)
{
$row = array_values($row);
$fresult = Question::model()->getQuestionsForStatistics('*', "parent_qid='$flt[0]' AND language = '{$language}' AND scale_id = 1", 'question_order, title');
foreach($fresult as $frow)
{
//$fresult = Question::model()->getQuestionsForStatistics('*', "parent_qid='{$row->qid}' AND language = '{$language}' AND scale_id = 1", 'question_order, title');
$fresult = Question::model()->findAllByAttributes(['parent_qid'=>$row->qid,'scale_id'=>1]);
foreach ($fresult as $frow) {
$myfield2 = $myfield . $row[0] . "_" . $frow['title'];
echo "<!-- MyField2: $myfield2 - ";
if (isset($_POST[$myfield2])) {echo htmlspecialchars($_POST[$myfield2]);}
Expand Down

0 comments on commit 129f5fa

Please sign in to comment.