Move date output at the top instead of the footer

I would like to move the data and arrow output to the top of the Calendar Upcoming widget. I know I need to edit class_eab_calendar_helper.php but I've tried moving various code pieces around to no avail. Anyone know what to move and where?

  • PC

    Hey @ThatGD

    Thanks for posting back and sorry for the delay. I was away for the weekend for a family wedding.

    I believe I need to somehow move the output controlled by lines 520 - 582 of /lib/class_eab_calendar_helper.php to before (or within) the output controlled by lines 125 - 131.

    That file does not contain 520 lines in total. I see only 454 lines there.

    Let me see if I can get some info from our lead developer @Vladislav on this piece.

    Cheers, PC

  • ThatGD

    Sorry - my ftp program had added blank spaces onto each line of code. Damn ftp program.

    Anyways to revise my previous statement:

    I believe I need to somehow move the output controlled by lines 261 - 292 of /lib/class_eab_calendar_helper.php to before (or within) the output controlled by lines 63 - 66

    Sorry about that. As a bonus, if you know of any way I can easily get those blank spaces removed please advise. :slight_smile:

  • Vladislav

    Hello,

    If you want to entirely move the widget navigation row to the top, you can simply rename the "_get_last_row" method of Eab_CalendarTable_UpcomingCalendarWidget class (line 263) to "_get_first_row". If you want to replicate it instead, you can add a new method with this name, like this:

    protected function _get_first_row () {
    	return $this->_get_last_row();
    }

    Please, note that this will add the navigation below the THEAD weekdays legend.

  • PC

    Hey @ThatGD

    Thanks for posting back

    After trying to get it to appear above the THEAD and failing - I'm assuming it's just not designed that way?

    I'll sell it to the client - they'll probably live with it but wondering if it's something simple to get it to appear above the THEAD?

    Let me get @Vladislav to comment on that one

    (Hope you enjoyed the wedding @PC)

    Yeah, I enjoyed a lot. however as a return gift, I got over 200 items in my feed to respond to :smiley: lol

    Cheers, PC

  • Vladislav

    Hi,

    We can actually to get the navigation to appear above the weekdays legend with a bit more code changes and by wrapping the legend in TBODY instead. So, to do this, we'll first kill the old legend generation - replace the entire _get_table_meta_row method (line 230) with this:

    protected function _get_table_meta_row ($which) {}

    It's an empty method, so it'll generate no output. Next, we'll define a new "_get_first_row" method, which will show the repeated footer navigation and the legend in a new order:

    protected function _get_first_row () {
    	return $this->_get_last_row() . parent::_get_table_meta_row('tbody');
    }

    Again, this is assuming you want to replicate the bottom navigation row on top of the element. If you want to replace it entirely, just rename the "_get_last_row" method to "_get_first_row" and concatenate the parent::_get_table_meta_row call() result to the end of the result string.

  • ThatGD

    @Vladislav thank you!

    The first instruction works as intended.

    Now, following the second set of instructions, I am trying to remove the navigation from the bottom row (only display above the day listing) but I'm running into issue with the instructions. If I understand correctly to accomplish this I should use:

    protected function _get_first_row () {
    	return $this->_get_first_row() .
    	parent::_get_table_meta_row();
    }

    But this is causes unspecified errors (just fails to load the page). What am I doing incorrectly?

    Thanks!

  • Vladislav

    Hi,

    Ah, I see what's the problem - basically, in the code above, we're calling the method recursively (basically, the method infinitely calls itself), which finally fails. I'm sorry, I was probably bad at explaining what I was on about. Let's give it another go, with a slightly different approach to hopefully make it easier to follow.

    To replace the bottom navigation with the top one, we first kill the top meta row output (like we did in the previous post):

    protected function _get_table_meta_row ($which) {}

    Next, we rename the "_get_last_row" to "_get_navigation_row", like this (and we change nothing else in this method - just the name):

    protected function _get_navigation_row () {

    If we leave it like this, we now have no navigation and no weekdays legend row. Finally, let's bring back both, this time at the top and in the order we wish:

    protected function _get_first_row () {
    	return $this->_get_navigation_row() . parent::_get_table_meta_row('tbody');
    }

    The "_get_first_row" and "_get_last_row" are "magic" methods, that get called automatically - which is why we renamed the "_get_last_row" to a "non-magical" name first. We do need its output though, so we haven't removed it entirely - just renamed it to something we can use later on, without it being called automatically.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.