Page 1 of 50 12311 ... LastLast
Results 1 to 10 of 500
  1. #1
    Join Date
    Oct 2004
    Posts
    50
    Plugin Contributions
    1

    Default Event Calendar v3

    I started to port the events calendar from osc to zen.

    The most of the work is done. The admin section working OK and half of the frontend.
    Some coding is needed to be done for the calendar year_view in main and the block.

    I have this error in the calendar.php class.

    Fatal error: Call to a member function on a non-object in /WebServer/includes/classes/calendar.php on line 120

    Here is calendar class

    PHP Code:
    <?php

    class Calendar
    {
        
    /*
            Constructor for the Calendar class
        */
        
    function Calendar()
        {
        }
        
        
    /*
            Get the array of strings used to label the days of the week. This array contains seven 
            elements, one for each day of the week. The first entry in this array represents Sunday. 
        */
        
    function getDayNames()
        {
            return 
    $this->dayNames;
        }
        
        
    /*
            Set the array of strings used to label the days of the week. This array must contain seven 
            elements, one for each day of the week. The first entry in this array represents Sunday. 
        */
        
    function setDayNames($names)
        {

            
    $this->dayNames $names;
        }

        
    /*
            Get the array of strings used to label the months of the year. This array contains twelve
            elements, one for each month of the year. The first entry in this array represents January.
        */
        
    function getMonthNames()
        {
            
    $this->monthNames;
        }

        
    /*
            Set the array of strings used to label the months of the year. This array must contain twelve
            elements, one for each month of the year. The first entry in this array represents January.
        */
        
    function setMonthNames($names)
        {
             
    $this->monthNames $names;
        }
        
        
    /* 
            Gets the start day of the week. This is the day that appears in the first column
            of the calendar. Sunday = 0.
        */
          
    function getStartDay()
        {
            return 
    $this->startDay;
        }
        
        
    /* 
            Sets the start day of the week. This is the day that appears in the first column
            of the calendar. Sunday = 0.
        */
        
    function setStartDay($day)
        {
            
    $this->startDay $day;
        }
        
      
        
    /* 
            Gets the start month of the year. This is the month that appears first in the year
            view. January = 1.
        */
        
    function getStartMonth()
        {
            return 
    $this->startMonth;
        }
        
        
    /* 
            Sets the start month of the year. This is the month that appears first in the year
            view. January = 1.
        */
        
    function setStartMonth($month)
        {
            
    $this->startMonth $month;
        }
        
        
        
    /*
            Return the URL to link to in order to display a calendar for a given month/year.
            You must override this method if you want to activate the "forward" and "back" 
            feature of the calendar.
            
            Note: If you return an empty string from this function, no navigation link will
            be displayed. This is the default behaviour.
            
            If the calendar is being displayed in "year" view, $month will be set to 1.
        */

        
    function getCalendarLink($month$year)
        {
             return 
    "?_month=$month&_year=$year";
        }
       
        function 
    pad($s$n)
        {
        
    $r $s;
        while (
    strlen($r) < $n)
        {
        
    $r "0".$r;
        }
        return 
    $r;
        }
        
        function 
    getFileName($day$month$year)
        {
            return 
    $this->pad($year4) ."-"$this->pad($month2) ."-"$this->pad($day2);
        }
        
        function 
    getDbLink($day$month$year)
        {    
            
    $dateString $this->getFileName($day$month$year);        
            
            
    //get all events that have the provided date in their duration.
            
    $event $db->Execute("select start_date from " TABLE_EVENTS_CALENDAR 
                
    " where '" $dateString "' between start_date and end_date");
            
    //if(zen_db_num_rows($request) > 0) 
            
    if($event->RecordCount() > 0)
            {
                
    //while($event = zen_db_fetch_array($request))
                
    while (!$event->EOF
                {    
    //get the first event for this day's start date for the link
                    
    list($year_start$month_start$day_start) = split ('[/.-]'$event->fields['start_date']);
                    
                    break;
                    
    $event->MoveNext(); 
                
                }   

                
    $bname FILENAME_EVENTS_CALENDAR;
                return 
    "index.php?main_page=".$bname."&_day=$day_start&_month=$month_start&_year=$year_start";
              }
        }

        
    /*
            Return the HTML for the current month
        */
        
    function getCurrentMonthView()
        {
            
    $d getdate(time());
            return 
    $this->getMonthView($d["mon"], $d["year"]);
        }
        

        
    /*
            Return the HTML for the current year
        */
        
    function getCurrentYearView()
        {
            
    $d getdate(time());
            return 
    $this->getYearView($d["year"]);
        }
        
        
        
    /*
            Return the HTML for a specified month
        */
        
    function getMonthView($month$year)
        {
            return 
    $this->getMonthHTML($month$year);
        }

        
    /*
            Return the HTML for a specified year
        */
        
    function getYearView($year)
        {
            return 
    $this->getYearHTML($year);
        }
        

        
    /********************************************************************************
        
            The rest are private methods. No user-servicable parts inside.
            
            You shouldn't need to call any of these functions directly.
            
        *********************************************************************************/

        /*
            Calculate the number of days in a month, taking into account leap years.
        */
        
    function getDaysInMonth($month$year)
        {
            if (
    $month || $month 12)
            {
                return 
    0;
            }
       
            
    $d $this->daysInMonth[$month 1];
       
            if (
    $month == 2)
            {
                
    // Check for leap year
                
    if ($year%== 0)
                {
                    if (
    $year%100 == 0)
                    {
                        if (
    $year%400 == 0)
                        {
                            
    $d 29;
                        }
                    }
                    else
                    {
                        
    $d 29;
                    }
                }
            }
            return 
    $d;
        }
        
        
    /*
            Generate the HTML for a given month
        */
        
    function getMonthHTML($m$y$show 1)
        {
            
    $s "";
            
            
    $a $this->adjustDate($m$y);
            
    $month $a[0];
            
    $year  $a[1];
            
            
    $daysInMonth $this->getDaysInMonth($month$year);
            
    $date getdate(mktime(1200$month1$year));
            
            
    $first $date["wday"];
            
    $monthName $this->monthNames[$month 1];
            
            
    $prev $this->adjustDate($month 1$year);
            
    $next $this->adjustDate($month 1$year);
            
            
    $this_month date('m');
            
    $this_year date('Y');
            
    $header $monthName . (($show 0) ? " " $year "");
            
    $D $this->monthNames[11].'&nbsp;';
            
    $J $this->monthNames[0].'&nbsp;';
            
            if (
    $show == 1)
            {
             
    $prevMonth '<a href='FILENAME_EVENTS_CALENDAR_CONTENT $this->getCalendarLink($prev[0], $prev[1]).' target=calendar title='$this->monthNames[$month 2] . (($month-1) ? $D.($year-1) : '&nbsp;'$year) .' >&lt;</a>';
             
    $nextMonth '<a href='FILENAME_EVENTS_CALENDAR_CONTENT $this->getCalendarLink($next[0], $next[1]).' target=calendar title='$this->monthNames[$month 0] . (($month+11) ? $J.($year+1) : '&nbsp;'$year) .' >&gt;</a>';
            }
            else
            {
                
    $prevMonth "";
                
    $nextMonth "";
            }
            
            
    $s .= "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
            
    $s .= "<tr class=\"calendarHeader\">\n";
            
    $linkHeader zen_href_link(FILENAME_EVENTS_CALENDAR"_month=$month&_year=$year");
            
    $s .= "<td align=\"left\"><a href=\"$linkHeader\" target=\"_parent\">$header</a></td>\n";
            
    $s .= "<td align=\"center\" class=\"yearHeader\">\n";
          if(
    mktime (0,0,0,$month ,0,$year) > mktime (0,0,0,$this_month ,0,$this_year)){
            
    $s .= $prevMonth;
            }else{
     
    //       $s .= "&nbsp;";
            
    $s .= $prevMonth;
            }
            
    $s .= "</td>\n";
            
    $s .= "<td align=\"center\" class=\"yearHeader\">$nextMonth</td></tr>\n";
            
    $s .= "<tr><td colspan=\"3\">\n";
            
    $s .= "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" class=\"calendarMonth\"><tr class=\"calendarHeader\">\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+1)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+2)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+3)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+4)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+5)%7] . "</td>\n";
            
    $s .= "<td align=\"center\" valign=\"middle\">" $this->dayNames[($this->startDay+6)%7] . "</td>\n";
            
    $s .= "</tr>\n";
            
            
    // We need to work out what date to start at so that the first appears in the correct column
            
    $d $this->startDay $first;
            while (
    $d 1)
            {
                
    $d -= 7;
            }

            
    // Make sure we know when today is, so that we can use a different CSS style
            
    $today getdate(time());
            
    $start_day $this->getStartDay();
            
    $click BOX_CLICK_LINK;
            while (
    $d <= $daysInMonth)
            {
                
    $s .= "<tr>\n";
                for (
    $i 0$i 7$i++)
                {
                    
    $class = (($i < (6-$start_day) &! $i <= $start_day) ? (($year == $today["year"] && $month == $today["mon"] && $d == $today["mday"]) ? "calendarToday" "calendar" ) : (($year == $today["year"] && $month == $today["mon"] && $d == $today["mday"]) ? "calendarToday" "calendarWeekend"));
                    if (
    $d && $d <= $daysInMonth)
                    {
                     
    $link $this->getDbLink($d$month$year);
                     
    $s .= (($link == "") ? "<td class=\"$class\" align=\"left\" valign=\"bottom\">" "<td class=\"$class\" onclick=top.window.location=\"$link\" align=\"left\" valign=\"bottom\" style=\"cursor: hand;\">" );
                     if(
    $show == 1){
                     
    $s .= (($link == "") ? $d "<a href=\"$link\" target=\"_parent\" title=\"$click\">$d</a>");
                     }else{
                     
    $s .= (($link == "") ? $d "<a href=\"$link\" title=\"$click\">$d</a>");
                     }
                    }
                    else
                    {
                        
    $s .= "<td class=\"empty\">&nbsp;";
                    }
                      
    $s .= "</td>\n";       
                    
    $d++;
                }
                
    $s .= "</tr>\n";    
            }
            
    $s .= "</table>\n";
            
    $s .= "</td></tr></table>\n";
            return 
    $s;      
        }


        
    /*
            Generate the HTML for a given year
        */
        
    function getYearHTML($year)
        {
            
    $year_view 1;
            
    $s "";
            
    $prev FILENAME_EVENTS_CALENDAR $this->getCalendarLink(1$year 1) .'&year_view=1';
            
    $next FILENAME_EVENTS_CALENDAR $this->getCalendarLink(1$year 1) .'&year_view=1';
            
    $this_year date('Y');

            
    $s .= "<table align=\"center\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\" style=\"cursor: default\">\n";
            
    $s .= "<tr>";
            
            if(
    $year $this_year){
            
    $s .= "<td class=\"yearHeader\" align=\"center\" align=\"left\">" . (($prev == "") ? "&nbsp;" "<a href=\"$prev\">&lt;&lt;</a>")  . "</td>\n";
            }else{
            
    $s .= "<td class=\"yearHeader\" align=\"center\" align=\"left\">&nbsp;</td>\n";
            }
            
            
    $s .= "<td height=\"20\" class=\"yearHeader\" align=\"center\">" . (($this->startMonth 1) ? $year " - " . ($year 1) : $year) ."</td>\n";
            
    $s .= "<td class=\"yearHeader\" align=\"center\" align=\"right\">" . (($next == "") ? "&nbsp;" "<a href=\"$next\">&gt;&gt;</a>")  . "</td>\n";
            
    $s .= "</tr>\n";
            
    $s .= "<tr>";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "</tr>\n";
            
    $s .= "<tr>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "</tr>\n";
            
    $s .= "<tr>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "</tr>\n";
            
    $s .= "<tr>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML($this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML(10 $this->startMonth$year0) ."</td>\n";
            
    $s .= "<td valign=\"top\">" $this->getMonthHTML(11 $this->startMonth$year0) ."</td>\n";
            
    $s .= "</tr>\n";
            
    $s .= "</table>\n";
            return 
    $s;
        }

        
    /*
            Adjust dates to allow months > 12 and < 0. Just adjust the years appropriately.
            e.g. Month 14 of the year 2001 is actually month 2 of year 2002.
        */
        
    function adjustDate($month$year)
        {
            
    $a = array();  
            
    $a[0] = $month;
            
    $a[1] = $year;
            while (
    $a[0] > 12)
            {
                
    $a[0] -= 12;
                
    $a[1]++;
            }
            while (
    $a[0] <= 0)
            {
                
    $a[0] += 12;
                
    $a[1]--;
            }
            return 
    $a;
        }
        


        
    /*
            The start day of the week. This is the day that appears in the first column
            of the calendar. Sunday = 0.
        */
        
    var $startDay '1';


        
    /*
            The start month of the year. This is the month that appears in the first slot
            of the calendar in the year view. January = 1.
        */
        
    var $startMonth '1';

        
    /*
            The labels to display for the days of the week. The first entry in this array
            represents Sunday.
        */
        
    var $dayNames = array('Su','Mo','Tu','We','Th','Fr','Sa');

        
    /*
            The labels to display for the months of the year. The first entry in this array
            represents January.
        */
        
    var $monthNames = array('January','February','March','April','May','June','July','August','September','October','November','December');

        
    /*
            The number of days in each month. You're unlikely to want to change this...
            The first entry in this array represents January.
        */
          
    var $daysInMonth = array('31''28''31''30''31''30''31''31''30''31''30''31');
    }

    ?>
    I think that the problem is with the var $daysInMonth and the function that uses this var in the last line

    If i comment last line the calendar is working ok with months years but without the days.
    // var $daysInMonth = array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');

    Here is the full ported code for zencart

    oscommerce.com/community/contributions,1061 and here is the original osc events callendar.

    Here you can see the year_view of the events calendar

    Maybe anyone can take look at the code please?.

    Thanks.
    Last edited by Kim; 2 Oct 2007 at 08:13 PM.

  2. #2
    Join Date
    May 2005
    Location
    Brussels belgium
    Posts
    203
    Plugin Contributions
    0

    Idea or Suggestion Re: Event Calendar

    Looks good great id for now I use google calendar but can change the layout

    Zen cart or nothing !!

  3. #3
    Join Date
    Oct 2004
    Posts
    50
    Plugin Contributions
    1

    Default Re: Event Calendar

    Ok I solved the error by adding

    global $db; to the getDbLink() function.

  4. #4
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Event Calendar

    Quote Originally Posted by stav View Post
    Ok I solved the error by adding

    global $db; to the getDbLink() function.
    Great work.. so does your zip file(link above) contain latest
    files to enable correct working of this ported calendar mod?

  5. #5
    Join Date
    May 2005
    Location
    Brussels belgium
    Posts
    203
    Plugin Contributions
    0

    Default Re: Event Calendar

    I've try to make the changes like stav explain but don't work

    regards
    Zen cart or nothing !!

  6. #6
    Join Date
    Oct 2004
    Posts
    50
    Plugin Contributions
    1

    Default Re: Event Calendar

    The events calendar is not ready for production site. I can say that is an alpha version for now.

    At this time you can use onlu the list mode of events, the callendar view is not ready.

  7. #7
    Join Date
    Oct 2004
    Posts
    50
    Plugin Contributions
    1

    Default Re: Event Calendar

    I have updated the events calendar now is functional the calendar view in main and in the sidebox.

    Some cleaning is nedded to be done and small bug fixes. You can download and test it from here.

    Sorry about my bad english.

  8. #8
    Join Date
    Oct 2004
    Posts
    50
    Plugin Contributions
    1

    Default Re: Event Calendar

    Tthe events calendar v1.0 RC1 is on the way to the contributions/other modules.

    and waiting for aproval .

    Until then you can download the contribution from the link in the previous post.

  9. #9
    Join Date
    Apr 2006
    Location
    Fort Bragg, North Carolina
    Posts
    153
    Plugin Contributions
    0

    Default Re: Event Calendar

    When trying to add a new event I get the following error:

    Fatal error: Cannot use string offset as an array in mywebsite.com/admin/includes/classes/table_block.php on line 77

    Can anybody tell me what am I doing wrong?

    Thanks

  10. #10
    Join Date
    Jan 2007
    Posts
    49
    Plugin Contributions
    0

    Default Re: Event Calendar

    Hi: Ive installed Events Calendar. Im using Apple Zen Temp with drop down menus. The Events Cal is appearing on my sideboxes funky.
    The HOME part of the drop menu is there with the calendar.

    I installed the Sql patch. and the tablenupdate file. I gave the permissins on the image folder also. The caledar reads fine on the side bar with the correct date highlighted in yellow. When i view selected month the sideboxes are showing up on the left side of page. (Apple Zen is a default rt side boxes only) Start Date End Date And Title are showing up on page in yellow bar with a subhead of NO events Found. Above it reads All Events.
    Any idea where the snag is. I checked all install files and did not miss one. thanks for the help, im new at all of this.

    1)Install database sql file tabelenupdate.sql from admin/tools/install sql patches

    2)Add all files to your folders in your zencart directory

    3)Make writable chmod(0777) images/events_images directory

    4)Edit includes/templates/your_template/common/tpl_main_page.php

    //Add at top first line before "<?php " this code:

    <?php
    if (isset($_GET['eventmode']) && $_GET['eventmode'] == 'eventframe') {
    require($body_code);
    }else{
    ?>

    //Add at bottom last line after "?> " this code:

    <?php
    }
    ?>
    [FONT=Arial]DezineJunkie[/FONT]

 

 
Page 1 of 50 12311 ... LastLast

Similar Threads

  1. Timeslot Booking Event Calendar
    By escapis in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 31 Jan 2014, 12:45 AM
  2. Multiple Choices error with Event Booking Calendar addon
    By FukienMan in forum All Other Contributions/Addons
    Replies: 9
    Last Post: 16 Feb 2012, 12:17 AM
  3. Help with Event Calendar add-on
    By blabay in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 24 Mar 2010, 01:34 PM
  4. Event Calendar Broken - take out of download section!
    By Asmodai in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 10 Nov 2007, 07:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR