collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 428
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Calendar Block  (Read 9492 times)

0 Members and 4 Guests are viewing this topic.

Offline edi67

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC1
  • SP Version: 2.3
Calendar Block
« on: October 11, 2008, 03:01:45 PM »
These are 2 type of calendar for our Simpleportal ;) need only to create one NEW PHP BLOCK and insert code in php block it's all

Regards to oringal author:
http://keithdevens.com/software/php_calendar

Code: [Select]
global $scripturl;

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

         $day_name_length = 3;
         $month_href = NULL;
         $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>";
}

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'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else $calendar .= "<td class=\"smalltext\">$day</td>";
}
if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days

echo $calendar."</tr>\n</table>\n";

This same version but with events and months clickable for smf calendar
Code: [Select]
$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 4px 0px 4px;" 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 = 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 .= '<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>\n</table>\n";

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #1 on: October 21, 2008, 09:10:24 AM »
Thanks works great!!

Chris
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline Flip

  • Semi Newbie
  • *
  • Posts: 7
  • Gender: Male
  • Flip - KE4OBT
    • Ham Radio Advisors
Re: Calendar Block
« Reply #2 on: October 23, 2008, 11:16:23 AM »
will either of the codes above show the holidays on the calendar in the block?
And take it from the defined settings - example, show upcoming holidays x number of days before they arrive?
If not, any clue how to do that?
What I want to do, if it's possible, is to have one block that has the calendar in the top part of it and the upcoming events, birthdays and holidays in the bottom part of it. This way, for the visually impaired, the screen readers can read it a lot easier.

Thanks in advance,
Flip
Flip - KE4OBT


The BLIND HAM


from


Ham Radio Advisors

Offline Costa

  • Full Member
  • ***
  • Posts: 246
  • Gender: Male
  • Don't feed the trolls...
Re: Calendar Block
« Reply #3 on: October 23, 2008, 11:24:21 AM »
It works fine to me here

Thank you!
Hugo "Costa" FernandesCrudelius est quam semper mortem timere

Offline Burke Knight

  • Sr. Member
  • ****
  • Posts: 394
  • Gender: Male
  • I tell it how I see it. Don't like it? Hit Alt+F4
    • BurkeKnight Enterprises
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
Re: Calendar Block
« Reply #4 on: October 26, 2008, 11:01:08 AM »
How do you change it so it shows Sunday at first of the week?
All members have that set in profiles, but the block still shows it at end of week.

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #5 on: October 26, 2008, 05:58:27 PM »
find this code
Code: [Select]
$first_day = 0;
and change the 0 to 1
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline AlenNS

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
    • Baklja forum
Re: Calendar Block
« Reply #6 on: October 26, 2008, 08:44:08 PM »
Is it possible to translate months and days?

Offline Burke Knight

  • Sr. Member
  • ****
  • Posts: 394
  • Gender: Male
  • I tell it how I see it. Don't like it? Hit Alt+F4
    • BurkeKnight Enterprises
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
Re: Calendar Block
« Reply #7 on: October 26, 2008, 09:29:24 PM »
find this code
Code: [Select]
$first_day = 0;
and change the 0 to 1

Actually, it was at 1, and I had to change it to 0.
But thank you, you at least showed me the way. :)

Offline AlenNS

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
    • Baklja forum
Re: Calendar Block
« Reply #8 on: October 27, 2008, 11:42:25 PM »
Is it possible to translate months and days?
Bump.

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Calendar Block
« Reply #9 on: October 28, 2008, 01:40:24 AM »
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline AlenNS

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
    • Baklja forum
Re: Calendar Block
« Reply #10 on: October 28, 2008, 10:59:11 AM »
Serbianl-utf8

Serbian has latin and cyrilic.
I'm using latin. :)

Offline Aw06

  • Full Member
  • ***
  • Posts: 238
  • Gender: Male
    • www.ShopinJA.com
  • SMF Version: 1.1.13
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #11 on: October 28, 2008, 11:53:06 AM »
I entered the second code posted, but in my block its not displaying events, ... so im not seeing halloween/etc ??

Running SP 2.0.4 .. SMF 1.1.6

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #12 on: October 28, 2008, 12:17:22 PM »
As far as I know, the events part of the second code lets you click on a date to post an event.  It does not show events.

Chris
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline Aw06

  • Full Member
  • ***
  • Posts: 238
  • Gender: Male
    • www.ShopinJA.com
  • SMF Version: 1.1.13
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #13 on: October 28, 2008, 12:25:23 PM »
Check here http://www.burkeknight.com/ and http://yarriesafety.mine.nu/

They both displaying events .. unless they using a diff or edited code ...

can those website owners give some imput please  8)

Offline cme1st2302

  • Full Member
  • ***
  • Posts: 117
  • Gender: Male
    • East Coast Astro
  • SMF Version: 1.1.11
  • SP Version: 2.3.2
Re: Calendar Block
« Reply #14 on: October 28, 2008, 12:38:20 PM »
Yes please!!!  That is what I want as well!!
Admin

He who waits for perfect conditions sees nothing!!
SMF Version: 1.1.11
SimplePortal Version: 2.3.1

Offline Manu

  • Translator
  • *
  • Posts: 203
  • Gender: Female
  • Angel by Day, Devil by Night
    • Arsenie Official Forum
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Calendar Block
« Reply #15 on: October 28, 2008, 02:43:11 PM »
Here you can find the codes for the calendar you can see at the sites there:
http://simpleportal.net/index.php?topic=89.0
Sometimes I'm an angel, sometimes I'm a devil, but I am always 100% woman and if you have a problem with me, learn to deal with it!

Offline Mithotyn

  • Jr. Member
  • **
  • Posts: 54
  • Gender: Male
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Calendar Block
« Reply #16 on: October 29, 2008, 06:06:30 PM »
Thank you  :applause:

Offline GreenStork

  • Just Registered
  • Posts: 1
  • Gender: Male
  • Fiat Justitia Ruat Caelum!
    • In guests for the Heretic =)
Re: Calendar Block
« Reply #17 on: November 08, 2008, 09:06:31 AM »
Thank you very much!  ;D
Fiat Justitia Ruat Caelum!

Offline jb3398

  • Semi Newbie
  • *
  • Posts: 29
Re: Calendar Block
« Reply #18 on: December 31, 2008, 10:05:39 PM »
Second PHP Block worked like a charm! Just what I was looking for.