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 getEandH() { // Load up hypo and evidence arrays. And calculate some rating scores. global $active_user, $SQL_CACHING_ACTIVE, $all_cred; $this->hypotheses = array(); $this->evidence = array(); $this->hypotheses_rating_scores = array(); $this->hypotheses_rating_scores_personal = array(); $this->ratings = array(); $result = mysql_do("SELECT id FROM evidence WHERE project_id='{$this->id}' AND deleted!='y' ORDER BY name DESC"); while ($query_data = mysql_fetch_array($result)) { $this->evidence[] = $query_data['id']; } $result = mysql_do("SELECT id FROM hypotheses WHERE project_id='{$this->id}' AND deleted!='y' ORDER BY label DESC"); while ($query_data = mysql_fetch_array($result)) { $this->hypotheses[] = $query_data['id']; } // Shut off if too much memory is being used. /*if( count($this->evidence)*count($this->hypotheses) > 10000 ) { $SQL_CACHING_ACTIVE = FALSE; }*/ $all_cred = Credibility::getAllCred($this->evidence, $this->users); $this->all_ratings = $this->getAllRatings($this->hypotheses, $this->evidence, $this->users); for ($j = 0; $j < count($this->hypotheses); $j++) { $this->hypotheses_rating_scores[$this->hypotheses[$j]] = 0; $this->hypotheses_rating_scores_personal[$this->hypotheses[$j]] = 0; for ($i = 0; $i < count($this->evidence); $i++) { for ($k = 0; $k < count($this->users); $k++) { $this_cred = new Credibility(); $this_cred->getUserUserEvidence($this->users[$k], $this->evidence[$i]); if ($this_cred->weight == "") { $this_cred->weight = 1; } $rating = $this->getRating($this->evidence[$i], $this->hypotheses[$j], $this->users[$k]); $this->ratings[$this->evidence[$i]][$this->hypotheses[$j]][$this->users[$k]] = $rating; $this->hypotheses_rating_scores[$this->hypotheses[$j]] += getHypoRatingScore($rating) * $this_cred->weight; if ($this->users[$k] == $active_user->id) { $this->hypotheses_rating_scores_personal[$this->hypotheses[$j]] += getHypoRatingScore($rating) * $this_cred->weight; } $this->hypotheses_rating_scores_users[$this->users[$k]][$this->hypotheses[$j]] += getHypoRatingScore($rating) * $this_cred->weight; } } } }
<td class="dclDateOfSource" style="display: none;">Date of Source</td> <td class="dclType" style="display: none;">Type</td> <td class="dclCode" style="display: none;">Code</td> <td class="dclFlag" style="display: none;">Flag</td> <?php for ($j = 0; $j < count($active_project->hypotheses); $j++) { $this_hypothesis = new Hypothesis(); $this_hypothesis->populateFromId($active_project->hypotheses[$j]); echo '<th class="hypothesis" onmouseover="return overlib(\'' . cleanForDisplay($this_hypothesis->description) . '\', CAPTION, \'Hypothesis\');" onmouseout="return nd();"><a href="' . $base_URL . 'project/' . $active_project->id . '/hypothesis/' . $this_hypothesis->id . '">' . $this_hypothesis->label . '</a> '; $rating_score = 0; for ($i = 0; $i < count($active_project->evidence); $i++) { $rating = $compare_user_2->getRating($active_project->evidence[$i], $active_project->hypotheses[$j]); $rating_score += getHypoRatingScore($rating); $rating = $compare_user->getRating($active_project->evidence[$i], $active_project->hypotheses[$j]); $rating_score += getHypoRatingScore($rating); } echo '<br><i>' . $rating_score . '</i></th>'; } echo '</tr></thead><tbody>'; for ($i = 0; $i < count($active_project->evidence); $i++) { $this_evidence = new Evidence(); $this_evidence->populateFromId($active_project->evidence[$i]); echo '<tr><td class="evidence" onmouseover="return overlib(\'' . cleanForDisplay($this_evidence->details) . '\', CAPTION, \'Evidence\');" onmouseout="return nd();"><a href="' . $base_URL . 'project/' . $active_project->id . '/evidence/' . $this_evidence->id . '">' . $this_evidence->name . '</a></td>'; ?> <td class="dcDateAdded" style="display: none;"><?php echo $this_evidence->created; ?> </td> <td class="dcDateOfSource" style="display: none;"><?php