You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 213 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - nucalendar am/pm to 24 hours hack ? [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
Butte
Nuke Soldier
Nuke Soldier


Joined: Jul 16, 2003
Posts: 14


PostPosted: Tue Mar 22, 2005 1:13 am Reply with quoteBack to top

NUcalendar.

Anybody have done a change from am/pm to 24 hours ?

Also have any body made a hack that have weekday start with monday, instead of sunday ?

Thanks for any answer on this.

Butte
spam1@anjaro.dk
Find all posts by ButteView user's profileSend private message
Mysmasken
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2005
Posts: 33


PostPosted: Mon Sep 05, 2005 1:19 pm Reply with quoteBack to top

I'm also interrested in this!
Find all posts by MysmaskenView user's profileSend private message
Mysmasken
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2005
Posts: 33


PostPosted: Tue Sep 13, 2005 11:29 am Reply with quoteBack to top

This is the code, and I supposed it's kinda simple, but I don't get it:

Code:
<?php

/************************************************************************/
/* NuCalendar                                                           */
/* ===========================                                          */
/*                                                                      */
/* 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.
 */

require_once("mainfile.php");

function PrevDay(&$month, &$day, &$year)
{

   $day -= 1;
   if ($day == 0) {
         
      $month -= 1;   
      
      if ($month == 0) {
         $month = 12;
         $year -= 1;
      }
      
      if ($month == 1 || $month == 3 || $month == 5 || $month == 7 || $month == 8 || $month == 10 || $month == 12) {
         $day = 31;
      } else if ($month == 2) {
         $day = 28;
      } else {
         $day = 30;
      }
   }
}


function NextDay(&$month, &$day, &$year)
{
   $day += 1;
    $maxday = 30;
      if ($month == 1 || $month == 3 || $month == 5 || $month == 7 || $month == 8 || $month == 10 || $month == 12) {
      $maxday = 31;
   } else if ($month == 2) {
      $maxday = 28;
   }
   
   if ($day > $maxday) {
      $month += 1;
      $day = 1;
      
      if ($month == 13) {
         $month = 1;
         $year += 1;
      }
   }
}

function DotWForFirstDay($month, $year)
{
   return DotWForDate($month, 1, $year);
}

function DotWForDate($month, $day, $year)
{
    return date("w", mktime(0, 0, 0, $month, $day, $year));
}

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

   return $lastday;
}

function NumDotWInMonth($dotw, $month, $year)
{
   $numDotW = 0;   
   for ($x = 1; $x < NumDaysInMonth($month, $year)+1; $x++) {
      if ($dotw == DotwForDate($month, $x, $year)) {
         $numDotW++;
      }
   }
   return $numDotW;
}


function PrintEventDateHeader($month, $day, $year)
{
   $prevday = $day;
      $prevmonth = $month;
      $prevyear = $year;

      PrevDay($prevmonth, $prevday, $prevyear);

      $nextday = $day;
      $nextmonth = $month;
      $nextyear = $year;

      NextDay($nextmonth, $nextday, $nextyear);


   $today = GetMonthDayYearText($month, $day, $year);
   $backward = GetMonthDayYearText($prevmonth, $prevday, $prevyear);
   $forward = GetMonthDayYearText($nextmonth, $nextday, $nextyear);

   echo "<td width=\"100%\">";
        echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\"  width=\"100%\">";
        echo "<tr>";
        echo "<td width=\"20%\" align=\"left\"><a href=modules.php?name=NuCalendar&op=ShowDay&day=".$prevday."&month=".$prevmonth."&year=".$prevyear.">";
      $ThemeSel = get_theme();
      if (file_exists("themes/$ThemeSel/images/nucalendar_left.gif"))
      {
         echo "<img src=\"themes/$ThemeSel/images/nucalendar_left.gif\" border=\"0\" align=\"absmiddle\" />&nbsp;";
      }
      else if (file_exists("images/left.gif"))
      {
         echo "<img src=\"images/left.gif\" border=\"0\" align=\"absmiddle\" />&nbsp;";
      }
      else
      {
         echo '<< ';
      };
      echo "".$backward."</a></td>";
        echo "<td width=\"60%\" align=\"center\"><b><font size=\"5\">".$today."</font></b></td>";
        echo "<td width=\"20%\" align=\"right\"><a href=modules.php?name=NuCalendar&op=ShowDay&day=".$nextday."&month=".$nextmonth."&year=".$nextyear.">".$forward."&nbsp;";
      $ThemeSel = get_theme();
      if (file_exists("themes/$ThemeSel/images/nucalendar_right.gif"))
      {
         echo "<img src=\"themes/$ThemeSel/images/nucalendar_right.gif\" border=\"0\" align=\"absmiddle\" />";
      }
      else if (file_exists("images/right.gif"))
      {
         echo "<img src=\"images/right.gif\" border=\"0\" align=\"absmiddle\" />";
      }
      else
      {
         echo '>>';
      };
      
      echo "</a></td>";
        echo "</tr>";
        echo "</table>";
}

function GetMonthDayYearText($month, $day, $year)
{
   global $dbi, $user_prefix, $currentlang;

   $result = sql_query("SELECT * FROM ".$user_prefix."_nucal_options WHERE 1", $dbi);
   $row = sql_fetch_array($result, $dbi);


   if ($row[show_mdy]) {
      $rtnVal = GetMonthName($month);


      if ($currentlang == "english")
         $formater = " jS Y";
      else
         $formater = " j Y";
      $rtnVal .= date($formater, mktime(0, 0, 0, $month, $day, $year));   
   } else {
       if ($currentlang == "english")
                        $formater = "jS";
                else
                        $formater = "j";
      $rtnVal = date($formater, mktime(0, 0, 0, $month, $day, $year));
      $rtnVal .= " " . GetMonthName($month) . " ";
      $rtnVal .= date("Y", mktime(0, 0, 0, $month, $day, $year));
   }

   return $rtnVal;
}

function GetMonthYearText($month, $year)
{
        $rtnVal = GetMonthName($month);
        $rtnVal .= date(" Y", mktime(0, 0, 0, $month, 1, $year));
        return $rtnVal;
}

function GetMonthDayText($month, $day)
{

   global $dbi, $user_prefix;

        $result = sql_query("SELECT * FROM ".$user_prefix."_nucal_options WHERE
1", $dbi);
        $row = sql_fetch_array($result, $dbi);

        if ($row[show_mdy]) {
                $rtnVal = $month . "/" . $day;
        } else {
                $rtnVal = $day . "/" . $month;
        }
        return $rtnVal;
}

function GetMonthName($month)
{
   $rtnVal = "";
   if ($month == -1) {
      $rtnVal = date("m");
   } else {
      $rtnVal = date("F", mktime(0, 0, 0, $month, 1, 0));
   }

   // php's date func always seems to return month names in english....
   $rtnVal = ereg_replace("January", _JANUARY, $rtnVal);
   $rtnVal = ereg_replace("February", _FEBRUARY, $rtnVal);
   $rtnVal = ereg_replace("March", _MARCH, $rtnVal);
   $rtnVal = ereg_replace("April", _APRIL, $rtnVal);
   $rtnVal = ereg_replace("May", _MAY, $rtnVal);
   $rtnVal = ereg_replace("June", _JUNE, $rtnVal);
   $rtnVal = ereg_replace("July", _JULY, $rtnVal);
   $rtnVal = ereg_replace("August", _AUGUST, $rtnVal);
   $rtnVal = ereg_replace("September", _SEPTEMBER, $rtnVal);
   $rtnVal = ereg_replace("October", _OCTOBER, $rtnVal);
   $rtnVal = ereg_replace("November", _NOVEMBER, $rtnVal);
   $rtnVal = ereg_replace("December", _DECEMBER, $rtnVal);

   return $rtnVal;
}

function MilitaryTo12Hour($miltime)
{
   list($hour, $min, $sec) = split(":", $miltime);

   $pm = FALSE;
   if ($hour > 11) {
      $pm = TRUE;
      if ($hour == 24) {
         $pm = FALSE;
         $hour = 12;
      } else if ($hour == 12) {
         $hour = 12;
         $pm = TRUE;
      } else {
         $hour -= 12;
      }
   } else if ($hour == 0) {
      $hour = 12;
      $pm = FALSE;
   }

   $rtnVal = $hour . ":" . $min;
   if ($pm == 1)
      $rtnVal .= " " . _VIEW_DAY_PM;
   else
      $rtnVal .= " " . _VIEW_DAY_AM;

   return $rtnVal;
}

function MilitaryTo12HourDuration($miltime)
{
   list($hour, $min, $sec) = split(":", $miltime);

   if ($hour == 24) {
      $rtnVal = _VIEW_DAY_ALL_DAY;
   } else {
      $rtnVal = $hour . " " . _VIEW_DAY_HOURS;
      $rtnVal .= " " . $min . " " . _VIEW_DAY_MINUTES;
   }

   return $rtnVal;
}

function MilitaryTimeIsPM($miltime)
{
   list($hour, $min, $sec) = split(":", $miltime);

   $rtnVal = FALSE;
   if ($hour > 11) {
                $rtnVal = TRUE;
                if ($hour == 24) {
                        $rtnVal = FALSE;
                }
        } else if ($hour == 0) {
                $pm = FALSE;
        }

   return $rtnVal;
}

function MilitaryTimeGetHour($miltime)
{
        list($hour, $min, $sec) = split(":", $miltime);

   $pm = FALSE;
        if ($hour > 11) {
                if ($hour == 24) {
                        $hour = 12;
                } else if ($hour == 12) {
                        $hour = 12;
                } else {
                        $hour -= 12;
                }
        } else if ($hour == 0) {
                $hour = 12;
        }
   return $hour;
}

function MilitaryTimeGetMinute($miltime)
{
   list($hour, $min, $sec) = split(":", $miltime);

   return $min;
}

function TimeToMilitaryTime($hour, $min, $pm)
{
   if ($pm == 1) {
      if ($hour < 12)
         $hour += 12;
   } else {
      if ($hour == 12)
         $hour = 24;
   }

   return $hour . ":" . $min;
}
?>
Find all posts by MysmaskenView user's profileSend private message
Mysmasken
Nuke Soldier
Nuke Soldier


Joined: Aug 09, 2005
Posts: 33


PostPosted: Wed Sep 14, 2005 6:45 am Reply with quoteBack to top

I think I fixed it. This is what I did:

modules/NuCalendar/datefuncs.php
On line 74-77 replace:
Code:
function DotWForFirstDay($month, $year)
{
   return DotWForDate($month, 1, $year);
}


With:
Code:
function DotWForFirstDay($month, $year)
{
   return DotWForDate($month, 0, $year);
}


blocks/block-Month_Of_Events2.php
On line 70-73 replace:
Code:

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


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


NuCalendar\language\lang-english.php
To get the days in your own language and in the right order switch the english "Sunday" to "Monday" in your own language.
Find all posts by MysmaskenView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next 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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.364 Seconds - 115 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::