paint the background-color of the holidays in a fullcalendar

-1

I am implementing the Fullcalendar widget in yii2 but I have not been able to paint the background-color of the holidays and Sundays. I do not know who can help me, I have a lot of time looking for a guide but I could not thank you

    
asked by jenny gamez 17.11.2017 в 22:24
source

2 answers

0

You must add the properties "rendering: 'background'" and "color: '#XXXXXX'", as follows:

$(document).ready(function() {
        $('#calendar').fullCalendar({
            defaultDate: '2017-11-17',
            events: [
                {
                    start: '2017-11-24',
                    end: '2017-11-24',
                    overlap: false,
                    rendering: 'background',
                    color: '#ff9f89'
                }
            ]
        });
    });

    
answered by 17.11.2017 в 22:52
0

I am thankful for the answer, but if I have it in the following way

<?=
edofre\fullcalendar\Fullcalendar::widget([
    'options' => [
        'id' => 'calendar',
        'language' => 'es',
    ],
    'clientOptions' => [
        'weekNumbers' => true,
        'selectable' => true,
        'selectHelper' => false, // Permite seleccionar la un rango de hora desde el mismo calendario
        'editable' => true, // Permite mover la tarea en cualquier dia de la semana en cual quier rango de hora
        'defaultView' => 'agendaWeek',
    ],
    'events' => $events,
]);
?>

$ events come from controller query

public function actionIndex() {
    $programaciones = Programadores::find()->all();
    $tasks = [];
    foreach ($programaciones as $programacion) {
        $programacions = new \edofre\fullcalendar\models\Event();

        $programacions->id = $programacion->idProgramador;

        switch ($programacion->tipo) {
            // 1 son cursos osea Academico
            case 1:
                $color = '#ffffff';
                break;
            // 2 son proyectos osea Investigación
            case 2:
                $color = '#82f142';
                break;
            case 3:
                $color = '#ffff0f';
                break;
            case 4:
                $color = '#eeeeeb';
                break;
            default:
                $color = '#9999999';
                break;
        }


        $programacions->backgroundColor = $color;
        $programacions->textColor = '#000000';
        $programacions->title = $programacion->idProgramador;
        $programacions->start = $programacion->fechaInicio;
        $programacions->end = $programacion->fechaFin;
        $tasks[] = $programacions;
    }

    return $this->render('index', [
                'events' => $tasks,
    ]);
}

How could I charge the holidays to paint them in another color?

    
answered by 19.11.2017 в 19:39