summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-15 19:34:44 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-15 19:34:44 -0800
commite0f4e6500de0b5f0e9de973eadcd879c45da8e18 (patch)
tree4029f3c1abe18fd6dbc097e2ee1f7a562fbe4625 /modules
parent64ef86a8ee0c054bdc8743beaa1eca3bbb46a676 (diff)
Use text::alternate() instead of hand-rolled even/odd code.
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/views/admin_block_recent_comments.html.php4
-rw-r--r--modules/comment/views/admin_comments.html.php4
-rw-r--r--modules/gallery/views/admin_advanced_settings.html.php4
-rw-r--r--modules/gallery/views/admin_identity.html.php4
-rw-r--r--modules/gallery/views/admin_maintenance.html.php12
-rw-r--r--modules/gallery/views/admin_modules.html.php4
6 files changed, 10 insertions, 22 deletions
diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php
index 7941e02d..d9776def 100644
--- a/modules/comment/views/admin_block_recent_comments.html.php
+++ b/modules/comment/views/admin_block_recent_comments.html.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul>
- <? foreach ($comments as $i => $comment): ?>
- <li class="<?= ($i % 2 == 0) ? "g-even" : "g-odd" ?>">
+ <? foreach ($comments as $comment): ?>
+ <li class="<?= text::alternate("g-even", "g-odd") ?>">
<img src="<?= $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)) ?>"
class="g-avatar"
alt="<?= html::clean_attribute($comment->author_name()) ?>"
diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php
index b138702c..20236a7a 100644
--- a/modules/comment/views/admin_comments.html.php
+++ b/modules/comment/views/admin_comments.html.php
@@ -103,8 +103,8 @@
<?= t("Actions") ?>
</th>
</tr>
- <? foreach ($comments as $i => $comment): ?>
- <tr id="g-comment-<?= $comment->id ?>" class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?>">
+ <? foreach ($comments as $comment): ?>
+ <tr id="g-comment-<?= $comment->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>">
<td>
<a href="#">
<img src="<?= $comment->author()->avatar_url(40, $theme->url("images/avatar.jpg", true)) ?>"
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php
index 32fbc2c3..ff4843ab 100644
--- a/modules/gallery/views/admin_advanced_settings.html.php
+++ b/modules/gallery/views/admin_advanced_settings.html.php
@@ -16,10 +16,9 @@
<th> <?= t("Name") ?> </th>
<th> <?= t("Value") ?></th>
</tr>
- <? $i = 0; ?>
<? foreach ($vars as $var): ?>
<? if ($var->module_name == "gallery" && $var->name == "_cache") continue ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?>">
<td> <?= $var->module_name ?> </td>
<td> <?= html::clean($var->name) ?> </td>
<td>
@@ -34,7 +33,6 @@
</a>
</td>
</tr>
- <? $i++ ?>
<? endforeach ?>
</table>
</div>
diff --git a/modules/gallery/views/admin_identity.html.php b/modules/gallery/views/admin_identity.html.php
index 70fe401f..51eaa58a 100644
--- a/modules/gallery/views/admin_identity.html.php
+++ b/modules/gallery/views/admin_identity.html.php
@@ -46,14 +46,12 @@
<th> <?= t("Active") ?> </th>
<th> <?= t("Description") ?> </th>
</tr>
- <? $i = 0 ?>
<? foreach ($available as $module_name => $description): ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?>">
<? $data = array("name" => "provider"); ?>
<td> <?= form::radio($data, $module_name, $module_name == $active) ?> </td>
<td> <?= t($description) ?> </td>
</tr>
- <? $i++ ?>
<? endforeach ?>
</table>
<input type="submit" value="<?= t("Change")->for_html_attr() ?>" />
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index 7ad75f85..ac597715 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -20,9 +20,8 @@
<?= t("Action") ?>
</th>
</tr>
- <? $i = 0; ?>
<? foreach ($task_definitions as $task): ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?> <?= log::severity_class($task->severity) ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?> <?= log::severity_class($task->severity) ?>">
<td class="<?= log::severity_class($task->severity) ?>">
<?= $task->name ?>
</td>
@@ -36,7 +35,6 @@
</a>
</td>
</tr>
- <? $i++ ?>
<? endforeach ?>
</table>
</div>
@@ -68,9 +66,8 @@
<?= t("Action") ?>
</th>
</tr>
- <? $i = 0; ?>
<? foreach ($running_tasks as $task): ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?> <?= $task->state == "stalled" ? "g-warning" : "" ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?> <?= $task->state == "stalled" ? "g-warning" : "" ?>">
<td class="<?= $task->state == "stalled" ? "g-warning" : "" ?>">
<?= gallery::date_time($task->updated) ?>
</td>
@@ -108,7 +105,6 @@
<? endif ?>
</td>
</tr>
- <? $i++ ?>
<? endforeach ?>
</table>
</div>
@@ -141,9 +137,8 @@
<?= t("Action") ?>
</th>
</tr>
- <? $i = 0; ?>
<? foreach ($finished_tasks as $task): ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?> <?= $task->state == "success" ? "g-success" : "g-error" ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?> <?= $task->state == "success" ? "g-success" : "g-error" ?>">
<td class="<?= $task->state == "success" ? "g-success" : "g-error" ?>">
<?= gallery::date_time($task->updated) ?>
</td>
@@ -187,7 +182,6 @@
</td>
</tr>
<? endforeach ?>
- <? $i++ ?>
</table>
</div>
<? endif ?>
diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php
index 4c4976f8..aebedf09 100644
--- a/modules/gallery/views/admin_modules.html.php
+++ b/modules/gallery/views/admin_modules.html.php
@@ -15,9 +15,8 @@
<th> <?= t("Version") ?> </th>
<th> <?= t("Description") ?> </th>
</tr>
- <? $i = 0 ?>
<? foreach ($available as $module_name => $module_info): ?>
- <tr class="<?= ($i % 2 == 0) ? "g-odd" : "g-even" ?>">
+ <tr class="<?= text::alternate("g-odd", "g-even") ?>">
<? $data = array("name" => $module_name); ?>
<? if ($module_info->locked) $data["disabled"] = 1; ?>
<td> <?= form::checkbox($data, '1', module::is_active($module_name)) ?> </td>
@@ -25,7 +24,6 @@
<td> <?= $module_info->version ?> </td>
<td> <?= t($module_info->description) ?> </td>
</tr>
- <? $i++ ?>
<? endforeach ?>
</table>
<input type="submit" value="<?= t("Update")->for_html_attr() ?>" />