Results 1 to 5 of 5

Thread: Calendar event list mark next event

  1. #1
    User zlobec's Avatar
    Join Date
    02-14-14.
    Posts
    34

    Default Calendar event list mark next event

    Hey,

    I'm trying to find a way to mark the first upcomming event in a single event list (different css class), for example that it would mark not only the bygone, current and upcomming class but also that the first next upcomming event would also be marked with a css class "next".

    Any Ideas how to do that?

    I'm currently working with the Events.php file in "addEvent" function the lines around 300:

    Code:
    		// Mark past and upcoming events (see #3692)
    		if ($intEnd < $this->intTodayBegin)
    		{
    			$arrEvent['class'] .= ' bygone';
    		}
    		elseif ($intStart > $this->intTodayEnd)
    		{
    			$arrEvent['class'] .= ' upcoming';
    		}
    		else
    		{
    			$arrEvent['class'] .= ' current';
    		}

  2. #2
    User zlobec's Avatar
    Join Date
    02-14-14.
    Posts
    34

    Default

    I was thinking that maybe after the $this->arrEvents is ksorted that I should find the first occurence of the "upcoming" and simply replace it with "next". Or sth...

    Any ideas how to do that?

    Regard,
    Darjan

  3. #3
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    485

    Default

    Maybe you can do it with CSS
    PHP Code:
    .upcoming {
      
    backgroundred;
    }
    .
    upcoming + .upcoming {
      
    backgroundinherit;

    or with JS (mootools)
    PHP Code:
    $$('.upcoming')[0].addClass('first_upcoming'); 
    or put this on top of your template
    PHP Code:
    <?php
      
    if(in_array('upcoming'explode(' '$this->classUpcoming)) && !isset($GLOBALS['firstUpcoming']))
      {
        
    $GLOBALS['firstUpcoming'] = true;
        
    $this->classUpcoming .= ' first_upcoming';
      }
    ?>
    Don't modify a core file.
    Last edited by Andreas; 12/07/2014 at 17:59.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  4. #4
    User zlobec's Avatar
    Join Date
    02-14-14.
    Posts
    34

    Default

    Hey,

    I added this
    Code:
    <?php if ((strpos($this->classHeader, 'last') == 0) || (strpos($this->classHeader, 'first last') <> 0)):?>
    at the beginning of the template... and created 3 modules (1st upcomming events, 2nd current event, and 3rd as the past events) added 1 extra number of event to the upcomming module and it worked. Not so clean but it works.

    If I'll have time I'll try your solution... should be more clean and it would run only one module.

    Thanks for the suggestion. I forgot about the global variables
    Regard,
    Darjan

  5. #5
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    485

    Default

    You better should use in_array() with explode(' ', ...) than strpos() to analyze the classes.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •