Permalink
Browse files

more analysis

  • Loading branch information...
1 parent 0cd10fd commit f3bf67f008a7f4651f2e8d16f7ee9066348d4456 @slifty committed May 13, 2012
Showing with 458 additions and 42 deletions.
  1. +346 −5 analysis.php
  2. +28 −20 analysis_json.php
  3. +7 −7 models/Claim.php
  4. +10 −10 models/Response.php
  5. +67 −0 styles/analysis.css
View
351 analysis.php
@@ -1,5 +1,346 @@
-<?PHP
-
-
-
-?>
+<html>
+ <head>
+ <title>Truth Goggles User Study Results Summary</title>
+ <link rel="stylesheet" href="styles/main.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <link rel="stylesheet" href="styles/analysis.css" type="text/css" media="screen" title="no title" charset="utf-8">
+ <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" charset="utf-8"></script>
+
+ <script type="text/javascript">
+ var treatments = {};
+ var ideology = {
+ unspecified: 0,
+ strong_conservative: 0,
+ moderate_conservative: 0,
+ independent: 0,
+ moderate_liberal: 0,
+ strong_liberal: 0,
+ unspecified_percent: function() { return this.unspecified?Math.round(this.unspecified / phase_breakdown.complete * 1000)/10:0; },
+ strong_conservative_percent: function() { return this.strong_conservative?Math.round(this.strong_conservative / phase_breakdown.complete * 1000)/10:0; },
+ moderate_conservative_percent: function() { return this.moderate_conservative?Math.round(this.moderate_conservative / phase_breakdown.complete * 1000)/10:0; },
+ independent_percent: function() { return this.independent?Math.round(this.independent / phase_breakdown.complete * 1000)/10:0; },
+ moderate_liberal_percent: function() { return this.moderate_liberal?Math.round(this.moderate_liberal / phase_breakdown.complete * 1000)/10:0; },
+ strong_liberal_percent: function() { return this.strong_liberal?Math.round(this.strong_liberal / phase_breakdown.complete * 1000)/10:0; }
+ };
+ var phase_breakdown = {
+ omit: 0,
+ pre: 0,
+ mid: 0,
+ post: 0,
+ complete: 0,
+ total: 0,
+ omit_percent: function() { return Math.round(this.omit / this.total * 1000)/10; },
+ pre_percent: function() { return Math.round(this.pre / this.total * 1000)/10; },
+ mid_percent: function() { return Math.round(this.mid / this.total * 1000)/10; },
+ post_percent: function() { return Math.round(this.post / this.total * 1000)/10; },
+ complete_percent: function() { return Math.round(this.complete / this.total * 1000)/10; }
+ };
+
+ $(function() {
+ $.ajax({
+ method: "GET",
+ url: "analysis_json.php",
+ dataType: "json",
+ success: function(data) {
+ phase_breakdown["total"] = parseInt(data.total);
+ phase_breakdown["omit"] = parseInt(data.omitted);
+ var participants = data.participants;
+ for(var x = 0; x < participants.length ; ++x) {
+ var participant = participants[x];
+ var stage = participant.stage
+ var stage_progress = participant.stage_progress;
+
+ if(stage < 8) {
+ if(stage < 4 || (stage == 4 && stage_progress <= 2))
+ phase_breakdown["pre"]++;
+ else if(stage == 4 && stage_progress > 2)
+ phase_breakdown["mid"]++;
+ else
+ phase_breakdown["post"]++;
+ continue;
+ }
+
+ switch(parseInt(participant.ideology)) {
+ case 0:
+ ideology["unspecified"]++;
+ break;
+ case 1:
+ ideology["strong_conservative"]++;
+ break;
+ case 2:
+ ideology["moderate_conservative"]++;
+ break;
+ case 3:
+ ideology["independent"]++;
+ break;
+ case 4:
+ ideology["moderate_liberal"]++;
+ break;
+ case 5:
+ ideology["strong_liberal"]++;
+ break;
+ }
+
+ phase_breakdown["complete"]++;
+
+ var claims = participant.claims;
+ for(var y = 0 ; y < claims.length ; ++y) {
+ if(isNaN(claims[y].response_1) || isNaN(claims[y].response_2))
+ continue;
+ var claim = claims[y].claim;
+ var pre = parseInt(claims[y].response_1);
+ var post = parseInt(claims[y].response_2);
+ var real = parseInt(claim.verdict);
+
+ var treatment = claims[y].treatment;
+ if(treatments[treatment] == undefined) {
+ treatments[treatment] = {
+ total: 0,
+ max_distance: 0,
+ pre_total_distance: 0, // the total number of units deviated
+ pre_over_count: 0,
+ pre_under_count: 0,
+ pre_exact_count: 0,
+ pre_over_percent: function(){return this.pre_over_count / this.total;},
+ pre_under_percent: function(){return this.pre_under_count / this.total;},
+ pre_exact_percent: function(){return this.pre_exact_count / this.total;},
+ pre_accuracy_ratio: function(){return this.pre_total_distance / this.max_distance;},
+ post_total_distance: 0,
+ post_over_count: 0,
+ post_under_count: 0,
+ post_exact_count: 0,
+ post_over_percent: function(){return this.post_over_count / this.total;},
+ post_under_percent: function(){return this.post_under_count / this.total;},
+ post_exact_percent: function(){return this.post_exact_count / this.total;},
+ post_accuracy_ratio: function(){return this.post_total_distance / this.max_distance;},
+ max_drift: 0, // the most a result could drift
+ total_drift: 0,
+ good_drift: 0,
+ bad_drift: 0,
+ neutral_drift: 0,
+ drift_ratio: function(){return this.total_drift / this.max_drift},
+ drift_accuracy_ratio: function(){return this.total_drift / this.max_distance},
+ good_drift_percent: function(){return this.good_drift / this.total;},
+ bad_drift_percent: function(){return this.bad_drift / this.total;},
+ neutral_drift_percent: function(){return this.neutral_drift / this.total;}
+ };
+ }
+
+ treatments[treatment].total += 1;
+ treatments[treatment].max_distance += Math.max(Math.abs(real - 5), Math.abs(real - 1));
+ treatments[treatment].pre_total_distance += Math.abs(pre - real);
+ treatments[treatment].pre_over_count += (pre > real)?1:0;
+ treatments[treatment].pre_under_count += (pre < real)?1:0;
+ treatments[treatment].pre_exact_count += (pre == real)?1:0;
+ treatments[treatment].post_total_distance += Math.abs(post - real);
+ treatments[treatment].post_over_count += (post > real)?1:0;
+ treatments[treatment].post_under_count += (post < real)?1:0;
+ treatments[treatment].post_exact_count += (post == real)?1:0;
+ treatments[treatment].max_drift += Math.max(Math.abs(pre - 5), Math.abs(pre - 1));
+ treatments[treatment].total_drift += Math.abs(pre - post);
+ treatments[treatment].good_drift += (Math.abs(pre - real) > Math.abs(post - real))?1:0;
+ treatments[treatment].bad_drift += (Math.abs(pre - real) < Math.abs(post - real))?1:0;
+ treatments[treatment].neutral_drift += (Math.abs(pre - real) == Math.abs(post - real))?1:0;
+ treatments[treatment].max_drift += Math.max(Math.abs(pre - 5), Math.abs(pre - 1));
+ }
+ }
+ render();
+ }
+ });
+ });
+
+ function render() {
+ $(".total_participants").text(phase_breakdown["total"]);
+ $(".omitted_participants").text(phase_breakdown["omit"]);
+ $(".pre_bail").text(phase_breakdown["pre"]);
+ $(".mid_bail").text(phase_breakdown["mid"]);
+ $(".post_bail").text(phase_breakdown["post"]);
+ $(".complete").text(phase_breakdown["complete"]);
+ $(".omit_percent").text(phase_breakdown.omit_percent());
+ $(".pre_percent").text(phase_breakdown.pre_percent());
+ $(".mid_percent").text(phase_breakdown.mid_percent());
+ $(".post_percent").text(phase_breakdown.post_percent());
+ $(".complete_percent").text(phase_breakdown.complete_percent());
+
+ $(".strong_conservative").text(ideology["strong_conservative"]);
+ $(".moderate_conservative").text(ideology["moderate_conservative"]);
+ $(".independent").text(ideology["independent"]);
+ $(".moderate_liberal").text(ideology["moderate_liberal"]);
+ $(".strong_liberal").text(ideology["strong_liberal"]);
+ $(".unspecified").text(ideology["unspecified"]);
+ $(".strong_conservative_percent").text(ideology.strong_conservative_percent());
+ $(".moderate_conservative_percent").text(ideology.moderate_conservative_percent());
+ $(".independent_percent").text(ideology.independent_percent());
+ $(".moderate_liberal_percent").text(ideology.moderate_liberal_percent());
+ $(".strong_liberal_percent").text(ideology.strong_liberal_percent());
+ $(".unspecified_percent").text(ideology.unspecified_percent());
+
+ <?PHP
+ $prefix_list = array("control","none","safe","goggles","highlight");
+ foreach($prefix_list as $prefix) {
+ ?>
+ $(".<?PHP echo($prefix); ?>_pre_distance").text(treatments["<?PHP echo($prefix); ?>"].pre_total_distance);
+ $(".<?PHP echo($prefix); ?>_max_distance").text(treatments["<?PHP echo($prefix); ?>"].max_distance);
+ $(".<?PHP echo($prefix); ?>_pre_accuracy_ratio").text(Math.round(treatments["<?PHP echo($prefix); ?>"].pre_accuracy_ratio() * 100,2) / 100);
+ $(".<?PHP echo($prefix); ?>_pre_over").text(treatments["<?PHP echo($prefix); ?>"].pre_over_count);
+ $(".<?PHP echo($prefix); ?>_pre_under").text(treatments["<?PHP echo($prefix); ?>"].pre_under_count);
+ $(".<?PHP echo($prefix); ?>_pre_exact").text(treatments["<?PHP echo($prefix); ?>"].pre_exact_count);
+ $(".<?PHP echo($prefix); ?>_post_distance").text(treatments["<?PHP echo($prefix); ?>"].post_total_distance);
+ $(".<?PHP echo($prefix); ?>_post_accuracy_ratio").text(Math.round(treatments["<?PHP echo($prefix); ?>"].post_accuracy_ratio() * 100,2) / 100);
+ $(".<?PHP echo($prefix); ?>_post_over").text(treatments["<?PHP echo($prefix); ?>"].post_over_count);
+ $(".<?PHP echo($prefix); ?>_post_under").text(treatments["<?PHP echo($prefix); ?>"].post_under_count);
+ $(".<?PHP echo($prefix); ?>_post_exact").text(treatments["<?PHP echo($prefix); ?>"].post_exact_count);
+ $(".<?PHP echo($prefix); ?>_pre_over_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].pre_over_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_pre_under_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].pre_under_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_pre_exact_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].pre_exact_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_post_over_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].post_over_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_post_under_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].post_under_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_post_exact_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].post_exact_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_total").text(treatments["<?PHP echo($prefix); ?>"].total);
+ $(".<?PHP echo($prefix); ?>_total_drift").text(treatments["<?PHP echo($prefix); ?>"].total_drift);
+ $(".<?PHP echo($prefix); ?>_drift_accuracy_ratio").text(Math.round(treatments["<?PHP echo($prefix); ?>"].drift_accuracy_ratio() * 100,2) / 100);
+ $(".<?PHP echo($prefix); ?>_max_drift").text(treatments["<?PHP echo($prefix); ?>"].max_drift);
+ $(".<?PHP echo($prefix); ?>_drift_ratio").text(Math.round(treatments["<?PHP echo($prefix); ?>"].drift_ratio() * 100,2) / 100);
+ $(".<?PHP echo($prefix); ?>_good_drift").text(treatments["<?PHP echo($prefix); ?>"].good_drift);
+ $(".<?PHP echo($prefix); ?>_bad_drift").text(treatments["<?PHP echo($prefix); ?>"].bad_drift);
+ $(".<?PHP echo($prefix); ?>_neutral_drift").text(treatments["<?PHP echo($prefix); ?>"].neutral_drift);
+ $(".<?PHP echo($prefix); ?>_good_drift_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].good_drift_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_bad_drift_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].bad_drift_percent() * 100,2));
+ $(".<?PHP echo($prefix); ?>_neutral_drift_percent").text(Math.round(treatments["<?PHP echo($prefix); ?>"].neutral_drift_percent() * 100,2));
+ <?PHP
+ }
+ ?>
+
+ }
+
+ </script>
+ </head>
+ <body>
+ <?PHP echo("<?PHP TESTING ?>");?>
+ <div id="content">
+ <h1>Results Summary</h1>
+ <h2>Participation</h2>
+ <h3>Completion</h3>
+ <div class="results">
+ <ul class="wide">
+ <li><label>Total:</label><span class="total_participants"></span></li>
+ <li><label>Omitted:</label><span class="omitted_participants"></span> (<span class="omit_percent"></span>%)</li>
+ <li><label>Pre-Goggles Bail:</label><span class="pre_bail"></span> (<span class="pre_percent"></span>%)</li>
+ <li><label>Mid-Goggles Bail:</label><span class="mid_bail"></span> (<span class="mid_percent"></span>%)</li>
+ <li><label>Post-Goggles Bail:</label><span class="post_bail"></span> (<span class="post_percent"></span>%)</li>
+ <li><label>Complete:</label><span class="complete"></span> (<span class="complete_percent"></span>%)</li>
+ </ul>
+ </div>
+ <h3>Demographics</h3>
+ <h4>Political Leanings</h4>
+ <div class="results">
+ <ul class="wide">
+ <li><label>Unspecified:</label><span class="unspecified"></span> (<span class="unspecified_percent"></span>%)</li>
+ <li><label>Strong conservative:</label><span class="strong_conservative"></span> (<span class="strong_conservative_percent"></span>%)</li>
+ <li><label>Moderate conservative:</label><span class="moderate_conservative"></span> (<span class="moderate_conservative_percent"></span>%)</li>
+ <li><label>Independent:</label><span class="independent"></span> (<span class="independent_percent"></span>%)</li>
+ <li><label>Moderate liberal:</label><span class="moderate_liberal"></span> (<span class="moderate_liberal_percent"></span>%)</li>
+ <li><label>Strong liberal:</label><span class="strong_liberal"></span> (<span class="strong_liberal_percent"></span>%)</li>
+ </ul>
+ </div>
+ <h2>Results</h2>
+ <?PHP
+
+ function results($prefix) {
+ ?>
+ <div class="results">
+ <h5>Pre-treatment</h5>
+ <ul>
+ <li>
+ <label>Accuracy:</label>
+ <span class="<?PHP echo($prefix); ?>_pre_distance" class="result"></span> / <span class="<?PHP echo($prefix); ?>_max_distance" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_pre_accuracy_ratio" class="result"></span>)
+ </li>
+ <li>
+ <label>Over:</label>
+ <span class="<?PHP echo($prefix); ?>_pre_over" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_pre_over_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Under:</label>
+ <span class="<?PHP echo($prefix); ?>_pre_under" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_pre_under_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Exact:</label>
+ <span class="<?PHP echo($prefix); ?>_pre_exact" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_pre_exact_percent" class="result"></span>%)
+ </li>
+ </ul>
+ <h5>Post-treatment</h5>
+ <ul>
+ <li>
+ <label>Accuracy:</label>
+ <span class="<?PHP echo($prefix); ?>_post_distance" class="result"></span> / <span class="<?PHP echo($prefix); ?>_max_distance" class="result"></span> (<span class="<?PHP echo($prefix); ?>_post_accuracy_ratio" class="result"></span>)
+ </li>
+ <li>
+ <label>Over:</label>
+ <span class="<?PHP echo($prefix); ?>_post_over" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_post_over_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Under:</label>
+ <span class="<?PHP echo($prefix); ?>_post_under" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_post_under_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Exact:</label>
+ <span class="<?PHP echo($prefix); ?>_post_exact" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_post_exact_percent" class="result"></span>%)
+ </li>
+ </ul>
+ <h5>Drift</h5>
+ <ul>
+ <li>
+ <label>Accuracy:</label>
+ <span class="<?PHP echo($prefix); ?>_total_drift" class="result"></span> / <span class="<?PHP echo($prefix); ?>_max_distance" class="result"></span> (<span class="<?PHP echo($prefix); ?>_drift_accuracy_ratio" class="result"></span>)
+ </li>
+ <li>
+ <label>Absolute:</label>
+ <span class="<?PHP echo($prefix); ?>_total_drift" class="result"></span> / <span class="<?PHP echo($prefix); ?>_max_drift" class="result"></span> (<span class="<?PHP echo($prefix); ?>_drift_ratio" class="result"></span>)
+ </li>
+ <li>
+ <label>Good:</label>
+ <span class="<?PHP echo($prefix); ?>_good_drift" class="result"></span> / <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_good_drift_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Bad:</label>
+ <span class="<?PHP echo($prefix); ?>_bad_drift" class="result"></span>/ <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_bad_drift_percent" class="result"></span>%)
+ </li>
+ <li>
+ <label>Neutral:</label>
+ <span class="<?PHP echo($prefix); ?>_neutral_drift" class="result"></span>/ <span class="<?PHP echo($prefix); ?>_total" class="result"></span>
+ (<span class="<?PHP echo($prefix); ?>_neutral_drift_percent" class="result"></span>%)
+ </li>
+ </ul>
+ </div>
+ <?PHP
+ }
+
+ ?>
+ <h3>Controls</h3>
+ <h4>No Evidence</h4>
+ <?PHP results("control"); ?>
+
+ <h4>No Layer</h4>
+ <?PHP results("none"); ?>
+
+ <h3>Treatments</h3>
+ <h4>Highlight Mode</h4>
+ <?PHP results("highlight"); ?>
+
+ <h4>Goggles Mode</h4>
+ <?PHP results("goggles"); ?>
+
+ <h4>Safe Mode</h4>
+ <?PHP results("safe"); ?>
+
+ </div>
+ </body>
+</html>
View
48 analysis_json.php
@@ -17,13 +17,17 @@
?>
{
+ "total": <?PHP echo(sizeof($participants)); ?>,
+ "omitted": <?PHP echo(sizeof($participant_blacklist)); ?>,
"participants": [
<?PHP
+ $participant_responses = array();
$participant_counter = 0;
foreach($participants as $participant) {
- echo((++$participant_counter>1)?",":"");
if(in_array($participant->getItemID(), $participant_blacklist))
continue;
+
+ echo((++$participant_counter>1)?",":"");
$events = Event::getObjectsByParticipantID($participant->getItemID());
$treatment_order = explode(',', $participant->getTreatmentOrder());
@@ -37,6 +41,8 @@
foreach(Response::getObjectsByParticipantID($participant->getItemID()) as $response)
$responses[$response->getQuestionID()] = $response;
+ $participant_responses[$participant->getItemID()] = $responses;
+
foreach($claim_objects as $claim) {
$claims[$claim->getItemID()] = array(
"claim" => $claim,
@@ -47,12 +53,12 @@
}
foreach($claim_order_1 as $x => $claim_id)
- $claims[$claim_id]['response_1'] = isset($responses['2_'.($x + 1)])?$responses['2_'.($x + 1)]:"";
+ $claims[$claim_id]['response_1'] = isset($responses['2_'.($x + 1)])?$responses['2_'.($x + 1)]->getContent():"";
- foreach($claim_order_1 as $x => $claim_id)
- $claims[$claim_id]['response_2'] = isset($responses['6_'.($x + 1)])?$responses['6_'.($x + 1)]:"";
+ foreach($claim_order_2 as $x => $claim_id)
+ $claims[$claim_id]['response_2'] = isset($responses['6_'.($x + 1)])?$responses['6_'.($x + 1)]->getContent():"";
- foreach($claims as $x => $claim) {
+ foreach($claims as $claim_id => $claim) {
if($claim["claim"]->getArticleID() != 0) {
$article = $articles[$claim["claim"]->getArticleID()];
$claims[$claim_id]['treatment'] = $treatment_order[array_search($article->getItemID(),$article_order)];
@@ -65,29 +71,31 @@
if($event->getType() == "more")
$more_count++;
?>
-{
- "participant_id": <?PHP echo(DBConn::clean($participant->getItemID())); ?>,
- "stage": <?PHP echo(DBConn::clean($participant->getStage())); ?>,
- "stage_progress": <?PHP echo(DBConn::clean($participant->getStageProgress())); ?>,
- "claims": [
+ {
+ "participant_id": <?PHP echo(DBConn::clean($participant->getItemID())); ?>,
+ "ideology": <?PHP echo(DBConn::clean(isset($participant_responses[$participant->getItemID()]["q_politics"])?$participant_responses[$participant->getItemID()]["q_politics"]->getContent():0));?>,
+ "stage": <?PHP echo(DBConn::clean($participant->getStage())); ?>,
+ "stage_progress": <?PHP echo(DBConn::clean($participant->getStageProgress())); ?>,
+ "claims": [
<?PHP
$claim_counter = 0;
foreach($claims as $claim) {
echo((++$claim_counter>1)?",":"");
?>
-{
- "claim":<?PHP echo($claim["claim"]->toJSON()); ?>,
- "response_1":<?PHP echo(DBConn::clean($claim["response_1"])); ?>,
- "response_2":<?PHP echo(DBConn::clean($claim["response_2"])); ?>,
- "treatment":<?PHP echo(DBConn::clean($claim["treatment"])); ?>
-}
+ {
+ "claim":<?PHP echo($claim["claim"]->toJSON()); ?>,
+ "response_1":<?PHP echo(DBConn::clean($claim["response_1"])); ?>,
+ "response_2":<?PHP echo(DBConn::clean($claim["response_2"])); ?>,
+ "treatment":<?PHP echo(DBConn::clean($claim["treatment"])); ?>
+ }
<?PHP
}
?>
- ],
- "more_count":<?PHP echo($more_count);?>
-}
+ ],
+ "more_count":<?PHP echo(DBConn::clean($more_count));?>
+ }
<?PHP
}
?>
-]}
+ ]
+}
View
14 models/Claim.php
@@ -101,13 +101,13 @@ public function load($data_array) {
# JSONObject Methods
public function toJSON() {
- $json = '{';
- $json .= ' "id": '.DBConn::clean($this->getItemID()).',';
- $json .= ' "article_id": '.DBConn::clean($this->getArticleID()).',';
- $json .= ' "content": '.DBConn::clean($this->getContent()).',';
- $json .= ' "verdict": '.DBConn::clean($this->getVerdict()).',';
- $json .= ' "date_created": '.DBConn::clean($this->getDateCreated()).'';
- $json .= '}';
+ $json = '{
+ "id": '.DBConn::clean($this->getItemID()).',
+ "article_id": '.DBConn::clean($this->getArticleID()).',
+ "content": '.DBConn::clean($this->getContent()).',
+ "verdict": '.DBConn::clean($this->getVerdict()).',
+ "date_created": '.DBConn::clean($this->getDateCreated()).'
+ }';
return $json;
}
View
20 models/Response.php
@@ -94,22 +94,22 @@ protected static function gatherData($objectString, $start=FactoryObject::LIMIT_
public function load($data_array) {
parent::load($data_array);
- $this->type = isset($data_array["participantID"])?$data_array["participantID"]:0;
- $this->type = isset($data_array["questionID"])?$data_array["questionID"]:"";
- $this->type = isset($data_array["content"])?$data_array["content"]:"";
+ $this->participantID = isset($data_array["participantID"])?$data_array["participantID"]:0;
+ $this->questionID = isset($data_array["questionID"])?$data_array["questionID"]:"";
+ $this->content = isset($data_array["content"])?$data_array["content"]:"";
$this->dateCreated = isset($data_array["dateCreated"])?$data_array["dateCreated"]:0;
}
# JSONObject Methods
public function toJSON() {
- $json = '{';
- $json .= ' "id": '.DBConn::clean($this->getItemID()).',';
- $json .= ' "participant": '.$this->getParticipant()->toJSON().',';
- $json .= ' "questionID": '.DBConn::clean($this->getQuestionID()).',';
- $json .= ' "content": '.DBConn::clean($this->getContent()).',';
- $json .= ' "date_created": '.DBConn::clean($this->getDateCreated()).'';
- $json .= '}';
+ $json = '{
+ "id": '.DBConn::clean($this->getItemID()).',
+ "participant": '.$this->getParticipant()->toJSON().',
+ "question_id": '.DBConn::clean($this->getQuestionID()).',
+ "content": '.DBConn::clean($this->getContent()).',
+ "date_created": '.DBConn::clean($this->getDateCreated()).'
+ }';
return $json;
}
View
67 styles/analysis.css
@@ -0,0 +1,67 @@
+
+#content {
+ width: 700px;
+ margin-right:250px;
+}
+
+h1 {
+ margin-bottom: 0px;
+}
+h2 {
+ color: 770000;
+ font-size: 18px;
+ margin-bottom: 5px;
+}
+h3 {
+ margin-top: 20px;
+}
+h4 {
+ margin-left: 20px;
+}
+h5 {
+}
+
+div.results {
+ border: 1px solid black;
+ padding: 10px;
+ margin: 10px 40px;
+}
+
+ul {
+ list-style: none;
+ min-height: 100px;
+}
+ul li {
+ margin: 5px;
+ width: 320px;
+}
+ul li a {
+ display: block;
+ border: 1px solid black;
+ padding: 5px 10px;
+ width: 300px;
+ text-align: center;
+ margin: 5px;
+ text-decoration: none;
+ color: #333333;
+}
+
+ul li label {
+ font-weight: bold;
+ color: #444444;
+ float: left;
+ display: block;
+ width: 100px;
+ clear: left;
+}
+
+
+ul.wide li label {
+ font-weight: bold;
+ color: #444444;
+ width: 200px;
+}
+
+span.result {
+ color: #600;
+}

0 comments on commit f3bf67f

Please sign in to comment.