1
Tuscany
extcal - upcoming events for 7 days
  • 2006/2/19 19:16

  • Tuscany

  • Just popping in

  • Posts: 56

  • Since: 2005/4/19


Hi!

I already posted in the developers board - but no response.
I hope one of you coders can help me with a very urgent need.

I need the upcoming events block in extCal to show the upcoming events within the next 7 days, not the next defined amount of events regardless of their date.

Please can someone help me

I guess changes have to be made to the following code:

function getUpcomingEvent($user, $limit, $cats, $skipPerm = false)
    {
        
$time = userTimeToServerTime(time(), $this->_extcalTime->_getUserTimeZone($user));
        
$criteriaCompo = new CriteriaCompo();
        
$criteriaCompo->add(new Criteria('event_start', $time, '>'));
        
$criteriaCompo->add(new Criteria('event_approved', 1));
        if(!
is_array($cats) && $cats > 0) {
            
$criteriaCompo->add(new Criteria('cat_id', $cats));
        }
        if(
is_array($cats)) {
            if(
array_search(0, $cats) === false) {
                
$in = '('.current($cats);
                
array_shift($cats);
                foreach(
$cats as $cat) {
                    
$in .= ','.$cat;
                }
                
$in .= ')';
                
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
            }
        }
        if(!
$skipPerm) {
            
$authorizedAccessCats = $this->_extcalPerm->getAuthorizedCat($user, 'extcal_cat_view');
            
$count = count($authorizedAccessCats);
            if(
$count > 0) {
                
$in = '('.$authorizedAccessCats[0];
                
array_shift($authorizedAccessCats);
                foreach(
$authorizedAccessCats as $authorizedAccessCat) {
                    
$in .= ','.$authorizedAccessCat;
                }
                
$in .= ')';
                
$criteriaCompo->add(new Criteria('cat_id', $in, 'IN'));
            } else {
                
$criteriaCompo->add(new Criteria('cat_id', '(0)', 'IN'));
            }
        }
        
$criteriaCompo->setSort('event_start');
        
$criteriaCompo->setLimit($limit);
        return 
$this->getObjects($criteriaCompo);
    }

Thank You very much for your help

Tus