We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    Quote from: wendy at Jan 12, 2006, 09:07 PM
    Btw, that’s a good idea. So are we going to back into the drawing board? I mean we have the class, except we need to set the right way to represent the data, for the calendar class to be able to access it and display it in the right way.
    I don’t think we have to go back to the drawing board at all. Give me a day to catch my breath from other projects and I’ll go ahead and create the base CalendarEvent class and the DBCalendarEvent class we can use to represent your current data source implementation of a CalendarEvent, and then use that in the Calendar class you’ve chosen here. It should be transparent to the components and will require minimal changes to the Calendar class. It’ll all make sense when I show you what I’m talking about.

    Quote from: wendy at Jan 12, 2006, 09:07 PM
    As for iCal, I believe it’s still better to have it based on database. If we can provide some kind of syncronization between the database and iCal, that will be great.
    That’s a good idea, but everyone wants something different, so why not give them the option? By implementing this as I am suggesting, someone could implement an iCalendarEvent class implementation that handled ics file persistence of the data and another could implement an AggregateCalendarEvent class that syncronized data to and from the DBCalendarEvent and iCalendarEvent implementations as you suggest. Follow? But in this way, we can reduce the number of one-off components that pop-up in the community for Calendaring, as well as provide plug and play components that could all use a common model to interact with any number of potential event data sources. I mean, I’m sure someone wants this to work with Outlook too, right? laugh
      • 32241
      • 1,495 Posts
      Sure thing, that sounds awesome. I’ll wait for your implementation then. If you want to, just give me the class and functions with description of input and output, so that I can help you out with it. Just drop me an email if you need my help. How long do you think this thing will take?

      Btw, any idea on why the window is not closing, and it’s not able to reload the parent page with javascript on IE browser? I copy and paste the one on QuickEdit, but I’m lost with the implementation of AJAX and etc. Pardon me for being ignorant about the latest technology trend here.

      I also realize the defect in the layout on IE browser. Hate IE...
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 23260
        • 30 Posts
        Yay! laugh

        Sorry guys, I know I said I would help but it looks like I’m going to get very busy again next week. Between 8 hours at work and 3-4 hours freelancing 5 days a week it’s hard to find the time to catch a breath (let alone work on my own projects). Anyway, it looks like you have everything under control. I’m going to install this and put back in whatever way I can.

        Cheers,

        Phil
          • 32241
          • 1,495 Posts
          Jason,

          After reading your post, I did a few update to the current class. I added a data source wrapper and calendar view wrapper.

          This might be the end modificaiton of the current class, in terms about accessing data source wrapper. When there is a new data source layer to be added, for example when you’re done making a class for the event database/iCal, then all you need is to modify the current fetchDataSource function inside the class to return the right array for the calendar class to output the result.

          Note:
          the necessary field for the current array is still undecided. Here is what I have in mind:
          1. calendardbid -> event id to be used for deleting or editing
          2. datebegin -> event begin date
          3. dateended -> event ended date
          4. timebegin -> event begin time
          5. timeended -> event ended time
          6. description -> short title/description for events
          7. details -> full information of events
          8. category -> category name, currently it was stored as a string, instead of another id to special table handling category, to ease the database clutter when installing this.

          I think that’s going to be enough, unless you have other things that needed to be added to the array for data processing.

          Talking about recuring events, when it fetch for the current date, month, or year, the data source layer has to return duplicate events entry to the array, whenever there is a recuring event happen on that period of display.

          Here is the question, do you think it’s better to store the events in 3 dimensional array with the key name as the date in "20061230" format and the value will be a 2 dimensional array containing the current events listed in there?

          So the display function will only need to fetch the array based on the date. The processing power to store the data in the right array format like this will be handled by the data source layer. Currently, in the display functin, I go over the array and added the date span to detect whether the current event is spanning to how many day, and detect which events will be displayed on the current date. This process will be processed for every date.

          I think the full-job of setting up the right array format is better to be handled by the data source layer. Easier to be extended as well.

          Please give me a reply by today, so I can decide which direction I should be heading.

          Thanks
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 25663 MODX Staff
            • 12,272 Posts
            Hi wendy,

            I’m definitely following this thread... any reason not to just use unix timestamps for the start / stop date+times?

              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 32241
              • 1,495 Posts
              Quote from: rthrash at Jan 13, 2006, 03:31 PM

              Hi wendy,

              I’m definitely following this thread... any reason not to just use unix timestamps for the start / stop date+times?

              Thanks for pointing that out, honestly I have no idea the difference between unix timestamp and MySql timestamp.

              But as far as my understanding goes, do you mean combining the date and the time, instead of having separate date and time?

              If that’s what you mean, I thought that each day it will have their own separate time for each event. Imagine having an event span from date 2006-01-13 to 2006-01-16, and the evnt time will be from 13:00:00 to 15:00:00, which is specific to each day. Now if I have them being combined from 2006-01-13 13:00:00 to 2006-01-16 15:00:00, it will have a different meaning.

              But nothing to worry about though, I’m thinking to modify the way the calendar displaying the data. I will assume that everything in the array will be key named with the date, and the time of the event will be stored specific to that date. SO it will have duplication in the array for each events. The class layer that need to do this is the data source layer, which it will have its own logic. I post my thought a few hours ago in the above post I believe.

              Hope with this, Jason and the other guy able to help me out in expanding the calendar. So instead of having a totally flexible layout/template, it will also have a totally flexible data sources.

              Help in designing the template will be great. I’m not a Javascript or CSS expert. If somebody wanting to help out, feel free to get the code, and start modifying following my instruction in the previous post.

              Ryan, hope it answer your question.
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 22303 MODX Staff
                • 10,725 Posts
                Here is a decent overview of the iCalendar format for events, todos, and more:

                http://en.wikipedia.org/wiki/ICalendar#Core_object

                Now, I have to agree with Ryan that each calendar event should be stored as a timestamp (i.e. an integer representation of the date) to be consistent with our existing date/time formats/handling. Notice that for events in iCalendar, you have DTSTART and DTEND, which are stored in a date time format specific to iCalendar, but very close to the ISO standard date time. We can easily convert our timestamps to this (or any other) date time format with the PHP function date(format, timestamp) and back again using strtotime(datestring). I do not follow your logic with the spanning, as each event simply spans from a start time to an end time, and that’s it.
                  • 32241
                  • 1,495 Posts
                  Then I might get the wrong logic then.

                  I think my logic is more to recuring events, instead of span.
                  Lets take a open source seminar example. Basically the time will be set, from 8am to 3pm for example, but the event date will span from january 13 to january 15.

                  I thought this is span, but I think it’s better to be included as a recuring event, and change the whole logic of my span to the span that you guys mean.

                  I’ll work on that, I will release the next version tonight maybe.

                  Regards,
                    Wendy Novianto
                    [font=Verdana]PT DJAMOER Technology Media
                    [font=Verdana]Xituz Media
                    • 25663 MODX Staff
                    • 12,272 Posts
                    I definitely think we need both concepts: spans and recurring events.

                    Recurring events can happen for example on every third Monday of each month, every Thursday from 1PM to 2PM, Every year on the 15th of March (no specific time), etc.

                    And would be cool to think about triggering reminders somehow, too smiley
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Recurring events are just events that are duplicated and have a relation back to a parent event that was used to create the repetitions. This can be accomplished with a single column in the table to represent the self-relationship. This could be referred to as parent or parentId, where each recurrence of a parent event would refer to the parentId of the initial event in the series. Then, if you decide to destroy the parent event, you might have the option of destroying all recurrences or leaving them alone. If you leave them alone, you could define a new parent or have the orphaned events simply become standalone events at that point. The logic at that point would be up to your requirements.