access rights for single events? private / public

Hello!

First of all: Thanks a lot for this wunderful plug-in! Our group uses it for internal communication purposes. It always worked fine.

Now we face some problem: For some time we worked in private extended mode (access right tab in the backend). Now we want to assign “access” rights to single events instead of users. Guests on our website should be able to show some public events of our calendar. These should show up under “oncoming events” in the sidebar. But our private events should still be unvisible to guests. So there should be two diffferent kinds of events: private and public ones.

We tried to achieve this by some custom fields. But unfortunately didn’t get it working. Any help would be appreciated!

Perhaps there’s a simple solution - but we don’t get it! Thanks a lot in advance!

Hello,

Unfortunately there is no easy solution for that. Either way you will have to edit source codes.
You can try following (be sure to create backups first ):

Add field ‘public’ in your ‘events_rec’ table. It will store 0 or 1 for events. Public events = 1.

Open dhtmlxSchedulerConfigurator.php file.

  1. In the following section you can add check of public events (for example, OR event.public == 1).

if ($settings["privatemode"] == "ext") { $scheduler .= "scheduler.attachEvent('onEventLoading', check_user);"; $scheduler .= "scheduler.attachEvent('onBeforeDrag', check_user_before_drag);"; $scheduler .= "function check_user_before_drag(event_id, native_event_object){ if (event_id == null) { return true; } var event = scheduler.getEvent(event_id); if (event.user == '".$this->userid."') { return true; } else { return false; }
2. When saving to the database same check is made if author of current change is actually owner of the event

public function set_event_user($action) {
  1. Selecting events from the databse (getEventsRec method), here we added ‘public’ property to the selected fields:

$fields = 'start_date,end_date'; if ($this->settings['customfieldsList']) { $fields .= ",".$this->settings['customfieldsList']; } $fields .= ',public';
This is untested solution but it can be tweaked if you encounter some issues.

Best regards,
Ilya

Hello Ilya!

Thank you for your answer. Unfortunately I couldn’t get it working until now. My changes in ‘dhtmlxSchedulerConfigurator.php’ result in crash of the scheduler. I will try to contact our ‘geek’ in order to support me in coding this. If we get it fixed, we will post it here…