Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi,

    in

    app/helper/class-ai1ec-calendar-helper.php

    there are some lines of code calculating $now for the agenda view:

    case 'agenda':
                                            // Find out how many event instances are between today's first
                                            // instance and the desired event's instance
                                            $now = $ai1ec_events_helper->local_to_gmt( time() );

    You would have to subract the seconds went by the current day from $now.

    $s_today=modulo($now,(24*60*60));
    $earlymorning=$now-$s_today;
    $now=earlymorning; // just pretend all events of today will be in the future

    Maybe that could be turned into an option? I was just hacking this for the widget function in app/view/class-ai1ec-agenda-widget.php
    such that todays agenda will stay the whole day and even show what was missed…

    it should read: $now=$earlymorning;

    Of course, with some appropriate modulo function:

    function modulo($n, $m)
    {
       $r = $n % $m;
       return $r < 0 ? $r + abs($m) : $r;
    }

    Thread Starter sg1_anhell

    (@sg1_anhell)

    Hi, thanks for replying, I tried to understand what you tell me and I put the code in this way, but I think I have not understood very well or there is something wrong with the code:

    [50 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Hi,

    you were right, there is another pice of code which would need to be changed: in
    app/controller/class-ai1ec-calendar-controller.php
    you need to add similar code in function get_agenda_view() just before it calls get_events_relative_to(...). It should be relative to early in the morning:

    function get_agenda_view( $args )
            {
                    global $ai1ec_view_helper,
                           $ai1ec_events_helper,
                           $ai1ec_calendar_helper,
                           $ai1ec_settings;
    
                    extract( $args );
    
                    // Get localized time
                    $timestamp = $ai1ec_events_helper->gmt_to_local( time() );
    
    function modulo($n, $m)
    {
       $r = $n % $m;
       return $r < 0 ? $r + abs($m) : $r;
    }
    
    $s_today=modulo($timestamp,(24*60*60));
    $timestamp-=$s_today;
    
                    // Get events, then classify into date array

    This time I did test the patch. Works 4 me. Would be nice to have all this as an option, of course…

    Thread Starter sg1_anhell

    (@sg1_anhell)

    Yess!!!! Works! ??

    but as I can do the same with the widget?
    I thought that making this change in the general codes also work in the Widget, but no .. : S

    Thanks por help me ??

    Hi,

    to avoid similar code it might be wise to introduce a

    function gmt_to_local_morning( $timestamp )

    next to

    function gmt_to_local( $timestamp )

    which would include subtracting the seconds of the current day.

    In the function widget you need it before calling get_events_relative_to().

    Thread Starter sg1_anhell

    (@sg1_anhell)

    Forgive my ignorance but I have little knowledge of PHP, just the basics.
    I tried but I can not understand to do or how to do it. Can you tell me if possible what is the code that I put and where should I put it?
    I would be very grateful!
    Thank you very much ??

    In app/view/class-ai1ec-agenda-widget.php there is a function widget, which would need just one additional line:

    `
    […]
    // Get localized time
    $timestamp = $ai1ec_events_helper->gmt_to_local( time() );

    $timestamp-=modulo($timestamp,(24*60*60));

    // Set $limit to the specified category/tag
    […]
    `

    You might not need to define modulo again if it’s in the helper script allready.

    P.S. Just put the code of the helper function modulo outside the class definition, i.e. at the top of class-ai1ec-calendar-helper.php, such that all other functions can use it.

    Then it’s just a simple code line at the locations mentioned allreday:

    app/controller/class-ai1ec-calendar-controller.php:
    $timestamp-=modulo($timestamp,(24*60*60));
    
    app/helper/class-ai1ec-calendar-helper.php:
    $now-=modulo($now,(24*60*60));
    
    app/view/class-ai1ec-agenda-widget.php:
    $timestamp-=modulo($timestamp,(24*60*60));

    Thread Starter sg1_anhell

    (@sg1_anhell)

    I made ??the changes as you said, I think.

    But as you can see now the calendar not works and has created a loop:
    https://www.esodecimostodos.com/

    Maybe I have some piece of code in the wrong place, I think it will be easier if you step in a zip folder:

    https://www.esodecimostodos.com/sg1_anhell-all-in-one-event-calendar.zip

    Strange. I made the changes I suggested as well and it works like a charm: events of the current day remain on the calendar until midnight.
    If you need this for your business it might be an option for you to support the developement of an official option patch for this feature? It would be cool if there would be a checkbox for it. Since the solution is allready here professional support from the official developers should not be expensive.

    Advantage: the next wordpress update will not destroy those changes.
    Yani.iliev might help you in this respect:
    https://profiles.www.ads-software.com/users/yani.iliev/

    P.S. I enjoy and stronly support free and open source software but if this software is used for business it should be ok to give something back for professional support.

    Thread Starter sg1_anhell

    (@sg1_anhell)

    Okay, I’ll try again, maybe there’s a little thing done wrong,

    My site is not a business, is a free blog so I can not have expenses.

    I will try and tell you, wish me luck ??

    Thank you very much for your help ??

    There was a time .com was used for commerial stuff. Good luck!

    Thread Starter sg1_anhell

    (@sg1_anhell)

    Hello again ??

    You can send me your folder “app” of the plugin with this changes please?
    to: [email protected],

    Then I can compare what I did wrong;)

    Thank you very much!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: All-in-One Event Calendar] Today's events are not displayed’ is closed to new replies.