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.

Lotti

well i tried this script and it rocks! just few questions: why the month is in my forum language in calendar and in events section is in english (sep for september)?

plus saturday&sunday are highligthed in green that is not so good with the standard theme :)

thanks

Lotti

i can't put my calendar block to italian language.. someone can help?

dannbass

Just change this part to your language.

$day_names = array('Lunes','Martes','Miercoles','Jueves','Viernes','Sabado','Domingo');                                      #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));
$month_nam = array();
$month_nam['01'] = 'Enero';
$month_nam['02'] = 'Febrero';
$month_nam['03'] = 'Marzo';
$month_nam['04'] = 'Abril';
$month_nam['05'] = 'Mayo';
$month_nam['06'] = 'Junio';
$month_nam['07'] = 'Julio';
$month_nam['08'] = 'Agosto';
$month_nam['09'] = 'Septiembre';
$month_nam['10'] = 'Octubre';
$month_nam['11'] = 'Noviembre';
$month_nam['12'] = 'Diciembre';
$month_name = $month_nam[$month];


And for the color...

if(((($weekday+$first_day) % 7)==0)||((($weekday+$first_day) % 7)==6))
            {
            $calendar .= ' style="color:#C00000;"';
            }


Change this part to the color that you want.

Hope it helps!

Lotti

thanks danbass. but why set_locale(), doesn't work??

dannbass

I'm not sure about it, I just change the $day_names and the $month_nam = array(); and it did the trick, my php is not that good... but I just follow instructions, I read them somewhere in this long thread, somebody asking for a german translation.

Sorry I can't be more helpful.

Lotti

yeah, you're right infact i'll do what you posted above, but the script says that is "locale" compatible and infact it uses the right functions to use "locale". i tried to set_locale(LC_TIME,'it_IT') on local and online server, with no result :\

dannbass

Ahh I see... sure I should work... but if everything fails... that could be a shortcut.

Anyway, I'm glad it worked!

jacortina

#367
OK. Here it is. The latest iteration of my version of the Calendar block.

Plenty of comments in the code and notes about use, but here's a summary.

Numerous options selectable by parameters including:

  • Individual selections to choose to show Birthday, Event, Holiday Lists.
  • Separate individual selections to choose to show same to guests.
  • Separate text colors for each of Saturdays, Sundays.
  • Parameterized foreground and background colors for 'Today' highlight.
  • Choice to have day numbers link to 'Post Event' form or Calendar page display (with SMF 'post event' permission check).
  • Option to show a 'Post Event' button on bottom of block (with SMF 'post event' permission check).
  • Variables for text of list section labels ('Birthdays', 'Events', 'Holidays').
  • Option to highlight day numbers for days with Birthdays, Events, Holidays.
  • Variables for foreground, backround, bolding to use for highlights.
  • Ability to specify sequence of the list sections shown.
  • Ability to specify 'priority' of highlighting.
  • Can allow for user's time offset for determination of 'today'.
  • Still able to choose Sunday or Monday as start of week.
  • Still able to choose how many letters of day names to show.

Highlighting does NOT highlight past days, only days going forward.

Additionally, there's an example section, currently commented out, to show
how to use Non-English Labels, Month and Day names in place.

Also modified to avoid all SQL queries in the block itself (and optimized
usage of SMF functions likely to perform queries).

I've done what testing I can, but no board I admin makes much use of events,
so apart from a couple of dummy entries for the purpose of testing, that part
of the code isn't as well 'shaken down'.

CODE REMOVED - OBSOLETE VERSION

Latest Code at: http://www.tinyportal.net/index.php?topic=700.msg157042#msg157042

Rus

Looking great, just one comment

The holidays section is in reverse order.

Other than thanks a lot for some great code.  :)

jacortina

Quote from: Rus on October 05, 2007, 05:22:04 AM
Looking great, just one comment

The holidays section is in reverse order.

Other than thanks a lot for some great code.  :)

Interesting.

Holidays are definitely in correct order on the boards I've tested on.

Currently showing:

   Holidays   
Oct 24 - United Nations Day
Oct 31 - Halloween

This website is proudly hosted on Crocweb Cloud Website Hosting.