Commit 5457c7f7 authored by Pierre Ducroquet's avatar Pierre Ducroquet
Browse files

Get rid of par for odd/even, CSS RULES

parent 1fc9b348
......@@ -52,18 +52,16 @@ $currencies = $currSrv->getAll();
</thead>
<tbody>
<?php
$par = FALSE;
foreach ($currencies as $currency) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><?php echo $currency->label; ?></td>
<td><?php
if ($currency->isMain) {
\pi18n("Main", PLUGIN_NAME);
} else {
echo($currency->rate);
} ?>
} ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
'currency_edit', array("id" => $currency->id)), "",
......
......@@ -45,7 +45,7 @@ if (isset($_POST['id']) && isset($_POST['label'])) {
$_POST['format'], $_POST['rate'], $isMain, $isActive);
$id = $currSrv->create($curr);
if ($id !== FALSE) {
$message = \i18n("Currency saved. <a href=\"%s\">Go to the currecy page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'currency_edit', array('id' => $id)));
$message = \i18n("Currency saved. <a href=\"%s\">Go to the currency page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'currency_edit', array('id' => $id)));
} else {
$error = \i18n("Unable to save changes");
}
......@@ -57,7 +57,6 @@ if (isset($_GET['id'])) {
}
else {
$currency = new \Pasteque\Currency();
echo $currency->format;
}
?>
<h1><?php \pi18n("Edit a currency", PLUGIN_NAME); ?></h1>
......@@ -79,7 +78,7 @@ else {
<?php \Pasteque\form_save(); ?>
</div>
</form>
<?php if ($currency !== NULL) { ?>
<?php if ($currency->id !== NULL) { ?>
<form action="<?php echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'currencies'); ?>" method="post">
<?php \Pasteque\form_delete("cat", $currency->id); ?>
</form>
......
......@@ -57,15 +57,14 @@ $categories = \Pasteque\CategoriesService::getAll();
</thead>
<tbody>
<?php
function printCategory($printCategory, $level, &$par) {
$par = !$par;
function printCategory($printCategory, $level) {
if ($printCategory->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category&id=" . $printCategory->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td>
<?php
for($i=0;$i<$level;$i++) {
......@@ -86,14 +85,13 @@ function printCategory($printCategory, $level, &$par) {
$categories = \Pasteque\CategoriesService::getChildren($printCategory->id);
$level++;
foreach($categories as $childCategory) {
printCategory($childCategory, $level, $par);
printCategory($childCategory, $level);
}
}
$par = false;
foreach ($categories as $category) {
if($category->parentId == "") {
printCategory($category, 0, $par); // we start with root categories. As the function is recursive, we don’t need more than this :-)
printCategory($category, 0); // we start with root categories. As the function is recursive, we don’t need more than this :-)
}
}
?>
......
......@@ -100,7 +100,6 @@ foreach ($products as $product) {
<?php \Pasteque\tpl_pagination($totalProducts,$range,$start); ?>
<?php
$par = false;
$archive = false;
foreach ($categories as $category) {
if (isset($prdCat[$category->id])) { ?>
......@@ -118,14 +117,13 @@ foreach ($categories as $category) {
<?php
foreach ($prdCat[$category->id] as $product) {
if ($product->visible) {
$par = !$par;
if ($product->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $product->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $product->reference; ?></td>
<td><?php echo $product->label; ?></td>
......@@ -170,11 +168,10 @@ foreach ($categories as $category) {
</thead>
<tbody>
<?php
$par = false;
foreach ($archivesCat[$category->id] as $product) {
if (!$product->visible) {
$par = !$par;
?>
<<<<<<< HEAD
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $product->id; ?>" />
<td><?php echo $product->reference; ?></td>
......@@ -183,6 +180,16 @@ foreach ($categories as $category) {
<a href="<?php echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array('id' => $product->id)); ?>"><img src="<?php echo \Pasteque\get_template_url(); ?>img/edit.png" alt="<?php \pi18n('Edit'); ?>" title="<?php \pi18n('Edit'); ?>"></a>
</td>
</tr>
=======
<tr>
<td><img class="thumbnail" src="?<?php echo \Pasteque\PT::URL_ACTION_PARAM; ?>=img&w=product&id=<?php echo $product->id; ?>" />
<td><?php echo $product->reference; ?></td>
<td><?php echo $product->label; ?></td>
<td class="edition">
<a href="<?php echo \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array('id' => $product->id)); ?>"><img src="<?php echo \Pasteque\get_template_url(); ?>img/edit.png" alt="<?php \pi18n('Edit'); ?>" title="<?php \pi18n('Edit'); ?>"></a>
</td>
</tr>
>>>>>>> Get rid of par for odd/even, CSS RULES
<?php
}
}
......
......@@ -52,11 +52,9 @@ $taxes = \Pasteque\TaxesService::getAll();
</thead>
<tbody>
<?php
$par = FALSE;
foreach ($taxes as $tax) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><?php echo $tax->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(
......
......@@ -47,10 +47,8 @@ $resources = $resSrv->getAll();
<tbody>
<ul class="resources-list">
<?php
$par = FALSE;
foreach ($resources as $res) {
$par = !$par; ?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
foreach ($resources as $res) { ?>
<tr>
<td><?php echo $res->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(
......
......@@ -170,7 +170,6 @@ if ($countedStock !== null) {
<?php if ($countedStock !== null) { ?>
<?php foreach ($categories as $category) {
$printed = false;
$par = false;
if (isset($prdCat[$category->id])) {
foreach ($prdCat[$category->id] as $product) {
$counted = 0;
......@@ -182,7 +181,6 @@ if ($countedStock !== null) {
$actual = $levels[$product->id]->qty;
}
if ($counted !== $actual) {
$par = !$par;
if ($product->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $product->id;
} else {
......@@ -207,7 +205,7 @@ if ($countedStock !== null) {
<?php
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $product->reference; ?></td>
<td><?php echo $product->label; ?></td>
......
......@@ -71,7 +71,6 @@ foreach ($levels as $level) {
<?php
}
$par = false;
foreach ($categories as $category) {
if (isset($prdCat[$category->id])) {
// Category header ?>
......@@ -96,7 +95,6 @@ foreach ($categories as $category) {
continue;
}
// Level lines
$par = !$par;
$prdRef = "";
$prdLabel = "";
$imgSrc = "";
......@@ -135,7 +133,7 @@ foreach ($categories as $category) {
$max = \i18n("Undefined");
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><img class="thumbnail" src="?<?php echo \Pasteque\esc_attr($imgSrc); ?>" />
<td><?php echo \Pasteque\esc_html($prdRef); ?></td>
<td><?php echo \Pasteque\esc_html($prdLabel); ?></td>
......
......@@ -49,11 +49,9 @@ $attributes = \Pasteque\AttributesService::getAllAttrs();
</thead>
<tbody>
<?php
$par = false;
foreach ($attributes as $attr) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><?php echo $attr->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
......
......@@ -49,11 +49,9 @@ $sets = \Pasteque\AttributesService::getAll();
</thead>
<tbody>
<?php
$par = false;
foreach ($sets as $set) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><?php echo $set->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
......
......@@ -41,16 +41,14 @@ else {
</thead>
<tbody>
<?php
$par = false;
foreach ($compositions as $composition) {
$par = !$par;
if ($composition->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product&id=" . $composition->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=product";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><img class="thumbnail" src="?<?php echo $imgSrc ?>" />
<td><?php echo $composition->label; ?></td>
<td class="edition">
......
......@@ -57,15 +57,14 @@ $providers = \Pasteque\providersService::getAll();
</thead>
<tbody>
<?php
function printprovider($printprovider, $level, &$par) {
$par = !$par;
function printprovider($printprovider, $level) {
if ($printprovider->hasImage) {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=provider&id=" . $printprovider->id;
} else {
$imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=provider";
}
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td>
<?php
for($i=0;$i<$level;$i++) {
......@@ -85,9 +84,8 @@ function printprovider($printprovider, $level, &$par) {
<?php
}
$par = false;
foreach ($providers as $provider) {
printprovider($provider, 0, $par);
printprovider($provider, 0);
}
?>
</tbody>
......
......@@ -53,11 +53,9 @@ $areas = $srv->getAll();
</thead>
<tbody>
<?php
$par = false;
foreach ($areas as $area) {
$par = !$par;
?>
<tr class="row-<?php echo $par ? 'par' : 'odd'; ?>">
<tr>
<td><?php echo $area->label; ?></td>
<td class="edition">
<?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME,
......
......@@ -211,7 +211,7 @@ function __tpl_report_footer($report) {
echo "\").tablesorter();});</script>";
}
function __tpl_report_line($report, $line, $par) {
echo "\t\t<tr class=\"row-" . ($par ? 'par' : 'odd') . "\">\n";
echo "\t\t<tr>\n";
foreach ($report->getFields() as $field) {
if (isset($line[$field])) {
echo "\t\t\t<td>" . $report->applyVisualFilter($field, $line)
......@@ -229,7 +229,7 @@ function __tpl_group_footer($report, $run) {
echo "\t\t<tr>\n";
echo "\t\t\t<td colspan=\"" . count($report->getHeaders()) . "\">" . \i18n("Subtotal") . "</td>\n";
echo "\t\t</tr>\n";
echo "\t\t<tr class=\"row-par\">\n";
echo "\t\t<tr>\n";
$subtotals = $run->getSubtotals();
foreach ($report->getFields() as $field) {
if (isset($subtotals[$field])) {
......@@ -268,7 +268,7 @@ function __tpl_total_header($report, $run) {
function __tpl_report_totals($report, $run) {
echo "<h2>" . \i18n("Total") . "</h2>\n";
__tpl_total_header($report, $run);
echo "\t\t<tr class=\"row-par\">\n";
echo "\t\t<tr>\n";
$totals = $run->getTotals();
foreach ($report->getFields() as $field) {
if (isset($totals[$field])) {
......
......@@ -269,10 +269,10 @@ th {
border-right: none;
padding: 5px 20px;
}
tr {
tbody tr:nth-child(even) {
background-color: #DDD;
}
tr.row-odd {
tbody tr:nth-child(odd) {
background-color: #EEE;
}
table.report td {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment