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

Recent

Welcome to TinyPortal. Please login or sign up.

October 11, 2024, 04:02:10 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,395
  • Total Topics: 21,244
  • Online today: 175
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 118
  • Total: 118

SSI - Kalender nicht funktionsfähig

Started by Alduras, May 03, 2006, 05:46:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alduras

Wie aktiviere ich den Block Kalender aus dem Unterpunkt SSI?

Aktiviere ich diesen, erscheint zwar die ÃÆ'Ã...“berschrift, das Feld selber bleibt jedoch leider leer.

Alduras

feline

Da wird nur etwas angezeigt, wenn HEUTE etwas ist, z.B. Geburstage, Ereignisse, Feiertage ...

Fel

Alduras

faszinierend! Wie kommt es denn dann, daÃÆ'Ã...¸ in anderen Foren mit Tiny der ganze Kalender des Monats angezeigt wird, selbst wenn am aktuellen Tag nichts los ist?

feline

Wie der ganze Kalender?
Du meinst sowas, wie auf meiner Seite oben rechts?
Das ist ein php Block-Code snippet ... keine ssi funktion.

Fel

Alduras

ok, Feli und was muÃÆ'Ã...¸ ich machen, um so einen schönen Kalender wie du ihn hast auch in mein Forum zu integrieren?

feline

oooch .. einen php-block anlegen und mit folgendem füllen:


// -------------------------------
// php inside a box (TinyPortal)
// my small calendar for a sidebox
// Thanks to Bloc for the idea :-)
// -------------------------------

$now = mktime();
$today = date('j',$now);
$days = array($today=>array(NULL,NULL,'<span class="smalltext" style="color: blue; border: 1px solid black; background-color: yellow; padding:0px 2px 0px 2px;">'.$today.'</span>'));
$year = date("Y",$now);
$month = date("n",$now);

$day_name_length = 3;
$month_href = NULL;
$first_day = 1;
$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 .= '<td class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</td>';
$calendar .= "</tr>\n<tr>";
}

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>";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td align=\"center\" valign=\"middle\" '.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else $calendar .= "<td align=\"center\" valign=\"middle\" class=\"smalltext\">$day</td>";
}

if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
echo $calendar.'</tr>';

$todaysBirthdays = ssi_todaysBirthdays('array');
$todaysEvents = ssi_todaysEvents('array');
$todaysHolidays = ssi_todaysHolidays('array');

global $context, $scripturl, $modSettings;

if (!empty($todaysEvents) || !empty($todaysHolidays) || !empty($todaysBirthdays))
{
echo '<tr><td colspan="2"><hr></td><td colspan="3" class="smalltext" align="center">Heutige Ereignisse</td><td colspan="2"><hr></td></tr><td colspan="7" class="smalltext">';
if (!empty($todaysBirthdays))
{
echo '<span style="color: #' . $modSettings['cal_bdaycolor'] . ';">Geburstage: </span>';
foreach ($todaysBirthdays as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');

if (!empty($todaysEvents) || !empty($todaysHolidays))
echo '<br />';
}

if (!empty($todaysHolidays))
{
echo '<span style="color: #' . $modSettings['cal_holidaycolor'] . ';">Feiertag: </span>';
echo implode(', ', $todaysHolidays);

if (!empty($todaysEvents))
echo '<br />';
        }

if (!empty($todaysEvents))
{
echo '<span style="color: #' . $modSettings['cal_eventcolor'] . ';">Events: </span>';
foreach ($todaysEvents as $event)
echo $event['link'] . (!$event['is_last'] ? ', ' : '');
}
echo '</td></tr>';
}

$today = ssi_todaysCalendar('array');
if (!empty($today))
{
echo '<tr><td colspan="2"><hr></td><td colspan="3" class="smalltext" align="center">Zukünftige Ereignisse</td><td colspan="2"><hr></td></tr><td colspan="7" class="smalltext">';

if (!empty($today['birthdays']))
{
echo '<span style="color: #' . $modSettings['cal_bdaycolor'] . ';">Geburstage: </span>';
foreach ($today['birthdays'] as $member)
echo '
<a href="'. $scripturl .'?action=profile;u='. $member['id']. '">'. $member['name'] .'', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';

if (!empty($today['events']) || !empty($today['holidays']))
echo '<br />';
}

if (!empty($today['events']))
{
echo '<span style="color: #' . $modSettings['cal_eventcolor'] . ';">Events: </span>';
foreach ($today['events'] as $event)
{
echo '
' . $event['link'] . (!$event['is_last'] ? ', ' : '');
}
if (!empty($today['holidays']))
echo '<br />';
}

if (!empty($today['holidays']))
echo '<span style="color: #' . $modSettings['cal_holidaycolor'] . ';">Feiertage: </span>' . implode(', ', $today['holidays']);

echo '</td></tr>';
}

echo '</table>';


Allerdings habe ich dafür die SSI.php von smf (RC2) erweitert/verÃÆ'Ã,¤ndert.
Ich hÃÆ'Ã,¤nge die mal an .. musst du nur ins root kopieren (original vorher sichern).

Fel


Netsnoop

Wie bekomme ich da deutsche Wochentagsnamen (bzw. die Abkürzungen) rein?

feline

Pack folgenden code in eine PHP box ...

echo '
<div class="windowbg2" style="margin-bottom:5px; margin-left:5px; width:160px;">';
$now = mktime();
$today = date('j',$now);
$days = array($today=>array($today));
$year = date("Y",$now);
$month = date("n",$now);
$first_day = 1;
$first_of_month = gmmktime(0,0,0,$month,1,$year);
$day_names = array();

for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400)
$day_names[$n] = htmlentities(substr($txt['days'][(int) strftime('%w', $t)],0,3));

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7;
$title = htmlentities($txt['months'][(int) strftime('%m', $now)]).' '.$year;

$calendar = '<div class="catbg" style="padding:3px 5px; text-align:center;">'.$title.'</div>';
$calendar .= '<table border="0" cellspacing="3" cellpadding="0" style="padding-left:1px;"><tr>';

foreach($day_names as $d)
$calendar .= '<td class="smalltext" align="center">'.substr($d,0,2).'</td>';
$calendar .= "</tr><tr>";
if($weekday > 0)
$calendar .= '<td class="smalltext" colspan="'.$weekday.'"></td>';
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++)
{
if($weekday == 7)
{
$weekday   = 0;
$calendar .= "</tr><tr>";
}
$calendar .= '<td align="right" valign="middle" class="smalltext"';
if($day == $today)
$calendar .= ' style="padding:0px 1px 1px 1px; border:2px inset ButtonHighlight;">';
else
$calendar .= ' style="padding:1px 2px;">';
$calendar .= $day .'</td>';
}
if($weekday != 7)
$calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>';
echo $calendar.'</tr></table>
</div>';


Fel

Netsnoop

Danke feline, habe jetzt aber dat Problemsche das dort keine Ereignisse angezeigt werden, das wÃÆ'Ã,¤re schon ganz wichtig... bekommt man den englischen net einfach mit nem Code deutsch?

feline

Den teil kannst du aus dem verherigen Teil nehmen und anfügen ..

Fel

Netsnoop

jup, dat funzt :)

sach mal wo kann ich denn die Tage einstellen die der im vorraus anzeigt?


Netsnoop

#13
... au man bin ich bekloppt...  :idiot2: danke, aber das habe ich wohl übersehen...


habe jetzt aber noch das Problemchen das ich die Wochennamen oben noch fett dargestellt habe möchte...hab da mal versucht was zu friemeln aber mehr als parse error etc. brauche ich wohl net zu sagen...  ;)


...und gibts das schon das die Events zum Bsp. durch Farbumrandungen an den jeweiligen Wochentagen angezeigt werden?

feline

Wochentage fett:

ÃÆ'Ã,¤ndere
foreach($day_names as $d)
$calendar .= '<td class="smalltext" align="center">'.substr($d,0,2).'</td>';


in
foreach($day_names as $d)
$calendar .= '<td class="smalltext" align="center"><b>'.substr($d,0,2).'</b></td>';


Das andere ist ein bischen aufwendiger, muss ich mal sehen ...

Fel