Skip to content

Commit

Permalink
Dev : better fix #6073 browse response
Browse files Browse the repository at this point in the history
Dev : separation of index and browse
  • Loading branch information
Shnoulle committed May 15, 2012
1 parent 9fddbd8 commit 30b18e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
37 changes: 24 additions & 13 deletions application/controllers/admin/browse.php
Expand Up @@ -423,8 +423,28 @@ public function index($iSurveyId)
}

$clang = $aData['clang'];
if(isset($aData['all']))
$aData['num_total_answers'] = Survey_dynamic::model($iSurveyId)->count();
$aData['num_completed_answers'] = Survey_dynamic::model($iSurveyId)->count('submitdate IS NOT NULL');

$aViewUrls[] = 'browseindex_view';
$this->_renderWrappedTemplate('',$aViewUrls, $aData);
}
function browse($iSurveyId)
{
$aData = $this->_getData($iSurveyId);
extract($aData);
$aViewUrls = array();
$oBrowseLanguage = new Limesurvey_lang($aData['language']);

/**
* fnames is used as informational array
* it containts
* $fnames[] = array(<dbfieldname>, <some strange title>, <questiontext>, <group_id>, <questiontype>);
*/
if (Yii::app()->request->getPost('sql'))
{
$aViewUrls[] = 'browseallfiltered_view';
}
//add token to top of list if survey is not private
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyId)) //add token to top of list if survey is not private
{
Expand Down Expand Up @@ -578,17 +598,8 @@ public function index($iSurveyId)
}

$aViewUrls[] = 'browseallfooter_view';
}
else
{
$aData['num_total_answers'] = Survey_dynamic::model($iSurveyId)->count();
$aData['num_completed_answers'] = Survey_dynamic::model($iSurveyId)->count('submitdate IS NOT NULL');

$aViewUrls[] = 'browseindex_view';
}
$this->_renderWrappedTemplate('',$aViewUrls, $aData);
}

public function time($iSurveyId)
{
$aData = $this->_getData(array('iSurveyId' => $iSurveyId));
Expand All @@ -611,7 +622,7 @@ public function time($iSurveyId)
}
}

$fields = createTimingsFieldMap($iSurveyId, 'full');
$fields = createTimingsFieldMap($iSurveyId, 'full',true,false,$aData['language']);

$clang = $aData['clang'];
foreach ($fields as $fielddetails)
Expand Down Expand Up @@ -654,7 +665,7 @@ public function time($iSurveyId)
$limit = Yii::app()->request->getParam('limit', 50);

//LETS COUNT THE DATA
$oCriteria = new CdbCritera();
$oCriteria = new CdbCriteria();
$oCriteria->select = 'tid';
$oCriteria->join = "INNER JOIN {{survey_{$iSurveyId}}} ON {{survey_{$iSurveyId}_timings}}.id={{survey_{$iSurveyId}}}.id";
$oCriteria->condition = 'submitdate IS NOT NULL';
Expand All @@ -666,7 +677,7 @@ public function time($iSurveyId)
}

//NOW LETS SHOW THE DATA
$oCriteria = new CdbCritera();
$oCriteria = new CdbCriteria();
$oCriteria->join = "INNER JOIN {{survey_{$iSurveyId}}} ON {{survey_{$iSurveyId}_timings}}.id = {{survey_{$iSurveyId}}}.id";
$oCriteria->condition = 'submitdate IS NOT NULL';
$oCriteria->order = "{{survey_{$iSurveyId}}}.id";
Expand Down
8 changes: 4 additions & 4 deletions application/views/admin/browse/browsemenubar_view.php
Expand Up @@ -15,12 +15,12 @@
<img src='<?php echo $sImageURL; ?>summary.png' title='' alt='<?php $clang->eT("Show summary information"); ?>' /></a>
<?php if (count(Survey::model()->findByPk($surveyid)->additionalLanguages) == 0)
{ ?>
<a href='<?php echo $this->createUrl("admin/browse/index/surveyid/$surveyid/all"); ?>'>
<a href='<?php echo $this->createUrl("admin/browse/browse/surveyid/$surveyid/all"); ?>'>
<img src='<?php echo $sImageURL; ?>document.png' title='' alt='<?php $clang->eT("Display Responses"); ?>' /></a>
<?php }
else
{ ?>
<a href="<?php echo $this->createUrl("admin/browse/index/surveyid/$surveyid/all"); ?>" accesskey='b' id='browseresponses'>
<a href="<?php echo $this->createUrl("admin/browse/browse/surveyid/$surveyid/all"); ?>" accesskey='b' id='browseresponses'>
<img src='<?php echo $sImageURL; ?>document.png' alt='<?php $clang->eT("Display Responses"); ?>' /></a>

<div class="langpopup" id="browselangpopup"><?php $clang->eT("Please select a language:"); ?><ul>
Expand All @@ -30,7 +30,7 @@
<?php } ?>
</ul></div>
<?php } ?>
<a href='<?php echo $this->createUrl("admin/browse/index/surveyid/$surveyid/all/start/0/limit/50/order/desc"); ?>'>
<a href='<?php echo $this->createUrl("admin/browse/browse/surveyid/$surveyid/all/start/0/limit/50/order/desc"); ?>'>
<img src='<?php echo $sImageURL; ?>viewlast.png' alt='<?php $clang->eT("Display Last 50 Responses"); ?>' /></a>
<?php }
if (hasSurveyPermission($surveyid, 'responses', 'create'))
Expand All @@ -44,7 +44,7 @@
<img src='<?php echo $sImageURL; ?>statistics.png' alt='<?php $clang->eT("Get statistics from these responses"); ?>' /></a>
<?php if ($thissurvey['savetimings'] == "Y")
{ ?>
<a href='<?php echo $this->createUrl("admin/browse/index/surveyid/$surveyid/subaction/time"); ?>'>
<a href='<?php echo $this->createUrl("admin/browse/browse/surveyid/$surveyid/subaction/time"); ?>'>
<img src='<?php echo $sImageURL; ?>statistics_time.png' alt='<?php $clang->eT("Get time statistics from these responses"); ?>' /></a>
<?php }
} ?>
Expand Down

0 comments on commit 30b18e8

Please sign in to comment.