• [Snippet] Calendar (Used to be DBCalendar)#

  • wendy Reply #1, 6 years, 4 months ago

    Reply
    Name: Calendar (Used to be DBCalendar)
    For: MODx cms (modxcms.com)
    Description: Database calendar module for MODx
    Version: 0.2a
    Written by: Wendy Novianto
    Created: 1/12/2006
    Modified: 1/14/2006

    Fully Tested on MODx v0.9.1

    Hi guys,

    This is the first alpha release of DBCalendar module that I build. The modules itself serve as a sharing parameter for now, but in the future, I would like to have an administration capability inside the manager.

    Here is a full details about the modules.
    http://test.djamoer.net/calendar.html

    If you want to see inside the code and how the administration interface looks like, please login using this info.
    Address: http://test.djamoer.net/manager/
    Username: calendar
    Password: password

    After you're log in, feel free to browse the snippet, plugin, and module that make this thing come to work. If you want to edit the calendar, go back to http://test.djamoer.net/calendar.html, then you will have an admin capability to add, delete, and edit events.

    WARNING: This is just an alpha release, don't use this for production website! You've been warn! The last included version is not the final release of v0.2b. I'll release the official one soon, as soon as I'm able to get this working on at least Mark's server. Check the preview site for more updated information.

    NOTE:
      [list]
    • I'm looking for a coder to partner up together in building this calendar. I made the core to be as flexible and modular as possible.
    [/list]




    Regards,

    edit: Link updated


  • banzai Reply #2, 6 years, 4 months ago

    Reply
    Nice! nice! very nice module!!!!


  • wendy Reply #3, 6 years, 4 months ago

    Reply
    Thanks Banzai


  • davidm Reply #4, 6 years, 4 months ago

    Reply
    I'll install it and test it local, and report !

    Thanks for this much useful module


  • wendy Reply #5, 6 years, 4 months ago

    Reply
    As I promise, to make the understanding of the code easier.

    Architecture
    Build upon Calendar class created by David Wilkinson (http://www.cascade.org.uk/software/php/calendar/ )
    I extend the class directly into the class itself, instead of extending it, ebcause I figure out that the current class is not flexible enough, so I added a few changes, and it's ended up to the horse power of the whole system.

    To output a calendar view, all that it akes is to declare a new calendar object, and call the right function to display it in either day, month, or year view. This is all being done by the snippet. The snippet also works as the place to validate the current user, if they are log in with the right role, it will set a session to let calendar know that the user has calendar admin priviledge. The web group can be set on the snippet, and the manager group will depend upon the document group that is associated with the manager group. Snippet also work to customize certain template with a chunk for that certain calendar only. You can also use the available variable to change the name of the Sunday, Monday, and etc for month or year view.

    Considering the needs to include certain javascript, stylesheet, or html tag inside the header tag, as well as at the begining of open body tag, then here comes the plugin. Plugin will use a shared module parameter to determine the corresponsing pageid that has this calendar snippet. It needs to be set manually. In that sharing parameters, it also has the chunk name for the inserted header or body tag, if it's set to 'default', then it will use the on included in the calendar class. All default template is inside the calendar class file, even some javascript code required to make the popup admin work is inside there as well.

    The template also being set like this, "[+Content+]" or "[+Admin+]" will be replaced by the inner output of the other template. Here is a better view of the whole template. I will represent each template as a variable name for the snippet. The default variable inside the class for default template will be named the same, with 'Default' being inserted between 'tpl' and 'VAR_NAME'.

    Year View
    tplTemplate
      tplMonth
        *Auto generated month table (table is labeled with css class for easy styling)
          tplMonthNone or tplMonthDay
            tplMonthDayList (repeated by the ammount of events on that day)
              tplMonthAdmin (for edit and delete button, because it's related to events, new button is available everywhere)
    
    Month View
    tplTemplate
      tplYear
        tplYearMonth (displaying the month box/table)
          *Auto generated month table (table is labeled with css class for easy styling)
            tplYearNone or tplMonthDay
              tplYearDayList (repeated by the ammount of events on that day)
                tplYearAdmin (for edit and delete button, because it's related to events, new button is available everywhere)
    
    Day View
    tplTemplate
      tplDay
        tplDayList (repeated by the ammount of events on that day)
          tplDayAdmin (for edit and delete button, because it's related to events, new button is available everywhere)
    


    For reserved placeholder, it's listed inside snippet, but it's not complete yet, so I will work on that later. Btw, for databasel column, everything is lower case letter. I haven't try this yet, but I assume MODx placeholder is case sensitive, is that true?

    To insert header and body extra tag, please set the chunk name on the module.

    Current architecture that need to be improved, the database access, so that it will support recuring events.


  • MARKSVIRTUALDESK Reply #6, 6 years, 4 months ago

    Reply
    This is AWESOME wendy! GREAT work!


  • opengeek Reply #7, 6 years, 4 months ago

    Reply
    Very, very nice Wendy! This is a great start. I can simply create the iCalendarExport and hCalendar-compatible EventListing snippets I was talking about directly from this data structure. Or potentially, we could even integrate phpicalendar so the events could be persisted and managed directly in the ics files, rather than a separate database (this could give iCal users the ability to manage shared calendars from their local clients, which I personally would love).

    Ideally, I'd like to be able to provide the necessary event data to any of these components from whatever data source I want. By de-coupling the data source from these other portions, we just increase the usefullness and usability of each component in the module. We can probably do this by simply creating an Event class based on the iCal structure and allowing different extensions of the class to define their own data access methods, or limit/extend access to specific attributes applicable only to that event data source. Make any sense?


  • wendy Reply #8, 6 years, 4 months ago

    Reply
    Make sense to me, but not entirely.

    Let see, to extend the class, I was thinking that we can just extend the class in a snippet to support different data sources, for example, instead of database, we can overwrite the function that start with db to return a set of array from different sources, with this, different snippet will provide different data sources.

    Now from your view point, you're thinking to add event based system to the class, which I think it will be great. Basically it will work just like MODx. So instead of overwriting function from class, you want to add event to interupt the current process and do modification during accessing the database, and use ical format instead. It sounds great to me, but, I don't have basic flow inside the class, which is not like MODx.

    In document.parser of MODx, it has executeParser function that will do the whole routine from receiving request, accessing data until it outputing content. It's awesome if the current system have the needs to have a basic flow, but I don't think the current model doesn't need an event based system.

    I'm not to for sure that I got this right though, so if I misunderstand your post, then correct me. Btw, the big reason that I don't want to use event based, because I don't really have that many experience with event base system, other than in .Net. lol

    I'm looking forward to learn event based system from you in PHP. Honestly, I'm a ASP .Net programmer before, and I made a proposal to my company, and they approve it to move to PHP and Open Source system. So I use PHP just for a while right now. I know about trigering event and capturing event in ASP .Net, but not in PHP though. If you could direct me to the right place, I will do it.

    Thhank you Jason.


  • opengeek Reply #9, 6 years, 4 months ago

    Reply
    No, I mean a class to represent the data access for events, that could easily be extended for any data source. Plain and simple. The calendar class would then use this event class to get the data it needs to do it's job, as could any other snippet you wanted to create to deal with events in a calendar. Not talking about event based programming at all.


  • wendy Reply #10, 6 years, 4 months ago

    Reply
    lol.

    I knew I was wrong. When I read the evnt stuff, I'm expecting about the invoke event on MODx core. Sorry for misunderstanding it.
    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.

    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.

    I'm looking forward to be walkthrough by you.

    Regards,