Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

October 02, 2022, 11:11:49 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 193513
  • Total Topics: 21092
  • Online today: 38
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 1
Guests: 38
Total: 39

Author Topic: SMF Calendar Block  (Read 285731 times)

0 Members and 1 Guest are viewing this topic.

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: SMF Calendar Block
« Reply #610 on: May 30, 2010, 09:45:13 AM »
mariusfv,

Each of your members, in the "Look and Layout" preferences of their profile, has the ability to auto detect the "Time Offset:" for their local computer from the server tme.

ZarPrime

mariusfv

  • Guest
Re: SMF Calendar Block
« Reply #611 on: May 30, 2010, 10:13:24 AM »
Yes...but in Block the date it change after 5 hours !(server time) i test this with my account ....and when my time is 12.30(night) the date must change in block but it change only after 5 hours....try clear coookie...log out etc....so in block is problem....it change only after 5 hours....server time...

Offline pvcblue

  • Smurfs!!
  • Jr. Member
  • **
  • Posts: 73
Re: SMF Calendar Block
« Reply #612 on: May 30, 2010, 02:45:06 PM »
Yes...but in Block the date it change after 5 hours !(server time) i test this with my account ....and when my time is 12.30(night) the date must change in block but it change only after 5 hours....try clear coookie...log out etc....so in block is problem....it change only after 5 hours....server time...

Have you tried setting your server time to your time in the Admin>Features and Options>Overall time offset   ???

"Smurfs, Smurfs, and More Smurfs!"

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: SMF Calendar Block
« Reply #613 on: May 30, 2010, 10:58:20 PM »
mariusfv,

Please post the exact code you are using here so that one of us can try it on one of our test forums.  Please use the bbc code tags (#) to post the code.

ZarPrime

mariusfv

  • Guest
Re: SMF Calendar Block
« Reply #614 on: May 31, 2010, 01:34:40 PM »
Edit:
Problem Solved !

In Overall time offset +8 solve the problem(that was difference between server time and forum time) !

10x for information !
« Last Edit: May 31, 2010, 03:23:28 PM by mariusfv »

Offline Smythe

  • Jr. Member
  • **
  • Posts: 5
Re: SMF Calendar Block
« Reply #615 on: January 21, 2013, 09:24:03 PM »
Listed below is the code that I am using...

I would like to have the calendar block NOT show the holidays.... just events ...that's it.... I know how to remove the birthdays.... for the life of me I can't get the holidays out of there...thanks in advance ( also if you know how i could get it to show one event per line vs. all of them in a row separated by comas.... that would be great too....)

Code: [Select]
global $scripturl;
$now = mktime();
         $today = date('j',$now);
         $year = date("Y",$now);
         $month = date("n",$now);
         $days = array($today=>array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; border: solid 1px black; background-color: white; padding: 0px 0px 0px 0px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>'));

         $day_name_length = 3;
         $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>'."\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 class=\"smalltext\" style=\"padding-right:4px;\"><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>';

if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center">Birthdays</td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysBirthdays();
  echo '</td></tr>';
}

if (ssi_todaysCalendar('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center">Upcoming Events</td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysCalendar();
  echo '</td></tr>';
}

echo '</table>';

Offline IchBin

  • Friends
  • *
  • Posts: 16231
Re: SMF Calendar Block
« Reply #616 on: January 21, 2013, 10:31:11 PM »
This is the section for events that you can comment out or remove:
Code: [Select]
if (ssi_todaysCalendar('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center">Upcoming Events</td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysCalendar();
  echo '</td></tr>';
}

To change the output of the birthdays you have to add some code. This isn't tested, so let me know if there's any problems.
Find this:
Code: [Select]
if (ssi_todaysBirthdays('')) {
  echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center">Birthdays</td><td><hr></td></tr><td colspan="7" class="smalltext">';
  ssi_todaysBirthdays();
  echo '</td></tr>';
}

Replace with this:
Code: [Select]
$birthdayList = ssi_todaysBirthdays('array');

if ($birthdayList) {
foreach ($birthdayList as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? '<br />' : '');
}

Offline Smythe

  • Jr. Member
  • **
  • Posts: 5
Re: SMF Calendar Block
« Reply #617 on: January 22, 2013, 05:50:45 PM »
I think maybe I didn't explain my request enuff....

NO Birthdays...
NO Holidays

ONLY Events...



Would like Ground Hogs Day and Valentines Day to go away....

also would like to have the "Upcoming Events" displayed once... I think I got that one but then would like to have the events listed one per line

test event 1
test event 2
test event 3

vs test event 1, test event 2, test event 3... etc

thanks for the quick response on my prior request...

Offline ZarPrime

  • Friends
  • *
  • Posts: 4653
Re: SMF Calendar Block
« Reply #618 on: January 22, 2013, 09:36:31 PM »
All of these are valid ssi calls ...

  • ssi_todaysBirthdays();
  • ssi_todaysHolidays();
  • ssi_todaysEvents();
  • ssi_todaysCalendar();

The last one is a combination of all 3 of the first.  If you only want the events then just use the third one.  The ssi functions, when using the default echo, will display each one right after the other one in a single line.  If you want each event to be on a separate line, you will have to use array rather than echo and write the code with a line break accordingly.

ZarPrime

Offline Smythe

  • Jr. Member
  • **
  • Posts: 5
Re: SMF Calendar Block
« Reply #619 on: January 23, 2013, 06:18:05 AM »
Sorry to be a pain... I am not sure how to write the code for the array for calendar events..

I would greatly appreciate it if someone much smarter then I would lend a hand....lol ... smf 2.0.2

Thanks so much for the help thus far... it is greatly appreciated
« Last Edit: January 23, 2013, 08:34:50 AM by Smythe »