Skip to content

Commit

Permalink
Merge branch 'master' into 192_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TMSWhite committed May 16, 2012
2 parents 4c5495c + e1e38ca commit 1cbf3a1
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 1,774 deletions.
37 changes: 0 additions & 37 deletions admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,6 @@ function get_max_question_order($gid)
if (isset($postgid) && $postgid != "")
{

// $array_result=checkMovequestionConstraintsForConditions(sanitize_int($postsid),sanitize_int($postqid), sanitize_int($postgid));
// If there is no blocking conditions that could prevent this move
// if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
// {

$questlangs = GetAdditionalLanguagesFromSurveyID($postsid);
$baselang = GetBaseLanguageFromSurveyID($postsid);
array_push($questlangs,$baselang);
Expand Down Expand Up @@ -634,38 +629,6 @@ function get_max_question_order($gid)
$_SESSION['flashmessage'] = $clang->gT("Question was successfully saved.");


// }
// else
// {
// // There are conditions constraints: alert the user
// $errormsg="";
// if (!is_null($array_result['notAbove']))
// {
// $errormsg.=$clang->gT("This question relies on other question's answers and can't be moved above groupId:","js")
// . " " . $array_result['notAbove'][0][0] . " " . $clang->gT("in position","js")." ".$array_result['notAbove'][0][1]."\\n"
// . $clang->gT("See conditions:")."\\n";
//
// foreach ($array_result['notAbove'] as $notAboveCond)
// {
// $errormsg.="- cid:". $notAboveCond[3]."\\n";
// }
//
// }
// if (!is_null($array_result['notBelow']))
// {
// $errormsg.=$clang->gT("Some questions rely on this question's answers. You can't move this question below groupId:","js")
// . " " . $array_result['notBelow'][0][0] . " " . $clang->gT("in position","js")." ".$array_result['notBelow'][0][1]."\\n"
// . $clang->gT("See conditions:")."\\n";
//
// foreach ($array_result['notBelow'] as $notBelowCond)
// {
// $errormsg.="- cid:". $notBelowCond[3]."\\n";
// }
// }
//
// $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"$errormsg\")\n //-->\n</script>\n";
// $gid= $oldgid; // group move impossible ==> keep display on oldgid
// }
}
else
{
Expand Down
148 changes: 0 additions & 148 deletions admin/dataentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -1821,154 +1821,6 @@ function saveshow(value)
//GET ANY CONDITIONS THAT APPLY TO THIS QUESTION
$explanation = ""; //reset conditions explanation
$s=0;
// $scenarioquery="SELECT DISTINCT scenario FROM ".db_table_name("conditions")." WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} ORDER BY scenario";
// $scenarioresult=db_execute_assoc($scenarioquery);
// while ($scenariorow=$scenarioresult->FetchRow())
// {
// if ($s == 0 && $scenarioresult->RecordCount() > 1) { $explanation .= " <br />-------- <i>Scenario {$scenariorow['scenario']}</i> --------<br />";}
// if ($s > 0) { $explanation .= " <br />-------- <i>".$clang->gT("OR")." Scenario {$scenariorow['scenario']}</i> --------<br />";}
//
// $x=0;
// $distinctquery="SELECT DISTINCT cqid, ".db_table_name("questions").".title FROM ".db_table_name("conditions").", ".db_table_name("questions")." WHERE ".db_table_name("conditions").".cqid=".db_table_name("questions").".qid AND ".db_table_name("conditions").".qid={$deqrow['qid']} AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']} ORDER BY cqid";
// $distinctresult=db_execute_assoc($distinctquery);
//
// while ($distinctrow=$distinctresult->FetchRow())
// {
// if ($x > 0) {$explanation .= " <i>".$blang->gT("AND")."</i><br />";}
// $conquery="SELECT cid, cqid, cfieldname, ".db_table_name("questions").".title, ".db_table_name("questions").".question, value, ".db_table_name("questions").".type, method FROM ".db_table_name("conditions").", ".db_table_name("questions")." WHERE ".db_table_name("conditions").".cqid=".db_table_name("questions").".qid AND ".db_table_name("conditions").".cqid={$distinctrow['cqid']} AND ".db_table_name("conditions").".qid={$deqrow['qid']} AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']}";
// $conresult=db_execute_assoc($conquery);
// while ($conrow=$conresult->FetchRow())
// {
// if ($conrow['method']=="==") {$conrow['method']="= ";} else {$conrow['method']=$conrow['method']." ";}
// switch($conrow['type'])
// {
// case "Y":
// switch ($conrow['value'])
// {
// case "Y": $conditions[]=$conrow['method']."'".$blang->gT("Yes")."'"; break;
// case "N": $conditions[]=$conrow['method']."'".$blang->gT("No")."'"; break;
// }
// break;
// case "G":
// switch($conrow['value'])
// {
// case "M": $conditions[]=$conrow['method']."'".$blang->gT("Male")."'"; break;
// case "F": $conditions[]=$conrow['method']."'".$blang->gT("Female")."'"; break;
// } // switch
// break;
// case "A":
// case "B":
// $conditions[]=$conrow['method']."'".$conrow['value']."'";
// break;
// case "C":
// switch($conrow['value'])
// {
// case "Y": $conditions[]=$conrow['method']."'".$blang->gT("Yes")."'"; break;
// case "U": $conditions[]=$conrow['method']."'".$blang->gT("Uncertain")."'"; break;
// case "N": $conditions[]=$conrow['method']."'".$blang->gT("No")."'"; break;
// } // switch
// break;
// case "1":
// $value=substr($conrow['cfieldname'], strpos($conrow['cfieldname'], "X".$conrow['cqid'])+strlen("X".$conrow['cqid']), strlen($conrow['cfieldname']));
// $fquery = "SELECT * FROM ".db_table_name("labels")."\n"
// . "WHERE lid='{$conrow['lid']}'\n and language='$sDataEntryLanguage' "
// . "AND code='{$conrow['value']}'";
// $fresult=db_execute_assoc($fquery) or safe_die("$fquery<br />".$connect->ErrorMsg());
// while($frow=$fresult->FetchRow())
// {
// $postans=$frow['title'];
// $conditions[]=$conrow['method']."'".$frow['title']."'";
// } // while
// break;
//
// case "E":
// switch($conrow['value'])
// {
// case "I": $conditions[]=$conrow['method']."'".$blang->gT("Increase")."'"; break;
// case "D": $conditions[]=$conrow['method']."'".$blang->gT("Decrease")."'"; break;
// case "S": $conditions[]=$conrow['method']."'".$blang->gT("Same")."'"; break;
// }
// break;
// case "F":
// case "H":
// default:
// $value=substr($conrow['cfieldname'], strpos($conrow['cfieldname'], "X".$conrow['cqid'])+strlen("X".$conrow['cqid']), strlen($conrow['cfieldname']));
// $fquery = "SELECT * FROM ".db_table_name("questions")."\n"
// . "WHERE qid='{$conrow['cqid']}'\n and language='$sDataEntryLanguage' "
// . "AND title='{$conrow['title']}' and scale_id=0";
// $fresult=db_execute_assoc($fquery) or safe_die("$fquery<br />".$connect->ErrorMsg());
// if ($fresult->RecordCount() <= 0) die($fquery);
// while($frow=$fresult->FetchRow())
// {
// $postans=$frow['title'];
// $conditions[]=$conrow['method']."'".$frow['title']."'";
// } // while
// break;
// } // switch
// $answer_section="";
// switch($conrow['type'])
// {
//
// case "1":
// $ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$conrow['value']}' AND language='{$baselang}'";
// $ansresult=db_execute_assoc($ansquery);
// while ($ansrow=$ansresult->FetchRow())
// {
// $conditions[]=$conrow['method']."'".$ansrow['answer']."'";
// }
// $operator=$clang->gT("OR");
// if (isset($conditions)) $conditions = array_unique($conditions);
// break;
//
// case "A":
// case "B":
// case "C":
// case "E":
// case "F":
// case "H":
// case ":":
// case ";":
// $thiscquestion=$fieldmap[$conrow['cfieldname']];
// $ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$thiscquestion['aid']}' AND language='{$sDataEntryLanguage}'";
// $ansresult=db_execute_assoc($ansquery);
// $i=0;
// while ($ansrow=$ansresult->FetchRow())
// {
// if (isset($conditions) && count($conditions) > 0)
// {
// $conditions[sizeof($conditions)-1]="(".$ansrow['answer'].") : ".end($conditions);
// }
// }
// $operator=$blang->gT("AND"); // this is a dirty, DIRTY fix but it works since only array questions seem to be ORd
// break;
// default:
// $ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$conrow['value']}' AND language='{$sDataEntryLanguage}'";
// $ansresult=db_execute_assoc($ansquery);
// while ($ansrow=$ansresult->FetchRow())
// {
// $conditions[]=$conrow['method']."'".$ansrow['answer']."'";
// }
// $operator=$blang->gT("OR");
// if (isset($conditions)) $conditions = array_unique($conditions);
// break;
// }
// }
// if (isset($conditions) && count($conditions) > 1)
// {
// $conanswers = implode(" ".$operator." ", $conditions);
// $explanation .= " -" . str_replace("{ANSWER}", $conanswers, $blang->gT("to question {QUESTION}, answer {ANSWER}"));
// }
// else
// {
// if(empty($conditions[0])) $conditions[0] = "'".$blang->gT("No Answer")."'";
// $explanation .= " -" . str_replace("{ANSWER}", $conditions[0], $blang->gT("to question {QUESTION}, answer {ANSWER}"));
// }
// unset($conditions);
// $explanation = str_replace("{QUESTION}", "'{$distinctrow['title']}$answer_section'", $explanation);
// $x++;
// }
// $s++;
// }

$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
Expand Down

0 comments on commit 1cbf3a1

Please sign in to comment.