TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 400
  • Total: 400

SMF Calendar Block

Started by Lesmond, September 03, 2005, 11:30:42 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Jump1979man

Looks good but everything says "Birthdays today" or "Events Today" etc....even when they are NOT today but just in the future....


Wondering if it could actually highlight the days for these events and birthdays etc...for those dates?

londonhogfan

#161
go into admin
Under the FORUM category select Calendar

3rd section down change
"Max days in advance on board index:" to 0

Jump1979man

Quote from: londonhogfan on August 07, 2006, 09:42:51 PM
go into admin
Under the FORUM category select Calendar

3rd section down change
"Max days in advance on board index:" to 0
that will only show what is actually today then right?

Is there a way to make it show upcoming things as well?  and highlight these days?

EG

excellent code londonhogfan!!  love it!

oooh! I love TP!!! its so good!

itsacoaster

#164
Is there a way to include the date of the event below the "upcoming event" as well?

For example, check out the calendar in the lower right, would it be possible to add "21 August 2006" below it or something?

Or, is this an SMF thing that can't be changed?

jpark

A few questions, I hope someone can help me.  How can I set the birthdays so it shows only Today's Birthdays but have the events set so it shows Upcoming Events (for next 2 weeks or so)?  Right now I have it so everything is basically upcoming but for birthdays I would love to be able to have just today's.  If this is not possible, how can I get rid of the age of the person in parenthesis that shows up next to their name?  I am getting some complaints about having their age revealed... :O  I'd appreciate any and all help!

G6Cad

I think you have the answer in this very thread if you read through it.
I think i remember this being discussed in here :)

JPDeni

One thing that the users can do themselves if they don't want their ages revealed is to remove their year of birth from their profile. It's "legal" to enter 0000 in the year field.

jpark

Quote from: Mrs G6 on August 20, 2006, 07:08:56 PM
I think you have the answer in this very thread if you read through it.
I think i remember this being discussed in here :)

Thanks for your reply~  Just finished reading through all the posts.. i did not find the answer to my first question..  I know about setting the "Max days in advance on board index" in Admin which i have set to 30 because I would like upcoming events for a month in advance.  BUT is there a way to keep this and only have TODAY's birthdays show up?  For this, I guess i'm asking if you can have two different "Max days in advance on board index" values.  Or do it some other way through the calendar code.  If someone knows how to do this, I would be so grateful! 

Quote from: itsacoaster on August 16, 2006, 02:39:23 AM
Is there a way to include the date of the event below the "upcoming event" as well?

For example, check out the calendar in the lower right, would it be possible to add "21 August 2006" below it or something?

Or, is this an SMF thing that can't be changed?
kail's code (http://www.tinyportal.net/smf/index.php?topic=700.msg30584#msg30584) has dates for events show up.  I loved this feature but liked the updates made in recent codes so I am using a different code.  For example, this has "Upcoming Birthdays" twice and holidays are not listed.  If there was a way to combine this code with newer ones, that would be terrific.  I was unsuccessful at my attempts to combine the codes and make them work.  Has anyone tried this?

And the age solution seems like a temporary solution.. there's no way to completely remove the age for everyone?

Thank you all~!

jpark

#169
oops, what am i talking about?Ã,  i think the version i'm using now does in fact show the date.Ã,  Try this: global $scripturl, $modSettings;

         $now = mktime() + $modSettings['time_offset'] * 3600;
         $today = date('j',$now);
         $days = array($today=>array(NULL,NULL,'<span class="smalltext" style="color: blue; font-weight: bold; border: solid 0px black; background-color: #ffffff; padding: 0px 4px 0px 4px;">'.$today.'</span>'));
         $year = date("Y",$now);
         $month = date("n",$now);

         $day_name_length = 2;
         $month_href = $scripturl . '?action=calendar';
         $first_day = 0;
         $pn = array();

$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table align="center" valign="top">'."\n".
'<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
            $calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday   = 0; #start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else
{
$calendar .= "<td style=\"padding-right: 4px; font-size: x-small; font-family: trebuchet ms, verdana, sans-serif;\"  onmouseover=\"this.style.backgroundColor='#D0E4FF'\" onMouseOut=\"this.style.backgroundColor=''\"><a";
if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;sa=post;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$day</a></td>";
}
} if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
echo $calendar.'</tr>';

#create notice for Holidays, Events & Birthdays.

if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_bdaycolor'] . ';"><u><b>BIRTHDAYS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysBirthdays();
  echo '</td></tr>';
}

if (ssi_todaysHolidays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_holidaycolor'] . ';"><u><b>SPECIAL DAYS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysHolidays();
  echo '</td></tr>';
}

if (ssi_todaysEvents('')) {
$result = ssi_todaysCalendar('');
if(!empty($result['events']))
{
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center" style="color: #' . $modSettings['cal_eventcolor'] . ';"><u><b>EVENTS</b></u></td><td><hr></td></tr><td colspan="7" class="smalltext">';
$events = $result['events'];
foreach ($events as $event)
{
echo '
'.substr($event['start_date'],5 , 2).'/'.substr($event['start_date'],8).':';
if ($event['can_edit'])
echo '
<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
echo '
' . $event['link'] . '<br />';
}
                   }
  echo '</td></tr>';
}

echo '</table>';


I think either i found it or was able to combine codes... either way, see if it works for you~!

This website is proudly hosted on Crocweb Cloud Website Hosting.