Skip to main content
added 253 characters in body
Source Link
dustin
  • 107
  • 7

I have a course listing component, and each course as zero, one, or more corresponding sections for that course. Basically different versions of that course that run at different times at different locations.

If an administrator tries to delete a course, I'd like my component to first check for corresponding sections and if there are sections, prompt the user that those should be deleted or reassigned first before deleting the course itself.

Sorry, I've looked around and haven't found much documentation on this specifically. I'm somewhat new to Joomla MVC development as well.

Thank you very much!

EDIT: Starting to think that I have to override the default JControllerAdmin delete() function (I think that's what it is) and telling it to run a SELECT statement, and then whether or not there are matching sections, run or don't run the actual delete action. Hmm..

EDIT 2: The above thought seems to be the case, as I now have a delete() function in the controller that shows a JS alert when the delete button is hit.

I have a course listing component, and each course as zero, one, or more corresponding sections for that course. Basically different versions of that course that run at different times at different locations.

If an administrator tries to delete a course, I'd like my component to first check for corresponding sections and if there are sections, prompt the user that those should be deleted or reassigned first before deleting the course itself.

Sorry, I've looked around and haven't found much documentation on this specifically. I'm somewhat new to Joomla MVC development as well.

Thank you very much!

I have a course listing component, and each course as zero, one, or more corresponding sections for that course. Basically different versions of that course that run at different times at different locations.

If an administrator tries to delete a course, I'd like my component to first check for corresponding sections and if there are sections, prompt the user that those should be deleted or reassigned first before deleting the course itself.

Sorry, I've looked around and haven't found much documentation on this specifically. I'm somewhat new to Joomla MVC development as well.

Thank you very much!

EDIT: Starting to think that I have to override the default JControllerAdmin delete() function (I think that's what it is) and telling it to run a SELECT statement, and then whether or not there are matching sections, run or don't run the actual delete action. Hmm..

EDIT 2: The above thought seems to be the case, as I now have a delete() function in the controller that shows a JS alert when the delete button is hit.

Source Link
dustin
  • 107
  • 7

Joomla MVC Component: Run SQL before deleting record

I have a course listing component, and each course as zero, one, or more corresponding sections for that course. Basically different versions of that course that run at different times at different locations.

If an administrator tries to delete a course, I'd like my component to first check for corresponding sections and if there are sections, prompt the user that those should be deleted or reassigned first before deleting the course itself.

Sorry, I've looked around and haven't found much documentation on this specifically. I'm somewhat new to Joomla MVC development as well.

Thank you very much!