summaryrefslogtreecommitdiffstats
path: root/web/template/tu_list.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/template/tu_list.php')
-rw-r--r--web/template/tu_list.php26
1 files changed, 12 insertions, 14 deletions
diff --git a/web/template/tu_list.php b/web/template/tu_list.php
index d8acd713..ce19da3c 100644
--- a/web/template/tu_list.php
+++ b/web/template/tu_list.php
@@ -14,9 +14,15 @@
</thead>
<tbody>
- <?php if (mysql_num_rows($result) == 0): ?>
+ <?php if (empty($result)): ?>
<tr><td align="center" colspan="0"><?php print __("No results found.") ?></td></tr>
- <?php else: for ($i = 0; $row = mysql_fetch_assoc($result); $i++): (($i % 2) == 0) ? $c = 'odd' : $c = 'even'; ?>
+ <?php else: while (list($indx, $row) = each($result)):
+ if ($indx % 2):
+ $c = "even";
+ else:
+ $c = "odd";
+ endif;
+ ?>
<tr class="<?php print $c ?>">
<td><?php $row["Agenda"] = htmlspecialchars(substr($row["Agenda"], 0, $prev_Len)); ?>
<a href="tu.php?id=<?php print $row['ID'] ?>"><?php print $row["Agenda"] ?></a></span></span>
@@ -34,23 +40,15 @@
<td><?php print $row['Yes'] ?></td>
<td><?php print $row['No'] ?></td>
<td>
- <?php
- $q = "SELECT * FROM TU_Votes WHERE VoteID = " . $row['ID'] . " AND UserID = " . uid_from_sid($_COOKIE["AURSID"]);
- $result_tulist = db_query($q, $dbh);
- if ($result_tulist):
- $hasvoted = mysql_num_rows($result_tulist);
- else:
- $hasvoted = 0;
- endif;
- if ($hasvoted == 0): ?>
- <span style="color: red; font-weight: bold"><?php print __("No") ?></span>
- <?php else: ?>
+ <?php if (tu_voted($row['ID'], uid_from_sid($_COOKIE["AURSID"]))): ?>
<span style="color: green; font-weight: bold"><?php print __("Yes") ?></span>
+ <?php else: ?>
+ <span style="color: red; font-weight: bold"><?php print __("No") ?></span>
<?php endif; ?>
</td>
</tr>
<?php
- endfor;
+ endwhile;
endif;
?>
</tbody>