Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2005, 05:44 AM
rb2k1 rb2k1 is offline
 
Join Date: Sep 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Today's Events Question

Hey Everyone.. ive made a mod to the code that grabs an event from the calendar and posts it.. here is the code i took from the main board php page to add to my vbindex code.. it works now but i just want to know how to do 1 thing... basically now all i have to do is call $upcomingevents and it puts the title and link to the calendar event but it includes the date which i do not want added.. ive searched through the code quite a bit but i cant figure out where its picking up the date.

example:
what it does....
Blah In The Mix Live - 04-05-2005

what i want it to do
Blah In The Mix Live

All help is very appreciated!

PHP Code:
// ### TODAY'S EVENTS #################################################
if ($vboptions['showevents'])
{
    require_once('./includes/functions_calendar.php');

    $future = gmdate('n-j-Y' , TIMENOW + 43200 + (86400 * ($vboptions['showevents'] - 1)));
    $eventstore = unserialize($datastore['eventcache']);

    if (!is_array($eventstore) OR $future != $eventstore['date'])
    {
        // Need to update!
        require_once('./includes/functions_databuild.php');
        $eventstore = build_events();
        DEVDEBUG('Updated Events');
    }

    unset($eventstore['date']);
    $events = array();
    $eventcount = 0;
    foreach ($eventstore AS $eventid => $eventinfo)
    {
        $offset = iif (!$eventinfo['utc'], $bbuserinfo['tzoffset'], $bbuserinfo['timezoneoffset']);
        $eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
        $eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;
        $gettime = TIMENOW - $vboptions['hourdiff'];
        $iterations = 0;

        if ($bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWCALENDAR OR ($eventinfo['holidayid'] AND $vboptions['showholidays']))
        {
            if ($eventinfo['userid'] == $bbuserinfo['userid'] OR $bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWOTHERSEVENT OR ($eventinfo['holidayid'] AND $vboptions['showholidays']))
            {
                while ($iterations < $vboptions['showevents'])
                {
                    $addcache = false;

                    $todaydate = getdate($gettime);
                    if ($eventinfo['holidayid'] AND $eventinfo['recurring'] == 6)
                    {
                        if ($eventinfo['recuroption'] == "$todaydate[mon]|$todaydate[mday]")
                        {
                            $addcache = true;
                        }
                    }
                    else if (cache_event_info($eventinfo, $todaydate['mon'], $todaydate['mday'], $todaydate['year']))
                    {
                        $addcache = true;
                    }

                    if ($addcache)
                    {
                        if (!$vboptions['showeventtype'])
                        {
                            $events["$eventinfo[eventid]"][] = $gettime;
                        }
                        else
                        {
                            $events["$gettime"][] = $eventinfo['eventid'];
                        }
                        $eventcount++;
                    }

                    $iterations++;
                    $gettime += 86400;
                }
            }
        }
    }

    if (!empty($events))
    {
        ksort($events, SORT_NUMERIC);
        foreach($events AS $index => $value)
        {
            $pastevent = 0;
            $pastcount = 0;
            unset($eventdates, $comma, $daysevents);
            if (!$vboptions['showeventtype'])
            {    // Group by Event // $index = $eventid
                unset($day);
                foreach($value AS $key => $dateline)
                {
                    if (($dateline - 86400) == $pastevent AND !$eventinfo['holidayid'])
                    {
                        $pastevent = $dateline;
                        $pastcount++;
                        continue;
                    }
                    else
                    {
                        if ($pastcount)
                        {
                            $eventdates = construct_phrase($vbphrase['event_x_to_y'], $eventdates, vbdate($vboptions['dateformat'], $pastevent, false, true, false));
                        }
                        $pastcount = 0;
                        $pastevent = $dateline;
                    }
                    if (!$day)
                    {
                        $day = vbdate('Y-n-j', $dateline, false, false, false);
                    }
                    $eventdates .= $comma . vbdate($vboptions['dateformat'], $dateline, false, true, false);
                    $comma = ', ';
                    $eventinfo = $eventstore["$index"];
                }
                if ($pastcount)
                {
                    $eventdates = construct_phrase($vbphrase['event_x_to_y'], $eventdates, vbdate($vboptions['dateformat'], $pastevent, false, true, false));
                }

                if ($eventinfo['holidayid'])
                {
                    $callink = "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
                }
                else
                {
                    $callink = "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
                }
            }
            else
            {    // Group by Date
                $eventdate = vbdate($vboptions['dateformat'], $index, false, true, false);
                $day = vbdate('Y-n-j', $index, false, false);
                foreach($value AS $key => $eventid)
                {
                    $eventinfo = $eventstore["$eventid"];
                    if ($eventinfo['holidayid'])
                    {
                        $daysevents .= $comma . "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
                    }
                    else
                    {
                        $daysevents .= $comma . "<a href=\"calendar.php?$session[sessionurl]do=getinfo&amp;day=$day&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
                    }
                    $comma = ', ';
                }
            }
            eval('$upcomingevents .= "' . fetch_template('forumhome_event') . '";');
        }
        // memory saving
        unset($events, $eventstore);
    }
    $show['upcomingevents'] = iif ($upcomingevents, true, false);
    $show['todaysevents'] = iif ($vboptions['showevents'] == 1, true, false);
}
else
{
    $show['upcomingevents'] = false;
} 
Reply With Quote
  #2  
Old 04-14-2005, 12:45 AM
rb2k1 rb2k1 is offline
 
Join Date: Sep 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump :|
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:45 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.