Module Recettes : on avance encore...
This commit is contained in:
@@ -6,13 +6,22 @@
|
|||||||
|
|
||||||
<forms>
|
<forms>
|
||||||
<form name="recette_create_form" class="Recettes\Form\RecetteCreateForm" />
|
<form name="recette_create_form" class="Recettes\Form\RecetteCreateForm" />
|
||||||
<form name="recette_update_form" class="Recettes\Form\RecetteUpdateForm" />
|
|
||||||
</forms>
|
</forms>
|
||||||
|
|
||||||
<hooks>
|
<hooks>
|
||||||
<hook id="recettes.hook" class="Recettes\Hook\HookManager">
|
<hook id="recettes.back.hook" class="Recettes\Hook\HookManager">
|
||||||
<tag name="hook.event_listener" event="content.tab" type="back" method="onEditTab" />
|
<tag name="hook.event_listener" event="content.tab" type="back" method="onAddTab" />
|
||||||
|
</hook>
|
||||||
|
<hook id="recettes.front.hook" class="Recettes\Hook\HookManager">
|
||||||
|
<tag name="hook.event_listener" event="content.stylesheet" type="front" method="onAddCSS" />
|
||||||
</hook>
|
</hook>
|
||||||
</hooks>
|
</hooks>
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<loop name="recipe" class="Recettes\Loop\GeneralLoop"/>
|
||||||
|
<loop name="recipe_products" class="Recettes\Loop\ProductsLoop"/>
|
||||||
|
<loop name="recipe_steps" class="Recettes\Loop\StepsLoop"/>
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
|
||||||
</config>
|
</config>
|
||||||
|
|||||||
@@ -8,5 +8,4 @@
|
|||||||
<default key="_controller">Recettes\Controller\MainController::saveRecipe</default>
|
<default key="_controller">Recettes\Controller\MainController::saveRecipe</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
|
||||||
</routes>
|
</routes>
|
||||||
|
|||||||
41
local/modules/Recettes/Config/schema.xml
Normal file
41
local/modules/Recettes/Config/schema.xml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<database defaultIdMethod="native" name="thelia" namespace="Recettes\Model">
|
||||||
|
|
||||||
|
<table name="recipe">
|
||||||
|
<column name="id" autoIncrement="true" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
<column name="content_id" type="INTEGER" />
|
||||||
|
<column name="title" required="true" type="VARCHAR" />
|
||||||
|
<column name="people" required="true" type="INTEGER" />
|
||||||
|
<column name="difficulty" required="true" type="INTEGER" />
|
||||||
|
<column name="preparation_time" required="true" type="VARCHAR" />
|
||||||
|
<column name="cooking_time" required="false" type="VARCHAR" />
|
||||||
|
|
||||||
|
<foreign-key foreignTable="content" name="fk_content_content_id">
|
||||||
|
<reference foreign="id" local="content_id" />
|
||||||
|
</foreign-key>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="recipe_steps">
|
||||||
|
<column name="recipe_id" required="true" type="INTEGER" />
|
||||||
|
<column name="step" required="true" type="INTEGER" />
|
||||||
|
<column name="description" required="true" type="VARCHAR" />
|
||||||
|
|
||||||
|
<foreign-key foreignTable="recipe" name="fk_recipesteps_recipe_id">
|
||||||
|
<reference foreign="id" local="recipe_id" />
|
||||||
|
</foreign-key>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<table name="recipe_products">
|
||||||
|
<column name="recipe_id" required="true" type="INTEGER" />
|
||||||
|
<column name="pse_id" required="true" type="INTEGER" />
|
||||||
|
<column name="quantity" required="true" type="INTEGER" />
|
||||||
|
|
||||||
|
<foreign-key foreignTable="recipe" name="fk_recipeproducts_recipe_id">
|
||||||
|
<reference foreign="id" local="recipe_id" />
|
||||||
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="product_sale_elements" name="fk_recipeproducts_pse_id">
|
||||||
|
<reference foreign="id" local="pse_id" />
|
||||||
|
</foreign-key>
|
||||||
|
</table>
|
||||||
|
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||||
|
|
||||||
|
</database>
|
||||||
2
local/modules/Recettes/Config/sqldb.map
Normal file
2
local/modules/Recettes/Config/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Sqlfile -> Database map
|
||||||
|
thelia.sql=thelia
|
||||||
67
local/modules/Recettes/Config/thelia.sql
Normal file
67
local/modules/Recettes/Config/thelia.sql
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||||
|
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- recipe
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `recipe`;
|
||||||
|
|
||||||
|
CREATE TABLE `recipe`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`content_id` INTEGER,
|
||||||
|
`title` VARCHAR(255) NOT NULL,
|
||||||
|
`people` INTEGER NOT NULL,
|
||||||
|
`difficulty` INTEGER NOT NULL,
|
||||||
|
`preparation_time` VARCHAR(255) NOT NULL,
|
||||||
|
`cooking_time` VARCHAR(255),
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `fi_content_content_id` (`content_id`),
|
||||||
|
CONSTRAINT `fk_content_content_id`
|
||||||
|
FOREIGN KEY (`content_id`)
|
||||||
|
REFERENCES `content` (`id`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- recipe_steps
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `recipe_steps`;
|
||||||
|
|
||||||
|
CREATE TABLE `recipe_steps`
|
||||||
|
(
|
||||||
|
`recipe_id` INTEGER NOT NULL,
|
||||||
|
`step` INTEGER NOT NULL,
|
||||||
|
`description` VARCHAR(255) NOT NULL,
|
||||||
|
INDEX `fi_recipesteps_recipe_id` (`recipe_id`),
|
||||||
|
CONSTRAINT `fk_recipesteps_recipe_id`
|
||||||
|
FOREIGN KEY (`recipe_id`)
|
||||||
|
REFERENCES `recipe` (`id`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- recipe_products
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `recipe_products`;
|
||||||
|
|
||||||
|
CREATE TABLE `recipe_products`
|
||||||
|
(
|
||||||
|
`recipe_id` INTEGER NOT NULL,
|
||||||
|
`pse_id` INTEGER NOT NULL,
|
||||||
|
`quantity` INTEGER NOT NULL,
|
||||||
|
INDEX `fi_recipeproducts_recipe_id` (`recipe_id`),
|
||||||
|
INDEX `fi_recipeproducts_pse_id` (`pse_id`),
|
||||||
|
CONSTRAINT `fk_recipeproducts_recipe_id`
|
||||||
|
FOREIGN KEY (`recipe_id`)
|
||||||
|
REFERENCES `recipe` (`id`),
|
||||||
|
CONSTRAINT `fk_recipeproducts_pse_id`
|
||||||
|
FOREIGN KEY (`pse_id`)
|
||||||
|
REFERENCES `product_sale_elements` (`id`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
# This restores the fkey checks, after having unset them earlier
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@@ -6,6 +6,11 @@ use Exception;
|
|||||||
use Propel\Runtime\Exception\PropelException;
|
use Propel\Runtime\Exception\PropelException;
|
||||||
use Propel\Runtime\Propel;
|
use Propel\Runtime\Propel;
|
||||||
use Recettes\Form\RecetteCreateForm;
|
use Recettes\Form\RecetteCreateForm;
|
||||||
|
use Recettes\Model\Recipe;
|
||||||
|
use Recettes\Model\RecipeProducts;
|
||||||
|
use Recettes\Model\RecipeQuery;
|
||||||
|
use Recettes\Model\RecipeSteps;
|
||||||
|
use Recettes\Model\RecipeStepsQuery;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
use Thelia\Controller\Admin\BaseAdminController;
|
||||||
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
||||||
@@ -22,26 +27,18 @@ use Thelia\Tools\URL;
|
|||||||
class MainController extends BaseAdminController
|
class MainController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function viewAction(Request $request)
|
|
||||||
{
|
|
||||||
$id = $request->get("content_id");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function saveRecipe(Request $request)
|
public function saveRecipe(Request $request)
|
||||||
{
|
{
|
||||||
$productsList = [];
|
|
||||||
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
$error = "";
|
$error = "";
|
||||||
|
$con = Propel::getConnection();
|
||||||
|
$nouvelleRecette = false;
|
||||||
|
|
||||||
$form = new RecetteCreateForm($request);
|
$form = new RecetteCreateForm($request);
|
||||||
try {
|
try {
|
||||||
$formValidate = $this->validateForm($form);
|
$formValidate = $this->validateForm($form);
|
||||||
$data = $formValidate->getData();
|
$data = $formValidate->getData();
|
||||||
|
|
||||||
$content_id = $data['content_id'];
|
$contentId = $data['content_id'];
|
||||||
$title = $data['title'];
|
$title = $data['title'];
|
||||||
$difficulty = $data['difficulty'];
|
$difficulty = $data['difficulty'];
|
||||||
$numberPeople = $data['people'];
|
$numberPeople = $data['people'];
|
||||||
@@ -49,19 +46,52 @@ class MainController extends BaseAdminController
|
|||||||
$cookingTime = $data['cooking_time'];
|
$cookingTime = $data['cooking_time'];
|
||||||
$steps = $data['steps'];
|
$steps = $data['steps'];
|
||||||
|
|
||||||
if (null !== $title && null !== $preparationTime) {
|
if (null !== $title && null !== $contentId && null !== $difficulty && null !== $numberPeople && null !== $preparationTime) {
|
||||||
$content = ContentI18nQuery::create()->filterByLocale('fr_FR')->findOneById($content_id);
|
|
||||||
|
|
||||||
$encodedData = json_encode($data);
|
$recipe = RecipeQuery::create()->findOneByContentId($contentId);
|
||||||
$content->setDescription($encodedData);
|
if (null === $recipe)
|
||||||
$content->save($con);
|
{
|
||||||
|
$nouvelleRecette = true;
|
||||||
|
$recipe = new Recipe();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$recipeId = $recipe->getId();
|
||||||
|
|
||||||
|
$recipe->setContentId($contentId);
|
||||||
|
$recipe->setTitle($title);
|
||||||
|
$recipe->setDifficulty($difficulty);
|
||||||
|
$recipe->setPeople($numberPeople);
|
||||||
|
$recipe->setPreparationTime($preparationTime);
|
||||||
|
$recipe->setCookingTime($cookingTime);
|
||||||
|
$recipe->save($con);
|
||||||
$con->commit();
|
$con->commit();
|
||||||
|
|
||||||
|
if (!$nouvelleRecette)
|
||||||
|
{
|
||||||
|
// On supprime les étapes pour les recréer par la suite.
|
||||||
|
$steps = RecipeStepsQuery::create()->findByRecipeId($recipeId);
|
||||||
|
$steps->delete($con);
|
||||||
|
$con->commit();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
foreach ($steps as $step) {
|
||||||
|
$recipeSteps = new RecipeSteps();
|
||||||
|
$recipeSteps->setRecipeId($recipeId);
|
||||||
|
$recipeSteps->setStep($step['id']);
|
||||||
|
$recipeSteps->setDescription($step['description']);
|
||||||
|
$recipeSteps->save();
|
||||||
|
$con->commit();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// A rajouter : les produits et les étapes
|
||||||
|
|
||||||
|
return new RedirectResponse(URL::getInstance()->absoluteUrl("/admin/content/update/" . $contentId));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RedirectResponse(URL::getInstance()->absoluteUrl("/admin/content/update/" . $content_id));
|
return new RedirectResponse(URL::getInstance()->absoluteUrl("/admin/content"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
namespace Recettes\Form;
|
namespace Recettes\Form;
|
||||||
|
|
||||||
use Recettes\Recettes;
|
use Recettes\Recettes;
|
||||||
|
use Symfony\Component\Validator\Constraints\AbstractComparison;
|
||||||
|
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||||
|
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||||
|
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Validator\Constraints\Range;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Form\BaseForm;
|
use Thelia\Form\BaseForm;
|
||||||
|
|
||||||
@@ -33,10 +38,7 @@ class RecetteCreateForm extends BaseForm
|
|||||||
"content_id",
|
"content_id",
|
||||||
"integer",
|
"integer",
|
||||||
[
|
[
|
||||||
"label" => $this->trans("Content Id"),
|
"constraints" => [ new NotBlank() ]
|
||||||
"constraints" => [
|
|
||||||
new NotBlank()
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
@@ -45,29 +47,25 @@ class RecetteCreateForm extends BaseForm
|
|||||||
[
|
[
|
||||||
"label" => $this->trans("Title"),
|
"label" => $this->trans("Title"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-title"
|
"for" => "title"
|
||||||
],
|
],
|
||||||
"constraints" => [
|
"constraints" => [ new NotBlank() ],
|
||||||
new NotBlank()
|
"required" => true
|
||||||
]
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
"difficulty",
|
"difficulty",
|
||||||
"choice",
|
"integer",
|
||||||
[
|
[
|
||||||
"choices" => array(
|
|
||||||
"Facile",
|
|
||||||
"Moyen",
|
|
||||||
"Difficile"
|
|
||||||
),
|
|
||||||
"label" => $this->trans("Difficulty"),
|
"label" => $this->trans("Difficulty"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-difficulty"
|
"for" => "difficulty"
|
||||||
],
|
],
|
||||||
"constraints" => [
|
"constraints" => [
|
||||||
new NotBlank()
|
new GreaterThanOrEqual(array('value' => 0)),
|
||||||
]
|
new LessThanOrEqual(array('value' => 2))
|
||||||
|
],
|
||||||
|
"required" => true
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
@@ -76,11 +74,10 @@ class RecetteCreateForm extends BaseForm
|
|||||||
[
|
[
|
||||||
"label" => $this->trans("Number of people"),
|
"label" => $this->trans("Number of people"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-difficulty"
|
"for" => "people"
|
||||||
],
|
],
|
||||||
"constraints" => [
|
"constraints" => [ new GreaterThan(array('value' => 0)) ],
|
||||||
new NotBlank()
|
"required" => true
|
||||||
]
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
@@ -89,12 +86,11 @@ class RecetteCreateForm extends BaseForm
|
|||||||
[
|
[
|
||||||
"label" => $this->trans("Preparation time"),
|
"label" => $this->trans("Preparation time"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-preparation-time",
|
"for" => "preparation_time",
|
||||||
"help" => "ex : 1h15 ou 45 minutes"
|
"help" => "ex : 1h15 ou 45 minutes"
|
||||||
],
|
],
|
||||||
"constraints" => [
|
"constraints" => [ new NotBlank() ],
|
||||||
new NotBlank()
|
"required" => true
|
||||||
]
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
@@ -103,7 +99,7 @@ class RecetteCreateForm extends BaseForm
|
|||||||
[
|
[
|
||||||
"label" => $this->trans("Cooking time"),
|
"label" => $this->trans("Cooking time"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-cooking-time",
|
"for" => "cooking_time",
|
||||||
"help" => "ex : 1h15 ou 45 minutes"
|
"help" => "ex : 1h15 ou 45 minutes"
|
||||||
],
|
],
|
||||||
"required" => false
|
"required" => false
|
||||||
@@ -115,10 +111,7 @@ class RecetteCreateForm extends BaseForm
|
|||||||
[
|
[
|
||||||
"label" => $this->trans("Steps"),
|
"label" => $this->trans("Steps"),
|
||||||
"label_attr" => [
|
"label_attr" => [
|
||||||
"for" => "attr-recipe"
|
"for" => "steps"
|
||||||
],
|
|
||||||
"constraints" => [
|
|
||||||
new NotBlank()
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Recettes\Form;
|
|
||||||
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class RecetteUpdateForm
|
|
||||||
* @package Recettes\Form
|
|
||||||
*/
|
|
||||||
class RecetteUpdateForm extends RecetteCreateForm
|
|
||||||
{
|
|
||||||
/** @var Translator $translator */
|
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string the name of you form. This name must be unique
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'recette_update_form';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
parent::buildForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace Recettes\Hook;
|
namespace Recettes\Hook;
|
||||||
|
|
||||||
|
use Recettes\Recettes;
|
||||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||||
|
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||||
use Thelia\Core\Hook\BaseHook;
|
use Thelia\Core\Hook\BaseHook;
|
||||||
use Thelia\Model\ContentFolderQuery;
|
use Thelia\Model\ContentFolderQuery;
|
||||||
use Thelia\Model\FolderI18nQuery;
|
use Thelia\Model\FolderI18nQuery;
|
||||||
@@ -14,23 +16,27 @@ use Thelia\Model\FolderI18nQuery;
|
|||||||
class HookManager extends baseHook
|
class HookManager extends baseHook
|
||||||
{
|
{
|
||||||
|
|
||||||
public function onEditTab(HookRenderBlockEvent $event)
|
public function onAddTab(HookRenderBlockEvent $event)
|
||||||
{
|
{
|
||||||
$contentId = $event->getArgument('id');
|
$contentId = $event->getArgument('id');
|
||||||
$parentFolderId = ContentFolderQuery::create()->findOneByContentId($contentId)->getFolderId();
|
$parentFolderId = ContentFolderQuery::create()->findOneByContentId($contentId)->getFolderId();
|
||||||
$parentFolder = FolderI18nQuery::create()->findOneById($parentFolderId)->getTitle();
|
$parentFolder = FolderI18nQuery::create()->findOneById($parentFolderId)->getTitle();
|
||||||
|
|
||||||
if (0 != strpos($parentFolder, 'recette')) {
|
if (0 != strpos($parentFolder, Recettes::MOT_CLE_RECETTE)) {
|
||||||
|
|
||||||
$event->add(
|
$event->add(
|
||||||
[
|
[
|
||||||
"id" => 'admin-content-recipe',
|
"id" => 'recipe',
|
||||||
"title" => 'Recette',
|
"title" => 'Recette',
|
||||||
"content" => ($this->render('recette-tab.html',
|
"content" => ($this->render('recette-tab.html'))
|
||||||
[ "people" => "2" ]
|
|
||||||
))
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onAddCss(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$event->add($this->addCSS('assets/css/Recettes.css'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,4 +8,7 @@ return array(
|
|||||||
'Number of people' => 'Nombre de personnes',
|
'Number of people' => 'Nombre de personnes',
|
||||||
'Product' => 'Produit',
|
'Product' => 'Produit',
|
||||||
'Quantity' => 'Quantité',
|
'Quantity' => 'Quantité',
|
||||||
|
'Preparation time' => 'Préparation ',
|
||||||
|
'Cooking time' => 'Cuisson ',
|
||||||
|
'Difficulty' => 'Niveau ',
|
||||||
);
|
);
|
||||||
|
|||||||
76
local/modules/Recettes/Loop/GeneralLoop.php
Normal file
76
local/modules/Recettes/Loop/GeneralLoop.php
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Loop;
|
||||||
|
|
||||||
|
use Recettes\Model\RecipeQuery;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeneralLoop
|
||||||
|
* @package Recettes\Loop
|
||||||
|
*/
|
||||||
|
class GeneralLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||||
|
{
|
||||||
|
public $countable = false;
|
||||||
|
public $timestampable = false;
|
||||||
|
public $versionable = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LoopResult $loopResult
|
||||||
|
*
|
||||||
|
* @return LoopResult
|
||||||
|
*/
|
||||||
|
public function parseResults(LoopResult $loopResult)
|
||||||
|
{
|
||||||
|
foreach ($loopResult->getResultDataCollection() as $recipe) {
|
||||||
|
|
||||||
|
$loopResultRow = new LoopResultRow($recipe);
|
||||||
|
$loopResultRow
|
||||||
|
->set("ID", $recipe->getId())
|
||||||
|
->set("CONTENT_ID", $recipe->getContentId())
|
||||||
|
->set("TITLE", $recipe->getTitle())
|
||||||
|
->set("PEOPLE", $recipe->getPeople())
|
||||||
|
->set("DIFFICULTY", $recipe->getDifficulty())
|
||||||
|
->set("PREPARATION_TIME", $recipe->getPreparationTime())
|
||||||
|
->set("COOKING_TIME", $recipe->getCookingTime())
|
||||||
|
;
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntListTypeArgument('id'),
|
||||||
|
Argument::createIntListTypeArgument('content_id')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function buildModelCriteria()
|
||||||
|
{
|
||||||
|
$recipes = RecipeQuery::create();
|
||||||
|
|
||||||
|
/* Filtrages éventuels */
|
||||||
|
if (null != $id = $this->getId()) {
|
||||||
|
$recipes->filterById($id);
|
||||||
|
}
|
||||||
|
if (null != $contentId = $this->getContentId()) {
|
||||||
|
$recipes->filterByContentId($contentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recipes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
67
local/modules/Recettes/Loop/ProductsLoop.php
Normal file
67
local/modules/Recettes/Loop/ProductsLoop.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Loop;
|
||||||
|
|
||||||
|
use Recettes\Model\RecipeProductsQuery;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProductsLoop
|
||||||
|
* @package Recettes\Loop
|
||||||
|
*/
|
||||||
|
class ProductsLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||||
|
{
|
||||||
|
public $countable = false;
|
||||||
|
public $timestampable = false;
|
||||||
|
public $versionable = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LoopResult $loopResult
|
||||||
|
*
|
||||||
|
* @return LoopResult
|
||||||
|
*/
|
||||||
|
public function parseResults(LoopResult $loopResult)
|
||||||
|
{
|
||||||
|
foreach ($loopResult->getResultDataCollection() as $product) {
|
||||||
|
|
||||||
|
$loopResultRow = new LoopResultRow($product);
|
||||||
|
$loopResultRow
|
||||||
|
->set("RECIPE_ID", $product->getId())
|
||||||
|
->set("PSE_ID", $product->getPseId())
|
||||||
|
->set("QUANTITY", $product->getQuantity())
|
||||||
|
;
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntListTypeArgument('recipe_id')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function buildModelCriteria()
|
||||||
|
{
|
||||||
|
$products = RecipeProductsQuery::create();
|
||||||
|
|
||||||
|
if (null != $id = $this->getRecipeId()) {
|
||||||
|
$products->filterById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $products;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
67
local/modules/Recettes/Loop/StepsLoop.php
Normal file
67
local/modules/Recettes/Loop/StepsLoop.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Loop;
|
||||||
|
|
||||||
|
use Recettes\Model\RecipeStepsQuery;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StepsLoop
|
||||||
|
* @package Recettes\Loop
|
||||||
|
*/
|
||||||
|
class StepsLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||||
|
{
|
||||||
|
public $countable = false;
|
||||||
|
public $timestampable = false;
|
||||||
|
public $versionable = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LoopResult $loopResult
|
||||||
|
*
|
||||||
|
* @return LoopResult
|
||||||
|
*/
|
||||||
|
public function parseResults(LoopResult $loopResult)
|
||||||
|
{
|
||||||
|
foreach ($loopResult->getResultDataCollection() as $step) {
|
||||||
|
|
||||||
|
$loopResultRow = new LoopResultRow($step);
|
||||||
|
$loopResultRow
|
||||||
|
->set("RECIPE_ID", $step->getId())
|
||||||
|
->set("STEP", $step->getContentId())
|
||||||
|
->set("DESCRIPTION", $step->getTitle())
|
||||||
|
;
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntListTypeArgument('recipe_id')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function buildModelCriteria()
|
||||||
|
{
|
||||||
|
$steps = RecipeStepsQuery::create();
|
||||||
|
|
||||||
|
if (null != $id = $this->getRecipeId()) {
|
||||||
|
$steps->filterById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/Recipe.php
Normal file
20
local/modules/Recettes/Model/Recipe.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\Recipe as BaseRecipe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'recipe' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Recipe extends BaseRecipe
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/RecipeProducts.php
Normal file
20
local/modules/Recettes/Model/RecipeProducts.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\RecipeProducts as BaseRecipeProducts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'recipe_products' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RecipeProducts extends BaseRecipeProducts
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/RecipeProductsQuery.php
Normal file
20
local/modules/Recettes/Model/RecipeProductsQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\RecipeProductsQuery as BaseRecipeProductsQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'recipe_products' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RecipeProductsQuery extends BaseRecipeProductsQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/RecipeQuery.php
Normal file
20
local/modules/Recettes/Model/RecipeQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\RecipeQuery as BaseRecipeQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'recipe' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RecipeQuery extends BaseRecipeQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/RecipeSteps.php
Normal file
20
local/modules/Recettes/Model/RecipeSteps.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\RecipeSteps as BaseRecipeSteps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'recipe_steps' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RecipeSteps extends BaseRecipeSteps
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
20
local/modules/Recettes/Model/RecipeStepsQuery.php
Normal file
20
local/modules/Recettes/Model/RecipeStepsQuery.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Recettes\Model;
|
||||||
|
|
||||||
|
use Recettes\Model\Base\RecipeStepsQuery as BaseRecipeStepsQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'recipe_steps' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RecipeStepsQuery extends BaseRecipeStepsQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,12 +2,25 @@
|
|||||||
|
|
||||||
namespace Recettes;
|
namespace Recettes;
|
||||||
|
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
|
use Thelia\Install\Database;
|
||||||
|
|
||||||
|
|
||||||
class Recettes extends BaseModule
|
class Recettes extends BaseModule
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
const DOMAIN_NAME = 'recettes';
|
const DOMAIN_NAME = 'recettes';
|
||||||
const MESSAGE_DOMAIN = 'recettes';
|
const MESSAGE_DOMAIN = 'recettes';
|
||||||
|
const MOT_CLE_RECETTE = 'recette';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ConnectionInterface|null $con
|
||||||
|
*/
|
||||||
|
public function postActivation(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$database = new Database($con->getWrappedConnection());
|
||||||
|
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
{loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"}
|
||||||
|
{assign var="title" value=$TITLE}
|
||||||
|
{assign var="people" value=$PEOPLE}
|
||||||
|
{assign var="difficulty" value=$DIFFICULTY}
|
||||||
|
{assign var="preparation_time" value=$PREPARATION_TIME}
|
||||||
|
{assign var="cooking_time" value=$COOKING_TIME}
|
||||||
|
{/loop}
|
||||||
|
|
||||||
<div id="wrapper" class="container">
|
<div id="wrapper" class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{form name="recette_create_form"}
|
{form name="recette_create_form"}
|
||||||
@@ -8,7 +16,7 @@
|
|||||||
{form_field form=$form field="content_id"}
|
{form_field form=$form field="content_id"}
|
||||||
<input type="hidden" name="{$name}" value="{$content_id}">
|
<input type="hidden" name="{$name}" value="{$content_id}">
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
<br>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
||||||
{form_field form=$form field="title"}
|
{form_field form=$form field="title"}
|
||||||
@@ -18,7 +26,7 @@
|
|||||||
{if $required}<span class="required">*</span>{/if}
|
{if $required}<span class="required">*</span>{/if}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" class="form-control large" name="{$name}" value="" {if $required}required{/if} /> 
|
<input type="text" id="{$label_attr.for}" class="form-control large" name="{$name}" value="{$title}" {if $required}required{/if} /> 
|
||||||
</div>
|
</div>
|
||||||
{form_error form=$form field="title"}{$message}{/form_error}
|
{form_error form=$form field="title"}{$message}{/form_error}
|
||||||
{/form_field}
|
{/form_field}
|
||||||
@@ -30,11 +38,10 @@
|
|||||||
{intl l=$label d='recettes'}
|
{intl l=$label d='recettes'}
|
||||||
{if $required}<span class="required">*</span>{/if}
|
{if $required}<span class="required">*</span>{/if}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<select id="{$label_attr.for}" name="{$name}">
|
<select id="{$label_attr.for}" name="{$name}">
|
||||||
<option value=0>Facile</option>
|
<option value="0" {if $difficulty eq 0}selected{/if}>Facile</option>
|
||||||
<option value=1>Moyen</option>
|
<option value="1" {if $difficulty eq 1}selected{/if}>Moyen</option>
|
||||||
<option value=2>Difficile</option>
|
<option value="2" {if $difficulty eq 2}selected{/if}>Difficile</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
{form_error form=$form field="difficulty"}{$message}{/form_error}
|
{form_error form=$form field="difficulty"}{$message}{/form_error}
|
||||||
@@ -59,7 +66,7 @@
|
|||||||
{intl l=$label d='recettes'}
|
{intl l=$label d='recettes'}
|
||||||
{if $required}<span class="required">*</span>{/if}
|
{if $required}<span class="required">*</span>{/if}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="" {if $required}required{/if} /> 
|
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$preparation_time}" {if $required}required{/if} /> 
|
||||||
<span class="help-block">{$label_attr.help}</span>
|
<span class="help-block">{$label_attr.help}</span>
|
||||||
</div>
|
</div>
|
||||||
{form_error form=$form field="preparation_time"}{$message}{/form_error}
|
{form_error form=$form field="preparation_time"}{$message}{/form_error}
|
||||||
@@ -71,7 +78,7 @@
|
|||||||
<label class="control-label" for="{$label_attr.for}">
|
<label class="control-label" for="{$label_attr.for}">
|
||||||
{intl l=$label d='recettes'}
|
{intl l=$label d='recettes'}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="" /> 
|
<input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$cooking_time}" /> 
|
||||||
<span class="help-block">{$label_attr.help}</span>
|
<span class="help-block">{$label_attr.help}</span>
|
||||||
</div>
|
</div>
|
||||||
{form_error form=$form field="cooking_time"}{$message}{/form_error}
|
{form_error form=$form field="cooking_time"}{$message}{/form_error}
|
||||||
@@ -83,7 +90,7 @@
|
|||||||
{intl l=$label d='recettes'}
|
{intl l=$label d='recettes'}
|
||||||
</label>
|
</label>
|
||||||
{if $required}<span class="required">*</span>{/if}
|
{if $required}<span class="required">*</span>{/if}
|
||||||
<textarea id="attr-recipe" name="{$name}" rows="10" class="form-control wysiwyg">{$value}</textarea>
|
<textarea id="attr-recipe" name="{$name}" rows="10" class="form-control wysiwyg">{$steps}</textarea>
|
||||||
</div>
|
</div>
|
||||||
{form_error form=$form field="steps"}{$message}{/form_error}
|
{form_error form=$form field="steps"}{$message}{/form_error}
|
||||||
{/form_field}
|
{/form_field}
|
||||||
@@ -99,7 +106,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-primary">{intl l="Save" d="recettes"}</button>
|
<button type="submit" class="btn btn-primary">{intl l="Save" d="recettes"}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
article#recette {
|
||||||
|
width: 90% !important;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.entete {
|
||||||
|
background-color: #95c11e;
|
||||||
|
color: white;
|
||||||
|
width: auto;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.entete img {
|
||||||
|
width: 30px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
div.entete span {
|
||||||
|
margin-right: 40px;
|
||||||
|
padding: 10px 10px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
div.entete span b {
|
||||||
|
color: #0e0e0e;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><title>Cellular</title><rect x='416' y='96' width='64' height='320' rx='8' ry='8' fill='none' stroke='currentColor' stroke-linejoin='round' stroke-width='32'/><rect x='288' y='176' width='64' height='240' rx='8' ry='8' fill='none' stroke='currentColor' stroke-linejoin='round' stroke-width='32'/><rect x='160' y='240' width='64' height='176' rx='8' ry='8' fill='none' stroke='currentColor' stroke-linejoin='round' stroke-width='32'/><rect x='32' y='304' width='64' height='112' rx='8' ry='8' fill='none' stroke='currentColor' stroke-linejoin='round' stroke-width='32'/></svg>
|
||||||
|
After Width: | Height: | Size: 653 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><title>Thermometer</title><path d='M307.72 302.27a8 8 0 01-3.72-6.75V80a48 48 0 00-48-48h0a48 48 0 00-48 48v215.52a8 8 0 01-3.71 6.74 97.51 97.51 0 00-44.19 86.07A96 96 0 00352 384a97.49 97.49 0 00-44.28-81.73zM256 112v272' fill='none' stroke='currentColor' stroke-linecap='round' stroke-miterlimit='10' stroke-width='32'/><circle cx='256' cy='384' r='48'/></svg>
|
||||||
|
After Width: | Height: | Size: 441 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'><title>Timer</title><path d='M112.91 128A191.85 191.85 0 0064 254c-1.18 106.35 85.65 193.8 192 194 106.2.2 192-85.83 192-192 0-104.54-83.55-189.61-187.5-192a4.36 4.36 0 00-4.5 4.37V152' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32'/><path d='M233.38 278.63l-79-113a8.13 8.13 0 0111.32-11.32l113 79a32.5 32.5 0 01-37.25 53.26 33.21 33.21 0 01-8.07-7.94z'/></svg>
|
||||||
|
After Width: | Height: | Size: 492 B |
59
templates/frontOffice/custom/recette.html
Normal file
59
templates/frontOffice/custom/recette.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{extends file="layout.tpl"}
|
||||||
|
|
||||||
|
{block name='init'}
|
||||||
|
{assign var="content_id" value={content attr="id"}}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{* Body Class *}
|
||||||
|
{block name="body-class"}page-content{/block}
|
||||||
|
|
||||||
|
{* Page Title *}
|
||||||
|
{block name='no-return-functions' append}
|
||||||
|
{if {$content_id}}
|
||||||
|
{$page_title = $TITLE}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{* Breadcrumb *}
|
||||||
|
{block name='no-return-functions' append}
|
||||||
|
{if $content_id}
|
||||||
|
{$breadcrumbs = []}
|
||||||
|
{loop type="content" name="content-breadcrumb" id=$content_id limit="1"}
|
||||||
|
{loop name="folder_path" type="folder-path" folder={$DEFAULT_FOLDER}}
|
||||||
|
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL nofilter}]}
|
||||||
|
{/loop}
|
||||||
|
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL nofilter}]}
|
||||||
|
{/loop}
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="main-content"}
|
||||||
|
{if $content_id}
|
||||||
|
<div class="main row">
|
||||||
|
<article id="recette" class="col-md-12" role="main">
|
||||||
|
|
||||||
|
{loop type="recipe" name="recipe-loop" content_id=$content_id limit="1"}
|
||||||
|
{if $DIFFICULTY eq 0}{assign var="label_difficulty" value="Facile"}{/if}
|
||||||
|
{if $DIFFICULTY eq 1}{assign var="label_difficulty" value="Moyen"}{/if}
|
||||||
|
{if $DIFFICULTY eq 2}{assign var="label_difficulty" value="Difficile"}{/if}
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="titre-recette">{$TITLE}</h1>
|
||||||
|
<div class="entete col-md-12">
|
||||||
|
<span class="preparation"><b>{intl l='Preparation time' d='recettes'}</b><img src="{image file='assets/img/timer.svg' source='Recettes'}" alt="Preparation time">{$PREPARATION_TIME}</span>
|
||||||
|
<span class="cuisson"><b>{intl l='Cooking time' d='recettes'}</b><img src="{image file='assets/img/thermometer.svg' source='Recettes'}" alt="Cooking time">{$COOKING_TIME}</span>
|
||||||
|
<span class="difficulte"><b>{intl l='Difficulty' d='recettes'}</b><img src="{image file='assets/img/cellular.svg' source='Recettes'}" alt="Difficulty">{$label_difficulty}</span>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
{/loop}
|
||||||
|
|
||||||
|
</article>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="stylesheet"}
|
||||||
|
{hook name="content.stylesheet"}
|
||||||
|
{/block}
|
||||||
Reference in New Issue
Block a user