Results 1 to 2 of 2

Thread: How to restrict one user's events to its own events ?

  1. #1
    User
    Join Date
    04-01-10.
    Posts
    289

    Frage How to restrict one user's events to its own events ?

    Hi,

    I need to create a calendar that different users will have to feed. But I would like each user can edit or suppress only the events he has created, not events created by other users.
    Is it possible ?

    Thanks.

  2. #2

    Default

    Hi,

    You can't do that, it's just possible to limit users to specifics calendars.

    Two things to solve that problem :

    1 : You create one calendar for each user (it's the good one if you don't have two hundreds users ^^)
    2 : You can decide to not display lines created by the others users with a label callback

    (See : https://contao.org/en/manual/3.0/dat...isting-records )

    You can do a function like this (it's a bit dirty, but it works...)

    PHP Code:
    public function listEventsUser($arrRow) {
       if(
    $arrRow['author'] != $this->User->id) {
          return 
    '<div id="row_'.$arrRow['id'].'"></div><script type="text/javascript">document.getElementById("row_'.$arrRow['id'].'").parentNode.parentNode.remove();</script>';
       } else {
          return 
    $this->listEvents($arrRow);

    If I use this, it's to delete all the line of the table in the HTML, because if you return nothing, you'll have the buttons of the line.
    You just need to create a module who extends tl_calendar_events to do that, and change the child_record_callback function in the DCa of the extended module.

    But if someone knows a better way to do this, i'll be happy to know how :-)
    Last edited by Lupus; 07/25/2014 at 01:57.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •