skip to main content

kiesler.at

Filtering Categories in Calendar
updated by rck, 2006-04-23

Tommy, aka trf from the phpWebSite forums had an idea. What, if it would be possible to filter your sites' calendar by its category? Like: You select the “Party” category and would only see all parties in your Calendar

Well, I've seen that idea, talked to Tommy and we implemented it. The whole project didn't even take a week and I got a very generous amount of money on my paypal account.

v7 (2005-03-10) instead of simply setting all checkboxes in the category selector to false when the Master category is selected, I commented the whole check out. This wasn't exactly a good idea as it generated an "invalid argument" warning during the foreach loop in CatSel.php. Fixed in this version

                     
1 | 2 | 3

The basics

What do you need to use the hack? Actually, you only need a working phpWebSite installation. Installing it is also very easy. Just download this already patched version of it and boost it in like every other module.

It will create a table called mod_calendar_trans where it can put “translations” of the category names.

Using it

As soon as you've installed the patched calendar module, you'll see something you aren't used to from other versions. Enter the Calendar and notice the line reading “Master”. Below it, you should read “apply filter”

To filter categories, you click that apply filter link. The hacked Calendar module will show you all categories in fatcat together with a checkbox. If all or no categories are selected, it will revert to “Master”, which includes all categories.

If you've chosen only one category, it will show that instead of “Master” together with “change filter”. If you've chosen more categories, but not all, they will show below the first one as “Including also”.

Translating sections

“if you have the rights to change settings, you will find a new link “map category names...” there. It will show every category together with a (probably) empty textbox next to it.

In case you wouldn't want the calendar to show the categories the way they are entered in fatcat, you can change them here. This mapping only works in the calendar module.

After entering all the translations you want to have, you click “go”. As there is no caching whatsoever, this change will be immediately visible to all current sessions after the next page load.

Special URLs

To override the user selection and to get informations at a glance, a webadministrator can use certain urls.

./index.php?module=calendar&show_cat shows you all entries of the calendar, together with their category as seen to the hack and the corresponding category translation

./index.php?module=calendar&cat_select=1,2,3 will set the current filter to filter the fatcat-categories 1, 2 and 3. Any applied user-filter will be reset.

./index.php?module=calendar&cat_select=all will reset the current filter. The calendar module shows the “Master” category, which includes all the calendar items.

                     
1 | 2 | 3



RSSComments - Make a comment
The comments are owned by the poster. We are not responsible for its content.
  • No Subject

    Posted on 2005-02-17 16:40:39 By trf000[6]

    I'm already loving it. We are implementing a single instance of phpws college wide. no branch sites (though academic departments will likely get branch sites at a later date). Changing the calendar in this way really enhances the site, and makes it more content driven.

    [Reply ]

  • New to phpWebSite... Will this work with the Pagemaster Security hack?

    Posted on 2005-03-24 07:53:26 By Anonymous

    If I've installed the Pagemaster security hack, will this override anything, or will both continue to work?

    TIA,
    LiL

    [Reply ]

    • Re: New to phpWebSite... Will this work with the Pagemaster Security hack?

      Posted on 2005-03-24 08:10:37 By rck[110]

      The calendar module works completely independent of the Pagemaster module. So the answer is: Yes, of course!

      [Reply ]

      • Re: New to phpWebSite... Will this work with the Pagemaster Security hack?

        Posted on 2005-03-24 23:37:32 By Anonymous

        That's what I thought, but I'm just starting with phpWebSite and getting familiar with its structure.

        Thanks for the awesome hack!

        LiL

        [Reply ]

  • Rollback - table mods

    Posted on 2005-03-25 04:20:25 By call4ei[1]

    Does this modify any of the original calendar module tables?

    If I want to rollback to the original calendar module and remove the hacked version, will this break anything?

    Thanks,
    Ellen

    [Reply ]

    • Re: Rollback - table mods

      Posted on 2005-03-25 09:25:40 By rck[110]

      No, it does not modify any table. But it adds a new table, called mod_calendar_trans. So if you don't want the hack anymore:

      • put the old calendar files back in the mod-directory
      • delete the new files (inc/CatSelect and inc/CatMan) and
      • drop the table mod_calendar_trans

      [Reply ]

  • Submit Event button

    Posted on 2005-03-25 22:10:04 By cboyle[2]

    Hello,

    I have just starting using phpwebsite and came across your calendar hack. I was looking something like this. Great Job!!

    Ok, now to one minor issue:
    When I click on the Submit Event button in the mini calendar box, the calendar page loads with no form to enter an event into. Inorder for the form to show up I have to click on the link create new event link in the menu. Before I installed the hack, clicking on the submit event button, opened the calendar page with the event form. Since I am new to using phpwebsite, I am not sure where/what files I should be looking at to resolve the issue.
    any suggestions?

    Thanks,

    Chris

    [Reply ]

    • Re: Submit Event button

      Posted on 2005-03-25 23:54:26 By rck[110]

      Just had a quick look at it and get the same result like you. Hmmm. If you are experienced with php, you might want to play around with the dispatcher in index.php

      If not: please wait a couple of days until I have time to fix it and use the link until then.

      Thanks for the info!

      [Reply ]

      • Re: Submit Event button

        Posted on 2005-03-26 00:01:08 By cboyle[2]

        changed On 2005-03-26 00:02:10 Edited By cboyle (reason: )

        Thanks. I am just starting to learn php, so I will wait for you.
        I also just tried to edit an event and I didn't get a response that the it was updated. I then went to the event I just tried to edit and it wasn't updated.

        thanks,

        chris

        [Reply ]

        • Re: Submit Event button

          Posted on 2006-02-03 03:36:11 By Anonymous

          Looks like the submit event function is still dead. Has anybody else gotten it to work?

          [Reply ]

  • rec

    Posted on 2005-03-30 10:16:28 By Anonymous

    You might also want to include the htmlarea/FCKeditor hack/mod. The main site doesn't have it listed, most likely because it involves a small hack.

    [Reply ]

    • Re: rec

      Posted on 2005-04-01 02:08:31 By rck[110]

      Thank you. Where can I find it? Haven't used it yet.

      [Reply ]

    • Re: Filter selection via URL

      Posted on 2005-07-26 19:51:54 By rck[110]

      Sorry for my late reply, have overlooked your post. No, I don't know why it does this. But you surely changed something, didn't you? Do you still know what it was?

      [Reply ]

  • Only showing certain categories in filter

    Posted on 2005-05-12 05:53:06 By Anonymous

    Is there a way we could adjust the filter so that when you get the "please select your categories" screen it only shows certain categories instead of all categories?

    I'm wondering if we could create a new field in the mod_fatcat_categories table called "showfilter" where 0 means it doesn't show up in the filter list and 1 means it does.

    Another thing that might be useful is to have a dropdown box where they select the category to filter on instead of clicking on "change filter".

    [Reply ]

    • Re: Only showing certain categories in filter

      Posted on 2005-05-12 15:35:00 By rck[110]

      an easy way to implement that filter would be to only show the categories that have an translation.

      about the dropdown-box... yes, is quite possible. but from a usability point of view you should only be able to select a single category then.

      [Reply ]

      • Re: Only showing certain categories in filter

        Posted on 2005-07-02 16:49:36 By Anonymous

        How would I go about making the calendar only show those categories with a translation?

        By the way, this hack is excellent!

        [Reply ]

        • Re: Only showing certain categories in filter

          Posted on 2005-07-26 19:49:24 By rck[110]

          If I recall correctly, there's a left-join somewhere deep in the center of the hack. Instead of it, try a full-join.

          [Reply ]

          • Re: Only showing certain categories in filter

            Posted on 2006-09-30 22:58:58 By Anonymous

            Could you elaborate more on how to only show those categories that have been translated?? I can pick my way around PHP to make changes, but I need to know exactly what bit I need to change and what to change it to so I don't break anything ;-)

            Love the hack, btw. I'm using it to filter meetings for various groups around the world and it's very helpful!

            Robin H in Los Angeles~

            [Reply ]

            • Re: Only showing certain categories in filter

              Posted on 2006-10-17 02:28:59 By rubelin[1]

              can anyone help me with this??

              I really need to be able to only show the categories that have been translated, otherwise I might as well just remove the hack entirely.

              Robin~ in losAngeles

              [Reply ]

  • HELP - copied hack but cannot boost.

    Posted on 2005-07-23 03:39:33 By Anonymous

    Hey, sorry to trouble you.
    I'm having trouble installing the hack into my phpws 0.10.1 hosted site. if I copy the contents of the hack over the calendar dir on the server then I get the modified links showing under the calendar pages BUT I don't get any options to BOOST the update so no tables are created in mySQL DB - errors about table not existing come shortly after.
    Q -Can I manually install the hack on a hosted site?

    thanks
    Euan

    [Reply ]

    • Re: HELP - copied hack but cannot boost.

      Posted on 2005-07-24 18:20:47 By rck[110]

      If you look into the mod-directory, you should see a conf-directory with a boost.conf in it. Simply change the version number to be a bit higher (e.g. instead of 1.7.6 make it 1.7.7 -- I don't know your actual numbers).

      That way, Boost should give you the option to update it.

      [Reply ]

      • Re: HELP - copied hack but cannot boost.

        Posted on 2005-07-24 22:13:32 By Anonymous

        THANKS!! that worked a treat.
        now I can filter based on the categories - cool.
        this doesn't affect the "coming soon" view though.
        I also wondered how I could change the wording from "Master" to something else like "Viewing All Events" ??

        sorry to be such a pest,
        Thanks again
        Euan

        [Reply ]

        • Re: HELP - copied hack but cannot boost.

          Posted on 2005-07-26 19:47:34 By rck[110]

          changed On 2005-07-26 19:48:00 Edited By rck (reason: )

          You're right about the coming soon -- I didn't implement it.

          About the Master... Just look for "Master" in the hack... It should be easy to find! I didn't use the language-module, as far as I remember.

          Go ahead and be a pest -- I like discussions ;-)

          [Reply ]

          • Re: HELP - copied hack but cannot boost.

            Posted on 2005-08-10 01:24:33 By Anonymous

            Ah Ha! Found it.
            Just editing \class\display.php allows you to have "Now viewing All Events" or something instead of "Master".
            Ah, relief.

            Many Thanks Again for the Hack.
            Euan

            [Reply ]

  • Coming Soon... ??

    Posted on 2005-08-10 01:47:14 By Anonymous

    Hey! Thanks for your help before.
    Now I have another request/question.
    How easy would it be to filer out certain categories of events from the "coming soon" display box?
    For example - I only want to display events in two out of ten categories.
    Regards
    Euan

    [Reply ]

    • Re: Coming Soon... ??

      Posted on 2005-08-11 19:59:23 By rck[110]

      It should be possible. Look into Display.php to find daysAhead(). instead of calling $eventList = PHPWS_Calendar::loadEvents($date, $end);
      , you'd probably want to call something like PHPWS_Calendar::loadEvents($date, $end, $myfilter). In $myfilter, you'd put an array of all the cat_ids you'd like to see.

      [Reply ]

  • An error occured

    Posted on 2005-12-12 18:20:15 By silkenstrand[1]

    This is the first modification I've made (other than layout) to phpws. I think I figured out that to use boost you simply enter it into your url. I tried updating through phpmyadmin first and kept getting a "this table already exists" message.

    Now, I think I've got it installed. I see the word MASTER and the "apply filter" on my calendar page. Unfortunately, when I click "apply filter" I go to a page that says "An error occurred". Any guidance would be appreciated.

    Tina

    [Reply ]

RSSAll Articles
2008, 2007, 2006, 2005, 2004

What's Related

Article Manager

Hacks

Latest Updates

AdministrativeTexts
updated by freddiemac1993, 2013-06-14
wiki

Re: adventures
created by brittdavis10, 2012-02-23 (1 rply, 3 views)
thread

Re: how to run phpwebsite...
created by alexander, 2011-08-25 (2 rpls, 3607 views)
thread

Re: Forum tags
created by HaroldFaragher, 2011-08-22 (3 rpls, 8488 views)
thread


Zu den KO2100 Foren