Event Category for wordpress plugin

Hi,

i'd like to organize the events in a kind of category - and change the css-styles later on.
could i do this via event options and if so, how?

any kind of a little howto would be great (which files do i have to edit f.e.).

I saw that other people asked more or less the same, but didn't really understood the answers, sorry.

thanks in advance ...

regs

peter
peterba
 
Posts: 10
Joined: Thu Jun 10, 2010 12:48 pm

As for version 2.0 - there is no need for any code customization

- Open Admin panel - Custom fields
- Add new field "category"
- Select type "select"
- Add options with necessary category types
- Save settings

After that , scheduler will have a category for each event.
Also, in the same custom fields form, you can define colors for different categories.
Stanislav
 
Posts: 9441
Joined: Wed Dec 23, 2009 3:04 pm

Thank you.
astonishing easy - thanks.

now a selector in the template would be great to see only the events of a certain category.

Cause I only know php, not js, is there a easy way to implement that in your code?
or - i'm asking for all of my luck of today at once :) - is it already implemented?

regs
peter
peterba
 
Posts: 10
Joined: Thu Jun 10, 2010 12:48 pm

It is not implemented, by it can be added by next steps

in
plugins\event-calendar-scheduler\codebase\dhtmlxSchedulerConfigurator.php
locate

Code: Select all
$scheduler .= "</script>


and replace with

Code: Select all
      $scheduler .= "
         scheduler._filter_by = '';
         scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){
            if (!scheduler._filter_by) return true;
            if (scheduler.getEvent(id).category == scheduler._filter_by) return true;
            return false;
         };
         </script>
         <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'><option value=''>All</option><option value='category_0'>Group A</option><option value='category_1'>Group B</option></select>


where "category" need to be replaced with name of your custom field.
Stanislav
 
Posts: 9441
Joined: Wed Dec 23, 2009 3:04 pm

GREAT!!
it works just "right out of the box".
thanks a lot.
I just needed to be aware of lower/uppercase for event_option - must not use uppercase (we love that in germany ;) ).

regs

peter
peterba
 
Posts: 10
Joined: Thu Jun 10, 2010 12:48 pm

Yes! This does work great! The only way I can think that this would work better is if the <options> for the filter selection menu were populated by reading what categories are available.

Since my client might want to set up a temporary set of categories (e.g. for a time-limited set of events) I'd rather not force them to hire me to manually modify the <select> as described upthread.

Any suggestions on reading from the DB for populating the <select><option>?? Or should I give up on that? :?

-g
izzaboo
 
Posts: 2
Joined: Wed Jul 07, 2010 6:50 pm

Maybe as part of the next version
Standalone version of scheduler has some built-in functionality, which can be used to manipulate with options list, but it requires not so simple coding, to achieve the same in case of plugins.
Stanislav
 
Posts: 9441
Joined: Wed Dec 23, 2009 3:04 pm

WOW, this works like a charm. Thank you!!! :D
jkwcape
 
Posts: 4
Joined: Wed Aug 04, 2010 2:06 am

Is there anything else I need to do to display the filter?
My customfield name: "test"
Type: "List"
Options: "option0", "option1"
Code: Select all
$scheduler .= "
         scheduler._filter_by = '';
         scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){
            if (!scheduler._filter_by) return true;
            if (scheduler.getEvent(id).test == scheduler._filter_by) return true;
            return false;
         };
         </script>
         <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
            <option value=''>All</option>
            <option value='option0'>option0</option>
            <option value='option1'>option1</option>
         </select>


Thanks for an amazing plugin
Attachments
test.png
test.png (31.27 KiB) Viewed 2925 times
jonek
 
Posts: 1
Joined: Thu Jun 16, 2011 12:04 pm

Modify your code like here:
Code: Select all
<select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
            <option value=''>All</option>
            <option value='test_0'>option0</option>
            <option value='test_1'>option1</option>
         </select>


You should use construction {fieldname}_{index} for option values:
{fieldname} - 'test' in your case.
{index} - number of option starting from zero.
radyno
 
Posts: 1399
Joined: Tue Apr 19, 2011 10:24 am

Next

Return to Scheduler for Joomla and WP

Who is online

Users browsing this forum: No registered users and 64 guests