*
*
* 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 .
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; } } } }
public function getCredWeight() { $this_credibility = new Credibility(); $this_credibility->getUserEvidence($this->id); $this->cred_weight = $this_credibility->weight; if ($this->cred_weight == "") { $this->cred_weight = 0; } }
//////////////////////////////////////////////////////////////////////////////// */ include "../code/includes.php"; $this_rating = $_REQUEST['new_value']; $evidence_id = $_REQUEST['evidence_id']; $this_evidence_id = substr($evidence_id, 10); $exists = FALSE; $result = mysql_do("SELECT id FROM credibility WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence_id}' LIMIT 1"); while ($query_data = mysql_fetch_array($result)) { $exists = TRUE; } if (!$exists) { mysql_do("INSERT INTO credibility (value, evidence_id, user_id, weight) VALUES ('{$this_rating}', '{$this_evidence_id}', '{$active_user->id}', '1')"); } $result = mysql_do("SELECT id FROM credibility WHERE user_id='{$active_user->id}' AND evidence_id='{$this_evidence_id}' LIMIT 1"); while ($query_data = mysql_fetch_array($result)) { $active_credibility = new Credibility(); $active_credibility->populateFromId($query_data['id']); $active_credibility->switchCred($this_rating); } ?> <select onChange="saveCredRating('<?php echo $evidence_id; ?> ');" name="<?php echo $evidence_id; ?> " id="<?php echo $evidence_id; ?> "> <option value="y" <?php
} ?> >MASINT</option> </select></p> <h4>Serial Number</h4> <p><input type="text" name="serial_number" value="<?php echo $active_evidence->serial_number; ?> " size="20" /></p> <h4>Credibility</h4> <?php $this_credibility = new Credibility(); $this_credibility->getUserEvidence($active_evidence->id); ?> <p>Remember, changing this will change the credibility of all of your pieces of evidence with the same serial number.</p> <p><select name="credibility"> <option value="none">---</option> <option <?php if ($this_credibility->value == "y") { echo "selected"; } ?> value="credible">Credible</option> <option <?php if ($this_credibility->value == "n") {
} else { if ($this_credibility->weight == "0.5") { echo "Low"; } } } ?> </td> <?php } ?> <?php if ($kind == "edit") { $this_credibility = new Credibility(); if ($kind == "user") { $this_credibility->getUserEvidenceUser($evidence[$i]->id, $ratings_user); } else { $this_credibility->getUserEvidence($evidence[$i]->id); } ?> <td class="dcCred" id="td_cred_edit_<?php echo $evidence[$i]->id; ?> "><select onChange="saveCredRating('cred_edit_<?php echo $evidence[$i]->id; ?> ');" name="cred_edit_<?php echo $evidence[$i]->id;
if ($values[$j] == "NA") { $this_rating = "N/A"; } if ($values[$j] == "N") { $this_rating = "Neutral"; } if ($values[$j] == "C") { $this_rating = "Consistent"; } if ($values[$j] == "C C") { $this_rating = "Very Consistent"; } $this_hypothesis_id = $this_hypothesis[$j]->id; mysql_do("INSERT INTO `ratings` (`hypothesis_id`,`evidence_id`,`user_id`,`rating`) VALUES ('{$this_hypothesis_id}', '{$this_evidence->id}', '{$active_user->id}', '{$this_rating}');"); } $this_credibility = new Credibility(); $this_credibility->evidence_id = $this_evidence->id; $this_credibility->user_id = $active_user->id; if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "HIGH") { $this_credibility->value = "y"; } if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "MEDIUM") { $this_credibility->value = "y"; } if ($achz->MATRIX->EVIDENCE[$i]->CREDIBILITY == "LOW") { $this_credibility->value = "n"; } $this_credibility->weight = 1; $this_credibility->insertNew(); } }
<?php /* //////////////////////////////////////////////////////////////////////////////// ** Copyright 2010 Matthew Burton, http://matthewburton.org ** Code by Burton and Joshua Knowles, http://auscillate.com ** ** This software is part of the Open Source ACH Project (ACH). You'll find ** all current information about project contributors, installation, updates, ** bugs and more at http://competinghypotheses.org. ** ** ** 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_credibility = new Credibility(); $active_credibility->populateFromId($_REQUEST['credibility_id']); echo $active_credibility->switchCred();
?> display: none;<?php } ?> "><?php if ($evidence[$i]->flag == "y") { echo "<img src='{$base_URL}/images/icons/flag_red.png' />"; } else { echo "<img src='{$base_URL}/images/icons/bullet_add.png' />"; } ?> </td> <?php if ($kind == "personal") { $this_credibility = new Credibility(); $this_credibility->getUserEvidence($evidence[$i]->id); ?> <td class="dcCred"><?php if ($this_credibility->value == "n") { echo "Suspect"; } else { echo "Credible"; } ?> </td> <td class="dcCredWeight" style="<?php if ($dccCredWeight == 0) { ?> display: none;<?php
** 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_evidence = new Evidence(); $active_evidence->populateFromId($_REQUEST['evidence_id']); foreach ($_REQUEST as $field => $value) { $active_evidence->{$field} = addslashes($value); } $active_evidence->id = $_REQUEST['evidence_id']; $active_evidence->update(); $cred = $_REQUEST['credibility']; $this_credibility = new Credibility(); $this_credibility->getUserEvidence($_REQUEST['evidence_id']); if ($cred == "credible") { $this_credibility->switchCred("y"); } else { if ($cred == "suspect") { $this_credibility->switchCred("n"); } } setStatusMessage("Updated!"); ?> <html> <head> <title>Updating...</title> <meta http-equiv=Refresh content="0; url=project/<?php