diff --git a/application/commands/InstallCommand.php b/application/commands/InstallCommand.php
index 428e1d6bd44..f3e73ecc747 100644
--- a/application/commands/InstallCommand.php
+++ b/application/commands/InstallCommand.php
@@ -60,6 +60,8 @@ public function run($sArgument)
$createDb=false;
}
break;
+
+ case 'dblib':
case 'mssql':
case 'odbc':
try
@@ -90,7 +92,7 @@ public function run($sArgument)
{
$createDb=false;
}
- break;
+ break;
}
if (!$createDb)
{
@@ -117,13 +119,14 @@ public function run($sArgument)
}
$sql_file = 'pgsql';
break;
+ case 'dblib':
case 'mssql':
$sql_file = 'mssql';
break;
default:
throw new Exception(sprintf('Unkown database type "%s".', $sDatabaseType));
}
- $this->_executeSQLFile(dirname(Yii::app()->basePath).'/installer/sql/create-'.$sql_file.'.sql', $aConfig['db']['tablePrefix']);
+ $this->_executeSQLFile(dirname(Yii::app()->basePath).'/installer/sql/create-'.$sql_file.'.sql', $aConfig['db']['tablePrefix']);
$this->connection->createCommand()->insert($aConfig['db']['tablePrefix'].'users', array(
'users_name'=>$sArgument[0],
'password'=>hash('sha256',$sArgument[1]),
diff --git a/application/config/config-sample-dblib.php b/application/config/config-sample-dblib.php
new file mode 100644
index 00000000000..ec08f1ba04a
--- /dev/null
+++ b/application/config/config-sample-dblib.php
@@ -0,0 +1,72 @@
+ dirname(dirname(__FILE__)),
+ 'runtimePath' => dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
+ 'name' => 'LimeSurvey',
+ 'defaultController' => 'survey',
+
+ 'import' => array(
+ 'application.core.*',
+ 'application.models.*',
+ 'application.controllers.*',
+ 'application.modules.*',
+ ),
+
+ 'components' => array(
+ 'db' => array(
+ 'connectionString' => 'dblib:host=localhost;dbname=limesurvey',
+ 'username' => 'sa',
+ 'password' => 'somepassword',
+ 'charset' => 'utf8',
+ 'tablePrefix' => 'lime_',
+ 'initSQLs'=>array('SET DATEFORMAT ymd;','SET QUOTED_IDENTIFIER ON;'),
+ ),
+
+ // Uncomment the following line if you need table-based sessions
+ // 'session' => array (
+ // 'class' => 'system.web.CDbHttpSession',
+ // 'connectionID' => 'db',
+ // 'sessionTableName' => '{{sessions}}',
+ // ),
+
+ 'urlManager' => array(
+ 'urlFormat' => 'get',
+ 'rules' => require('routes.php'),
+ 'showScriptName' => true,
+ ),
+
+ ),
+ // Use the following config variable to set modified optional settings copied from config-defaults.php
+ 'config'=>array(
+ // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
+ // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
+ // on your webspace.
+ // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
+ 'debug'=>0,
+ 'debugsql'=>0 // Set this to 1 to enanble sql logging, only active when debug = 2
+ )
+);
+/* End of file config.php */
+/* Location: ./application/config/config.php */
diff --git a/application/controllers/InstallerController.php b/application/controllers/InstallerController.php
index 3cd1cf86d2b..f248cc63291 100644
--- a/application/controllers/InstallerController.php
+++ b/application/controllers/InstallerController.php
@@ -290,7 +290,6 @@ private function stepDatabaseConfiguration()
Yii::app()->session['dblocation'] = $sDatabaseLocation;
//check if table exists or not
- $sTestTablename = 'surveys';
$bTablesDoNotExist = false;
// Check if the surveys table exists or not
@@ -338,7 +337,7 @@ private function stepDatabaseConfiguration()
}
// Setting dateformat for mssql driver. It seems if you don't do that the in- and output format could be different
- if (in_array($model->dbtype, array('mssql', 'sqlsrv'))) {
+ if (in_array($model->dbtype, array('mssql', 'sqlsrv', 'dblib'))) {
@$this->connection->createCommand('SET DATEFORMAT ymd;')->execute(); //Checked
@$this->connection->createCommand('SET QUOTED_IDENTIFIER ON;')->execute(); //Checked
}
@@ -446,6 +445,7 @@ function stepCreateDb()
$createDb=false;
}
break;
+ case 'dblib':
case 'mssql':
case 'odbc':
try
@@ -540,6 +540,7 @@ function stepPopulateDb()
case 'mysql':
$sql_file = 'mysql';
break;
+ case 'dblib':
case 'sqlsrv':
case 'mssql':
$sql_file = 'mssql';
@@ -818,7 +819,7 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecurs
// JSON library check
if (!check_PHPFunction('json_encode', $data['bJSONPresent']))
$bProceed = false;
-
+
// ** file and directory permissions checking **
// config directory
@@ -832,13 +833,13 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecurs
//upload directory check
if (!check_DirectoryWriteable(Yii::app()->getConfig('uploaddir').'/', $data, 'uploaddir', 'uerror',true) )
$bProceed = false;
-
+
// Session writable check
$session = Yii::app()->session; /* @var $session CHttpSession */
$sessionWritable = ($session->get('saveCheck', null)==='save');
$data['sessionWritable'] = $sessionWritable;
$data['sessionWritableImg'] = check_HTML_image($sessionWritable);
- if (!$sessionWritable){
+ if (!$sessionWritable){
// For recheck, try to set the value again
$session['saveCheck'] = 'save';
$bProceed = false;
@@ -860,7 +861,7 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecurs
// zlib php library check
check_PHPFunction('zlib_get_coding_type', $data['zlibPresent']);
-
+
// imap php library check
check_PHPFunction('imap_open', $data['bIMAPPresent']);
@@ -965,7 +966,7 @@ function _writeConfigFile()
{
$sURLFormat='get'; // Fall back to get if an Apache server cannot be determined reliably
}
-
+
$dbdata = " array(" . "\n"
."\t\t" . "'db' => array(" . "\n"
."\t\t\t" . "'connectionString' => '$sDsn'," . "\n";
- if ($sDatabaseType!='sqlsrv')
+ if ($sDatabaseType!='sqlsrv' && $sDatabaseType!='dblib' )
{
$dbdata .="\t\t\t" . "'emulatePrepare' => true," . "\n";
@@ -1017,7 +1018,7 @@ function _writeConfigFile()
."\t\t\t" . "'charset' => 'utf8'," . "\n"
."\t\t\t" . "'tablePrefix' => '$sDatabasePrefix'," . "\n";
- if (in_array($sDatabaseType, array('mssql', 'sqlsrv'))) {
+ if (in_array($sDatabaseType, array('mssql', 'sqlsrv', 'dblib'))) {
$dbdata .="\t\t\t" ."'initSQLs'=>array('SET DATEFORMAT ymd;','SET QUOTED_IDENTIFIER ON;')," . "\n";
}
@@ -1077,7 +1078,7 @@ function _writeConfigFile()
}
/**
- * Create a random ASCII string
+ * Create a random ASCII string
*
* @return string
*/
@@ -1120,6 +1121,9 @@ function _getDsn($sDatabaseType, $sDatabaseLocation, $sDatabasePort, $sDatabaseN
}
break;
+ case 'dblib' :
+ $dsn = $sDatabaseType.":host={$sDatabaseLocation};dbname={$sDatabaseName}";
+ break;
case 'mssql' :
case 'sqlsrv':
if ($sDatabasePort!=''){$sDatabaseLocation=$sDatabaseLocation.','.$sDatabasePort;}
@@ -1152,6 +1156,7 @@ function _getDbPort($sDatabaseType, $sDatabasePort = '')
case 'pgsql':
$sDatabasePort = '5432';
break;
+ case 'dblib' :
case 'mssql' :
case 'sqlsrv':
default:
@@ -1193,7 +1198,7 @@ function _dbConnect($aDbConfig = array(), $aData = array())
try {
$this->connection = new CDbConnection($sDsn, $sDatabaseUser, $sDatabasePwd);
- if($sDatabaseType!='sqlsrv'){
+ if($sDatabaseType!='sqlsrv' && $sDatabaseType!='dblib'){
$this->connection->emulatePrepare = true;
}
diff --git a/application/controllers/Statistics_userController.php b/application/controllers/Statistics_userController.php
index 62f14a8afd8..471832fd3e7 100644
--- a/application/controllers/Statistics_userController.php
+++ b/application/controllers/Statistics_userController.php
@@ -167,10 +167,10 @@ function actionAction($surveyid,$language)
* only show questions where question attribute "public_statistics" is set to "1"
*/
- $query = "SELECT q.* , group_name, group_order FROM {{questions}} q, {{groups}} g, {{question_attributes}} qa
+ $query = "SELECT q.* , group_name, group_order FROM {{questions}} q, {{groups}} g, {{question_attributes}} qa
WHERE g.gid = q.gid AND g.language = :lang1 AND q.language = :lang2 AND q.sid = :surveyid AND q.qid = qa.qid AND q.parent_qid = 0 AND qa.attribute = 'public_statistics'";
$databasetype = Yii::app()->db->getDriverName();
- if ($databasetype=='mssql' || $databasetype=="sqlsrv")
+ if ($databasetype=='mssql' || $databasetype=="sqlsrv" || $databasetype=="dblib")
{
$query .=" AND CAST(CAST(qa.value as varchar) as int)='1'\n";
}
@@ -355,7 +355,7 @@ function actionAction($surveyid,$language)
}// end if -> for removing the error message in case there are no filters
$summary = $allfields;
-
+
// Get the survey inforamtion
$thissurvey = getSurveyInfo($surveyid,$language);
@@ -368,8 +368,8 @@ function actionAction($surveyid,$language)
{
$data['sTemplatePath'] = validateTemplateDir($thissurvey['templatedir']);
}
-
-
+
+
//---------- CREATE STATISTICS ----------
$redata = compact(array_keys(get_defined_vars()));
doHeader();
diff --git a/application/helpers/admin/statistics_helper.php b/application/helpers/admin/statistics_helper.php
index 95b86ec30c3..92560dfd0ae 100644
--- a/application/helpers/admin/statistics_helper.php
+++ b/application/helpers/admin/statistics_helper.php
@@ -80,10 +80,10 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet));
unset($graph);
}
-
+
return $cachefilename;
}
-
+
if (array_sum($gdata ) > 0) //Make sure that the percentages add up to more than 0
{
$graph = "";
@@ -161,11 +161,11 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$counter=0;
foreach ($lblout as $sLabelName)
- {
+ {
$DataSet->SetSerieName(html_entity_decode($sLabelName,null,'UTF-8'), "Serie$counter");
$counter++;
}
-
+
if ($cache->IsInCache("graph".$language.$iSurveyID,$DataSet->GetData()) && Yii::app()->getConfig('debug')<2) {
$cachefilename=basename($cache->GetFileFromCache("graph".$language.$iSurveyID,$DataSet->GetData()));
}
@@ -566,31 +566,31 @@ class statistics_helper {
* @var pdf
*/
protected $pdf;
-
+
/**
* The Excel worksheet we are working on
- *
+ *
* @var Spreadsheet_Excel_Writer_Worksheet
*/
protected $sheet;
-
+
protected $xlsPercents;
-
+
protected $formatBold;
/**
* The current Excel workbook we are working on
- *
- * @var Xlswriter
+ *
+ * @var Xlswriter
*/
protected $workbook;
-
+
/**
* Keeps track of the current row in Excel sheet
- *
+ *
* @var int
*/
protected $xlsRow = 0;
-
+
/**
* Builds an array containing information about this particular question/answer combination
*
@@ -620,7 +620,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$sDatabaseType = Yii::app()->db->getDriverName();
$statisticsoutput="";
$qqid = "";
-
+
/* Some variable depend on output type, actually : only line feed */
switch($outputType)
{
@@ -868,7 +868,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$this->sheet->write($this->xlsRow, 0,$statlang->gT("Calculation"));
$this->sheet->write($this->xlsRow, 1,$statlang->gT("Result"));
break;
-
+
case 'pdf':
$headPDF = array();
$tablePDF = array();
@@ -920,7 +920,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$showem = array();
$fld = substr($rt, 1, strlen($rt));
$fielddata=$fieldmap[$fld];
-
+
$qtitle = flattenText($fielddata['title']);
$qtype = $fielddata['type'];
$qquestion = $fielddata['question'];
@@ -985,7 +985,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$fieldname=substr($rt, 1, strlen($rt));
//special treatment for MS SQL databases
- if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv')
+ if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv' || $sDatabaseType == 'dblib')
{
//standard deviation
$query = "SELECT STDEVP(".Yii::app()->db->quoteColumnName($fieldname)."*1) as stdev";
@@ -1012,7 +1012,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//Only select responses where there is an actual number response, ignore nulls and empties (if these are included, they are treated as zeroes, and distort the deviation/mean calculations)
//special treatment for MS SQL databases
- if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv')
+ if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv' || $sDatabaseType == 'dblib')
{
//no NULL/empty values please
$query .= " FROM {{survey_$surveyid}} WHERE ".Yii::app()->db->quoteColumnName($fieldname)." IS NOT NULL";
@@ -1066,7 +1066,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$quartiles[1] = $this->getQuartile(1, $fieldname, $surveyid, $sql, $excludezeros);
$quartiles[2] = $this->getQuartile(2, $fieldname, $surveyid, $sql, $excludezeros);
$quartiles[3] = $this->getQuartile(3, $fieldname, $surveyid, $sql, $excludezeros);
-
+
//we just put the total number of records at the beginning of this array
array_unshift($showem, array($statlang->gT("Count"), $medcount));
@@ -1186,7 +1186,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$this->pdf->titleintopdf($pdfTitle,$titleDesc);
$this->pdf->equalTable($tablePDF);
break;
-
+
case 'html':
//output
@@ -1580,7 +1580,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
return array("alist"=>$alist, "qtitle"=>$qtitle, "qquestion"=>$qquestion, "qtype"=>$qtype, "statisticsoutput"=>$statisticsoutput, "parentqid"=>$qqid);
}
-
+
/**
* displayResults builds html output to display the actual results from a survey
*
@@ -1682,7 +1682,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
}
else
{
- //get data - select a count of responses where no answer is provided
+ //get data - select a count of responses where no answer is provided
$query = "SELECT count(*) FROM {{survey_$surveyid}} WHERE ";
$query .= ($sDatabaseType == "mysql")? Yii::app()->db->quoteColumnName($al[2])." != ''" : "NOT (".Yii::app()->db->quoteColumnName($al[2])." LIKE '')";
}
@@ -1741,7 +1741,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
{
//get more data
$sDatabaseType = Yii::app()->db->getDriverName();
- if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv')
+ if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv' || $sDatabaseType == 'dblib')
{
// mssql cannot compare text blobs so we have to cast here
$query = "SELECT count(*) FROM {{survey_$surveyid}} WHERE cast(".Yii::app()->db->quoteColumnName($rt)." as varchar)= '$al[0]'";
@@ -1758,7 +1758,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
// ==> value is ''
// * NoAnswer due to conditions, or a page not displayed
// ==> value is NULL
- if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv')
+ if ($sDatabaseType == 'mssql' || $sDatabaseType == 'sqlsrv' || $sDatabaseType == 'dblib')
{
// mssql cannot compare text blobs so we have to cast here
//$query = "SELECT count(*) FROM {{survey_$surveyid}} WHERE (".sanitize_int($rt)." IS NULL "
@@ -1823,8 +1823,8 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
{
$tablePDF2[]=array($row2['id'], $row2['value']);
}
- }
-
+ }
+
if ($browse===true && isset($_POST['showtextinline']) && $outputType=='xls') {
$headXLS = array();
$tableXLS = array();
@@ -1837,9 +1837,9 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
$tableXLS[]=array($row2['id'],$row2['value']);
}
- }
-
-
+ }
+
+
}
/*
@@ -1873,7 +1873,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
."\t\t
";
}
@@ -2782,7 +2782,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
return array("statisticsoutput"=>$statisticsoutput, "pdf"=>$this->pdf, "astatdata"=>$astatdata);
}
-
+
/**
* Generates statistics
*
@@ -2939,7 +2939,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
$this->pdf->setHeaderFont(Array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
$this->pdf->setFooterFont(Array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
- // set default header data
+ // set default header data
// Since png crashes some servers (and we can not try/catch that) we use .gif (or .jpg) instead
$headerlogo = 'statistics.gif';
$this->pdf->SetHeaderData($headerlogo, 10, $statlang->gT("Quick statistics",'unescaped') , $statlang->gT("Survey")." ".$surveyid." '".flattenText($surveyInfo['surveyls_title'],false,true,'UTF-8')."'");
@@ -3057,7 +3057,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
$this->pdf->titleintopdf($statlang->gT("Results",'unescaped'),$statlang->gT("Survey",'unescaped')." ".$surveyid);
$this->pdf->tableintopdf($array);
break;
-
+
case 'html':
$statisticsoutput .= " \n\n"
@@ -3191,10 +3191,10 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
}
}
-
+
/**
* Get the quartile using minitab method
- *
+ *
* L=(1/4)(n+1), U=(3/4)(n+1)
* Minitab linear interpolation between the two
* closest data points. Minitab would let L = 2.5 and find the value half way between the
@@ -3205,7 +3205,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
* between the 2nd and 3rd data points and if L were 2.75, Minitab
* would find the value three fourths of the way between the 2nd and
* 3rd data points.
- *
+ *
* @staticvar null $sid
* @staticvar int $recordCount
* @staticvar null $field
@@ -3243,19 +3243,19 @@ protected function getQuartile($quartile, $fieldname, $surveyid, $sql, $excludez
//if $sql values have been passed to the statistics script from another script, incorporate them
if (!empty($sql)) {$query .= " AND $sql";}
}
-
+
if ($surveyid !== $sid) {
$sid = $surveyid;
$recordCount = 0;
$field = null; // Reset cache
}
-
+
if ($fieldname !== $field) {
$field = $fieldname;
$allRows = Yii::app()->db->createCommand("SELECT ".Yii::app()->db->quoteColumnName($fieldname) . $query . ' ORDER BY ' . Yii::app()->db->quoteColumnName($fieldname))->queryAll();
$recordCount = Yii::app()->db->createCommand("SELECT COUNT(".Yii::app()->db->quoteColumnName($fieldname).")" .$query)->queryScalar(); // Record count for THIS $fieldname
}
-
+
// Qx = (x/4) * (n+1) if not integer, interpolate
switch ($quartile)
{
@@ -3292,11 +3292,11 @@ function _listcolumn($surveyid, $column, $sortby="", $sortmethod="", $sorttype="
{
$search['condition']=Yii::app()->db->quoteColumnName($column)." != ''";
$sDBDriverName=Yii::app()->db->getDriverName();
- if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql')
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql' || $sDBDriverName == 'dblib') // ADAPTED JV: added condition for dblib
{
$search['condition']="CAST(".Yii::app()->db->quoteColumnName($column)." as varchar) != ''";
}
-
+
//Look for any selects/filters set in the original statistics query, and apply them to the column listing
if (isset(Yii::app()->session['statistics_selects_'.$surveyid]) && is_array(Yii::app()->session['statistics_selects_'.$surveyid]))
{
@@ -3304,16 +3304,16 @@ function _listcolumn($surveyid, $column, $sortby="", $sortmethod="", $sorttype="
$search['condition'] .= " AND $sql";
}
}
-
- if ($sortby!='')
+
+ if ($sortby!='')
{
- if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql')
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql' || $sDBDriverName == 'dblib') // ADAPTED JV: added condition for dblib
{
$sortby="CAST(".Yii::app()->db->quoteColumnName($sortby)." as varchar)";
}
else
- {
- $sortby=Yii::app()->db->quoteColumnName($sortby);
+ {
+ $sortby=Yii::app()->db->quoteColumnName($sortby);
}
if($sorttype=='N') {$sortby = "($sortby * 1)";} //Converts text sorting into numerical sorting
diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php
index 0767250e998..44c14e4b5d1 100644
--- a/application/helpers/common_helper.php
+++ b/application/helpers/common_helper.php
@@ -384,7 +384,7 @@ function getSurveyList($returnarray=false, $surveyid=false)
}
} // End Foreach
}
-
+
//Only show each activesurvey group if there are some
if ($activesurveys!='')
{
@@ -1292,7 +1292,7 @@ function getUserList($outputformat='fullinfoarray')
if (isset($myuid))
{
$sDatabaseType = Yii::app()->db->getDriverName();
- if ($sDatabaseType=='mssql' || $sDatabaseType=="sqlsrv")
+ if ($sDatabaseType=='mssql' || $sDatabaseType=="sqlsrv" || $sDatabaseType=="dblib")
{
$sSelectFields = 'users_name,uid,email,full_name,parent_id,create_survey,participant_panel,configurator,create_user,delete_user,superadmin,manage_template,manage_label,CAST(password as varchar) as password';
}
@@ -1313,13 +1313,13 @@ function getUserList($outputformat='fullinfoarray')
SELECT {$sSelectFields} from {{users}} v where v.parent_id={$myuid}
UNION
SELECT {$sSelectFields} from {{users}} v where uid={$myuid}";
-
+
}
else
{
return array(); // Or die maybe
}
-
+
}
else
{
@@ -1430,10 +1430,10 @@ function getSurveyInfo($surveyid, $languagecode='')
if (!isset($thissurvey['adminname'])) {$thissurvey['adminname']=Yii::app()->getConfig('siteadminemail');}
if (!isset($thissurvey['adminemail'])) {$thissurvey['adminemail']=Yii::app()->getConfig('siteadminname');}
if (!isset($thissurvey['urldescrip']) || $thissurvey['urldescrip'] == '' ) {$thissurvey['urldescrip']=$thissurvey['surveyls_url'];}
-
+
$staticSurveyInfo[$surveyid][$languagecode]=$thissurvey;
}
-
+
}
return $thissurvey;
@@ -2205,7 +2205,7 @@ function createCompleteSGQA($iSurveyID,$aFilters,$sLanguage) {
case ";": //ARRAY (Multi Flex) (Text)
case ":": //ARRAY (Multi Flex) (Numbers)
$result = Questions::model()->getQuestionsForStatistics('title, question', "parent_qid=$flt[qid] AND language = '{$sLanguage}' AND scale_id = 0", 'question_order');
-
+
foreach($result as $row)
{
$fresult = Questions::model()->getQuestionsForStatistics('title, question', "parent_qid=$flt[qid] AND language = '{$sLanguage}' AND scale_id = 1", 'question_order');
@@ -2888,7 +2888,7 @@ function createTimingsFieldMap($surveyid, $style='full', $force_refresh=false, $
$sLanguage = sanitize_languagecode($sQuestionLanguage);
$surveyid = sanitize_int($surveyid);
$clang = new Limesurvey_lang($sLanguage);
-
+
//checks to see if fieldmap has already been built for this page.
if (isset($timingsFieldMap[$surveyid][$style][$clang->langcode]) && $force_refresh==false) {
return $timingsFieldMap[$surveyid][$style][$clang->langcode];
@@ -3773,8 +3773,8 @@ function questionAttributes($returnByName=false)
'i18n'=>true,
'default'=>"",
"help"=>$clang->gT('In the printable version replace the relevance equation with this explanation text.'),
- "caption"=>$clang->gT("Relevance help for printable survey"));
-
+ "caption"=>$clang->gT("Relevance help for printable survey"));
+
$qattributes["public_statistics"]=array(
"types"=>"15ABCEFGHKLMNOPRWYZ!:*",
'category'=>$clang->gT('Statistics'),
@@ -4410,7 +4410,7 @@ function SendEmailMessage($body, $subject, $to, $from, $sitename, $ishtml=false,
$subject=mb_convert_encoding($subject,$emailcharset,'utf-8');
$sitename=mb_convert_encoding($sitename,$emailcharset,'utf-8');
}
-
+
if (!is_array($to)){
$to=array($to);
}
@@ -5402,7 +5402,7 @@ function GetAttributeFieldNames($iSurveyID)
/**
* Returns the full list of attribute token fields including the properties for each field
* Use this instead of plain Survey::model()->findByPk($iSurveyID)->tokenAttributes calls because Survey::model()->findByPk($iSurveyID)->tokenAttributes may contain old descriptions where the fields does not physically exist
-*
+*
* @param integer $iSurveyID The Survey ID
*/
function GetParticipantAttributes($iSurveyID)
@@ -5452,50 +5452,50 @@ function getTokenFieldsAndNames($surveyid, $bOnlyAttributes = false)
'description'=>$clang->gT('Last name'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'email'=>array(
'description'=>$clang->gT('Email address'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'token'=>array(
'description'=>$clang->gT('Token'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'language'=>array(
'description'=>$clang->gT('Language code'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'sent'=>array(
'description'=>$clang->gT('Invitation sent date'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'remindersent'=>array(
'description'=>$clang->gT('Last reminder sent date'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'remindercount'=>array(
'description'=>$clang->gT('Total numbers of sent reminders'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
'usesleft'=>array(
'description'=>$clang->gT('Uses left'),
'mandatory'=>'N',
'showregister'=>'Y'
- ),
+ ),
);
- $aExtraTokenFields=getAttributeFieldNames($surveyid);
+ $aExtraTokenFields=getAttributeFieldNames($surveyid);
$aSavedExtraTokenFields = Survey::model()->findByPk($surveyid)->tokenAttributes;
// Drop all fields that are in the saved field description but not in the table definition
$aSavedExtraTokenFields=array_intersect_key($aSavedExtraTokenFields,array_flip($aExtraTokenFields));
-
+
// Now add all fields that are in the table but not in the field description
foreach ($aExtraTokenFields as $sField)
{
@@ -5758,7 +5758,7 @@ function getNumericalFormat($lang = 'en', $integer = false, $negative = true) {
*
* @return Array of token data
*/
-function getTokenData($surveyid, $token)
+function getTokenData($surveyid, $token)
{
$thistoken = Tokens_dynamic::model($surveyid)->find('token = :token',array(':token' => $token));
$thistokenarray=array(); // so has default value
@@ -6135,7 +6135,7 @@ function getQuotaInformation($surveyid,$language,$iQuotaID='all')
{
$aAttributes['id'] = $iQuotaID;
}
-
+
$result = Quota::model()->with(array('languagesettings' => array('condition' => "quotals_language='$language'")))->findAllByAttributes($aAttributes);
$quota_info = array();
$x=0;
@@ -6793,24 +6793,24 @@ function fixLanguageConsistency($sid, $availlangs='')
*/
function switchMSSQLIdentityInsert($table,$state)
{
- if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv')))
+ if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv', 'dblib')))
{
if ($state == true)
{
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
- Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' ON');
+ Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' ON');
}
else
{
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
- Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' OFF');
+ Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' OFF');
}
}
}
/**
* Retrieves the last Insert ID realiable for cross-DB applications
-*
+*
* @param string $sTableName Needed for Postgres and MSSQL
*/
function getLastInsertID($sTableName)
@@ -7323,7 +7323,7 @@ function getLabelSets($languages = null)
}
$criteria = new CDbCriteria;
- $criteria->order = "label_name";
+ $criteria->order = "label_name";
foreach ($languagesarray as $k => $item)
{
$criteria->params[':lang_like1_' . $k] = "% $item %";
@@ -7491,7 +7491,7 @@ function getDBTableUsage($surveyid){
$hard_limit = 1600;
$size_limit = 0;
}
- elseif ($arrCols['dbtype'] == 'mssql'){
+ elseif ($arrCols['dbtype'] == 'mssql' || $arrCols['dbtype'] == 'dblib'){
$hard_limit = 1024;
$size_limit = 0;
}
@@ -7591,7 +7591,7 @@ function getSurveyUserList($bIncludeOwner=true, $bIncludeSuperAdmins=true,$surve
$sSurveyIDQuery.= 'ORDER BY a.users_name';
$oSurveyIDResult = Yii::app()->db->createCommand($sSurveyIDQuery)->query(); //Checked
$aSurveyIDResult = $oSurveyIDResult->readAll();
-
+
$surveyselecter = "";
if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true)
diff --git a/application/helpers/database_helper.php b/application/helpers/database_helper.php
index 48320faad74..751022a7a37 100644
--- a/application/helpers/database_helper.php
+++ b/application/helpers/database_helper.php
@@ -15,7 +15,7 @@
*/
/**
- *
+ *
* @param type $sql
* @param type $inputarr
* @param type $silent
@@ -103,6 +103,7 @@ function dbQuoteID($id)
case "mysql" :
return "`".$id."`";
break;
+ case "dblib":
case "mssql" :
case "sqlsrv" :
return "[".$id."]";
@@ -131,6 +132,7 @@ function dbRandom()
switch ($driver)
{
+ case 'dblib':
case 'mssql':
case 'sqlsrv':
$srandom='NEWID()';
@@ -168,6 +170,7 @@ function dbSelectTablesLike($table)
case 'mysqli':
case 'mysql' :
return "SHOW TABLES LIKE '$table'";
+ case 'dblib' :
case 'mssql' :
case 'sqlsrv' :
return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLE_NAME LIKE '$table' ESCAPE '\'";
@@ -199,7 +202,7 @@ function createTable($sTableName, $aColumns, $sOptions=null)
{
$sDBDriverName=Yii::app()->db->getDriverName();
- if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql')
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='mssql' || $sDBDriverName=='dblib')
{
foreach ($aColumns as $sName=>&$sType)
{
@@ -218,6 +221,6 @@ function createTable($sTableName, $aColumns, $sOptions=null)
{
if (is_null($sOptions))
$sOptions='ENGINE=MyISAM';
- }
+ }
Yii::app()->db->createCommand()->createTable($sTableName,$aColumns,$sOptions);
}
diff --git a/application/helpers/export_helper.php b/application/helpers/export_helper.php
index ded381e656e..7903a7c08a6 100644
--- a/application/helpers/export_helper.php
+++ b/application/helpers/export_helper.php
@@ -55,11 +55,11 @@ function isNumericExtended($value) {
* @return string
*/
function strSplitUnicode($str, $l = 0) {
- if ($l > 0)
+ if ($l > 0)
{
$ret = array();
$len = mb_strlen($str, "UTF-8");
- for ($i = 0; $i < $len; $i += $l)
+ for ($i = 0; $i < $len; $i += $l)
{
$ret[] = mb_substr($str, $i, $l, "UTF-8");
}
@@ -75,7 +75,7 @@ function strSplitUnicode($str, $l = 0) {
* @param mixed $iLength Maximum text lenght data, usually 255 for SPSS GetRowAssoc(true); //Get assoc array, use uppercase
@@ -326,7 +326,7 @@ function SPSSGetValues ($field = array(), $qidattributes = null ) {
*/
function SPSSFieldMap($iSurveyID, $prefix = 'V') {
global $clang, $surveyprivate, $tokensexist, $language;
-
+
$typeMap = array(
'5'=>Array('name'=>'5 Point Choice','size'=>1,'SPSStype'=>'F','Scale'=>3),
'B'=>Array('name'=>'Array (10 Point Choice)','size'=>1,'SPSStype'=>'F','Scale'=>3),
@@ -683,7 +683,7 @@ function surveyGetXMLStructure($iSurveyID, $xmlwriter, $exclude=array())
//Question attributes
$sBaseLanguage=Survey::model()->findByPk($iSurveyID)->language;
$platform = Yii::app()->db->getDriverName();
- if ($platform == 'mssql' || $platform =='sqlsrv')
+ if ($platform == 'mssql' || $platform =='sqlsrv' || $platform =='dblib')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value, qa.language
FROM {{question_attributes}} qa JOIN {{questions}} q ON q.qid = qa.qid AND q.sid={$iSurveyID}
@@ -1466,7 +1466,7 @@ function group_export($action, $iSurveyID, $gid)
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache"); // HTTP/1.0
- $xml->openUri('php://output');
+ $xml->openUri('php://output');
$xml->setIndent(true);
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('document');
@@ -1526,7 +1526,7 @@ function groupGetXMLStructure($xml,$gid)
$iSurveyID=$iSurveyID['sid'];
$sBaseLanguage=Survey::model()->findByPk($iSurveyID)->language;
$platform = Yii::app()->db->getDriverName();
- if ($platform == 'mssql' || $platform =='sqlsrv')
+ if ($platform == 'mssql' || $platform =='sqlsrv' || $platform =='dblib')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value, qa.language
FROM {{question_attributes}} qa JOIN {{questions}} q ON q.qid = qa.qid AND q.sid={$iSurveyID} and q.gid={$gid}
@@ -1617,7 +1617,7 @@ function questionGetXMLStructure($xml,$gid,$qid)
$iSurveyID=$iSurveyID['sid'];
$sBaseLanguage=Survey::model()->findByPk($iSurveyID)->language;
$platform = Yii::app()->db->getDriverName();
- if ($platform == 'mssql' || $platform =='sqlsrv')
+ if ($platform == 'mssql' || $platform =='sqlsrv'|| $platform =='dblib')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000)) as value, qa.language
FROM {{question_attributes}} qa JOIN {{questions}} q ON q.qid = qa.qid AND q.sid={$iSurveyID} and q.qid={$qid}
@@ -1645,7 +1645,7 @@ function tokensExport($iSurveyID)
$databasetype = Yii::app()->db->getDriverName();
if (trim($_POST['filteremail'])!='')
{
- if (in_array($databasetype, array('mssql', 'sqlsrv')))
+ if (in_array($databasetype, array('mssql', 'sqlsrv', 'dblib')))
{
$bquery .= ' and CAST(email as varchar) like '.dbQuoteAll('%'.$_POST['filteremail'].'%', true);
}
diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php
index adf749ffdbf..16aa4da7c1a 100644
--- a/application/helpers/expressions/em_manager_helper.php
+++ b/application/helpers/expressions/em_manager_helper.php
@@ -3458,10 +3458,10 @@ static function QuestionIsRelevant($qid)
$grel = (isset($_SESSION[$LEM->sessid]['relevanceStatus']['G' . $gseq]) ? $_SESSION[$LEM->sessid]['relevanceStatus']['G' . $gseq] : 1); // group-level relevance based upon grelevance equation
return ($grel && $qrel);
}
-
+
/**
* Returns true if the group is relevant and should be shown
- *
+ *
* @param int $gid
* @return boolean
*/
@@ -4471,8 +4471,8 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false)
$sdata = array_filter($sdata);
Survey_dynamic::sid($this->sid);
$oSurvey = new Survey_dynamic;
-
- $iNewID = $oSurvey->insertRecords($sdata);
+
+ $iNewID = $oSurvey->insertRecords($sdata);
if ($iNewID) // Checked
{
$srid = $iNewID;
@@ -4486,13 +4486,13 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false)
if ($this->surveyOptions['savetimings']) {
Survey_timings::sid($this->sid);
$oSurveyTimings = new Survey_timings;
-
+
$tdata = array(
'id'=>$srid,
'interviewtime'=>0
);
switchMSSQLIdentityInsert("survey_{$this->sid}_timings", true);
- $iNewID = $oSurveyTimings->insertRecords($tdata);
+ $iNewID = $oSurveyTimings->insertRecords($tdata);
switchMSSQLIdentityInsert("survey_{$this->sid}_timings", false);
}
}
@@ -4569,7 +4569,7 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false)
$query .= $_SESSION[$this->sessid]['srid'];
if (!dbExecuteAssoc($query))
- {
+ {
echo submitfailed(''); // TODO - report SQL error?
if (($this->debugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) {
@@ -7251,7 +7251,7 @@ private static function getConditionsForEM($surveyid=NULL, $qid=NULL)
." c.cqid = 0 and c.qid = q.qid";
$databasetype = Yii::app()->db->getDriverName();
- if ($databasetype=='mssql')
+ if ($databasetype=='mssql' || $databasetype=='dblib')
{
$query .= " order by sid, c.qid, scenario, cqid, cfieldname, value";
}
@@ -7343,7 +7343,7 @@ private function getQuestionAttributesForEM($surveyid=NULL,$qid=NULL, $lang=NULL
}
$databasetype = Yii::app()->db->getDriverName();
- if ($databasetype=='mssql' || $databasetype=="sqlsrv")
+ if ($databasetype=='mssql' || $databasetype=="sqlsrv" || $databasetype == 'dblib')
{
$query = "select distinct a.qid, a.attribute, CAST(a.value as varchar(max)) as value";
}
@@ -7457,7 +7457,7 @@ function getGroupInfoForEM($surveyid,$lang=NULL)
'grelevance' => (!($this->sPreviewMode=='question' || $this->sPreviewMode=='group')) ? $d['grelevance']:1,
);
$qinfo[$_order] = $gid[$d['gid']];
- ++$_order;
+ ++$_order;
}
if (isset($_SESSION['survey_'.$surveyid]) && isset($_SESSION['survey_'.$surveyid]['grouplist'])) {
$_order=0;
@@ -8026,7 +8026,7 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
// End Message
$LEM =& LimeExpressionManager::singleton();
-
+
$aSurveyInfo=getSurveyInfo($sid);
$allErrors = array();
@@ -8970,15 +8970,15 @@ static public function &TSVSurveyExport($sid)
}
return $out;
}
-
- /**
+
+ /**
* Returns the survey ID of the EM singleton
*/
public static function getLEMsurveyId() {
$LEM =& LimeExpressionManager::singleton();
return $LEM->sid;
- }
-
+ }
+
}
/**
@@ -9003,6 +9003,6 @@ function cmpQuestionSeq($a, $b)
}
return ($a['qseq'] < $b['qseq']) ? -1 : 1;
}
-
-
+
+
?>
diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php
index 5d129c1fcf8..f5775376537 100644
--- a/application/helpers/frontend_helper.php
+++ b/application/helpers/frontend_helper.php
@@ -31,7 +31,7 @@ function loadanswers()
}
$query .="AND {{saved_control}}.identifier = '".autoEscape($_SESSION['survey_'.$surveyid]['holdname'])."' ";
- if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv')))
+ if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv', 'dblib')))
{
$query .="AND CAST({{saved_control}}.access_code as varchar(32))= '".md5(autoUnescape($_SESSION['survey_'.$surveyid]['holdpass']))."'\n";
}
@@ -250,7 +250,7 @@ function makeLanguageChangerSurvey($sSelectedLanguage)
return false;
}
- }
+ }
/**
* This function creates the language selector for the public survey index page
@@ -960,7 +960,7 @@ function submittokens($quotaexit=false)
if(!empty($participant_id))
{
$slquery = Survey_links::model()->find('participant_id = :pid AND survey_id = :sid AND token_id = :tid', array(':pid'=>$participant_id, ':sid'=>$surveyid, ':tid'=>$oTokenInformation->tid));
-
+
if (isTokenCompletedDatestamped($thissurvey))
{
$slquery->date_completed = $today;
@@ -995,7 +995,7 @@ function submittokens($quotaexit=false)
// added survey url in replacement vars
$surveylink = Yii::app()->createAbsoluteUrl("/survey/index/sid/{$surveyid}",array('lang'=>$_SESSION['survey_'.$surveyid]['s_lang'],'token'=>$clienttoken));
$aReplacementVars['SURVEYURL'] = $surveylink;
-
+
$attrfieldnames=getAttributeFieldNames($surveyid);
foreach ($attrfieldnames as $attr_name)
{
@@ -1051,12 +1051,12 @@ function sendSubmitNotifications($surveyid)
{
// @todo: Remove globals
global $thissurvey, $maildebug, $tokensexist;
-
+
if (trim($thissurvey['adminemail'])=='')
{
return;
}
-
+
$homeurl=Yii::app()->createAbsoluteUrl('/admin');
$clang = Yii::app()->lang;
$sitename = Yii::app()->getConfig("sitename");
@@ -1177,8 +1177,8 @@ function sendSubmitNotifications($surveyid)
}
$sFrom = $thissurvey['adminname'].' <'.$thissurvey['adminemail'].'>';
-
-
+
+
$redata=compact(array_keys(get_defined_vars()));
if (count($aEmailNotificationTo)>0)
{
@@ -1655,7 +1655,7 @@ function buildsurveysession($surveyid,$preview=false)
." 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
@@ -1704,7 +1704,7 @@ function buildsurveysession($surveyid,$preview=false)
//An array containing information about used to insert the data into the db at the submit stage
//4. SESSION VARIABLE - fieldarray
//See rem at end..
-
+
if ($tokensexist == 1 && $clienttoken)
{
$_SESSION['survey_'.$surveyid]['token'] = $clienttoken;
@@ -1761,7 +1761,7 @@ function buildsurveysession($surveyid,$preview=false)
if (isset($aField['gid']))
{
$GroupFieldMap[$aField['gid']][]=$aField;
- }
+ }
else{
$GroupFieldMap['other'][]=$aField;
}
@@ -1795,7 +1795,7 @@ function buildsurveysession($surveyid,$preview=false)
// Find all defined randomization groups through question attribute values
$randomGroups=array();
- if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv')))
+ if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv', 'dblib')))
{
$rgquery = "SELECT attr.qid, CAST(value as varchar(255)) as value FROM {{question_attributes}} as attr right join {{questions}} as quests on attr.qid=quests.qid WHERE attribute='random_group' and CAST(value as varchar(255)) <> '' and sid=$surveyid GROUP BY attr.qid, CAST(value as varchar(255))";
}
@@ -1908,7 +1908,7 @@ function buildsurveysession($surveyid,$preview=false)
$_SESSION['survey_'.$surveyid]['fieldmap-' . $surveyid . $_SESSION['survey_'.$surveyid]['s_lang']] = $fieldmap;
$_SESSION['survey_'.$surveyid]['fieldmap-' . $surveyid . '-randMaster'] = 'fieldmap-' . $surveyid . $_SESSION['survey_'.$surveyid]['s_lang'];
}
-
+
// TMSW Conditions->Relevance: don't need hasconditions, or usedinconditions
$_SESSION['survey_'.$surveyid]['fieldmap']=$fieldmap;
@@ -2283,20 +2283,20 @@ function UpdateGroupList($surveyid, $language)
foreach ($result->readAll() as $row)
{
$group = array(
- 'gid' => $row['gid'],
+ 'gid' => $row['gid'],
'group_name' => $row['group_name'],
'description' => $row['description']);
$groupList[] = $group;
$gidList[$row['gid']] = $group;
}
-
+
if (isset($_SESSION['survey_'.$surveyid]['groupReMap']) && count($_SESSION['survey_'.$surveyid]['groupReMap'])>0)
{
// Now adjust the grouplist
$groupRemap = $_SESSION['survey_'.$surveyid]['groupReMap'];
$groupListCopy = $groupList;
foreach ($groupList as $gseq => $info) {
- $gid = $info['gid'];
+ $gid = $info['gid'];
if (isset($groupRemap[$gid])) {
$gid = $groupRemap[$gid];
}
@@ -2304,7 +2304,7 @@ function UpdateGroupList($surveyid, $language)
}
$groupList = $groupListCopy;
}
-
+
$_SESSION['survey_'.$surveyid]['grouplist'] = $groupList;
}
@@ -2328,7 +2328,7 @@ function UpdateFieldArray()
$query = "SELECT title, question FROM {{questions}} WHERE qid=".$questionarray[0]." AND language='".$_SESSION['survey_'.$surveyid]['s_lang']."'";
$usrow = Yii::app()->db->createCommand($query)->queryRow();
- if ($usrow)
+ if ($usrow)
{
$questionarray[2]=$usrow['title'];
$questionarray[3]=$usrow['question'];
@@ -2688,7 +2688,7 @@ function killSurveySession($iSurveyID)
// Unset the session
unset($_SESSION['survey_'.$iSurveyID]);
// Force EM to refresh
- LimeExpressionManager::SetDirtyFlag();
+ LimeExpressionManager::SetDirtyFlag();
}
diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php
index 4022eae3904..f81db12bd64 100644
--- a/application/helpers/update/updatedb_helper.php
+++ b/application/helpers/update/updatedb_helper.php
@@ -580,8 +580,8 @@ function db_upgrade_all($oldversion) {
alterColumn('{{user_groups}}','name',"{$sVarchar}(20)",false);
alterColumn('{{user_groups}}','description',"text",false);
- try { Yii::app()->db->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}'); } catch(Exception $e) {}
- try { addPrimaryKey('user_in_groups', array('ugid','uid')); } catch(Exception $e) {}
+ try { Yii::app()->db->createCommand()->dropIndex('user_in_groups_idx1','{{user_in_groups}}'); } catch(Exception $e) {}
+ try { addPrimaryKey('user_in_groups', array('ugid','uid')); } catch(Exception $e) {}
addColumn('{{surveys_languagesettings}}','surveyls_numberformat',"integer NOT NULL DEFAULT 0");
@@ -599,7 +599,7 @@ function db_upgrade_all($oldversion) {
{
upgradeSurveyTimings146();
// Fix permissions for new feature quick-translation
- try { setTransactionBookmark(); Yii::app()->db->createCommand("INSERT into {{survey_permissions}} (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from {{surveys}}")->execute(); echo $modifyoutput; flush();@ob_flush();} catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); Yii::app()->db->createCommand("INSERT into {{survey_permissions}} (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from {{surveys}}")->execute(); echo $modifyoutput; flush();@ob_flush();} catch(Exception $e) { rollBackToTransactionBookmark();}
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>146),"stg_name='DBVersion'");
}
@@ -735,7 +735,7 @@ function db_upgrade_all($oldversion) {
{
addColumn('{{surveys}}','googleanalyticsstyle',"{$sVarchar}(1)");
addColumn('{{surveys}}','googleanalyticsapikey',"{$sVarchar}(25)");
- try { setTransactionBookmark(); Yii::app()->db->createCommand()->renameColumn('{{surveys}}','showXquestions','showxquestions');} catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); Yii::app()->db->createCommand()->renameColumn('{{surveys}}','showXquestions','showxquestions');} catch(Exception $e) { rollBackToTransactionBookmark();}
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>155),"stg_name='DBVersion'");
}
@@ -802,7 +802,7 @@ function db_upgrade_all($oldversion) {
if ($oldversion < 157)
{
// MySQL DB corrections
- try { setTransactionBookmark(); Yii::app()->db->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); Yii::app()->db->createCommand()->dropIndex('questions_idx4','{{questions}}'); } catch(Exception $e) { rollBackToTransactionBookmark();}
alterColumn('{{answers}}','assessment_value','integer',false , '0');
dropPrimaryKey('answers');
@@ -823,7 +823,7 @@ function db_upgrade_all($oldversion) {
alterColumn('{{quota}}','active','integer',false , '1');
alterColumn('{{quota}}','autoload_url','integer',false , '0');
alterColumn('{{saved_control}}','status',"{$sVarchar}(1)",false , '');
- try { setTransactionBookmark(); alterColumn('{{sessions}}','id',"{$sVarchar}(32)",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); alterColumn('{{sessions}}','id',"{$sVarchar}(32)",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
alterColumn('{{surveys}}','active',"{$sVarchar}(1)",false , 'N');
alterColumn('{{surveys}}','anonymized',"{$sVarchar}(1)",false,'N');
alterColumn('{{surveys}}','format',"{$sVarchar}(1)");
@@ -862,8 +862,8 @@ function db_upgrade_all($oldversion) {
alterColumn('{{surveys}}','googleanalyticsstyle',"{$sVarchar}(1)");
alterColumn('{{surveys_languagesettings}}','surveyls_dateformat','integer',false , 1);
- try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
- try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
+ try { setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark();}
alterColumn('{{survey_permissions}}','create_p', 'integer',false , '0');
alterColumn('{{survey_permissions}}','read_p', 'integer',false , '0');
alterColumn('{{survey_permissions}}','update_p','integer',false , '0');
@@ -887,7 +887,7 @@ function db_upgrade_all($oldversion) {
alterColumn('{{users}}','dateformat','integer',false, 1);
alterColumn('{{users}}','participant_panel','integer',false , '0');
alterColumn('{{users}}','parent_id','integer',false);
- try { setTransactionBookmark(); alterColumn('{{surveys_languagesettings}}','surveyls_survey_id',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark(); }
+ try { setTransactionBookmark(); alterColumn('{{surveys_languagesettings}}','surveyls_survey_id',"integer",false); } catch(Exception $e) { rollBackToTransactionBookmark(); }
alterColumn('{{user_groups}}','owner_id',"integer",false);
alterColumn('{{user_in_groups}}','ugid',"integer",false);
alterColumn('{{user_in_groups}}','uid',"integer",false);
@@ -915,7 +915,7 @@ function db_upgrade_all($oldversion) {
try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','sid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };
try{ setTransactionBookmark(); alterColumn('{{survey_permissions}}','uid','integer',false); } catch(Exception $e) { rollBackToTransactionBookmark(); };
alterColumn('{{users}}','htmleditormode',"{$sVarchar}(7)",true,'default');
-
+
// Sometimes the survey_links table was deleted before this step, if so
// we recreate it (copied from line 663)
if (!tableExists('{survey_links}')) {
@@ -1041,13 +1041,13 @@ function db_upgrade_all($oldversion) {
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>163),"stg_name='DBVersion'");
}
-
+
if ($oldversion < 164)
{
// fix survey tables for missing or incorrect token field
upgradeSurveyTables164();
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>164),"stg_name='DBVersion'");
-
+
// Not updating settings table as upgrade process takes care of that step now
}
$oTransaction->commit();
@@ -1057,7 +1057,7 @@ function db_upgrade_all($oldversion) {
$oTransaction->rollback();
echo '
'.$clang->gT('An non-recoverable error happened during the update. Error details:')."".htmlspecialchars($e->getMessage()).' ';
return false;
- }
+ }
fixLanguageConsistencyAllSurveys();
echo '
'.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
';
return true;
@@ -1586,7 +1586,7 @@ function alterLanguageCode($sOldLanguageCode,$sNewLanguageCode)
$aLanguages=explode(' ',$datarow['languages']);
foreach ($aLanguages as &$sLanguage)
{
- if ($sLanguage==$sOldLanguageCode) $sLanguage=$sNewLanguageCode;
+ if ($sLanguage==$sOldLanguageCode) $sLanguage=$sNewLanguageCode;
}
$toreplace=implode(' ',$aLanguages);
Yii::app()->db->createCommand()->update('{{labelsets}}',array('languages'=>$toreplace),'lid=:lid',array(':lid'=>$datarow['lid']));
@@ -1597,7 +1597,7 @@ function alterLanguageCode($sOldLanguageCode,$sNewLanguageCode)
$aLanguages=explode(' ',$datarow['additional_languages']);
foreach ($aLanguages as &$sLanguage)
{
- if ($sLanguage==$sOldLanguageCode) $sLanguage=$sNewLanguageCode;
+ if ($sLanguage==$sOldLanguageCode) $sLanguage=$sNewLanguageCode;
}
$toreplace=implode(' ',$aLanguages);
Yii::app()->db->createCommand()->update('{{surveys}}',array('additional_languages'=>$toreplace),'sid=:sid',array(':sid'=>$datarow['sid']));
@@ -1614,7 +1614,7 @@ function dropPrimaryKey($sTablename)
{
$sDBDriverName=Yii::app()->db->getDriverName();
if ($sDBDriverName=='mysqli') $sDBDriverName='mysql';
- if ($sDBDriverName=='sqlsrv') $sDBDriverName='mssql';
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='dblib') $sDBDriverName='mssql';
global $modifyoutput;
switch ($sDBDriverName){
@@ -1655,10 +1655,9 @@ function alterColumn($sTable, $sColumn, $sFieldType, $bAllowNull=true, $sDefault
{
$sDBDriverName=Yii::app()->db->getDriverName();
if ($sDBDriverName=='mysqli') $sDBDriverName='mysql';
- if ($sDBDriverName=='sqlsrv') $sDBDriverName='mssql';
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='dblib') $sDBDriverName='mssql';
switch ($sDBDriverName){
case 'mysql':
-
$sType=$sFieldType;
if ($bAllowNull!=true)
{
@@ -1719,7 +1718,8 @@ function dropColumn($sTableName, $sColumnName)
{
$sDBDriverName=Yii::app()->db->getDriverName();
if ($sDBDriverName=='mysqli') $sDBDriverName='mysql';
- if ($sDBDriverName=='sqlsrv') $sDBDriverName='mssql';
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='dblib') $sDBDriverName='mssql';
+
if ($sDBDriverName=='mssql')
{
dropDefaultValueMSSQL($sColumnName,$sTableName);
@@ -1735,7 +1735,7 @@ function addColumn($sTableName, $sColumn, $sType)
{
$sDBDriverName=Yii::app()->db->getDriverName();
if ($sDBDriverName=='mysqli') $sDBDriverName='mysql';
- if ($sDBDriverName=='sqlsrv') $sDBDriverName='mssql';
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='dblib') $sDBDriverName='mssql';
if ($sDBDriverName=='mssql')
{
$sType=str_replace('text','varchar(max)',$sType);
@@ -1789,7 +1789,7 @@ function dropDefaultValueMSSQL($fieldname, $tablename)
function setsDBDriverName() {
$sDBDriverName=Yii::app()->db->getDriverName();
if ($sDBDriverName=='mysqli') $sDBDriverName='mysql';
- if ($sDBDriverName=='sqlsrv') $sDBDriverName='mssql';
+ if ($sDBDriverName=='sqlsrv' || $sDBDriverName=='dblib') $sDBDriverName='mssql';
return $sDBDriverName;
}
@@ -1885,12 +1885,12 @@ function replaceTemplateJS(){
/**
* Make sure all active tables have the right sized token field
- *
+ *
* During a small period in the 2.0 cycle some survey tables got no
* token field or a token field that was too small. This patch makes
* sure all surveys that are not anonymous have a token field with the
* right size
- *
+ *
* @return void
*/
function upgradeSurveyTables164()
diff --git a/application/models/InstallerConfigForm.php b/application/models/InstallerConfigForm.php
index 6030170a681..077c3b513dc 100644
--- a/application/models/InstallerConfigForm.php
+++ b/application/models/InstallerConfigForm.php
@@ -30,8 +30,7 @@ class InstallerConfigForm extends CFormModel
'mysqli' => 'MySQL (newer driver)',
'sqlsrv' => 'Microsoft SQL Server (sqlsrv)',
'mssql' => 'Microsoft SQL Server (mssql)',
-// 'dblib' => 'Microsoft SQL Server (dblib)',
-// 'sybase' => 'Microsoft SQL Server (sybase)',
+ 'dblib' => 'Microsoft SQL Server (dblib)',
'pgsql' => 'PostgreSQL',
);
diff --git a/application/models/Participants.php b/application/models/Participants.php
index b18a86adf9d..6a70324fdb0 100644
--- a/application/models/Participants.php
+++ b/application/models/Participants.php
@@ -166,7 +166,7 @@ public function primaryKey() {
/**
* This function updates the data edited in the jqgrid
- *
+ *
* @param aray $data
*/
function updateRow($data)
@@ -195,14 +195,14 @@ function getParticipantsOwner($userid)
->leftJoin('{{participant_shares}}', ' {{participants}}.participant_id={{participant_shares}}.participant_id')
->where('owner_uid = :userid1 OR share_uid = :userid2')
->group('{{participants}}.participant_id,{{participant_shares}}.can_edit');
-
+
$command = Yii::app()->db->createCommand()
->select('p.*, ps.can_edit')
->from('{{participants}} p')
->join('(' . $subquery->getText() . ') ps', 'ps.participant_id = p.participant_id')
->bindParam(":userid1", $userid, PDO::PARAM_INT)
->bindParam(":userid2", $userid, PDO::PARAM_INT);
-
+
return $command->queryAll();
}
@@ -220,14 +220,14 @@ function getParticipantsOwnerCount($userid)
/**
* Get the number of participants, no restrictions
- *
+ *
* @return int
*/
function getParticipantsCountWithoutLimit()
{
- return Participants::model()->count();
+ return Participants::model()->count();
}
-
+
function getParticipantsWithoutLimit()
{
return Yii::app()->db->createCommand()->select('*')->from('{{participants}}')->queryAll();
@@ -237,10 +237,10 @@ function getParticipantsWithoutLimit()
* This function combines the shared participant and the central participant
* table and searches for any reference of owner id in the combined record
* of the two tables
- *
+ *
* @param int $userid The id of the owner
* @return int The number of participants owned by $userid who are shared
- */
+ */
function getParticipantsSharedCount($userid)
{
$count = Yii::app()->db->createCommand()->select('count(*)')->from('{{participants}}')->join('{{participant_shares}}', '{{participant_shares}}.participant_id = {{participants}}.participant_id')->where('owner_uid = :userid')->bindParam(":userid", $userid, PDO::PARAM_INT)->queryScalar();
@@ -250,37 +250,37 @@ function getParticipantsSharedCount($userid)
function getParticipants($page, $limit,$attid, $order = null, $search = null, $userid = null)
{
$data = $this->getParticipantsSelectCommand(false, $attid, $search, $userid, $page, $limit, $order);
-
+
$allData = $data->queryAll();
return $allData;
}
-
+
/**
* Duplicated from getparticipants, only to have a count
- *
+ *
* @param type $attid
* @param type $order
* @param CDbCriteria $search
* @param type $userid
* @return type
- */
+ */
function getParticipantsCount($attid, $search = null, $userid = null) {
$data = $this->getParticipantsSelectCommand(true, $attid, $search, $userid);
-
+
return $data->queryScalar();
}
-
+
private function getParticipantsSelectCommand($count = false, $attid, $search = null, $userid = null, $page = null, $limit = null, $order = null)
{
$selectValue = array();
$joinValue = array();
-
+
$selectValue[] = "p.*";
$selectValue[] = "luser.full_name as ownername";
$selectValue[] = "luser.users_name as username";
-
-
+
+
// Add survey count subquery
$subQuery = Yii::app()->db->createCommand()
->select('count(*) survey')
@@ -292,7 +292,7 @@ private function getParticipantsSelectCommand($count = false, $attid, $search =
{
$attid = $attid['attribute_id'];
$databasetype = Yii::app()->db->getDriverName();
- if ($databasetype=='mssql' || $databasetype=="sqlsrv")
+ if ($databasetype=='mssql' || $databasetype=="sqlsrv" || $sDatabaseType == 'dblib')
{
$selectValue[]= "cast(attribute".$attid.".value as varchar(max)) as a".$attid;
} else {
@@ -300,7 +300,7 @@ private function getParticipantsSelectCommand($count = false, $attid, $search =
}
array_push($joinValue,"LEFT JOIN {{participant_attribute}} attribute".$attid." ON attribute".$attid.".participant_id=p.participant_id AND attribute".$attid.".attribute_id=".$attid);
}
-
+
$aConditions = array(); // this wil hold all conditions
$aParams = array();
if (!is_null($userid)) {
@@ -309,16 +309,16 @@ private function getParticipantsSelectCommand($count = false, $attid, $search =
$joinValue[] = 'LEFT JOIN {{participant_shares}} ON p.participant_id={{participant_shares}}.participant_id';
$aConditions[] = 'p.owner_uid = :userid1 OR {{participant_shares}}.share_uid = :userid2';
}
-
+
if ($count) {
$selectValue = 'count(*) as cnt';
}
-
+
$data = Yii::app()->db->createCommand()
->select($selectValue)
->from('{{participants}} p');
$data->setJoin($joinValue);
-
+
if (!empty($search)) {
/* @var $search CDbCriteria */
$aSearch = $search->toArray();
@@ -327,16 +327,16 @@ private function getParticipantsSelectCommand($count = false, $attid, $search =
}
$condition = ''; // This will be the final condition
foreach ($aConditions as $idx => $newCondition) {
- if ($idx>0) {
+ if ($idx>0) {
$condition .= ' AND ';
}
$condition .= '(' . $newCondition . ')';
}
-
+
if (!empty($condition)) {
$data->setWhere($condition);
}
-
+
if (!$count) {
// Apply order and limits
if (!empty($order)) {
@@ -349,14 +349,14 @@ private function getParticipantsSelectCommand($count = false, $attid, $search =
->limit($limit);
}
}
-
+
$data->bindValues($aParams);
-
+
if (!is_null($userid)) {
$data->bindParam(":userid1", $userid, PDO::PARAM_INT)
->bindParam(":userid2", $userid, PDO::PARAM_INT);
}
-
+
return $data;
}
@@ -367,7 +367,7 @@ function getSurveyCount($participant_id)
}
/**
- * This function deletes the participant from the participants table,
+ * This function deletes the participant from the participants table,
* references in the survey_links table (but not in matching tokens tables)
* and then all the participants attributes.
* @param $rows Participants ID separated by comma
@@ -376,7 +376,7 @@ function getSurveyCount($participant_id)
function deleteParticipants($rows, $bFilter=true)
{
// Converting the comma separated IDs to an array and assign chunks of 100 entries to have a reasonable query size
- $aParticipantsIDChunks = array_chunk(explode(",", $rows),100);
+ $aParticipantsIDChunks = array_chunk(explode(",", $rows),100);
foreach ($aParticipantsIDChunks as $aParticipantsIDs)
{
@@ -386,7 +386,7 @@ function deleteParticipants($rows, $bFilter=true)
}
Yii::app()->db->createCommand()->delete(Participants::model()->tableName(), array('in', 'participant_id', $aParticipantsIDs));
-
+
// Delete survey links
Yii::app()->db->createCommand()->delete(Survey_links::model()->tableName(), array('in', 'participant_id', $aParticipantsIDs));
// Delete participant attributes
@@ -394,10 +394,10 @@ function deleteParticipants($rows, $bFilter=true)
}
}
-
+
/**
* Filter an array of participants IDs according to permissions of the person being logged in
- *
+ *
* @param mixed $aParticipantsIDs
*/
function filterParticipantIDs($aParticipantIDs)
@@ -407,13 +407,13 @@ function filterParticipantIDs($aParticipantIDs)
$aCondition=array('and','owner_uid=:owner_uid',array('in', 'participant_id', $aParticipantIDs));
$aParameter=array(':owner_uid'=>Yii::app()->session['loginID']);
$aParticipantIDs=Yii::app()->db->createCommand()->select('participant_id')->from(Participants::model()->tableName())->where($aCondition, $aParameter)->queryColumn();
- }
+ }
return $aParticipantIDs;
}
-
+
/**
* Deletes CPDB participants identified by their participant ID from token tables
- *
+ *
* @param mixed $sParticipantsIDs
*/
function deleteParticipantToken($sParticipantsIDs)
@@ -421,7 +421,7 @@ function deleteParticipantToken($sParticipantsIDs)
/* This function deletes the participant from the participants table,
the participant from any tokens table they're in (using the survey_links table to find them)
and then all the participants attributes. */
- $aParticipantsIDChunks = array_chunk(explode(",", $sParticipantsIDs),100);
+ $aParticipantsIDChunks = array_chunk(explode(",", $sParticipantsIDs),100);
foreach ($aParticipantsIDChunks as $aParticipantsIDs)
{
$aParticipantsIDs=$this->filterParticipantIDs($aParticipantsIDs);
@@ -446,14 +446,14 @@ function deleteParticipantToken($sParticipantsIDs)
* the participant from any tokens table they're in (using the survey_links table to find them),
* all responses in surveys they've been linked to,
* and then all the participants attributes.
- *
+ *
* @param mixed $sParticipantsIDs
*/
function deleteParticipantTokenAnswer($sParticipantsIDs)
{
$aParticipantsIDs = explode(",", $sParticipantsIDs);
$aParticipantsIDs=$this->filterParticipantIDs($aParticipantsIDs);
-
+
foreach ($aParticipantsIDs as $row)
{
$tokens = Yii::app()->db->createCommand()
@@ -494,7 +494,7 @@ function deleteParticipantTokenAnswer($sParticipantsIDs)
}
if (hasSurveyPermission($iSurveyID, 'tokens', 'delete'))
{
-
+
Yii::app()->db->createCommand()
->delete('{{tokens_' . intval($value['survey_id']) . '}}', 'participant_id = :pid' , array(':pid'=>$value['participant_id'])); // Deletes matching token table entries
}
@@ -692,7 +692,7 @@ function getParticipantsSearchMultiple($condition, $page, $limit)
$i = $i + 4;
}
}
-
+
if ($page == 0 && $limit == 0)
{
$arr = Participants::model()->findAll($command);
@@ -716,8 +716,8 @@ function getParticipantsSearchMultiple($condition, $page, $limit)
return $data;
}
-
- /**
+
+ /**
* Function builds a select query for searches through participants using the $condition field passed
* which is in the format "firstfield||sqloperator||value||booleanoperator||secondfield||sqloperator||value||booleanoperator||etc||etc||etc"
* for example: "firstname||equal||Jason||and||lastname||equal||Cleeland" will produce SQL along the lines of "WHERE firstname = 'Jason' AND lastname=='Cleeland'"
@@ -749,11 +749,11 @@ function getParticipantsSearchMultipleCondition($condition)
$param = ':condition_'.$i;
switch ($sOperator)
{
- case 'equal':
+ case 'equal':
$operator = '=';
$aParams[$param] = $sValue;
break;
- case 'contains':
+ case 'contains':
$operator = 'LIKE';
$aParams[$param] = '%'.$sValue.'%';
break;
@@ -761,19 +761,19 @@ function getParticipantsSearchMultipleCondition($condition)
$operator = 'LIKE';
$aParams[$param] = $sValue.'%';
break;
- case 'notequal':
+ case 'notequal':
$operator = '!=';
$aParams[$param] = $sValue;
break;
- case 'notcontains':
+ case 'notcontains':
$operator = 'NOT LIKE';
$aParams[$param] = '%'.$sValue.'%';
break;
- case 'greaterthan':
+ case 'greaterthan':
$operator = '>';
$aParams[$param] = $sValue;
break;
- case 'lessthan':
+ case 'lessthan':
$operator = '<';
$aParams[$param] = $sValue;
break;
@@ -786,11 +786,11 @@ function getParticipantsSearchMultipleCondition($condition)
{
$booloperator='AND';
}
-
+
if($sFieldname=="email")
{
$command->addCondition('p.email ' . $operator . ' '.$param, $booloperator);
- }
+ }
elseif($sFieldname=="survey")
{
$subQuery = Yii::app()->db->createCommand()
@@ -799,7 +799,7 @@ function getParticipantsSearchMultipleCondition($condition)
->join('{{surveys_languagesettings}} sls', 'sl.survey_id = sls.surveyls_survey_id')
->where('sls.surveyls_title '. $operator.' '.$param)
->group('sl.participant_id');
- $command->addCondition('p.participant_id IN ('.$subQuery->getText().')', $booloperator);
+ $command->addCondition('p.participant_id IN ('.$subQuery->getText().')', $booloperator);
}
elseif($sFieldname=="surveyid")
{
@@ -808,7 +808,7 @@ function getParticipantsSearchMultipleCondition($condition)
->from('{{survey_links}} sl')
->where('sl.survey_id '. $operator.' '.$param)
->group('sl.participant_id');
- $command->addCondition('p.participant_id IN ('.$subQuery->getText().')', $booloperator);
+ $command->addCondition('p.participant_id IN ('.$subQuery->getText().')', $booloperator);
}
elseif($sFieldname=="surveys") //Search by quantity of linked surveys
{
@@ -835,15 +835,15 @@ function getParticipantsSearchMultipleCondition($condition)
{
$command->addCondition($sFieldname . ' '.$operator.' '.$param, $booloperator);
}
-
+
$i++;
}
-
+
if (count($aParams)>0)
{
$command->params = $aParams;
}
-
+
return $command;
}
diff --git a/application/views/admin/survey/surveySummary_view.php b/application/views/admin/survey/surveySummary_view.php
index c952ebfe826..6bfb7efa9c7 100644
--- a/application/views/admin/survey/surveySummary_view.php
+++ b/application/views/admin/survey/surveySummary_view.php
@@ -172,7 +172,7 @@
eT("Table column usage");?>: | |
eT("Table size usage");?>: | |
eT("Table column usage");?>: | % |
|