test asort
This commit is contained in:
parent
d8b19465e4
commit
f5c2f4309f
67
methods/schulzeResults.php
Normal file
67
methods/schulzeResults.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
class schulze
|
||||
{
|
||||
public int $nvotant;
|
||||
public int $ncandidats;
|
||||
public array $nvotes;
|
||||
|
||||
$v = array(
|
||||
array(5, 1, 3, 2, 4),
|
||||
array(1, 5, 2, 4, 3),
|
||||
array(5, 3, 2, 4, 1),
|
||||
array(5, 1, 3, 2, 4)
|
||||
);
|
||||
|
||||
function matrix()
|
||||
{
|
||||
foreach($nvotes as $votes)
|
||||
{
|
||||
for ($i=1;$i<=$votes;$i++)
|
||||
{
|
||||
for ($j=1;$j<=$ncandidats;$j++)
|
||||
{
|
||||
void
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function test($v)
|
||||
{
|
||||
asort($v);
|
||||
var_dump($v);
|
||||
}
|
||||
|
||||
function result()
|
||||
{
|
||||
for ($i=1;$i<=$ncandidats;$i++)
|
||||
{
|
||||
for ($j=1;$j<=$ncandidats;$j++)
|
||||
{
|
||||
if ($d[$i][$j] > $d[$j][$i])
|
||||
{
|
||||
$p[$i][$j] = $d[$i][$j];
|
||||
}else
|
||||
{
|
||||
$p[$i][$j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i=1;$i<=$ncandidats;$i++)
|
||||
{
|
||||
for ($j=1;$j<=$ncandidats;$j++)
|
||||
{
|
||||
for ($k=1;$k<=$ncandidats;$k++)
|
||||
{
|
||||
if ($j != $k)
|
||||
{
|
||||
$p[$j][$k] = max($p[$j][$k], min($p[$j][$i],$p[$i][$k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -12,9 +12,9 @@ $idVotation = $_GET["v"];
|
||||
$dolibarr = new dbDolibarr();
|
||||
|
||||
$query = "SELECT * FROM llx_adherent as a LEFT JOIN llx_adherent_type as t ON a.fk_adherent_type=t.rowid WHERE a.login='" . $dolibarr->protect($idVotant) . "' AND (DATE(a.datefin)>=CURDATE() OR t.subscription=0) AND t.vote=1";
|
||||
print $query .EOLH;
|
||||
print $query . EOLH;
|
||||
$result = $dolibarr->query($query);
|
||||
print_r($dolibarr);
|
||||
//print_r($dolibarr);
|
||||
$votant = $dolibarr->result->fetch_array();
|
||||
print('<br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
@ -64,6 +64,9 @@ print(' <br><br>
|
||||
$votes = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
foreach ($votes as $vote)
|
||||
{
|
||||
switch ($vote["method"])
|
||||
{
|
||||
case 1:
|
||||
$total = 0;
|
||||
echo "<div><h5>" . $vote["libelle"] . "</h5><br>";
|
||||
$query='SELECT * FROM liste_candidats WHERE idVotation=' . $idVotation . ' AND idVote=' . $vote["id"];
|
||||
@ -99,6 +102,10 @@ print(' <br><br>
|
||||
}
|
||||
listeVotants($idVotation, $vote["id"], $listeAdherents);
|
||||
print("</pre></div><br>" . EOLH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
@ -106,7 +113,6 @@ print(' <br><br>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print (' <div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user