Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Show only related objects

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 1955 Views
  • klikhier
    Avatar
    Community Member
    150 Posts

    Show only related objects Link to this post

    I have this many_many mentor-student relationship and I'm using the DataObjectManager module (ManyManyDataObjectManager) on the MentorPage to show related students.

    Now it's possible to show only the related (checked) students by using the filter clause in the ManyManyDOM, BUT is it also possible to hide the checkboxes completely, so that one can view/edit the students, but CAN NOT remove the relationship (uncheck the checkbox)?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Show only related objects Link to this post

    So no one can uncheck these boxes? Seems kind of limiting. I could definitely see adding a checkpoint for permissions that would disable/enable the checkboxes, but I don't think unconditionally turning them off is a good idea.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Show only related objects Link to this post

    What I'm looking for is the following: suppose there are 10.000 students and they are assigned to the mentors outside the CMS (using front-end form) or through ModelAdmin. Would be nice though to only show the assigned students (say 10 or so) on the mentor page in the CMS and not all 10.000. This can be done easily by using the filter clause (show related students only), but then there are still check boxes, which is a bit weird and users could accidentally remove the relation by unchecking the checkbox and saving the mentorpage.

    Sorry for the strange example, but I hope I explained the situation with it.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Show only related objects Link to this post

    Understood, but somebody needs the privileges to remove that relation, right? So I think it would make sense to assign a permission level to the checkboxes rather than just remove them all together. A top-level admin should have the power to remove the relations if he wants.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Show only related objects Link to this post

    Ah, yes, agreed!

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Show only related objects Link to this post

    UncleCheese, one more thing. It turns out that the filter clause is not that simple. I want to show only related students on a mentor page. I'm using this on 'MentorPage':

          $manager = new ManyManyDataObjectManager(
             $this, // Controller
             'Students', // Source name
             'Student', // Source class
             array(
                'Name' => 'Name'
             ), // Headings
             'getCMSFields_forPopup',
             '', // Filter clause
             '', // Sort clause
             '' // Join clause
          );

    What filter clause do I need to show only assigned(related) students? Do I need a join with MentorPage_Students? I'm sorry but my knowledge is scarce on this point. Would be very (very!) nice if you could help, sorry for inconvenience, if any ;)

  • UncleCheese
    Avatar
    4085 Posts

    Re: Show only related objects Link to this post

    I don't believe that type of filter is possible at this point. I did, however, just check in the feature for adding marking permissions. You might want to give that a test.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Show only related objects Link to this post

    Ok, thanks!!! Would there be another way to show only related Students on a MentorPage (i.e. by using something else than DOM?)

    1955 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.