Backend multitab details/edit.php, how is that organized in the controller.php/model.php

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Wed Mar 08, 2006 7:20 am

Backend multitab details/edit.php, how is that organized in the controller.php/model.php

Post by nkamp » Wed May 20, 2020 8:49 pm

I looking for a good example how it is solved if you have multitab on the edit.php, and every multitab has it's own table which strongly related with details tab of the edit.php.
Let say you have department, that's the main details tab. On the second tab you the employee's wich are working on the department. The third tab is management which is working for the department.
Tab 2 and 3 have there own linked table department -> employee and department -> manager.

But how is this organized in the controller and the model. For saving I have discovered that I make an override in the controller and the model of the function save. Till now I can't find out how it is configured in the controller and model. In the model I have a query for the department with his fields. But were do I put the query for the linked table of tab2 and tab 3?

Does anybody know which is a good example of component, so that I can look at how that needs to be done?

Regards,

Nico

 
User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 22576
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Backend multitab details/edit.php, how is that organized in the controller.php/model.php

Post by pe7er » Thu May 21, 2020 7:48 am

No, I do not have a good example.
How I would do it (but that's just an approach and I do not know if it's the best approach) :

In the XML form, for every tab in the form I would create a different "fieldset".
Those tabs are all within the same HTML <form>.
If you are on one tab and press the save button, it will also save all other tabs.

In case I needed to save to different tables, in model I would let the save method load other subsave methods in the same model. Those subsave methods would load their own table class to perform the save action.
Alternatively instead of using subsave models from the same model, you could load the save method from other models.

If you need different ACL on those different tabs, then I would create separate MVCs for each,
and making those configurable via access.xml and by adding an ACL check in the view.html.php of each view.

btw: You could ask your question here where more developers are active: https://groups.google.com/forum/#!forum ... ev-general
Kind Regards,
Peter Martin, Global Moderator
https://db8.nl - Joomla specialist, Nijmegen, Nederland
Co-developer of d2 Content https://data2site.com/joomla-extensions/d2-content

nkamp
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Wed Mar 08, 2006 7:20 am

Re: Backend multitab details/edit.php, how is that organized in the controller.php/model.php

Post by nkamp » Thu May 21, 2020 8:38 pm

Hi Peter,

Thanks for you're answer.

I think I've found something. I don't if this is the right way but...

I had created let say link table department -> employee view, as an independent view. While I was making this, I thought this not correct, it belongs to a department. So I want to move this to a tab.

With:

Code: Select all

echo $this->loadTemplate(edit_employee)
, it looks, it is solving my problem, I hope I guess, altough hope is not a strategy!

If I do not take the right track, I hope someone people will let me know.

Regards,

Nico

 

Post Reply

Return to “Joomla! 3.x Coding”