Welcome, Guest
Username: Password: Remember me

TOPIC: multiple 'own' ??

multiple 'own' ?? 02 Nov 2012 11:05 #4924

Hi,

It is possible that some entries be part of two owners ??
I need to do a thing of exchanges and i would like to allow both people to modify the entry relative to both of them?

thanks.
The administrator has disabled public write access.

Re: multiple 'own' ?? 02 Nov 2012 11:13 #4925

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Yes it can be done...

You'd need a table (say, items) where users could create new items with an author field.
Create another table (say, editor_items) where records are created by selecting/copying 'originals' from the items table into new editor_items (adding a user and item FK to the record.

This way, your original items will stay in tact but other users can create 'revisions' or 'editions' of them in another table.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: multiple 'own' ?? 02 Nov 2012 16:50 #4947

Hi, thanks for the fast answer, but it is not exactly this.
I have a table where i have multiple items. Each item can be modified by the author, this is easy, but i would like that the table would have two different authors, and that both of the could modify the same item. This is because each item will be exchanged between them and they have to fulfil some fields of the item, some communs other not.
The administrator has disabled public write access.

Re: multiple 'own' ?? 02 Nov 2012 16:58 #4949

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Well, you can't really have 2 authors. Without re-writing the publishing workflow completely, the creator will always be the author. Any subsequent edits will be displayed as modified by.

Unless you want to create all of your fields in 1 massive table which will lead to a lot of redundancy - bad idea - you will have to create an initial item in one table then use other tables to store additional related datasets. This mean that you'll have a core set of data (the parent item) and 1 or more child items of it. This will allow to share and display common data from all related fields/tables across you component - what you want, right?

Could you give a few more details about what you're trying to achieve?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: multiple 'own' ?? 04 Nov 2012 10:46 #4980

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Code inside your component. It is not a big deal once you've understood how it works in prepareQuery().

In your model :
Read the current user ACL.
Compare with the 2 Authors fields (create a second one)
Instance a filtering in your SQL
Use the states vars in order to active/unactive this filtering.

That's it.


PS : you can also add some code in the classes/model.item.php :
function isAuthor() : Update it to add your second author field.

These funtions (isAuthor, canView, canAccess, ...) are called in populateParams().
They define some tags to use when the items are loaded in memory, but sometimes you want show limited informations (checked out, canEdit icon, canDelete icon...)
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy
Time to create page: 0.094 seconds

Get Started