Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/Yii' into Yii
Browse files Browse the repository at this point in the history
  • Loading branch information
trougakoss committed Jul 24, 2012
2 parents 43780b0 + 5cd3331 commit d1e0d68
Show file tree
Hide file tree
Showing 10 changed files with 2,677 additions and 2,633 deletions.
4 changes: 2 additions & 2 deletions application/config/tcpdf.php
Expand Up @@ -75,8 +75,8 @@
* ADD TRAILING SLASH!
***********************************************************/

$tcpdf['image_directory'] = Yii::app()->getConfig('imagedir').DIRECTORY_SEPARATOR;

//$tcpdf['image_directory'] = Yii::app()->getConfig('imagedir').DIRECTORY_SEPARATOR;
$tcpdf['image_directory'] = Yii::app()->getConfig('rootdir').DIRECTORY_SEPARATOR.'styles'.DIRECTORY_SEPARATOR.Yii::app()->getConfig('admintheme').DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR;

/************************************************************
* TCPDF default (blank) image
Expand Down
10 changes: 6 additions & 4 deletions application/controllers/admin/dataentry.php
Expand Up @@ -1445,19 +1445,21 @@ public function editdata($subaction, $id, $surveyid, $language='')
*/
public function delete()
{
$subaction = Yii::app()->request->getPost('subaction');
$surveyid = $_REQUEST['surveyid'];
if (isset($_REQUEST['surveyid']) && !empty($_REQUEST['surveyid']))
{
$surveyid = $_REQUEST['surveyid'];
}
if (!empty($_REQUEST['sid'])) $surveyid = (int)$_REQUEST['sid'];

$surveyid = sanitize_int($surveyid);
$id = Yii::app()->request->getPost('id');
$id = $_REQUEST['id'];

$aData = array(
'surveyid' => $surveyid,
'id' => $id
);

if (hasSurveyPermission($surveyid, 'responses','read') && $subaction == "delete" && hasSurveyPermission($surveyid, 'responses', 'delete'))
if (hasSurveyPermission($surveyid, 'responses','read') && hasSurveyPermission($surveyid, 'responses', 'delete'))
{
$surveytable = "{{survey_".$surveyid.'}}';
$aData['thissurvey'] = getSurveyInfo($surveyid);
Expand Down
54 changes: 31 additions & 23 deletions application/controllers/admin/responses.php
Expand Up @@ -294,13 +294,36 @@ public function index($iSurveyId)
$aViewUrls[] = 'browseallfiltered_view';
}

$clang = $aData['clang'];
$aData['num_total_answers'] = Survey_dynamic::model($iSurveyId)->count();
$aData['num_completed_answers'] = Survey_dynamic::model($iSurveyId)->count('submitdate IS NOT NULL');
$aData['with_token']= Yii::app()->db->schema->getTable('{{tokens_' . $iSurveyId . '}}');
if($aData['with_token'])
{
$aData['tokeninfo'] = Tokens_dynamic::model($iSurveyId)->summary();
}

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


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



//Delete Individual answer using inrow delete buttons/links - checked
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') != '' && Yii::app()->request->getPost('deleteanswer') != 'marked' && hasSurveyPermission($iSurveyId, 'responses', 'delete'))
{
$_POST['deleteanswer'] = (int) Yii::app()->request->getPost('deleteanswer'); // sanitize the value
$iResponseID = (int) Yii::app()->request->getPost('deleteanswer'); // sanitize the value
// delete the files as well if its a fuqt

$fieldmap = createFieldMap($iSurveyId,'full',false,false,Yii::app()->session['browselang']);
$fieldmap = createFieldMap($iSurveyId,'full',false,false,$oBrowseLanguage->langcode);
$fuqtquestions = array();
// find all fuqt questions
foreach ($fieldmap as $field)
Expand Down Expand Up @@ -329,15 +352,17 @@ public function index($iSurveyId)
}

// delete the row
Survey_dynamic::model($iSurveyId)->deleteAllByAttributes(array('id' => mysql_real_escape_string(Yii::app()->request->getPost('deleteanswer'))));
Survey_dynamic::model($iSurveyId)->deleteAllByAttributes(array('id' => $iResponseID));
Yii::app()->session['flashmessage'] = sprintf($clang->gT("Response ID %s was successfully deleted."),$iResponseID);

}
// Marked responses -> deal with the whole batch of marked responses
if (Yii::app()->request->getPost('markedresponses') && count(Yii::app()->request->getPost('markedresponses')) > 0 && hasSurveyPermission($iSurveyId, 'responses', 'delete'))
{
// Delete the marked responses - checked
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked')
{
$fieldmap = createFieldMap($iSurveyId,'full',false,false,Yii::app()->session['browselang']);
$fieldmap = createFieldMap($iSurveyId,'full',false,false,$oBrowseLanguage->langcode);
$fuqtquestions = array();
// find all fuqt questions
foreach ($fieldmap as $field)
Expand Down Expand Up @@ -371,6 +396,8 @@ public function index($iSurveyId)

Survey_dynamic::model($iSurveyId)->deleteAllByAttributes(array('id' => $iResponseID));
}
Yii::app()->session['flashmessage'] = sprintf($clang->ngT("%s response was successfully deleted.","%s responses were successfully deleted.",count(Yii::app()->request->getPost('markedresponses'))),count(Yii::app()->request->getPost('markedresponses')));

}
// Download all files for all marked responses - checked
else if (Yii::app()->request->getPost('downloadfile') && Yii::app()->request->getPost('downloadfile') === 'marked')
Expand Down Expand Up @@ -422,25 +449,6 @@ public function index($iSurveyId)
}
}

$clang = $aData['clang'];
$aData['num_total_answers'] = Survey_dynamic::model($iSurveyId)->count();
$aData['num_completed_answers'] = Survey_dynamic::model($iSurveyId)->count('submitdate IS NOT NULL');
$aData['with_token']= Yii::app()->db->schema->getTable('{{tokens_' . $iSurveyId . '}}');
if($aData['with_token'])
{
$aData['tokeninfo'] = Tokens_dynamic::model($iSurveyId)->summary();
}

$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
Expand Down
1 change: 1 addition & 0 deletions application/controllers/admin/statistics.php
Expand Up @@ -42,6 +42,7 @@ public function run($surveyid, $subaction = null)

$imageurl = Yii::app()->getConfig("imageurl");
$aData = array('clang' => $clang, 'imageurl' => $imageurl);
$aData['sql']='';

/*
* We need this later:
Expand Down

0 comments on commit d1e0d68

Please sign in to comment.