kalendar po slovensky???

V tejto téme sa nachádzajú snippety (rozšírenia) pre Etomite.

Moderátor: Moderators

Používateľov profilový obrázok
gabo
Medium Expert
Medium Expert
Príspevky: 64
Dátum registrácie: Ut Jan 23, 2007 5:45 am
Bydlisko: Košice
Kontaktovať používateľa:

kalendar po slovensky???

Príspevok od používateľa gabo »

moze mi niekto pomoct s upravou tohoto snippetu? moc skusenosti s tym nemam a potrebujem aby sa ten kalendar zacinal pondelkom ale hlavne aby dni boli zobrazene v slovencine, vedel by ho niekto upravit?

toto je original z http://www.etomite.org/browsesnippets.h ... category=8

ja ho mam na http://www.spzke-mesto.sk


Kód: Vybrať všetko

# Calendar - Calendar for Etomite 0.6 - 2005-01-17
# Created By: Ralph A. Dahlgren - Email: rad14701@yahoo.com
# Usage: Simply customize the Variables & style settings below
#        Use [!Calendar!] to call this snippet
# START ---- Variables which can optionally be customized ----- #
#            Style Element names are pretty much self-explanatory
#
$day_heading_length = 2;  # Size of weekday abbr in calendar (0-4) 4=full day name
$output_style = "background-color:#F0F8FF; border:1px solid black; width:100%";
$month_style = "background-color:#FFDDBB; text-align:center; font-weight:bold";
$day_heading_style = "background-color:#BBF0F0; text-align:center; width:14%";
$day_style = "text-align:right; border:1px solid #F0F8FF";
$today_style = "color:red; background-color:#EAEAEA; text-align:right;";
$blogday_style = "color:green; background-color:#EAEAEA; text-align:right; font-weight:bold; border:1px solid red";
$empty_day_style = "";
#
# END ---- Variables which can optionally be customized ----- #
# ----- You should not need to modify code below this point ----- #
#
# Calculate required time & date related variables
#
$time = time();  # Grab the current timestamp
$Ym=$_GET['Ym'];  # Else extract $Ym variable if sent

if($Ym != "") {  # If $Ym exists, get $year and $month
  $year=substr($Ym, 0, 4);  # Get year part
  $month=substr($Ym, 4, 2);  # Get month part
}
else {  # If $Ym is empty, assign variables from current date
  $year=date('Y', $time);
  $month=date('m', $time);
  $today=date('j', $time);
}

if(($month == date('m', $time)) && ($year == date('Y', $time))) {
  $today=date('j', $time);  # If this month and this year, assign $today
}

$first_of_month = mktime(0,0,0,$month,1,$year);  # Always start with current month
$lastmonth = strftime("%Y%m%d",mktime(0,0,0,$month-1,1,$year));  # Previous month
$nextmonth = strftime("%Y%m%d",mktime(0,0,0,$month+1,1,$year));  # Next month

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

$day_headings = array_map('ucfirst',$day_headings);  # Some locales don't capitalize day names
list($month, $year, $month_name, $weekday) = explode(',',strftime('%m,%Y,%B,%w',$first_of_month));
# $weekday %= 7;  # strftime gives Monday as 1, Sunday as 7. Adjust so Sunday is 0
$month_name = ucfirst($month_name);  # Some locales don't capitalize month names
$maxdays = date('t', $first_of_month);  # Number of days in the month
$day = 1;  # starting day of the month

# Generate Calendar
$output = "<table style='$output_style'>\n";  # Begin actual calendar generation
$output .= "<tr><th colspan='1' style='$month_style'>\n";  # Create previous month link
$output .= "<a href='[~".$etomite->documentObject[id]."~]&Ym=$lastmonth'>&laq"."uo;</a>\n"; # Use << for link
$output .= "</th>\n";
$output .= "<th colspan='5' style='$month_style'>\n";  # Display calendar month and year
$output .= "$month_name, $year";
$output .= "</th>\n";
$output .= "<th colspan='1' style='$month_style'>\n";  # Create next month link
$output .= "<a href='[~".$etomite->documentObject[id]."~]&Ym=$nextmonth'>&raq"."uo;</a>\n"; # Use >> for link
$output .= "</th></tr>\n";

$output .= "<tr>\n";  # Display weekday heading abbreviations
if($day_heading_length > 0 and $day_heading_length <= 4){  # if day_heading_length is allowed value
  #  if day_heading_length is 4, the full name of the day will be printed
  #  otherwise, just the first n characters
  foreach($day_headings as $day_heading){
    $d = ($day_heading_length != 4) ? substr($day_heading,0,$day_heading_length) : $day_heading;
    $output .= "<th style='$day_heading_style' abbr='$day_heading'>$d</th>\n";
  }
  $output .= "</tr>\n<tr>\n";  # Close weekday heading and prepare to print days
}

# Take care of the first "empty" days of the month
if($weekday > 0) $output .= "<td style='$empty_day_style' colspan='$weekday'> </td>\n";

# Print all days of the month
while($day <= $maxdays){
  if($weekday == 7){  # Start a new week - end table row and start a new one
    $output .= "</tr>\n<tr>\n";
    $weekday = 0;
  }
  # Create the $Ymd variable to compare against the list of days with content
  $Ymd = $year.$month.str_pad($day,2,"0", STR_PAD_LEFT);

  $output .="<td><div style='$day_style'>\n";  # Use style formatting of days

  # If the day is today, give it special style formatting
  if ($day==$today) $output .= "<b style='$today_style'>$day</b>\n";
  else $output .= "$day";  # Otherwise just display the day


  # Close up the style formatting of days
  $output .="</div></td>\n";
  $day++; $weekday++;  # Goto the next day and weekday
}

# Take care of the remaining "empty" days of the month
if($weekday != 7) $output .= "<td style='$empty_day_style' colspan='".(7-$weekday)."'> </td>\n";
# Close the calendar and finish
$output .="</tr>\n</table>\n";

return $output;
dutch
PHP Support
PHP Support
Príspevky: 122
Dátum registrácie: So Dec 17, 2005 11:40 pm
Bydlisko: Mladá Boleslav
Kontaktovať používateľa:

Príspevok od používateľa dutch »

stacilo pouzit tlacitko 'Hledat' a nasel bys to...
nekam do zdrojaku [nejlip nahoru] napis:

Kód: Vybrať všetko

setlocale(LC_TIME, 'Slovak');
to by melo stacit...
Eto v1 - konečně ;) | Když se dva perou, třetí tam hodí granát...
Používateľov profilový obrázok
gabo
Medium Expert
Medium Expert
Príspevky: 64
Dátum registrácie: Ut Jan 23, 2007 5:45 am
Bydlisko: Košice
Kontaktovať používateľa:

Príspevok od používateľa gabo »

nejde mi to, respektive som to nenakopiroval na spravne miesto, kde to ma byt presne?
dutch
PHP Support
PHP Support
Príspevky: 122
Dátum registrácie: So Dec 17, 2005 11:40 pm
Bydlisko: Mladá Boleslav
Kontaktovať používateľa:

Príspevok od používateľa dutch »

dej to treba za

Kód: Vybrať všetko

#
# Calculate required time & date related variables
# 
das sem link, kde to provozujes?
Eto v1 - konečně ;) | Když se dva perou, třetí tam hodí granát...
Používateľov profilový obrázok
gabo
Medium Expert
Medium Expert
Príspevky: 64
Dátum registrácie: Ut Jan 23, 2007 5:45 am
Bydlisko: Košice
Kontaktovať používateľa:

Príspevok od používateľa gabo »

dutch napísal:dej to treba za

Kód: Vybrať všetko

#
# Calculate required time & date related variables
# 
das sem link, kde to provozujes?
http://www.spzke-mesto.sk
golem
Czech LT
Czech LT
Príspevky: 85
Dátum registrácie: St Sep 28, 2005 9:02 pm
Bydlisko: Brno
Kontaktovať používateľa:

Re: kalendar po slovensky???

Príspevok od používateľa golem »

Řešil jsem stejný problém
setlocale(LC_TIME, 'Slovak');
mi nefungovalo, tak jsem to upravil na
setlocale(LC_ALL, 'Slovak');
.
A běží to nádherně.
golem: Sviňa je proti mně charakter
Napísať odpoveď