public function getDiagCompare($this_evidence_id, $active_project, $user_1, $user_2) { // Get the diagnosticity. Both variables are objects. $total_diag = 0; $all_hypotheses = implode(",", $active_project->hypotheses); $results = mysql_fast("SELECT * FROM ratings WHERE evidence_id='{$this_evidence_id}' AND hypothesis_id IN ( {$all_hypotheses} ) AND user_id IN (" . $user_1->id . ", " . $user_2->id . ")"); for ($k = 0; $k < count($results); $k++) { $total_diag += getHypoRatingScore($results[$k]['rating']); } return $total_diag * -1; //multiple by -1 so that most diagnostic evidence appears at top upon sort }
public function populateFromAttribute($value, $kind) { // Populates all of the varibles in this object from the DB. $return_value = FALSE; $results = mysql_fast("SELECT * FROM {$this->database_table_name} WHERE {$kind}='{$value}' LIMIT 1"); $this_result = $results[0]; // Since only one results comes back. $badchars = array("\"", "\\"); $goodchars = array("''", ""); foreach ($this_result as $field => $value) { $this->{$field} = str_replace($badchars, $goodchars, $value); //stripslashes($value); $return_value = TRUE; } $this->found = $return_value; return $return_value; }
public function getUserEvidenceUser($evidence_id, $this_user) { // Populates for a user/evidence ID pair. $return_value = FALSE; $results = mysql_fast("SELECT * FROM credibility WHERE user_id='{$this_user->id}' AND evidence_id='{$evidence_id}' LIMIT 1"); if (count($results) > 0) { $this_result = $results[0]; // Since only one results comes back. foreach ($this_result as $field => $value) { $this->{$field} = $value; } $return_value = TRUE; } if ($return_value == FALSE) { $this->user_id = $this_user->id; $this->evidence_id = $evidence_id; $this->weight = "1"; //$this->insertNew(); } return $return_value; }
public function showCellEdit($evidence, $sort, $display) { // $sort can be "least_likely", "most_likely", "alpha", and "added". global $active_user; $this->sortH($sort); for ($j = 0; $j < count($this->hypotheses); $j++) { $this_hypothesis = new Hypothesis(); $this_hypothesis->populateFromId($this->hypotheses[$j]); $this_rating = ""; $results = mysql_fast("SELECT * FROM ratings WHERE evidence_id='{$evidence->id}' AND hypothesis_id='{$this_hypothesis->id}' AND user_id='{$active_user->id}'"); for ($i = 0; $i < count($results); $i++) { $this_rating = $results[$i]['rating']; } $this_rating_style = strtolower(str_replace(" ", "_", str_replace("/", "", $this_rating))); echo "<td class='colgroup_" . $sort . "' id='"; ?> td_rating_<?php echo $evidence->id; ?> -<?php echo $this_hypothesis->id; ?> _<?php echo $sort; echo "' "; if (!$display) { echo 'style="display: none;" '; } echo " >"; echo "<div class='blank " . $this_rating_style . "'>"; ?> <select onChange="saveCellRating('rating_<?php echo $evidence->id; ?> -<?php echo $this_hypothesis->id; ?> _<?php echo $sort; ?> ');" class="table" id="rating_<?php echo $evidence->id; ?> -<?php echo $this_hypothesis->id; ?> _<?php echo $sort; ?> " name="rating_<?php echo $evidence->id; ?> -<?php echo $this_hypothesis->id; ?> _<?php echo $sort; ?> "> <option value="">Select:</option> <option <?php if ($this_rating == "Very Inconsistent") { echo "selected"; } ?> value="Very Inconsistent">Very Incons't</option> <option <?php if ($this_rating == "Inconsistent") { echo "selected"; } ?> value="Inconsistent">Inconsistent</option> <option <?php if ($this_rating == "N/A") { echo "selected"; } ?> value="N/A">N/A</option> <option <?php if ($this_rating == "Neutral") { echo "selected"; } ?> value="Neutral">Neutral</option> <option <?php if ($this_rating == "Consistent") { echo "selected"; } ?> value="Consistent">Consistent</option> <option <?php if ($this_rating == "Very Consistent") { echo "selected"; } ?> value="Very Consistent">Very Cons't</option> </select> <?php echo "</span>"; echo "</td>"; } }
public function populateFromAttribute($value, $kind) { // Populates all of the varibles in this object from the DB. $return_value = parent::populateFromAttribute($value, $kind); $results = mysql_fast("SELECT last_visited, last_page, color FROM users_active WHERE user_id='{$id}'"); for ($i = 0; $i < count($results); $i++) { foreach ($results[$i] as $field => $value) { $this->{$field} = $value; } } $this->logged_in = $this->checkLoggedIn(); $this->found = $return_value; if ($this->password != "") { $this->logged_in_full_account = TRUE; } else { $this->logged_in_full_account = FALSE; } return $return_value; }