Skip to content

Commit

Permalink
Dev Save and close in editing response
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 11, 2016
1 parent 1719e0e commit 8bacf13
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions application/controllers/admin/dataentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,6 @@ public function update()
Yii::app()->loadHelper("database");
$surveytable = "{{survey_".$surveyid.'}}';

$aDataentryoutput = "<div class='header ui-widget-header'>".gT("Data entry")."</div>\n";

$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid));
// restet token if user is not allowed to update
if(!Permission::model()->hasSurveyPermission($surveyid,'tokens','update')) // If not allowed to read: remove it
Expand Down Expand Up @@ -1498,25 +1496,15 @@ public function update()

$updateres = dbExecuteAssoc($updateqr) or safeDie("Update failed:<br />\n<br />$updateqr");

$onerecord_link = $this->getController()->createUrl('/admin/responses/sa/view/surveyid/'.$surveyid.'/id/'.$id);
$allrecords_link = $this->getController()->createUrl('/admin/responses/sa/index/surveyid/'.$surveyid);


$aDataentryoutput .= "<div class='messagebox ui-corner-all'><div class='successheader'>".gT("Success")."</div>\n"
.gT("Record has been updated.")."<br /><br />\n"
."<input type='submit' value='".gT("View This Record")."' onclick=\"window.open('$onerecord_link', '_top')\" /><br /><br />\n"
."<input type='submit' value='".gT("Browse responses")."' onclick=\"window.open('$allrecords_link', '_top')\" />\n"
."</div>\n";

$aDataentryoutput = '<div class="jumbotron message-box">';
$aDataentryoutput .= '<h2>'.gT("Success").'</h2>';
$aDataentryoutput .= '<p class="lead">'.gT("Record has been updated.").'</p>';
$aDataentryoutput .= "<input type='submit' class='btn btn-lg btn-default' value='".gT("View This Record")."' onclick=\"window.open('$onerecord_link', '_top')\" /><br /><br />\n"
."<input type='submit' class='btn btn-lg btn-default' value='".gT("Browse responses")."' onclick=\"window.open('$allrecords_link', '_top')\" />\n";
$aDataentryoutput .= '</div>';

$aViewUrls['output'] = $aDataentryoutput;
$this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
Yii::app()->setFlashMessage(sprintf(gT("The response record %s was updated."),$id));
if (Yii::app()->request->getPost('close-after-save')=='true')
{
$this->getController()->redirect($this->getController()->createUrl("admin/responses/sa/view/surveyid/{$surveyid}/id/{$id}"));
}
else
{
$this->getController()->redirect($this->getController()->createUrl("admin/dataentry/sa/editdata/subaction/edit/surveyid/{$surveyid}/id/{$id}"));
}
}
}

Expand Down

0 comments on commit 8bacf13

Please sign in to comment.