Skip to content

Commit

Permalink
Dev updated database to enable new question index option(s).
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Jun 30, 2013
1 parent fe47d0b commit 6e059fa
Show file tree
Hide file tree
Showing 32 changed files with 227 additions and 213 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/

$config['versionnumber'] = "2.05b4";
$config['dbversionnumber'] = 168;
$config['dbversionnumber'] = 169;
$config['buildnumber'] = '';
$config['updatable'] = true;

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ function index($sa = null)
'shownoanswer'=> Yii::app()->request->getPost('shownoanswer'),
'showwelcome'=> Yii::app()->request->getPost('showwelcome'),
'allowprev'=> Yii::app()->request->getPost('allowprev'),
'allowjumps'=> Yii::app()->request->getPost('allowjumps'),
'questionindex'=> Yii::app()->request->getPost('questionindex'),
'nokeyboard'=> Yii::app()->request->getPost('nokeyboard'),
'showprogress'=> Yii::app()->request->getPost('showprogress'),
'listpublic'=> Yii::app()->request->getPost('public'),
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/surveyadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ private function _fetchSurveyInfo($action, $iSurveyID=null)
if ($action == 'newsurvey')
{
$esrow['active'] = 'N';
$esrow['allowjumps'] = 'N';
$esrow['questionindex'] = 0;
$esrow['format'] = 'G'; //Group-by-group mode
$esrow['template'] = Yii::app()->getConfig('defaulttemplate');
$esrow['allowsave'] = 'Y';
Expand Down Expand Up @@ -1533,7 +1533,7 @@ function insert($iSurveyID=null)
'shownoanswer' => $_POST['shownoanswer'],
'showwelcome' => $_POST['showwelcome'],
'allowprev' => $_POST['allowprev'],
'allowjumps' => $_POST['allowjumps'],
'questionindex' => $_POST['questionindex'],
'nokeyboard' => $_POST['nokeyboard'],
'showprogress' => $_POST['showprogress'],
'printanswers' => $_POST['printanswers'],
Expand Down
8 changes: 6 additions & 2 deletions application/core/Survey_Common_Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,16 +700,20 @@ function _surveysummary($iSurveyID, $action=null, $gid=null)
{
$surveysummary2 .= $clang->gT("It is presented on one single page.") . "<br />";
}
if ($surveyinfo['allowjumps'] == "Y")
if ($surveyinfo['questionindex'] > 0)
{
if ($surveyinfo['format'] == 'A')
{
$surveysummary2 .= $clang->gT("No question index will be shown with this format.") . "<br />";
}
else
elseif ($surveyinfo['questionindex'] == 1)
{
$surveysummary2 .= $clang->gT("A question index will be shown; participants will be able to jump between viewed questions.") . "<br />";
}
elseif ($surveyinfo['questionindex'] == 2)
{
$surveysummary2 .= $clang->gT("A full question index will be shown; participants will be able to jump between relevant questions.") . "<br />";
}
}
if ($surveyinfo['datestamp'] == "Y")
{
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/SurveyRuntimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function run($surveyid,$args) {
else if (!$LEMskipReprocessing)
{
//Move current step ###########################################################################
if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev'] == 'Y' || $thissurvey['allowjumps'] == 'Y'))
if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev'] == 'Y' || $thissurvey['questionindex'] > 0))
{
$moveResult = LimeExpressionManager::NavigateBackwards();
if ($moveResult['at_start'])
Expand Down Expand Up @@ -298,7 +298,7 @@ function run($surveyid,$args) {
// jump to current step using new language, processing POST values
$moveResult = LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, true, false, true); // do process the POST data
}
if (isset($move) && isNumericInt($move) && $thissurvey['allowjumps'] == 'Y')
if (isset($move) && isNumericInt($move) && $thissurvey['questionindex'] > 0)
{
$move = (int) $move;
if ($move > 0 && (($move <= $_SESSION[$LEMsessid]['step']) || (isset($_SESSION[$LEMsessid]['maxstep']) && $move <= $_SESSION[$LEMsessid]['maxstep'])))
Expand Down Expand Up @@ -1133,7 +1133,7 @@ function checkconditions(value, name, type, evt_type)
}


if ($surveyMode != 'survey' && $thissurvey['allowjumps'] == 'Y')
if ($surveyMode != 'survey' && $thissurvey['questionindex'] > 0)
{
$this->createQuestionIndex($LEMsessid, $surveyMode);
}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/survey_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getSurveyDefaultSettings()
{
return array(
'active'=>'N',
'allowjumps' => 'N',
'questionindex' => 0,
'format' => 'G', //Group-by-group mode
'template' => $this->config->item('defaulttemplate'),
'allowsave' => 'Y',
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/frontend_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ function surveymover()
$surveymover .= "<input type=\"hidden\" name=\"move\" value=\"movenext\" id=\"movenext\" />";
}

if (isset($_SESSION['survey_'.$surveyid]['step']) && $thissurvey['format'] != "A" && ($thissurvey['allowprev'] != "N" || $thissurvey['allowjumps'] == "Y") &&
if (isset($_SESSION['survey_'.$surveyid]['step']) && $thissurvey['format'] != "A" && ($thissurvey['allowprev'] != "N" || $thissurvey['questionindex'] > 0) &&
($_SESSION['survey_'.$surveyid]['step'] > 0 || (!$_SESSION['survey_'.$surveyid]['step'] && $presentinggroupdescription && $thissurvey['showwelcome'] == 'Y')))
{
//To prevent too much complication in the if statement above I put it here...
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/replacements_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
$surveyformat .= " page-odd";
}

if (isset($thissurvey['allowjumps']) && $thissurvey['allowjumps']=="Y" && $surveyformat!="allinone" && (isset(Yii::app()->session['step']) && Yii::app()->session['step']>0)){
if (isset($thissurvey['questionindex']) && $thissurvey['questionindex'] > 0 && $surveyformat!="allinone" && (isset(Yii::app()->session['step']) && Yii::app()->session['step']>0)){
$surveyformat .= " withindex";
}
if (isset($thissurvey['showprogress']) && $thissurvey['showprogress']=="Y"){
Expand Down
Loading

0 comments on commit 6e059fa

Please sign in to comment.