Commit b42d08d3 authored by Chenu Denis's avatar Chenu Denis

[feature] Allow to set only submitted survey in list

[feature] Allow to use EM dynamic
parent e21318a7
......@@ -100,6 +100,15 @@ class questionExtraSurvey extends \ls\pluginmanager\PluginBase
'help'=>gT(''),
'caption'=>gT('Not show survey if question is empty.'),
),
'extraSurveySetSurveySubmittedOnly'=>array(
'types'=>'XT',
'category'=>gT('Extra survey'),
'sortorder'=>80, /* Own category */
'inputtype'=>'switch',
'default'=>1,
'help'=>gT(''),
'caption'=>gT('Fill answer with question id only if submitted.'),
),
);
if(method_exists($this->getEvent(),'append')) {
......@@ -335,6 +344,7 @@ class questionExtraSurvey extends \ls\pluginmanager\PluginBase
$qCodeText=trim($aAttributes['extraSurveyQuestion']);
$showId=trim($aAttributes['extraSurveyShowId']);
$qCodeSrid=trim($aAttributes['extraSurveyQuestionLink']);
$setSubmittedSrid=trim($aAttributes['extraSurveySetSurveySubmittedOnly']);
$aResponses=$this->_getPreviousResponse($surveyId,$srid,$token,$qCodeText,$showId,$qCodeSrid);
$newUrlParam=array(
'sid' =>$surveyId,
......@@ -353,6 +363,7 @@ class questionExtraSurvey extends \ls\pluginmanager\PluginBase
'token' => $token,
'newUrl'=>Yii::app()->getController()->createUrl('survey/index',$newUrlParam),
'inputName'=>$inputName,
'setSubmittedSrid'=>$setSubmittedSrid,
);
return Yii::app()->controller->renderPartial("questionExtraSurvey.views.reponsesList",$renderData,1);
}
......
......@@ -32,13 +32,17 @@ foreach($aResponses as $id => $aResponse) {
echo CHtml::tag('li',$aAttribute,$content);
?>
</ul>
<?php
if($inputName) {
$aValidResponse = array();
//~ foreach(
<?php if($inputName) {?>
<?php
$value = implode(",",array_keys($aResponses));
if($setSubmittedSrid) {
$aValidResponse = array_filter($aResponses, function ($aResponse) {
return (!empty($aResponse['submitdate']));
});
$value = implode(",",array_keys($aValidResponse));
}
echo \CHtml::tag("div",array(
'class' => 'answer-item text-item hidden',
'class' => 'answer-item text-item',
'aria-hidden' => 'true',
'title' => '',
),
......@@ -47,5 +51,9 @@ if($inputName) {
'id' => 'answer'.$inputName,
))
);
}
?>
?>
<script>
$("#answer<?php echo $inputName?>").trigger("keyup");
</script>
<?php }?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment