klimeryk / recalendar

ReCalendar - highly customizable calendar for ReMarkable tablets
GNU General Public License v3.0
197 stars 23 forks source link

error regarding cells blocktag #6

Closed k-byte-rgb closed 3 years ago

k-byte-rgb commented 3 years ago

Notice: Trying to access array offset on value of type null in C:\Users\me\Downloads\recalendar-main\recalendar-main\vendor\mpdf\mpdf\src\Tag\BlockTag.php on line 117 PHP Fatal error: Uncaught Mpdf\MpdfException: Error detected. PDF file generation aborted: Trying to access array offset on value of type null in C:\Users\me\Downloads\recalendar-main\recalendar-main\vendor\mpdf\mpdf\src\Tag\BlockTag.php:117

the error points to this code:

if ($this->mpdf->cell[$this->mpdf->row][$this->mpdf->col]['s'] > 0 && !$this->mpdf->nestedtablejustfinished)

i have checked ins and outs of tags thats fine.

klimeryk commented 3 years ago

Thanks for the report, @k-byte-rgb! Could you provide your local.config.php or any other local modifications you've made to the code? Or any other steps that can help me reproduce this issue 🙏

k-byte-rgb commented 3 years ago

as asked the config file:

<?php

namespace ReCalendar;

class Config {
    public const DAY_NAMES_SHORT = 'day_names_short';
    public const DAY_ITINERARY_ITEMS = 'day_itinerary_items';
    public const DAY_ITINERARY_COMMON = 'day_itinerary_common';
    public const DAY_ITINERARY_WEEK_RETRO = 'day_itinerary_week_retro';
    public const DAY_ITINERARY_MONTH_OVERVIEW = 'day_itinerary_month_overview';
    public const FORMAT = 'format';
    public const HABITS = 'habits';
    public const HABITS_TITLE = 'habits_title';
    public const LOCALE = 'locale';
    public const MONTH = 'month';
    public const MONTH_COUNT = 'month_count';
    public const MONTHS = 'months';
    public const WEEK_NAME = 'week_name';
    public const WEEK_NUMBER = 'week_number';
    public const WEEKLY_RETROSPECTIVE_BOOKMARK = 'weekly_retrospective_bookmark';
    public const WEEKLY_RETROSPECTIVE_TITLE = 'weekly_retrospective_title';
    public const WEEKLY_TODOS = 'weekly_todos';
    public const WEEKLY_TODO = 'weekly_todo';
    public const DAYLY_TODOS = 'dayly_todos';
    public const MONTHLY_TODOS = 'month_todos';
    public const DAY_TODOS_COMMON = 'day_todos_common';
    public const SPECIAL_DATES = 'special_dates';
    public const YEAR = 'year';
    public const EASTER = 'easter'; 
    public const DAY_GRATITUDE_ITEMS = 'day_gratitude_items'; 
    public const DAY_GRATITUDE_COMMON = 'day_gratitude_common'; 
    public const DAY_SELF_LOVE_ITEMS = 'day_self_love_items'; 
    public const DAY_SELF_LOVE_COMMON = 'day_self_love_common'; 

    public function get( string $key ) {
        return $this->get_configuration()[ $key ] ?? null;
    }

    protected function get_configuration() : array {
        $configuration = [
            // Used in the small calendar in the upper right corner of most pages
            // Please try to use a 2 character abbreviations to save space on the page
            self::DAY_NAMES_SHORT => [
                'Mo',
                'Tu',
                'We',
                'Th',
                'Fr',
                'Sa',
                'Su',
            ],
            // Items for each page type
            // The format is: [ NUMBER OF LINES, NAME (optional) ]
            // You might need to adjust the number of lines depending on your config (locale, font size, etc.)
        self::DAYLY_TODOS => [
                self::DAY_TODOS_COMMON => [
                [ 23, ''],
                ],
                self::WEEKLY_TODOS => [
                [ 1, ' ' ],
                ],
                self::MONTHLY_TODOS => [
                [ 1, ' ' ],
                ],
            ],
            self::DAY_GRATITUDE_ITEMS => [
                self::DAY_GRATITUDE_COMMON => [

                [ 3, 'today I\'m gratefull for:' ],
                [ 2, 'people I\'m gratefull for:' ],
                ],
            ],
            self::DAY_SELF_LOVE_ITEMS => [
                self::DAY_SELF_LOVE_COMMON => [
                [ 3, 'Something I\'m look forward to:' ],
                [ 3, 'what would make today amazing:' ],

                [ 4, '3 things i like to try:' ],
                [ 3, '2 things i learned today:' ],
                [ 3, 'what would make today greater:' ],
                [ 3, 'best moments of my day:' ],
                [ 3, 'tomorrow I\'m looking forward to:' ],

                ],

            self::DAY_ITINERARY_ITEMS => [
                // Common itinerary used if nothing more specific was defined
                self::DAY_ITINERARY_COMMON => [
                    [ 1, '&nbsp;&nbsp;6:00:' ],
                    [ 1, '&nbsp;&nbsp;6:30:' ],
                    [ 1, '&nbsp;&nbsp;7:00:-Ontbijt' ],
                    [ 1, '&nbsp;&nbsp;7:30:' ],
                    [ 1, '&nbsp;&nbsp;8:00:' ],
                    [ 1, '&nbsp;&nbsp;8:30:' ],
                    [ 1, '&nbsp;&nbsp;9:00:' ],
                    [ 1, '&nbsp;&nbsp;9:30:' ],
                    [ 1, '10:00:' ],
                    [ 1, '10:30:' ],
                    [ 1, '11:00:' ],
                    [ 1, '11:30:' ],                    
                    [ 1, '12:00: - Lunch' ],
                    [ 1, '12:30:' ],
                    [ 1, '13:00:' ],
                    [ 1, '13:30:' ],
                    [ 1, '14:00:' ],
                    [ 1, '14:30:' ],
                    [ 1, '15:00:' ],
                    [ 1, '15:30:' ],
                    [ 1, '16:00:' ],
                    [ 1, '16:30:' ],
                    [ 1, '17:00:' ],
                    [ 1, '17:30: - avond eten' ],
                    [ 1, '18:00:' ],
                    [ 1, '18:30:' ],
                    [ 1, '19:00:' ],
                    [ 1, '19:30:' ],
                    [ 1, '20:00:' ],
                    [ 1, '20:30:' ],
                    [ 1, '21:00:' ],
                    [ 1, '21:30:' ],
                    [ 1, '22:00:' ],

                ],
                // Itinerary for the weekly retrospective
                self::DAY_ITINERARY_WEEK_RETRO => [
                    [ 24, '' ],
                ],
                // Itinerary for the month's overview
                self::DAY_ITINERARY_MONTH_OVERVIEW => [
                    [ 16, '' ],
                ],
            ],
            // A list of habits that triggers generating a table on the month's overview
            // to help tracking those habits
            self::HABITS => [
            ],
            // Title for the habits table on month overview
            self::HABITS_TITLE => 'Habits',
            // This is the exact size (in mm) of the ReMarkable 2 screen
            // You might want to adjust it to your device's size
            // See https://mpdf.github.io/reference/mpdf-functions/construct.html for possible values
            self::FORMAT => [ 157, 209 ],
            // Locale to generate the calendar in
            // To check which locale your PHP version supports run:
            // `locale -a` in your terminal (at least on Linux and MacOS)
            // Note that you will still need to override some configuration variables, like `WEEK_NAME`, etc.
            self::LOCALE => 'en_US.UTF-8',//United States
            //self::LOCALE => 'nld_nld.UTF-8',//nederland
            // The month from which to start the "year"
            // Useful if you want to track your college year, for example.
            // You could then set this to 10 (October) and the calendar
            // would then be generated for 12 months starting from October.
            self::MONTH => 1,
            // The number of months you want this calendar to be for.
            // Useful if you want a calendar for the quarter (3) or a 15 month calendar.
            self::MONTH_COUNT => 12,
            // Title of the Week overview page
            self::WEEK_NAME => 'Week',
            // A short version of "Week Number" used in the header of the small calendar in upper right corner of the page
            self::WEEK_NUMBER => 'W',
            // Used for the bookmark of the weekly retrospective pages
            self::WEEKLY_RETROSPECTIVE_BOOKMARK => 'Retrospective',
            // Used for the title of the weekly retrospective pages
            self::WEEKLY_RETROSPECTIVE_TITLE => 'Weekly retrospective',
            // A list of items you'd like to be listed in the notes of the weekly overview

            // A list of special dates (anniversaries, birthdays, holidays) that will be highlighted throughout the calendar:
            // in the small calendar, on weekly overviews and daily entries.
            self::SPECIAL_DATES => [
                // Example:
                // '01-01' => "New Year!",
                // '01-04' => "April Fools' Day",
                '01-01' => [ 'New Years\'!' ],

                '14-02' => [ 'Valentine\'s Day' ],

                self::EASTER => [ 'pasen' ],

                        '25-12' => [ 'eerste kerstdag' ],
                '26-12' => [ 'tweede kerstdag' ],
                '31-12' => [ 'oudjaarsdag'],
            ],

            // The year for which to generate this calendar.
            // Defaults to the current year.
            self::YEAR => (int) date( 'Y' ),
        ];

        // Get the names of the months in the set locale.
        // This might useful for non-English locales (like Polish), that apparently
        // have their names decilned in the locale provided by the system, while
        // you'd probably want a non-declined version.
        // Example: 'stycznia' instead of 'Styczeń' for January in Polish.
        $configuration[ self::MONTHS ] = $this->generate_month_names( $configuration[ self::LOCALE ] );

        return $configuration;
    }

    private function generate_month_names( string $locale ) : array {
        $old_locale = setlocale( LC_TIME, 0 );
        setlocale( LC_TIME, $locale );

        $start = new \DateTimeImmutable( 'first day of january' );
        $interval = new \DateInterval( 'P1M' );
        $end = new \DateTimeImmutable( 'last day of december' );
        $period = new \DatePeriod( $start, $interval, $end );
        $month_names = [];
        foreach ( $period as $index => $month ) {
            $month_names[ $index + 1 ] = strftime( '%B', $month->getTimestamp() );
        }

        setlocale( LC_TIME, $old_locale );
        return $month_names;
    }

}

for the styling to fit in one page this is needed:

table {
    border-collapse: collapse;
}

a {
    text-decoration: none;
    color: inherit;
}

.title-page {
    width: 100%;
    text-align: right;
    padding-right: 100px;
    padding-top: 400px;
    line-height: 30px;
}

.title-page__year {
    font-weight: bold;
    font-size: 90pt;
}

.title-page__recalendar {
    font-size: 15pt;
    color: #999;
}

.ui-datepicker-header {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #888;
}

.ui-datepicker-calendar {
    font-size: 10pt;
    width: 100%;
    text-align: center;
}

.calendar-week.highlight-week {
    background-color: #CCC;
}

.calendar-day {
    color: black;
    text-decoration: none;
    display: block;
    margin: auto;
    width: 15px;
    height: 15px;
    line-height: 15px;
    border: none;
}

.calendar-day.first-week {
    border-top: 1px solid black;
}

.calendar-day.weekend-day {
    font-weight: bold;
}

.calendar-day.highlight-day {
    background-color: #CCC;
}

.calendar-day.special-date {
    border: 1px solid #555;
}

.calendar-day.other-month {
    color: #999;
}

.calendar-box {
    border-left: 1px solid black;
    padding: 0px 10px 5px 10px;
    width: 100px;
    border-bottom: 1px solid black;
}

.calendar__week-number {
    border-right: 1px solid black;
}

th.calendar__week-number,
th.calendar__week-retrospective {
    border-bottom: 1px solid black;
}

td.calendar__week-number,
td.calendar__week-retrospective {
    color: #888;
}

.calendar__week-retrospective {
    border-left: 1px solid black;
}

td.calendar__week-number {
    color: #888;
}

.calendar__previous-month,
.calendar__next-month {
    color: #AAA;
    font-size: 18px;
    font-weight: bold;
}

.calendar__full-month-name {
    color: black;
    letter-spacing: 1px;
    font-size: 12pt;
}

.header-line {
    text-align: right;
    text-transform: uppercase;
    font-size: 20pt;
    padding-right: 10px;
}

.header-type {
}

.year-overview__title {
    text-align: center;
    font-size: 60pt;
    padding-top: 30px;
    margin-bottom: 20px;
}

.year-overview__calendars {
    width: 100%;
}

.year-overview__row {
}

.year-overview__calendar {
    vertical-align: top;
    padding: 5px;
}

.month-overview__month-name {
    text-transform: uppercase;
    font-size: 35pt;
    font-weight: bold;
}

.month-overview__habit-header {
    width: 22px;
    border-bottom: 1px solid #999;
    border-right: 1px solid #999;
    border-left: 1px solid #999;
}

.month-overview__habit-header.name {
    text-transform: capitalize;
    font-weight: normal;
    font-size: 7pt;
}

.month-overview__habit-header.disabled {
    background: white;
    border: 1px solid white;
}

.month-overview__habit-header.weekend,
.month-overview__habit-box.weekend {
    background: #EEE;
}

.month-overview__habit-name {
    border-top: 1px solid #999;
    border-bottom: 1px solid #999;
    font-weight: bold;
    width: 100px;
    height: 20px;
}

.month-overview__habit-box {
    border: 1px solid #999;
}

.month-overview__habit-box.disabled {
    background: white;
    border: 1px solid white;
}

.day-entry__month-name,
.week-overview__week-name,
.week-retrospective__week-name {
    text-align: right;
    font-size: 18pt;
    text-transform: uppercase;
    padding-top: 35px;
}

.week-retrospective__week-name {
    padding-top: 12px;
}

.week-overview__day-of-week {
    color: #333;
}

.day-entry__day-number,
.week-overview__day-number,
.week-retrospective__day-number {
    width: 90px;
    text-align: center;
    font-size: 50pt;
    font-weight: bold;
    padding: 0;
    margin: 0;
}

.day-entry__special-items {
    vertical-align: bottom;
    font-style: italic;
    font-size: 10pt;
    padding: 10px;
}

.day-entry__special-item {
}

.day-entry__day-of-week {
    vertical-align: bottom;
}

.day-entry__previous-day,
.day-entry__next-day,
.week-overview__previous-week,
.week-overview__next-week,
.week-retrospective__previous-week,
.week-retrospective__next-week {
    font-size: 20pt;
    color: #AAA;
    width: 22px;
}

.day-entry__previous-day,
.week-overview__previous-week,
.week-retrospective__previous-week {
    padding-left: 10px;
}

.day-entry__next-day,
.week-overview__next-week,
.week-retrospective__next-week {
    padding-right: 10px;
}

.content-box {
    width: 100%;
}

.content-box-line {
    width: 50%;
    border-bottom: 1px solid #AAA;
    height: 12pt;
    padding: 0 0 0 10px;
    font-size: 10pt;
    font-style: italic;
    //font-weight: bold;
    //text-transform: uppercase;
}

.week-overview__day-entry {
    border: 1px dotted black;
    width: 33%;
    vertical-align: top;
    padding: 5px;
}

.week-overview__day-of-week {
    width: 50%;
    font-size: 12pt;
    font-weight: bold;
    text-transform: capitalize;
}

.week-overview__date {
    text-align: right;
    width: 50%;
    text-transform: uppercase;
    font-size: 12pt;
}

.week-overview__notes {
    vertical-align: top;
    font-style: italic;
    font-size: 10pt;
    padding: 10px;
}

.week-overview__special-item {
    font-size: 10pt;
}

.week-overview__range,
.week-retrospective__range {
    text-transform: uppercase;
    font-size: 18pt;
    border-bottom: 1px solid black;
}
k-byte-rgb commented 3 years ago

i already can generate a compleet file just giving this error while generating. line 117 in blocktag

k-byte-rgb commented 3 years ago

it has something to do with day entry generator te stuf i put in.

k-byte-rgb commented 3 years ago

is it because the lable has a separed row `

                <td class="beoordeling" style="vertical-align:top; height:10px; width:55%;border-bottom: 1px dashed black; border-right: 1px solid black; padding: 0; margin: 0;"><b>dag&nbsp;beoordeling: </b></td>

                <!-- waterbottles to check if i drank water -->
                <td class="water" style="vertical-align:top;height:10px; width:45%; border-bottom: 1px dashed black; border-right: 1px solid black; padding: 0; margin: 0;"><b>watertoken:</b></td>
        </tr>
        <tr>
                <!-- dag beoordeling  to check -->
                <td class="beoordeling"  style="vertical-align:top;border-bottom: 1px solid black; border-right: 1px solid black; padding: 0; margin: 0;width:55%;height:35px;">

                <input id="beoordeling1" type="checkbox"/>
                <label for="beoordeling1"></label>

                <input id="beoordeling2" type="checkbox"/>
                <label for="beoordeling2" ></label>

                <input id="beoordeling3" type="checkbox"/>
                <label for="beoordeling3"></label>

                <input id="beoordeling4" type="checkbox"/>
                <label for="beoordeling4" ></label>

                <input id="beoordeling5" type="checkbox"/>
                <label for="beoordeling5" ></label>

                </td>

                <!-- waterbottles to check if i drank water -->

                <td class="water" style="vertical-align:top; border-bottom: 1px solid black; border-right: 1px solid black; padding: 0; margin: 0;width:45%; height:35px;">

                <input id="water1" type="checkbox"/>
                <label for="water1"></label>

                <input id="water2" type="checkbox"/>
                <label for="water2" ></label>

                <input id="water3" type="checkbox"/>
                <label for="water3"></label>

                <input id="water4" type="checkbox"/>
                <label for="water4" ></label>

                <input id="water5" type="checkbox"/>
                <label for="water5" ></label>

                </td>

            </tr>   `
klimeryk commented 3 years ago

The code in the repository is not generating checkboxes - it must some of your local modifications. Unfortunately I cannot help with such a modified version. Good luck figuring it out, though! 🤞