[insert_php]
/*************************************************************
Calculate scores and sort them descending
**************************************************************/
$graph[“Driver”] = $_GET[“q2”] + $_GET[“q4”] + $_GET[“q8”] + $_GET[“q13”] + $_GET[“q18”] + $_GET[“q24”];
$graph[“Organizer”] = $_GET[“q1”] + $_GET[“q5”] + $_GET[“q12”] + $_GET[“q16”] + $_GET[“q20”] + $_GET[“q23”];
$graph[“Collaborator”] = $_GET[“q3”] + $_GET[“q10”] + $_GET[“q2”] + $_GET[“q11”] + $_GET[“q19”] + $_GET[“q21”];
$graph[“Visionary”] = $_GET[“q7”] + $_GET[“q9”] + $_GET[“q14”] + $_GET[“q15”] + $_GET[“q22”] + $_GET[“q17”];
asort($graph);
$graph = array_reverse($graph, true);
/*************************************************************
Create bars for graph
**************************************************************/
$counter = 1;
foreach ($graph as $k=>$v) {
//$bars .= “
“;
$scores[$counter][“name”] = $k;
$scores[$counter][“value”] = $v;
$counter++;
}
$bars .= “
“;
/*************************************************************
Define top/bottom scores
**************************************************************/
if (($scores[1][“value”]-$scores[2][“value”])<3) { $topscore = $scores[1]["name"] . " and " . $scores[2]["name"]; $patternstop = "patterns"; } else { $topscore = $scores[1]["name"]; $patternstop = "pattern"; } if (($scores[3]["value"]-$scores[4]["value"])<3) { $botscore = $scores[3]["name"] . " and " . $scores[4]["name"]; $patternsbot = "patterns"; } else { $botscore = $scores[4]["name"]; $patternsbot = "pattern"; } /************************************************************* If all scores are within 4 points of each other, suggest user takes full test, otherwise describ results **************************************************************/ if (($scores[1]["value"]-$scores[4]["value"])<4) { $description .= "
Your Mini-FEBI results suggest you’re fairly Balanced in your use of all 4 patterns. The full FEBI may help you discover your home pattern and what you’re best at.
“;
} else {
$description .= “
Your results of the Mini-FEBI suggest that you most easily access the “.$patternstop.” of the “.$topscore.”, and you have the most difficulty accessing the “.$patternsbot.” of the “.$botscore.”
“;
}
/*************************************************************
Error if no data present, or not all boxes were completed
**************************************************************/
/*************************************************************
Print results
**************************************************************/
$returnme .= “
Results
“.$description.”
“;
print($returnme);
[/insert_php]