Skip to content

Commit

Permalink
Merge branch 'Yii' of github.com:LimeSurvey/LimeSurvey into Question_…
Browse files Browse the repository at this point in the history
…Objects

Conflicts:
	application/config/version.php
	application/controllers/survey/index.php
	application/helpers/admin/import_helper.php
	application/helpers/frontend_helper.php
	application/models/Conditions.php
  • Loading branch information
aaronschmitz committed Aug 18, 2012
2 parents c50a42d + 1a0afb3 commit f86fda4
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 161 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -12,7 +12,7 @@
*
*/

$config['versionnumber'] = "2.0RC8";
$config['versionnumber'] = "2.0RC9";
$config['dbversionnumber'] = 162;
$config['buildnumber'] = '';
$config['updatable'] = false;
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/database.php
Expand Up @@ -695,7 +695,7 @@ function index($sa = null)
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxQuestionOrder($gid) + 1;
$insertorder = getMaxQuestionOrder($gid,$surveyid) + 1;
$udata = array_merge($udata,array('question_order' => $insertorder));
}
else
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/admin/statistics.php
Expand Up @@ -453,7 +453,7 @@ public function run($surveyid = 0, $subaction = null)
Yii::app()->loadHelper('admin/statistics');
$showtextinline=isset($_POST['showtextinline']) ? 1 : 0;
$aData['showtextinline'] = $showtextinline;

//Show Summary results
if (isset($summary) && $summary)
{
Expand Down Expand Up @@ -497,6 +497,7 @@ public function run($surveyid = 0, $subaction = null)
function listcolumn($surveyid, $column, $sql, $sortby="", $sortmethod="", $sorttype="")
{
$search['condition']=$column." != ''";
if($sql != "") {$search['condition'].= " AND ($sql)";}
if($sorttype=='N') {$sortby = "($sortby * 1)";} //Converts text sorting into numerical sorting
if($sortby != "") $search['order']=$sortby.' '.$sortmethod;
$results=Survey_dynamic::model($surveyid)->findAll($search);
Expand Down
1 change: 1 addition & 0 deletions application/controllers/survey/index.php
Expand Up @@ -145,6 +145,7 @@ function action()
//CHECK FOR REQUIRED INFORMATION (sid)
if ($surveyid && $surveyExists)
{
LimeExpressionManager::SetSurveyId($surveyid); // must be called early - it clears internal cache if a new survey is being used
$clang = SetSurveyLanguage( $surveyid, $sTempLanguage);
UpdateSessionGroupList($surveyid, $sTempLanguage); // to refresh the language strings in the group list session variable
UpdateFieldArray(); // to refresh question titles and question text
Expand Down
6 changes: 1 addition & 5 deletions application/helpers/admin/import_helper.php
Expand Up @@ -4322,15 +4322,11 @@ function ExcelImportSurvey($sFullFilepath)
}

// Create the survey entry
$iNewSID=GetNewSurveyID($iOldSID);
$surveyinfo['startdate']=NULL;
$surveyinfo['sid']=$iNewSID;
$surveyinfo['active']='N';
$surveyinfo['owner_id']=$_SESSION['loginID'];
$surveyinfo['datecreated']= date('Y-m-d');

switchMSSQLIdentityInsert('surveys',true);
$iNewSID = Survey::model()->insertNewSurvey($surveyinfo) or safeDie($clang->gT("Error").": Failed to insert survey<br />");
$surveyinfo['sid']=$iNewSID;
$results['surveys']++;
switchMSSQLIdentityInsert('surveys',false);
$results['newsid']=$iNewSID;
Expand Down
11 changes: 11 additions & 0 deletions application/helpers/frontend_helper.php
Expand Up @@ -1605,6 +1605,17 @@ function buildsurveysession($surveyid,$previewGroup=false)
$totalquestions = count($unique);
$_SESSION['survey_'.$surveyid]['totalquestions'] = $totalquestions - count($display);


// Fix totalquestions by substracting Test Display questions
$iNumberofQuestions=dbExecuteAssoc("SELECT count(*)\n"
." FROM {{questions}}"
." WHERE type in ('X','*')\n"
." AND sid={$surveyid}"
." AND language='".$_SESSION['survey_'.$surveyid]['s_lang']."'"
." AND parent_qid=0")->read();

$_SESSION['survey_'.$surveyid]['totalquestions'] = $totalquestions - (int) reset($iNumberofQuestions);

//2. SESSION VARIABLE: totalsteps
//The number of "pages" that will be presented in this survey
//The number of pages to be presented will differ depending on the survey format
Expand Down
2 changes: 1 addition & 1 deletion application/libraries/admin/excel/excel_reader2.php
Expand Up @@ -858,7 +858,7 @@ function dump($row_numbers=false,$col_letters=false,$sheet=0,$table_class='excel
function read16bitstring($data, $start) {
$len = 0;
while (ord($data[$start + $len]) + ord($data[$start + $len + 1]) > 0) $len++;
return substr($data, $start, $len);
return substr($data, $start, $len+1);
}

// ADDED by Matt Kruse for better formatting
Expand Down
29 changes: 29 additions & 0 deletions application/models/Conditions.php
Expand Up @@ -96,7 +96,34 @@ public function deleteRecords($condition=FALSE)
}


/**
* Updates the group ID for all conditions
*
* @param integer $iSurveyID
* @param integer $iQuestionID
* @param integer $iOldGroupID
* @param integer $iNewGroupID
*/
public function updateCFieldName($iSurveyID, $iQuestionID, $iOldGroupID, $iNewGroupID)
{
$oResults=$this->findAllByAttributes(array('cqid'=>$iQuestionID));
foreach ($oResults as $oRow)
{

$cfnregs='';
if (preg_match('/'.$surveyid."X".$iOldGroupID."X".$iQuestionID."(.*)/", $oRow->cfieldname, $cfnregs) > 0)
{
$newcfn=$surveyid."X".$iNewGroupID."X".$iQuestionID.$cfnregs[1];
$c2query="UPDATE ".db_table_name('conditions')
." SET cfieldname='{$newcfn}' WHERE cid={$oRow->cid}";

Yii::app()->db->createCommand($c2query)->query();
}
}
}



public function insertRecords($data, $update=FALSE, $condition=FALSE)
{
$record = new self;
Expand Down Expand Up @@ -126,13 +153,15 @@ public function insertRecords($data, $update=FALSE, $condition=FALSE)
else
return $record->save();
}

function getScenarios($qid)
{

$scenarioquery = "SELECT DISTINCT scenario FROM ".$this->tableName()." WHERE qid=".$qid." ORDER BY scenario";

return Yii::app()->db->createCommand($scenarioquery)->query();
}

function getSomeConditions($fields, $condition, $order, $group){
$record = Yii::app()->db->createCommand()
->select($fields)
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/checkintegrity/check_view.php
Expand Up @@ -32,7 +32,7 @@

<?php
if ($defaultvalues) { ?>
<li><?php printf($clang->gT("There are %s orphaned default value entries which can be deleted."),$dv); ?> </li>
<li><?php printf($clang->gT("There are %s orphaned default value entries which can be deleted."),$defaultvalues); ?> </li>
<?php }
else
{ ?>
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/export/statistics_view.php
Expand Up @@ -9,7 +9,7 @@
<script type='text/javascript'>
var graphUrl="<?php echo Yii::app()->getController()->createUrl("admin/statistics/graph"); ?>";
var listColumnUrl="<?php echo Yii::app()->getController()->createUrl("admin/statistics/listcolumn/surveyid/".$surveyid."/column/"); ?>";
var sql="<?php //echo urlencode($sql) ?>";
var sql="<?php echo urlencode($sql); ?>";
var showTextInline="<?php echo $showtextinline ?>";
</script>
<form method='post' name='formbuilder' action='<?php echo Yii::app()->getController()->createUrl("admin/statistics/index/surveyid/$surveyid"); ?>#start'>
Expand Down Expand Up @@ -241,7 +241,7 @@
<select name='<?php
if ($flt[2] == "M" ) { echo "M";};
if ($flt[2] == "P" ) { echo "P";};
echo "{$surveyid}X{$flt[1]}X{$flt[0]}[]'";?> multiple='multiple'>
echo "{$surveyid}X{$flt[1]}X{$flt[0]}[]'";?>' multiple='multiple'>
<?php
}
}?>
Expand Down
32 changes: 16 additions & 16 deletions application/views/admin/participants/participantsPanel_view.php
Expand Up @@ -11,43 +11,43 @@
</div>
<?php
$home = array('src' => $sImageURL.'home.png',
'alt' => 'Home Page',
'title' => 'Home Page',
'alt' => $clang->gT("Main Admin Screen"),
'title' => $clang->gT("Main Admin Screen"),
'style' => 'margin-left:2px');

$information = array('src' => $sImageURL.'summary.png',
'alt' => 'Information',
'title' => 'Information',
'alt' => $clang->gT("Information"),
'title' => $clang->gT("Information"),
'style' => 'margin-left:2px');

$import = array('src' => $sImageURL.'importcsv.png',
'alt' => 'Import from CSV',
'title' => 'Import from CSV',
'alt' => $clang->gT("Import from CSV"),
'title' => $clang->gT("Import from CSV"),
'style' => 'margin-left:0px',
'style' => 'margin-right:1px');

$export = array('src' => $sImageURL.'exportcsv.png',
'alt' => 'Export all',
'title' => 'Export all',
'alt' => $clang->gT("Export all"),
'title' => $clang->gT("Export all"),
'name' => 'export',
'id' => 'export',
'style' => 'margin-left:0px',
'style' => 'margin-right:1px');

$display = array('src' => $sImageURL.'document.png',
'alt' => 'Display participants',
'title' => 'Display participants',
'alt' => $clang->gT("Display participants"),
'title' => $clang->gT("Display participants"),
'style' => 'margin-left:5px');

$blacklist = array('src' => $sImageURL.'trafficred.png',
'alt' => 'Blacklist control',
'title' => 'Blacklist control',
'alt' => $clang->gT("Blacklist control"),
'title' => $clang->gT("Blacklist control"),
'style' => 'margin-left:1px',
'style' => 'margin-right:1px');

$globalsettings = array('src' => $sImageURL.'global.png',
'alt' => 'Global participant settings',
'title' => 'Global participant settings',
'alt' => $clang->gT("Global participant settings"),
'title' => $clang->gT("Global participant settings"),
'style' => 'margin-left:5px',
'style' => 'margin-right:1px');

Expand All @@ -60,8 +60,8 @@
'style' => 'margin-right:1px');

$sharepanel = array('src' => $sImageURL.'share.png',
'alt' => 'Share panel',
'title' => 'Share panel',
'alt' => $clang->gT("Share panel"),
'title' => $clang->gT("Share panel"),
'height' => 35,
'width' => 35,
'style' => 'margin-left:5px');
Expand Down
2 changes: 1 addition & 1 deletion application/views/installer/success_view.php
Expand Up @@ -29,7 +29,7 @@
<tbody>
<tr>
<td align="left" style="width: 227px;"></td>
<td align="right" style="width: 227px;"><input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Administration" onclick="javascript: window.open('<?php echo $this->createUrl("/admin"); ?>', '_top')" />
<td align="right" style="width: 227px;"><input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="<?php $clang->eT("Administration"); ?>" onclick="javascript: window.open('<?php echo $this->createUrl("/admin"); ?>', '_top')" />
<div id="next" style="font-size:11px;"></div>
</td>
</tr>
Expand Down

0 comments on commit f86fda4

Please sign in to comment.