News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Two questions re: calendar events...

Started by lemur21, September 29, 2006, 09:39:49 AM

Previous topic - Next topic

Fiery

Quick calendar question.

On the board index it lists my calendar events as: 2006-10-31, how to I change it to 10-31-2006.


I dont know if this is related or not, but on the "Default time" option I set it to: %B %d, %Y, %I:%M:%S %p

Thanks!

NEMINI

Quote from: MoreBloodWine on October 18, 2006, 07:26:29 PM
Hey aka got another one for ya... surprised I didnt consider it before...



All the other stuff is aligned as expected thx to you and the code modifications , but see the holidays... How can I align them by date like the other stuff below and how would I go about adding Upcoming Holidays: like there is for Upcoming Birthdays: & Upcoming Events: ???



ever figure out how to accomplish this?
signatures are boring.

MoreBloodWine

Nope, lol... im hoping aka will still try to find a way to help me out with it.. im bettin ur interested in this as well huh... hehe
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


NEMINI

yeah would be nice to have dates and proper formatting for holidays.  If we can get this part straightened out, and aka's permission I may try and package this up as a mod.
signatures are boring.

MoreBloodWine

Quote from: NEMINI on November 28, 2006, 08:21:55 PM
yeah would be nice to have dates and proper formatting for holidays.  If we can get this part straightened out, and aka's permission I may try and package this up as a mod.
Any new news on this aka or anyone else...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Bulakbol

Dirty way to do it. Sources/BoardIndex.php, look for

// Happy Birthday, guys and gals!
$context['calendar_birthdays'] = array();
for ($i = $now; $i < $now + $days_for_index; $i += 86400)
if (isset($bday[strftime('%Y-%m-%d', $i)]))
{
foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy)
$bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = strftime('%Y-%m-%d', $i) == strftime('%Y-%m-%d', forum_time());
$context['calendar_birthdays'] = array_merge($context['calendar_birthdays'], $bday[strftime('%Y-%m-%d', $i)]);
}


and replace with

// Happy Birthday, guys and gals!
$context['calendar_birthdays'] = array();
for ($i = $now; $i < $now + $days_for_index; $i += 86400)
if (isset($bday[strftime('%Y-%m-%d', $i)]))
{
foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy)
{
$bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = strftime('%Y-%m-%d', $i) == strftime('%Y-%m-%d', forum_time());
$bday[strftime('%Y-%m-%d', $i)][$index]['date'] = strftime('%Y-%m-%d', $i);
}
$context['calendar_birthdays'] = array_merge($context['calendar_birthdays'], $bday[strftime('%Y-%m-%d', $i)]);
}
for ($x = 0; $x < count($context['calendar_birthdays']); $x++)
{
list($b_year[$x], $b_month[$x], $b_day[$x]) = split('-', $context['calendar_birthdays'][$x]['date']);
$context['month_day_year'][] = $b_month[$x].'-'. $b_day[$x].'-'. $b_year[$x];
}


and in default/BoardIndex.template.php, look for

foreach ($context['calendar_birthdays'] as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';


replace with

$i = 0;
foreach ($context['calendar_birthdays'] as $member)
echo '<br />
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? $context['month_day_year'][$i]. '-<b>' : $context['month_day_year'][$i]. '-', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';

$i++;
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

MoreBloodWine

Well in order for me to use it and for NEMINI to package it up, I think we'd both like a clean way to do it (whatever you meant by dirty)...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Bulakbol

I call it dirty until approved by the SMF Customizers. It it work and want to use it, use it. If you don't, it doesn't matter to me.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

myaicons

Quote from: Fiery on October 31, 2006, 07:20:46 PM
Quick calendar question.

On the board index it lists my calendar events as: 2006-10-31, how to I change it to 10-31-2006.


I dont know if this is related or not, but on the "Default time" option I set it to: %B %d, %Y, %I:%M:%S %p

Thanks!

any luck on this ???

seems like a year is long enought to wait for an answer? :)
i scratch your back you scratch my back...
funny thing about my back is its located on my...

Bulakbol

Use the same logic as the Birthdays. Sources/BoardIndex.php, find:

// This is used to make sure the header should be displayed.
return !empty($context['calendar_holidays']) || !empty($context['calendar_birthdays']) || !empty($context['calendar_events']);


and add the following codes above it.

for ($x = 0; $x < count($context['calendar_events']); $x++)
{
list($c_year[$x], $c_month[$x], $c_day[$x]) = split('-', $context['calendar_events'][$x]['date']);
$context['events_mdy'][] = $c_month[$x].'-'. $c_day[$x].'-'. $c_year[$x]. ' - '. $context['calendar_events'][$x]['title'];
}


And in default/BoardIndex.template.php, find:

foreach ($context['calendar_events'] as $event)
echo '
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';


and replace with:

$x = 0;
foreach ($context['calendar_events'] as $event)
{
echo '<br />
', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $context['events_mdy'][$x] . '</b>' : $context['events_mdy'][$x], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : '';
$x++;
}
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

myaicons

cool... thanks!

but while were at it.... how can i change the date output to be the same for the ssi upcomingCalendar m-d-y instead of y-m-d


<?php

$eventlist
= ssi_upcomingCalendar(7, 'array');

echo
'';

foreach (
$eventlist as $mday => $array)
{
 foreach (
$array as $event)
 {
   echo
'<br>', $event['start_date'] , ' : ' , $event['link'];

   if (
$event['can_edit'])
     echo
' <a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
 }
}
?>

i scratch your back you scratch my back...
funny thing about my back is its located on my...

Bulakbol

Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Bulakbol

Maybe this will work. Do the changes that I posted for Sources/BoardIndex.php and try this. It might work.

<?php

$eventlist
= ssi_upcomingCalendar(7, 'array');
echo
'';
foreach (
$eventlist as $mday => $array)
{
$x = 0;
foreach ($context['calendar_events'] as $event)
{
echo '<br />
'
, $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $context['events_mdy'][$x] . '</b>' : $context['events_mdy'][$x], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : '';
$x++;
}
}
?>

Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

MoreBloodWine

#33
I dont mean to reopen old wounds soto speak but I brought this post back up to make some changes on a new site of mine. Anyway, as you can see here all the birthdays and events are setup right using the code in the post. If you visit the link to my site and scroll down to view upcoming birthdays and stuff youll see that the holidays currently look like this ( Labor Day, Autumnal Equinox, United Nations Day, Halloween, Veterans Day, Thanksgiving )

Well what needs to be changed to get it to look like birthdays and events... example below.

Upcoming Holidays:
Date Here - Labor Day
Date Here - Autumnal Equinox
Date Here - United Nations Day
Date Here - Halloween
Date Here - Veterans Day
Date Here - Thanksgiving
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

MoreBloodWine

Quote from: [SiNaN] on August 18, 2008, 09:51:57 AM
Did you get it solved MoreBloodWine?
Not yet no... If im not mistaken this (what I posted in my last reply) is something you wanted as well.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


[SiNaN]

Well, I even don't use the calendar. But this would help you I hope:

BoardIndex.php

Find:

$context['calendar_holidays'] = array_merge($context['calendar_holidays'], $holidays[strftime('%Y-%m-%d', $i)]);

Replace:

$context['calendar_holidays'][strftime('%Y-%m-%d', $i)] = $holidays[strftime('%Y-%m-%d', $i)];

BoardIndex.template.php

Find:

echo '
<span style="color: #', $modSettings['cal_holidaycolor'], ';">', $txt['calendar5'], ' ', implode(', ', $context['calendar_holidays']), '</span><br />';


Replace:

{
echo '
<span style="color: #', $modSettings['cal_holidaycolor'], '; text-decoration:underline;">Upcoming Holidays:<br /></span><span style="color: #', $modSettings['cal_holidaycolor'], ';">';

foreach($context['calendar_holidays'] as $index => $holiday)
foreach($holiday as $day)
echo $index, ' - ', $day, '<br />';

echo '
</span><br />';
}
Former SMF Core Developer | My Mods | SimplePortal

MoreBloodWine

That did the trick, Thx man. Question though.

Is there any way to make this part display in white like the other dates for B-Days & Events ?

2008-09-01 -
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


[SiNaN]

Find:

               echo $index, ' - ', $day, '<br />';

Replace:

               echo '<span style="color: #FFFFFF;">', $index, ' -</span> ', $day, '<br />';
Former SMF Core Developer | My Mods | SimplePortal

MoreBloodWine

Thx man you rock ;-p

Now I got everything I've ever wanted out of this topic except for proper date formatting (MDY vs YMD)

Yes, I do know Johnny B's code helps with this but at the same time it hyperlinks the entire line instead of leaving the formatting as it is now while just changing the way in which the date orders itself if that makes sense.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: