$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)); }
} } $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++; } }
$content[0][0] = ""; $content[0][1] = \i18n("Product.reference"); $content[0][2] = \i18n("Product.label"); $i = 1; if (isset($archivesCat[$category->id])) { foreach ($archivesCat[$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))); $content[$i][2] .= \Pasteque\buttonGroup($btn_group, "pull-right"); $i++; } } } if (sizeof($content) > 1) { echo \Pasteque\row(\Pasteque\secondaryTitle(\Pasteque\esc_html($category->label) . " - " . \i18n("Archived", PLUGIN_NAME))); echo \Pasteque\row(\Pasteque\standardTable($content)); } unset($content); } } if (count($products) == 0) { echo \Pasteque\errorDiv(\i18n("No product found", PLUGIN_NAME)); }