Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard
Author Message
64bitguy
The Mouse Is Extension Of Arm



Joined: Mar 06, 2004
Posts: 1164

PostPosted: Sat Jan 29, 2005 3:43 pm Reply with quote

Hi Folks

As I've been inundated with emails, PMs, feedback on my site and basically tagged via every possible medium beyond phone calls from people seeing this code in action on my site; by popular demand, here it is:

GT-Calendar.php
Code:
<?php 


$urlin = array(
"'(?<!/)modules.php\?name=Calendar&amp;printing=1&amp;day=([0-9]*)&amp;month=([0-9]*)&amp;year=([0-9]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=([a-zA-Z0-9_-]*)&amp;month=([0-9]*)&amp;day=([0-9]*)&amp;year=([0-9]*)&amp;([a-zA-Z0-9_-])=([0-9]*)&amp;eventid=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=([a-zA-Z0-9_-]*)&amp;month=([0-9]*)&amp;day=([0-9]*)&amp;year=([0-9]*)&amp;eventid=([a-zA-Z0-9_-]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=ShowDay&amp;month=([0-9]*)&amp;day=([0-9]*)&amp;year=([0-9]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=ShowDay&amp;day=([0-9]*)&amp;month=([0-9]*)&amp;year=([0-9]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=ShowMonth&amp;month=([0-9]*)&amp;day=([0-9]*)&amp;year=([0-9]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;month=([0-9]*)&amp;year=([0-9]*)'",
"'(?<!/)modules.php\?name=Calendar&amp;op=SubmitEvent'",
"'(?<!/)modules.php\?name=Calendar&amp;op=AddEvent'",
"'(?<!/)modules.php\?name=Calendar'"
);

$urlout = array(
"calendar-print-\\1-\\2-\\3.html",
"calendar-\\1-\\2-\\3-\\4-\\5=\\6-\\7.html",
"calendar-\\1-\\2-\\3-\\4-\\5.html",
"calendar-allday-\\1-\\2-\\3.html",
"calendar-showday-\\1-\\2-\\3.html",
"calendar-showmonth-\\1-\\2-\\3.html",
"calendar-monthyear-\\1-\\2.html",
"calendar-submit-event.html",
"calendar-add-event.html",
"calendar.html"
);

?>


.htaccess
Code:
RewriteRule ^calendar-print-([0-9]*)-([0-9]*)-([0-9]*).html modules.php?name=Calendar&printing=1&day=$1&month=$2&year=$3 [L]

RewriteRule ^calendar-([a-zA-Z0-9_-]*)-([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z0-9_-]*)=([0-9]*)-([a-zA-Z0-9_-]*).html modules.php\?name=Calendar&op=$1&month=$2&day=$3&year=$4&$5=$6&eventid=$7 [L]
RewriteRule ^calendar-([a-zA-Z0-9_-]*)-([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z0-9_-]*).html modules.php?name=Calendar&op=$1&month=$2&day=$3&year=$4&eventid=$5 [L]
RewriteRule ^calendar-allday-([0-9]*)-([0-9]*)-([0-9]*).html modules.php?name=Calendar&op=ShowDay&month=$1&day=$2&year=$3 [L]
RewriteRule ^calendar-showday-([0-9]*)-([0-9]*)-([0-9]*).html modules.php?name=Calendar&op=ShowDay&day=$1&month=$2&year=$3 [L]
RewriteRule ^calendar-showmonth-([0-9]*)-([0-9]*)-([0-9]*).html modules.php?name=Calendar&op=ShowMonth&month=$1&day=$2&year=$3 [L]
RewriteRule ^calendar-monthyear-([0-9]*)-([0-9]*).html modules.php?name=Calendar&month=$1&year=$2 [L]
RewriteRule ^calendar-submit-event.html modules.php?name=Calendar&op=SubmitEvent [L]
RewriteRule ^calendar-add-event.html modules.php?name=Calendar&op=AddEvent [L]
RewriteRule ^calendar.html modules.php?name=Calendar [L]


NOTICE:Both of these files were revised on February 3, 2005 to reflect the monthyear option that I missed in Calendar and to support the below block.

Sorry it took so long to get out to everyone, but hey, I've been busier than a six-tailed cat in a room full of rocking chairs.

If anyone can figure out how to Tap the popup print window, let me know. I'm thinking that it is only a problem because it's not part of the "module" location.

Ideas?

Anyway.. Enjoy!
Steph

_________________
Steph Benoit
100% Section 508 and W3C HTML5 and CSS Compliant (Truly) Code, because I love compliance.

Last edited by 64bitguy on Thu Feb 03, 2005 1:08 pm; edited 2 times in total 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Jan 30, 2005 12:02 pm Reply with quote

Thanks 64bit for your contribution!
 
View user's profile Send private message
dean
Worker
Worker



Joined: Apr 14, 2004
Posts: 193

PostPosted: Mon Jan 31, 2005 11:39 am Reply with quote

I am one of the pests that urged you on. Very few taps have been generated since GT NextGen's author has been on sabatical. This effort makes it possible for those of us who need a replacement for the Event Calendar to move forward. I will proudly place this in my GT NextGen download section with credit to the wiley 64BitGuy.
 
View user's profile Send private message
64bitguy







PostPosted: Mon Jan 31, 2005 11:51 am Reply with quote

Added bonus time:

blocks-GT-Month_of_Events_3.php
Code:
<?php

/************************************************************************/
/* Calendar                                                           */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2003 by Bill Smith                                     */
/* http://www.vettesofthetropics.com                                    */
/*                                                                      */
/* Based on Web Calendar                                                */
/* Copyright (c) 2001 by Proverbs, LLC                                  */
/* http://www.proverbs.biz                                              */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*
 *  ©2001 Proverbs, LLC. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify it withthe following stipulations:
 *  Changes or modifications must retain all Copyright statements, including, but not limited to the Copyright statement
 *  and Proverbs, LLC homepage link provided at the bottom of this page.
 * 
 *  GoogleTapped by Steph Benoit - http://64bit.us
 */

if (stristr($_SERVER['SCRIPT_NAME'], "block-GT-Month_of_Events_3.php")) {
    Header("Location: ../index.php");
    die();
}

require_once("modules/Calendar/dbaccess.inc.php");
require_once("modules/Calendar/datefuncs.php");
require_once("modules/Calendar/printevent.php");
get_lang("Calendar");

function MakeDayLink($fmonth, $fday, $fyear, $color)
{
    $rtnVal = "<a href=calendar-showday-"
 . $fday ."-". $fmonth ."-" . $fyear . ".html>";
         $rtnVal .= "<font color=" . $color . ">";
         $rtnVal .=  $fday . "</font></a>";

   return $rtnVal;

}

function AddDayBlock2($fdotw, $fday, $fmonth, $fyear)
{
   $thisday=date("d");
   $rtnVal = "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">";

    $numEvents = Calendar_NumEventsOn($fmonth, $fday, $fyear, $fdotw);

   if ($fday == $thisday) {
      $rtnVal .= MakeDayLink($fmonth, $fday, $fyear, "#0f0fff");
   } else if ($numEvents > 0) {
      $rtnVal .= MakeDayLink($fmonth, $fday, $fyear, "#cc0000");
   } else {
                $rtnVal .= $fday;
   }

   $rtnVal .= "</td>";
   return $rtnVal;
}

   $month = date("m");
   $month = date("m");
   $year = date("Y");
   $first = date("w", mktime(0, 0, 0, $month, 1, $year));

   $prev_month = $month-1;
   $prev_year = $year;
   if ($month == 1) {
   $prev_month = 12;
   $prev_year--;
   }

   $next_month = $month+1;
   $next_year = $year;
   if ($month == 12) {
   $next_month = 1;
   $next_year++;
   }

$content = "<table width=100% border=0><tr><td width=5% align=left><a href=calendar-monthyear-" . $prev_month . "-" . $prev_year . ".html><</a></td>";
$content .= "<td width=100%><center><b>" .  GetMonthName($month) . " " . $year ."</b></center></td>";
$content .= "<td width=5% align=right><a href=calendar-monthyear-" . $next_month . "-" . $next_year . ".html>></a></td></tr></table>";
$content .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"  width=\"100%\">";
$content .= "<tr>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_SUNDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_MONDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_TUESDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_WEDNESDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_THURSDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_FRIDAY_SHORT."</TD>";
$content .= "<TD nowrap align=\"center\" valign=\"middle\" width=\"15%\">"._VIEW_MONTH_SATURDAY_SHORT."</TD>";
$content .= "</tr>";
$content .= "<tr><td colspan=7><hr></td></tr>";

   $lastday = 28;

   for ($i=$lastday;$i<32;$i++)
   {
      if (checkdate($month, $i, $year))
      {
         $lastday = $i;
      }
   }


   $calday = 1;
   while ($calday <= $lastday)
   {
      $content .= "<TR>";
      for ($j=0;$j<7;$j++)
      {
         if ($calday == 1)
         {
            if ($first == $j)
            {
               $content .= AddDayBlock2($j, $calday, $month, $year);
          $content .= "</td>";
               $calday++;
            }
            else
       {
               $content .= AddDayBlock2('', '', '', '');
          $content .= "</td>";
            }
         }
         else
         {
            if ($calday > $lastday)
            {
               $content .= AddDayBlock2('', '', '', '');
          $content .= "</td>";
            }
            else
            {
               $content .= AddDayBlock2($j, $calday, $month, $year);
          $content .= "</td>";
               $calday++;
            }
         }
      }
      $content .= "</TR><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr>";
   }



$content .= "</table>";

?>

NOTICE: This post/file was modified on february 3, 2005 to remove the special notice that existed as a comment in the file telling users to add an .htaccess line which is now included in the above .htaccess code. Thus those comments to add this line are no longer required.

Enjoy!
Steph


Last edited by 64bitguy on Thu Feb 03, 2005 1:11 pm; edited 3 times in total 
dean







PostPosted: Wed Feb 02, 2005 11:46 pm Reply with quote

You didnt by chance change the name of your module file directory from NuCalendar to Calendar?
 
64bitguy







PostPosted: Wed Feb 02, 2005 11:56 pm Reply with quote

lol... I didn't "change" anything. NuCalendar is an included mod with PHP-Nuke Platinum 7.6 and by default is installed in the /modules/Calendar directory.

If yours is different, you can simply use crimson or whatever editor to apply a global replace of all instances in all of these files of

FIND: Calendar
REPLACE: NuCalendar

Be sure your editor does case sensitive search/replace so as not to overwrite the "calendarxxx.html" functions.

I use Crimson editor which is case sensitive so it works quite well for this kind of thing.

Steph
 
dean







PostPosted: Thu Feb 03, 2005 5:04 am Reply with quote

Also renamed GT-Calendar.php to GT-NuCalendar.php. Works like a charm!!!! Zipped it up for download for those not wanting to do the edits themselves......
 
dean







PostPosted: Thu Feb 03, 2005 12:45 pm Reply with quote

I spoke to soon, I noticed that the tap doesnt work when you try to advance the calendar forward or backward using the month "buttons", ie January or March on our Calendar. I checked your site and it seems to have the same problem.
 
64bitguy







PostPosted: Thu Feb 03, 2005 12:52 pm Reply with quote

I didn't see those buttons when I tapped it. Like I said, I've tapped all of this by hand, so once in a while in a module there will be a button that I didn't see... I've only been using this puppy for about at week and I had been using the arrows and didn't even notice those labels.

Give me a few minutes and I'll add the code.

Steph
 
64bitguy







PostPosted: Thu Feb 03, 2005 1:05 pm Reply with quote

<----- 368 Posts --- I'm Beyond "Involved" LOL

Okay, remember in that block update how I said no in/outs were necessary? Smile

Well...... I was wrong because that block is actually using the same code that I missed from those month buttons on the calendar!... AHA!

So if you go up above to my post with the GT code, you'll find both the final in/outs as well as the final .htaccess which I have revised to reflect everything that you will need for the module and the block.

Thanks!
Steph
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©