Help (jevents 1.4 for 1.0.x)

Usage Question

Postby cambler » Mon Mar 03, 2008 3:30 am

I have a very specific need for an events component, and I'd like to ask if JEvents will let me do what I need to do.

I run ShootNotes.com, a web site for photographers and models. I would very much like to allow my members to have their own calendar where they can note upcoming photo shoots. From what I can see, any user can put an event on to the calendar, but it looks like it's one big calendar for everyone.

What I'd like is for every user to have their own calendar such that they can see just their own events and anyone else can see anyone's calendar, too.

So photographer A could browse model B's calendar, which would tell him when she's available for shoots, as model B will place events into her calendar showing when she's shooting and/or when she's available.

Does that make sense? Will JEvents do this?
cambler
 
Posts: 4
Joined: Mon Mar 03, 2008 3:26 am

Postby Geraint » Mon Mar 03, 2008 8:11 am

Not yet I'm afraid. This is similar to many other requests and we are considering implementing something similar in an upcoming version.

Geraint
JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!
User avatar
Geraint
 
Posts: 42795
Joined: Fri Feb 15, 2008 6:14 pm

Postby cambler » Mon Mar 03, 2008 6:30 pm

Rather than waiting, I think this is going to be a "do it myself" project, then.

Likely a module or component (or perhaps even a CB plugin) that will filter the display by user.
cambler
 
Posts: 4
Joined: Mon Mar 03, 2008 3:26 am

Postby cambler » Mon Mar 03, 2008 9:24 pm

Okay, this is likely to be much easier than I thought it would be.

The first part is done. I cloned the mod_events_cal module and called it mod_events_cal_user, added the "_user" to all of the names and renamed DisplayCalendarMod() to DisplayCalendarModUser(), and then added one extra line to the main SQL statement:

Code: Select all
. "\n AND #__events.created_by = $my->id"


And that did it. Now I have a module that shows the calendar only for the logged-in user.

I've also cloned this and made it into a Community Builder plugin that, instead of using $my->id uses $user->id so that a CB user can have their calendar displayed on their profile. This lets anyone view anyone else's calendar summary.

The next step will be to add a parameter to the links into the component that tell it to only show the current user's entries, also constrained via the extra SQL line, and that will make it so that users can see the whole calendar, with everyone's entries as well as a constrained calendar with only their entries.

I can then use that parameter to allow ANYONE to invoke the calendar component constrained to a single user to see that user's calendar.

No database changes required, since the created_by field handles this for me. Since for what I have in mind all calendar entries are public, I'm then done. If I wanted to, though, I could add a new field to the jos_events table, "public_entry" as a boolean value and allow users to set or clear that if they want. In my case, however, I have a different application that will store all of the ancillary data I need and simply reference the id of a calendar entry.

So for cases where one does not necessarily need a separate table per user, this is a reasonably easy modification.

Unless I missed something? :-)
cambler
 
Posts: 4
Joined: Mon Mar 03, 2008 3:26 am

Postby cambler » Tue Mar 04, 2008 1:32 am

Done. It works.

In the module that displays the mini-calendar (and in my CB plug-in that does the same), I now add "&member=###" to any query string passed in to the component, defaulting it to 0 (zero) if it's not set. I then load this variable in and pass it around everywhere.

I then put this code into all functions that load data (like listEventsByMonthNew):
Code: Select all
   
if ($member != 0)
{
  $memberConstrain = "\n AND #__events.created_by=$member";
}
else
{
  $memberConstrain = '';
}


... and then include $memberConstrain within the building of the SQL SELECT statement that gets calendar entries. And that's it. Passing in a variable on the querystring with a numeric value in "member" constrains the display to only entries created by that member.

Of course, this is a meaty-enough hack that I've nuked my chances to upgrade along with you... but it does get me everything I need for my site, today.
cambler
 
Posts: 4
Joined: Mon Mar 03, 2008 3:26 am


Return to Help (jevents 1.4 for 1.0.x)

  • Who is online
  • View new posts
  • View unanswered posts
  • In total there are 0 users online :: 0 registered and 0 hidden (based on users active over the past 5 minutes)
  • Most users ever online was 94 on Tue Sep 01, 2009 12:33 am
  • Users browsing this forum: No registered users