<?php

namespace Lycoreco\Apps\Recipes\Controllers;

use Lycoreco\Apps\Recipes\Models\RecipeUserMenu;
use Lycoreco\Includes\BaseController;

require_once(INCLUDES_PATH . '/Const/recipes.php');

class DailyMealsController extends BaseController
{
    protected $template_name = APPS_PATH . '/Recipes/Templates/daily-meals.php';

    protected $allow_role = 'user';

    function get_context_data() {
        $context = parent::get_context_data();

        $context['weeks'] = array();

        foreach (DAYS_OF_WEEK as $week) {
            $context['weeks'][$week] = RecipeUserMenu::get_prefetch_recipes(CURRENT_USER, $week);
        }

        return $context;
    }
}