public function getDiagUser($this_evidence, $active_project, $this_user) { // Get the diagnosticity. Both variables are objects. $total_diag = 0; for ($j = 0; $j < count($active_project->hypotheses); $j++) { $this_hypothesis = new Hypothesis(); $this_hypothesis->populateFromId($active_project->hypotheses[$j]); $results = mysql_fast("SELECT * FROM ratings WHERE evidence_id='{$this_evidence->id}' AND hypothesis_id='{$this_hypothesis->id}' AND user_id='{$this_user->id}'"); for ($i = 0; $i < count($results); $i++) { $total_diag += getHypoRatingScore($results[$i]['rating']); } } return $total_diag * -1; //multiple by -1 so that most diagnostic evidence appears at top upon sort }
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>"; } }
$this_evidence = new Evidence(); $this_evidence->populateFromId($query_data['id']); $this_evidence->project_id = $active_project->id; $this_evidence->user_id = $active_user->id; //this makes the duplicating user the creator of the new evidence, regardless of who originally created it $this_evidence->insertNew(); $new_evidence[] = $this_evidence->id; $old_evidence[] = $query_data['id']; } } //GET ALL OF THE HYPOTHESES FROM THIS MATRIX AND DUPLICATE THEM $result = mysql_do("SELECT id, deleted FROM hypotheses WHERE project_id='{$project_id}'"); while ($query_data = mysql_fetch_array($result)) { if ($query_data['deleted'] != "y") { $this_hypothesis = new Hypothesis(); $this_hypothesis->populateFromId($query_data['id']); $this_hypothesis->project_id = $active_project->id; $this_hypothesis->user_id = $active_user->id; //this makes the duplicating user the creator of the new hypothesis, regardless of who originally created it $this_hypothesis->insertNew(); $new_hypotheses[] = $this_hypothesis->id; $old_hypotheses[] = $query_data['id']; } } $active_user_id = $active_user->id; //GET ALL OF THE DUPLICATING USER'S CONSISTENCY RATINGS FOR THIS MATRIX $result = mysql_do("SELECT * FROM ratings WHERE user_id='{$active_user_id}'"); while ($query_data = mysql_fetch_array($result)) { if (in_array($query_data['evidence_id'], $old_evidence) && in_array($query_data['hypothesis_id'], $old_hypotheses)) { for ($i = 0; $i < count($old_evidence); $i++) { if ($old_evidence[$i] == $query_data['evidence_id']) {
** ACH is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** ACH is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Open Source ACH. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// */ include "code/includes.php"; $active_hypothesis = new Hypothesis(); $active_hypothesis->populateFromId($_REQUEST['hypothesis_id']); $active_project = new Project(); $active_project->populateFromId($_REQUEST['project_id']); foreach ($_REQUEST as $field => $value) { $active_hypothesis->{$field} = addslashes($value); } $active_hypothesis->id = $_REQUEST['hypothesis_id']; $active_hypothesis->update(); setStatusMessage("Updated!"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php echo $_REQUEST['project_id'];
<table cellspacing="0" cellpadding="0" border="0" class="sort-table" id="compareMatrix"><thead><tr><th class="hypothesis"></th> <?php $active_project->getEandH(); ?> <td class="dclDateAdded" style="display: none;">Date Added</td> <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>';