Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thedirtypanda committed Mar 25, 2020
1 parent f9f5daf commit dabe183
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions application/controllers/admin/responses.php
Expand Up @@ -68,7 +68,7 @@ private function _getData($params)
$aData['all'] = App()->request->getParam('all');
$thissurvey = getSurveyInfo($iSurveyId);
if (!$thissurvey) {
// Already done in Survey_Common_Action
// Already done in Survey_Common_Action
App()->session['flashmessage'] = gT("Invalid survey ID");
$this->getController()->redirect(array("admin/index"));
} elseif ($thissurvey['active'] != 'Y') {
Expand All @@ -77,7 +77,6 @@ private function _getData($params)
}

//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.

if (App()->request->getParam('browselang')) {
$aData['language'] = App()->request->getParam('browselang');
$aData['languagelist'] = $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
Expand Down Expand Up @@ -597,6 +596,8 @@ public function getResponsesTopBarData($sid)
$hasStatisticsReadPermission = Permission::model()->hasSurveyPermission($sid, 'statistics', 'read');
$hasResponsesExportPermission = Permission::model()->hasSurveyPermission($sid, 'responses', 'export');
$hasResponsesDeletePermission = Permission::model()->hasSurveyPermission($sid, 'responses', 'delete');
$isActive = $survey->active;
$isTimingEnabled = $survey->savetimings;

return App()->getController()->renderPartial(
'/admin/survey/topbar/responses_topbar',
Expand All @@ -607,6 +608,8 @@ public function getResponsesTopBarData($sid)
'hasStatisticsReadPermission' => $hasStatisticsReadPermission,
'hasResponsesExportPermission' => $hasResponsesExportPermission,
'hasResponsesDeletePermission' => $hasResponsesDeletePermission,
'isActive' => $isActive,
'isTimingEnabled' => $isTimingEnabled,
)
);
}
Expand Down
15 changes: 15 additions & 0 deletions application/views/admin/survey/topbar/responses_topbar.php
Expand Up @@ -63,6 +63,21 @@
array_push($topBar['alignment']['left']['buttons'], $buttons['statistics']);
}

if($isActive) {
// If 'save timings' is enabled (from Notifications & Data).
// Original view: views/admin/responses/browsemenubar_view.php
if ($isTimingEnabled) {
$buttons['timing_statistics'] = [
'name' => gT('Timing statistics'),
'url' => $this->createUrl("admin/responses/sa/time/surveyid/$survey->sid"),
'class'=> 'btn btn-default pjax',
'icon' => 'fa fa-clock-o',
'icon-class' => 'text-success',
];
array_push($topBar['alignment']['left']['buttons'], $buttons['timing_statistics']);
}
}

if ($hasResponsesExportPermission) {
$permissions['export'] = $hasResponsesExportPermission;
// Export Button
Expand Down

0 comments on commit dabe183

Please sign in to comment.