Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'Yii' of github.com:LimeSurvey/LimeSurvey into Yii
  • Loading branch information
Shnoulle committed Sep 6, 2012
2 parents 5f26bca + d38bd0c commit c35c06d
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 135 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@
*/

$config['versionnumber'] = "2.0RC9";
$config['dbversionnumber'] = 161;
$config['dbversionnumber'] = 162;
$config['buildnumber'] = '';
$config['updatable'] = false;

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/statistics.php
Expand Up @@ -399,7 +399,7 @@ public function run($surveyid = 0, $subaction = null)
{

//check if there is a dualscale_headerA/B
$dshresult = Question_attributes::getQuestionsForStatistics('value', "qid=$flt[0] AND attribute = 'dualscale_headerA'", '');
$dshresult = Question_attributes::model()->getQuestionsForStatistics('value', "qid=$flt[0] AND attribute = 'dualscale_headerA'", '');
$aData['dshresults'][$key1][$key] = $dshresult;


Expand All @@ -408,7 +408,7 @@ public function run($surveyid = 0, $subaction = null)
$aData['fresults'][$key1][$key] = $fresult;


$dshresult2 = Question_attributes::getQuestionsForStatistics('value', "qid=$flt[0] AND attribute = 'dualscale_headerB'", '');
$dshresult2 = Question_attributes::model()->getQuestionsForStatistics('value', "qid=$flt[0] AND attribute = 'dualscale_headerB'", '');
$aData['dshresults2'][$key1][$key] = $dshresult2;
}
break;
Expand Down
1 change: 1 addition & 0 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -1610,6 +1610,7 @@ function buildOutputList($rt, $language, $surveyid, $outputType, $sql) {

case "1": //array (dual scale)

$clang = Yii::app()->lang;
$sSubquestionQuery = "SELECT question FROM {{questions}} WHERE parent_qid='$qiqid' AND title='$qanswer' AND language='{$language}' ORDER BY question_order";
$questionDesc = Yii::app()->db->createCommand($sSubquestionQuery)->query()->read();
$sSubquestion = flattenText($questionDesc['question']);
Expand Down
9 changes: 9 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -994,6 +994,15 @@ function db_upgrade_all($oldversion) {
{
addColumn('{{survey_links}}','date_invited','datetime NULL default NULL');
addColumn('{{survey_links}}','date_completed','datetime NULL default NULL');
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>161),"stg_name='DBVersion'");
}
if ($oldversion < 162)
{
/* Fix participant db types */
alterColumn('{{participant_attribute}}', 'value', "text", false);
alterColumn('{{participant_attribute_names_lang}}', 'attribute_name', "{$sVarchar}(255)", false);
alterColumn('{{participant_attribute_values}}', 'value', "text", false);
Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>162),"stg_name='DBVersion'");
}

fixLanguageConsistencyAllSurveys();
Expand Down
2 changes: 1 addition & 1 deletion application/models/Question_attributes.php
Expand Up @@ -51,7 +51,7 @@ public function primaryKey()
return 'qaid';
}

function getQuestionAttributes($qid)
public function getQuestionAttributes($qid)
{
return Yii::app()->db->createCommand()
->select()
Expand Down
8 changes: 4 additions & 4 deletions application/views/admin/export/statistics_view.php
Expand Up @@ -581,7 +581,7 @@
echo "\t</tr>\n\t<tr>\n";

//get answers
$result[$key1] = Questions::getQuestionsForStatistics('title, question', "parent_qid='$flt[0]' AND language = '{$language}'", 'question_order');
$result[$key1] = Questions::model()->getQuestionsForStatistics('title, question', "parent_qid='$flt[0]' AND language = '{$language}'", 'question_order');
$counter2=0;

//check all the results
Expand Down Expand Up @@ -858,7 +858,7 @@
foreach($result[$key1] as $row)
{
$row = array_values($row);
$fresult = Questions::getQuestionsForStatistics('*', "parent_qid='$flt[0]' AND language = '{$language}' AND scale_id = 1", 'question_order, title');
$fresult = Questions::model()->getQuestionsForStatistics('*', "parent_qid='$flt[0]' AND language = '{$language}' AND scale_id = 1", 'question_order, title');
foreach($fresult as $frow)
{
$myfield2 = $myfield . $row[0] . "_" . $frow['title'];
Expand Down Expand Up @@ -1116,7 +1116,7 @@
* - sortorder
* - language
*/
$fresult = Answers::getQuestionsForStatistics('*', "qid='$flt[0]' AND language = '{$language}' AND scale_id = 0", 'sortorder, code');
$fresult = Answers::model()->getQuestionsForStatistics('*', "qid='$flt[0]' AND language = '{$language}' AND scale_id = 0", 'sortorder, code');

//this is for debugging only
//echo $fquery;
Expand Down Expand Up @@ -1192,7 +1192,7 @@
echo " />&nbsp;<strong>"
._showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle2)
."</strong><br />\n";
$fresult = Answers::getQuestionsForStatistics('*', "qid='$flt[0]' AND language = '$language' AND scale_id = 1", 'sortorder, code');
$fresult = Answers::model()->getQuestionsForStatistics('*', "qid='$flt[0]' AND language = '$language' AND scale_id = 1", 'sortorder, code');

//this is for debugging only
//echo $fquery;
Expand Down
2 changes: 1 addition & 1 deletion application/views/statistics_user_view.php
@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang="<?php echo $surveylanguage; ?>" lang="<?php echo $surveylanguage; ?>" <?php if ($condition) { echo 'dir = "rtl"'; } ?> >
<head>
<title>$sitename</title>
<title><?php echo $sitename; ?></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-\" />
<link href="<?php echo $thisSurveyCssPath; ?>/template.css" rel="stylesheet" type="text/css" />
</head>
Expand Down
8 changes: 4 additions & 4 deletions installer/sql/create-mssql.sql
Expand Up @@ -136,7 +136,7 @@ CREATE TABLE [prefix_labelsets] (
CREATE TABLE [prefix_participant_attribute] (
[participant_id] varchar(50) NOT NULL,
[attribute_id] int NOT NULL,
[value] varchar(50) NOT NULL,
[value] varchar(max) NOT NULL,
PRIMARY KEY ([participant_id],[attribute_id])
);

Expand All @@ -146,7 +146,7 @@ CREATE TABLE [prefix_participant_attribute] (
--
CREATE TABLE [prefix_participant_attribute_names_lang] (
[attribute_id] int NOT NULL,
[attribute_name] varchar(30) NOT NULL,
[attribute_name] varchar(255) NOT NULL,
[lang] varchar(20) NOT NULL,
PRIMARY KEY ([attribute_id],[lang])
);
Expand All @@ -169,7 +169,7 @@ CREATE TABLE [prefix_participant_attribute_names] (
CREATE TABLE [prefix_participant_attribute_values] (
[value_id] int NOT NULL IDENTITY (1,1) PRIMARY KEY,
[attribute_id] int NOT NULL,
[value] varchar(20) NOT NULL
[value] varchar(max) NOT NULL
);


Expand Down Expand Up @@ -551,4 +551,4 @@ create index [labels_code_idx] on [prefix_labels] ([code]);
--
-- Version Info
--
INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '161');
INSERT INTO [prefix_settings_global] VALUES ('DBVersion', '162');
8 changes: 4 additions & 4 deletions installer/sql/create-mysql.sql
Expand Up @@ -137,7 +137,7 @@ CREATE TABLE `prefix_labelsets` (
CREATE TABLE `prefix_participant_attribute` (
`participant_id` varchar(50) NOT NULL,
`attribute_id` int(11) NOT NULL,
`value` varchar(50) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`participant_id`,`attribute_id`)
) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Expand All @@ -148,7 +148,7 @@ CREATE TABLE `prefix_participant_attribute` (
CREATE TABLE `prefix_participant_attribute_names_lang` (
`attribute_id` int(11) NOT NULL,
`attribute_name` varchar(30) NOT NULL,
`lang` varchar(20) NOT NULL,
`lang` varchar(255) NOT NULL,
PRIMARY KEY (`attribute_id`,`lang`)
) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Expand All @@ -170,7 +170,7 @@ CREATE TABLE `prefix_participant_attribute_names` (
CREATE TABLE `prefix_participant_attribute_values` (
`value_id` int(11) NOT NULL AUTO_INCREMENT,
`attribute_id` int(11) NOT NULL,
`value` varchar(20) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY ( `value_id`)
) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Expand Down Expand Up @@ -556,4 +556,4 @@ create index `parent_qid_idx` on `prefix_questions` (`parent_qid`);
--
-- Version Info
--
INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '161');
INSERT INTO `prefix_settings_global` VALUES ('DBVersion', '162');
8 changes: 4 additions & 4 deletions installer/sql/create-pgsql.sql
Expand Up @@ -144,7 +144,7 @@ CREATE TABLE prefix_labelsets (
CREATE TABLE prefix_participant_attribute (
"participant_id" character varying( 50 ) NOT NULL,
"attribute_id" integer NOT NULL,
"value" character varying(50) NOT NULL,
"value" text NOT NULL,
CONSTRAINT prefix_participant_attribut_pkey PRIMARY KEY (participant_id,attribute_id)
);

Expand All @@ -155,7 +155,7 @@ CREATE TABLE prefix_participant_attribute (
CREATE TABLE prefix_participant_attribute_names_lang (
"attribute_id" integer NOT NULL,
"attribute_name" character varying( 30 ) NOT NULL,
"lang" character varying( 20 ) NOT NULL,
"lang" character varying( 255 ) NOT NULL,
CONSTRAINT prefix_participant_attribute_names_lang_pkey PRIMARY KEY (attribute_id,lang)
);

Expand All @@ -177,7 +177,7 @@ CREATE TABLE prefix_participant_attribute_names (
CREATE TABLE prefix_participant_attribute_values (
"value_id" serial PRIMARY KEY NOT NULL,
"attribute_id" integer NOT NULL,
"value" character varying( 20 ) NOT NULL
"value" character text NOT NULL
);


Expand Down Expand Up @@ -562,4 +562,4 @@ create index labels_code_idx on prefix_labels (code);
--
-- Version Info
--
INSERT INTO prefix_settings_global VALUES ('DBVersion', '161');
INSERT INTO prefix_settings_global VALUES ('DBVersion', '162');

0 comments on commit c35c06d

Please sign in to comment.