Skip to content

Commit

Permalink
Fixed survey import
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@11275 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Oct 26, 2011
1 parent 8efddf8 commit 0775773
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 6 deletions.
4 changes: 2 additions & 2 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -178,7 +178,7 @@ function fixintegrity()

if (isset($aDelete['groups'])) {
foreach ($aDelete['groups'] as $aQuestion) {
$sSQL = "DELETE FROM {$sDBPrefix}groups WHERE gid={$aQuestion['gid']}'";
$sSQL = "DELETE FROM {$sDBPrefix}groups WHERE gid={$aQuestion['gid']}";
$oResult = $this->db->query($sSQL) or safe_die ("Couldn't delete groups ({$sSQL})");
}
$aData['messages'][]= sprintf($clang->gT("Deleting groups: %u groups deleted"), count($aDelete['groups']));
Expand Down Expand Up @@ -468,7 +468,7 @@ function _checkintegrity()
$oResult2=db_execute_assoc($sQuery) or safe_die ("Couldn't check surveys table for sids from questions<br />$qquery");
if (!$oResult2->num_rows())
{
$aDelete['questions'][]=array("qid"=>$aRow['qid'], "reason"=>$clang->gT("No matching matching")." ({$aRow['sid']})");
$aDelete['questions'][]=array("qid"=>$aRow['qid'], "reason"=>$clang->gT("There is no matching survey.")." ({$aRow['sid']})");
}
}

Expand Down
7 changes: 3 additions & 4 deletions application/helpers/admin/import_helper.php
Expand Up @@ -1870,7 +1870,7 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
$insertdata['parent_qid']=$aQIDReplacements[(int)$insertdata['parent_qid']]; // remap the parent_qid

// now translate any links

$insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']);
if (isset($insertdata['help']))
{
Expand Down Expand Up @@ -3364,7 +3364,6 @@ function CSVImportSurvey($sFullFilepath,$iDesiredSurveyId=NULL,$bTranslateLinks=
function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDesiredSurveyId=NULL, $bTranslateInsertansTags=true)
{
$CI =& get_instance();

$CI->load->helper('database');
$clang = $CI->limesurvey_lang;
require_once ($CI->config->item('rootdir').'/application/third_party/adodb/adodb.inc.php');
Expand Down Expand Up @@ -3466,7 +3465,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe

db_switchIDInsert('surveys',true);

$result = $CI->surveys_model->insertNewSurvey($insertdata) or show_error($clang->gT("Error").": Failed to insert data<br />");
$newsid = $CI->surveys_model->insertNewSurvey($insertdata) or show_error($clang->gT("Error").": Failed to insert data<br />");

$results['surveys']++;
db_switchIDInsert('surveys',false);
Expand Down Expand Up @@ -3658,7 +3657,7 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
{
$insertdata['answer']=translink('survey', $oldsid, $newsid, $insertdata['answer']);
}

$result=$CI->answers_model->insertRecords($insertdata) or show_error($clang->gT("Error").": Failed to insert data<br />");
$results['answers']++;
}
Expand Down
55 changes: 55 additions & 0 deletions application/helpers/admin/survey_helper.php
@@ -0,0 +1,55 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: statistics_function.php 10193 2011-06-05 12:20:37Z c_schmitz $
*
*/



function getSurveyDefaultSettings()
{
return array(
'active'=>'N',
'allowjumps' => 'N',
'format' => 'G', //Group-by-group mode
'template' => $this->config->item('defaulttemplate'),
'allowsave' => 'Y',
'allowprev' => 'N',
'nokeyboard' => 'N',
'printanswers' => 'N',
'publicstatistics' => 'N',
'publicgraphs' => 'N',
'public' => 'Y',
'autoredirect' => 'N',
'tokenlength' => 15,
'allowregister' => 'N',
'usecookie' => 'N',
'usecaptcha' => 'D',
'htmlemail' => 'Y',
'emailnotificationto' => '',
'anonymized' => 'N',
'datestamp' => 'N',
'ipaddr' => 'N',
'refurl' => 'N',
'tokenanswerspersistence' => 'N',
'alloweditaftercompletion' => 'N',
'assesments' => 'N',
'startdate' => '',
'savetimings' => 'N',
'expires' => '',
'showqnumcode' => 'X',
'showwelcome' => 'Y',
'emailresponseto' => '',
'assessments' => 'N',
'navigationdelay' => 0);
}

0 comments on commit 0775773

Please sign in to comment.