function show_update($dbVer) { tpl_open(); ?> <h1><?php \pi18n("Update"); ?> </h1> <p><?php \pi18n("Update notice"); ?> </p> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"> <?php form_value_hidden("update", "update", $dbVer); ?> <label for="country"><?php \pi18n("Pays"); ?> <select id="country" name="country"> <option value="belgique">Belgique</option> <option value="france">France</option> <option value="luxembourg">Luxembourg</option> <option value="united_kingdom">United Kingdom</option> </select> <?php \Pasteque\form_send(); ?> </form> <?php tpl_close(); }
} } $compositions = \Pasteque\CompositionsService::getAll(); //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Compositions", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n("Add composition", PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "composition_edit")); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Information \Pasteque\tpl_msg_box($message, $error); //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d compositions", PLUGIN_NAME, count($compositions)))); if (count($compositions) == 0) { echo \Pasteque\errorDiv(\i18n("No category found", PLUGIN_NAME)); } else { $content[0][0] = \i18n("Composition.label"); $i = 1; foreach ($compositions as $composition) { 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"; } $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "composition_edit", array("productId" => $composition->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-comp=" . $composition->id); $content[$i][0] .= "<img class=\"img img-thumbnail thumbnail pull-left\" src=\"?" . $imgSrc . "\">"; $content[$i][0] .= $composition->label; $content[$i][0] .= \Pasteque\buttonGroup($btn_group, "pull-right"); $i++; } }
$provider = NULL; if (isset($_GET['id'])) { $provider = \Pasteque\providersService::get($_GET['id']); } ?> <h1><?php \pi18n("Edit a provider", PLUGIN_NAME); ?> </h1> <?php \Pasteque\tpl_msg_box($message, $error); ?> <form class="edit" action="<?php echo \Pasteque\get_current_url(); ?> " method="post" enctype="multipart/form-data"> <?php \Pasteque\form_hidden("edit", $provider, "id"); ?> <?php \Pasteque\form_input("edit", "Provider", $provider, "label", "string", array("required" => true)); ?> <?php \Pasteque\form_input("edit", "Provider", $provider, "dispOrder", "numeric"); ?> <div class="row"> <label for="image"><?php \pi18n("Image", PLUGIN_NAME); ?>
$categories = \Pasteque\CategoriesService::getAll(); //Title echo \Pasteque\row(\Pasteque\mainTitle(\i18n("Categories", PLUGIN_NAME))); //Buttons $buttons = \Pasteque\addButton(\i18n('Add a category', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "category_edit")); $buttons .= \Pasteque\importButton(\i18n('Import categories', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, "categoriesManagement")); echo \Pasteque\row(\Pasteque\buttonGroup($buttons)); //Information \Pasteque\tpl_msg_box($message, $error); //Counter echo \Pasteque\row(\Pasteque\counterDiv(\i18n("%d categories", PLUGIN_NAME, count($categories)))); if (count($categories) == 0) { echo \Pasteque\errorDiv(\i18n("No category found", PLUGIN_NAME)); } else { $content[0][0] = \i18n("Category.label"); $i = 1; foreach ($categories as $category) { if ($category->hasImage) { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category&id=" . $category->id; } else { $imgSrc = \Pasteque\PT::URL_ACTION_PARAM . "=img&w=category"; } $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, 'category_edit', array("id" => $category->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-cat=" . $category->id); $content[$i][0] .= "<img class=\"img img-thumbnail thumbnail pull-left\" src=\"?" . $imgSrc . "\">"; $content[$i][0] .= $category->label; $content[$i][0] .= \Pasteque\buttonGroup($btn_group, "pull-right"); $i++; } echo \Pasteque\row(\Pasteque\standardTable($content)); }
\pi18n("Resource.label"); ?> </th> <th></th> </tr> </thead> <tbody> <ul class="resources-list"> <?php 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(PLUGIN_NAME, 'resource_edit', array("id" => $res->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-resource=" . $res->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php
function printprovider($printprovider, $level, &$par) { $par = !$par; 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'; ?> "> <td> <?php for ($i = 0; $i < $level; $i++) { echo " "; } ?> <img class="thumbnail" src="?<?php echo $imgSrc; ?> " /> <td><?php echo $printprovider->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'provider_edit', array("id" => $printprovider->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("prov", $printprovider->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php }
?> " /> <td><?php echo $product->reference; ?> </td> <td><?php echo $product->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array("id" => $product->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-product=" . $product->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } else { $archive = true; $archivesCat[$category->id][] = $product; } } ?> </tbody> </table> <?php } }
function tpl_pagination($total, $range, $start = 0) { if ($range >= $total) { return; } echo "<div class=\"pagination\">"; echo "<a href=\"" . \Pasteque\get_current_url() . "&range=all\">" . \i18n('all') . "</a>"; if (isset($_GET["start"]) && $_GET["start"] != 0) { $url = __tpl_pagination_url($range, $_GET["start"] - $range); echo "<a class=\"prev_page\" href=\"" . $url . "\">«</a>"; } for ($i = 0; $i < ceil($total / $range); $i++) { echo "<a"; if ($i * $range == $_GET["start"]) { echo " class=\"current_page\""; } $url = __tpl_pagination_url($range, $i * $range); echo " href=\"" . $url . "\">" . $i . "</a>"; } if (isset($_GET["start"]) && $_GET["start"] < $total - $range) { $url = __tpl_pagination_url($range, $_GET["start"] + $range); echo "<a class=\"next_page\" href=\"" . $url . "\">»</a>"; } echo "</div>\n"; }
function printCategory($printCategory, $level, &$par) { $par = !$par; 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'; ?> "> <td> <?php for ($i = 0; $i < $level; $i++) { echo " "; } ?> <img class="thumbnail" src="?<?php echo $imgSrc; ?> " /> <td><?php echo $printCategory->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn("edition", \Pasteque\get_module_url_action(PLUGIN_NAME, 'category_edit', array("id" => $printCategory->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <form action="<?php echo \Pasteque\get_current_url(); ?> " method="post"><?php \Pasteque\form_delete("cat", $printCategory->id, \Pasteque\get_template_url() . 'img/delete.png'); ?> </form> </td> </tr> <?php $categories = \Pasteque\CategoriesService::getChildren($printCategory->id); $level++; foreach ($categories as $childCategory) { printCategory($childCategory, $level, $par); } }
$content[0][0] = ""; $content[0][1] = \i18n("Product.reference"); $content[0][2] = \i18n("Product.label"); $i = 1; foreach ($prdCat[$category->id] as $product) { if ($product->visible) { 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"; } $content[$i][0] = "<img class=\"img img-thumbnail thumbnail\" src=\"?" . $imgSrc . "\">"; $content[$i][1] = $product->reference; $content[$i][2] = $product->label; $btn_group = \Pasteque\editButton(\i18n('Edit', PLUGIN_NAME), \Pasteque\get_module_url_action(PLUGIN_NAME, 'product_edit', array("id" => $product->id))); $btn_group .= \Pasteque\deleteButton(\i18n('Delete', PLUGIN_NAME), \Pasteque\get_current_url() . "&delete-product=" . $product->id); $content[$i][2] .= \Pasteque\buttonGroup($btn_group, "pull-right"); $i++; } else { $archive = true; $archivesCat[$category->id][] = $product; } } if (sizeof($content) > 1) { echo \Pasteque\row(\Pasteque\secondaryTitle(\Pasteque\esc_html($category->label))); echo \Pasteque\row(\Pasteque\standardTable($content)); } unset($content); } } if ($archive) {
<?php foreach ($customers as $cust) { ?> <tr> <td><?php echo $cust->number; ?> </td> <td><?php echo $cust->key; ?> </td> <td><?php echo $cust->dispName; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'customer_edit', array("id" => $cust->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-customer=" . $cust->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php
function tpl_pagination($total, $range, $start = 0) { if ($range >= $total) { return; } echo "<nav>\n"; echo "\t<ul class=\"pagination\">\n"; echo "\t\t<li class=\"active\"><a href=\"" . \Pasteque\get_current_url() . "&range=all\">" . \i18n('all') . "</a></li>\n"; if (isset($_GET["start"]) && $_GET["start"] != 0) { $url = __tpl_pagination_url($range, $_GET["start"] - $range); echo "\t\t\t<li><a aria-label=\"Previous\" href=\"" . $url . "\">«</a></li>\n"; } for ($i = 0; $i < ceil($total / $range); $i++) { echo "\t\t\t<li"; if ($i * $range == $_GET["start"]) { echo " class=\"active\""; } $url = __tpl_pagination_url($range, $i * $range); echo "><a href=\"" . $url . "\">" . $i . "</a>\n"; } if (isset($_GET["start"]) && $_GET["start"] < $total - $range) { $url = __tpl_pagination_url($range, $_GET["start"] + $range); echo "\t\t\t<li><a aria-label=\"Next\" href=\"" . $url . "\">»</a></li>\n"; } echo "\t</div>\n"; echo "</nav>\n"; }
<th><?php \pi18n("CashRegister.label"); ?> </th> <th></th> </tr> </thead> <tbody> <?php foreach ($cashRegs as $cashReg) { ?> <tr> <td><?php echo $cashReg->label; ?> </td> <td class="edition"> <?php \Pasteque\tpl_btn('btn-edition', \Pasteque\get_module_url_action(PLUGIN_NAME, 'cashregister_edit', array("id" => $cashReg->id)), "", 'img/edit.png', \i18n('Edit'), \i18n('Edit')); ?> <?php \Pasteque\tpl_btn('btn-delete', \Pasteque\get_current_url() . "&delete-cashreg=" . $cashReg->id, "", 'img/delete.png', \i18n('Delete'), \i18n('Delete'), true); ?> </td> </tr> <?php } ?> </tbody> </table> <?php