Skip to content

Commit

Permalink
Merge branch '2.1' of github.com:LimeSurvey/LimeSurvey into 2.1
Browse files Browse the repository at this point in the history
Conflicts:
	application/views/admin/survey/QuestionGroups/addGroup_view.php
	application/views/admin/token/csvupload.php
  • Loading branch information
SamMousa committed Mar 5, 2013
2 parents c011f10 + 4241ad0 commit 79e2151
Show file tree
Hide file tree
Showing 38 changed files with 1,065 additions and 359 deletions.
2 changes: 1 addition & 1 deletion application/controllers/PrintanswersController.php
Expand Up @@ -208,7 +208,7 @@ function actionView($surveyid, $printablexport='')
}
else
{
$sPrintOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>".sanitize_html_string($fname[2])."</td></tr>";
$sPrintOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>".flattenText($fname[2])."</td></tr>";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/assessments.php
Expand Up @@ -201,8 +201,8 @@ private function _getAssessmentPostData($iSurveyID, $language)
'sid' => $iSurveyID,
'scope' => sanitize_paranoid_string($_POST['scope']),
'gid' => sanitize_int($_POST['gid']),
'minimum' => sanitize_paranoid_string($_POST['minimum']),
'maximum' => sanitize_paranoid_string($_POST['maximum']),
'minimum' => intval($_POST['minimum']),
'maximum' => intval($_POST['maximum']),
'name' => $_POST['name_' . $language],
'language' => $language,
'message' => $_POST['assessmentmessage_' . $language]
Expand Down
6 changes: 0 additions & 6 deletions application/controllers/admin/conditionsaction.php
Expand Up @@ -899,8 +899,6 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
->bindValue(":lang1", $sLanguage, PDO::PARAM_STR)
->bindValue(":lang2", $sLanguage, PDO::PARAM_STR)
->query() or safeDie ("Couldn't get other conditions for question $qid<br />$query<br />");



$querytoken = "SELECT count(*) as recordcount "
."FROM {{conditions}} "
Expand Down Expand Up @@ -931,8 +929,6 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
->bindValue(":qid", $qid, PDO::PARAM_INT)
->query() or safeDie ("Couldn't get other conditions for question $qid<br />$query<br />");



$conditionscount=$conditionscount+$conditionscounttoken;

if ($conditionscount > 0)
Expand Down Expand Up @@ -1206,7 +1202,6 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
}
//END DISPLAY CONDITIONS FOR THIS QUESTION


// BEGIN: DISPLAY THE COPY CONDITIONS FORM
if ($subaction == "copyconditionsform" || $subaction == "copyconditions")
{
Expand Down Expand Up @@ -1306,7 +1301,6 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$qcount = 0;
}


//BEGIN: DISPLAY THE ADD or EDIT CONDITION FORM
if ($subaction == "editconditionsform" || $subaction == "insertcondition" ||
$subaction == "updatecondition" || $subaction == "deletescenario" ||
Expand Down
33 changes: 15 additions & 18 deletions application/controllers/admin/dataentry.php
Expand Up @@ -10,7 +10,6 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
*/

/**
Expand Down Expand Up @@ -334,24 +333,22 @@ function import($surveyid)
{
// show UI for choosing old table

$result = dbGetTablesLike("old\_survey\_%");
$aTables = dbGetTablesLike("old\_survey\_%");

$aOptionElements = array();
//$queryCheckColumnsActive = $schema->getTable($oldtable)->columnNames;
$resultActive = $schema->getTable("{{survey_{$surveyid}}}")->columnNames;
//$resultActive = dbExecuteAssoc($queryCheckColumnsActive) or show_error("Error:<br />$query<br />");
$countActive = count($resultActive);

foreach ($result as $row)
foreach ($aTables as $sTable)
{
$row = each($row);

//$resultOld = dbExecuteAssoc($queryCheckColumnsOld) or show_error("Error:<br />$query<br />");
$resultOld = $schema->getTable($row[1])->columnNames;
$resultOld = $schema->getTable($sTable)->columnNames;

if($countActive == count($resultOld)) //num_fields()
{
$aOptionElements[$row[1]] = $row[1];
$aOptionElements[$sTable] = $sTable;
}
}
$aHTMLOptions=array('empty'=>$clang->gT('Please select...'));
Expand Down Expand Up @@ -396,15 +393,15 @@ function import($surveyid)
$resultOldValues = dbExecuteAssoc($queryOldValues) or show_error("Error:<br />$queryOldValues<br />");
$iRecordCount = 0;
$aSRIDConversions=array();
foreach ($resultOldValues->readAll() as $row)
foreach ($resultOldValues->readAll() as $sTable)
{
$iOldID=$row['id'];
unset($row['id']);
$iOldID=$sTable['id'];
unset($sTable['id']);
// Remove NULL values
$row=array_filter($row, 'strlen');
$sTable=array_filter($sTable, 'strlen');
//$sInsertSQL=Yii::app()->db->GetInsertSQL($activetable, $row);
$sInsertSQL="INSERT into {$activetable} (".implode(",", array_map("dbQuoteID", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll",array_values($row))).")";
$result = dbExecuteAssoc($sInsertSQL) or show_error("Error:<br />$sInsertSQL<br />");
$sInsertSQL="INSERT into {$activetable} (".implode(",", array_map("dbQuoteID", array_keys($sTable))).") VALUES (".implode(",", array_map("dbQuoteAll",array_values($sTable))).")";
$aTables = dbExecuteAssoc($sInsertSQL) or show_error("Error:<br />$sInsertSQL<br />");

$aSRIDConversions[$iOldID] = getLastInsertID($activetable);
$iRecordCount++;
Expand All @@ -427,16 +424,16 @@ function import($surveyid)
$resultOldValues = dbExecuteAssoc($queryOldValues) or show_error("Error:<br />$queryOldValues<br />");
$iRecordCountT=0;
$aSRIDConversions=array();
foreach ($resultOldValues->readAll() as $row)
foreach ($resultOldValues->readAll() as $sTable)
{
if (isset($aSRIDConversions[$row['id']]))
if (isset($aSRIDConversions[$sTable['id']]))
{
$row['id']=$aSRIDConversions[$row['id']];
$sTable['id']=$aSRIDConversions[$sTable['id']];
}
else continue;
//$sInsertSQL=Yii::app()->db->GetInsertSQL($sNewTimingsTable,$row);
$sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",", array_map("dbQuoteID", array_keys($row))).") VALUES (".implode(",", array_map("dbQuoteAll", array_values($row))).")";
$result = dbExecuteAssoc($sInsertSQL) or show_error("Error:<br />$sInsertSQL<br />");
$sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",", array_map("dbQuoteID", array_keys($sTable))).") VALUES (".implode(",", array_map("dbQuoteAll", array_values($sTable))).")";
$aTables = dbExecuteAssoc($sInsertSQL) or show_error("Error:<br />$sInsertSQL<br />");
$iRecordCountT++;
}
Yii::app()->session['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
Expand Down
21 changes: 13 additions & 8 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -452,7 +452,7 @@ function delParticipant()
// Deletes from participants only
if ($selectoption == 'po')
{
Participants::model()->deleteParticipant($iParticipantId);
Participants::model()->deleteParticipants($iParticipantId);
}
// Deletes from central and token table
elseif ($selectoption == 'ptt')
Expand Down Expand Up @@ -580,10 +580,13 @@ function getSurveyInfo_json()
$aData->records = count($records);
$aData->total = ceil($aData->records / 10);
$i = 0;

foreach ($records as $row)
{
$surveyname = Surveys_languagesettings::model()->getSurveyNames($row['survey_id']);
$oSurvey=Survey::model()->with(array('languagesettings'=>array('condition'=>'surveyls_language=language')))->findByAttributes(array('sid' => $row['survey_id']));
foreach($oSurvey->languagesettings as $oLanguageSetting)
{
$surveyname= $oLanguageSetting->surveyls_title;
}
$surveylink = "";
/* Check permissions of each survey before creating a link*/
if (!hasSurveyPermission($row['survey_id'], 'tokens', 'read'))
Expand All @@ -593,7 +596,7 @@ function getSurveyInfo_json()
{
$surveylink = '<a href=' . Yii::app()->getController()->createUrl("/admin/tokens/sa/browse/surveyid/{$row['survey_id']}") . '>' . $row['survey_id'].'</a>';
}
$aData->rows[$i]['cell'] = array($surveyname[0]['surveyls_title'], $surveylink, $row['token_id'], $row['date_created'], $row['date_invited'], $row['date_completed']);
$aData->rows[$i]['cell'] = array($surveyname, $surveylink, $row['token_id'], $row['date_created'], $row['date_invited'], $row['date_completed']);
$i++;
}

Expand Down Expand Up @@ -749,8 +752,7 @@ function exporttocsv()
*/
function getParticipantsResults_json()
{
$searchcondition = Yii::app()->request->getQuery('search');
$searchcondition = urldecode($searchcondition);
$searchcondition = Yii::app()->request->getpost('searchcondition');
$finalcondition = array();
$condition = explode("||", $searchcondition);
$search = Participants::model()->getParticipantsSearchMultipleCondition($condition);
Expand Down Expand Up @@ -808,9 +810,12 @@ function getParticipants_json($search = null)
// Super admin
$sCanEdit = "true";
}
if (trim($row['ownername'])=='') {
$row['ownername']=$row['username'];
}
$aRowToAdd['cell'] = array($row['participant_id'], $sCanEdit, $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $row['survey'], $row['language'], $row['ownername']);
$aRowToAdd['id'] = $row['participant_id'];
unset($row['participant_id'], $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $row['language'],$row['ownername'],$row['owner_uid'], $row['can_edit']);
unset($row['participant_id'], $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $row['language'],$row['ownername'],$row['owner_uid'], $row['can_edit'], $row['survey'], $row['username']);
foreach($row as $key=>$attvalue)
{
$aRowToAdd['cell'][] = $attvalue;
Expand Down Expand Up @@ -1457,7 +1462,7 @@ function addToCentral()
$overwriteman = Yii::app()->request->getPost('overwriteman');
$createautomap = Yii::app()->request->getPost('createautomap');

$response = Participants::model()->copyToCentral(Yii::app()->request->getPost('surveyid'), $newarr, $mapped, $overwriteauto, $overwriteman);
$response = Participants::model()->copyToCentral(Yii::app()->request->getPost('surveyid'), $newarr, $mapped, $overwriteauto, $overwriteman, $createautomap);
$clang = $this->getController()->lang;

printf($clang->gT("%s participants have been copied to the central participants table"), $response['success']);
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/admin/remotecontrol.php
Expand Up @@ -2254,6 +2254,8 @@ public function add_response($sSessionKey, $iSurveyID, $aResponseData)

Survey_dynamic::sid($iSurveyID);
$survey_dynamic = new Survey_dynamic;
$aBasicDestinationFields=$survey_dynamic->tableSchema->columnNames;
$aResponseData=array_intersect_key($aResponseData, array_flip($aBasicDestinationFields));
$result_id = $survey_dynamic->insertRecords($aResponseData);

if ($result_id)
Expand Down

0 comments on commit 79e2151

Please sign in to comment.