Forums / General / Delete information collection

Delete information collection

Author Message

Jens Kultima

Saturday 05 April 2008 3:46:53 am

Dear all,

<b>How do I, in a template, delete an information collection?</b>

I could use the Admin-interface, but I have created a custom view for my collected information. Now I would like a "delete this" button.

I don't understand how they have implemented the function in the admin-interface.

Could anyone help?

Thank you in advance!
Regards,
Jens

Xavier Gouley

Saturday 05 April 2008 10:58:40 am

Hi,

You have to follow this template, in the admin interface: design/admin/templates/infocollector/view.tpl

This one does what you want, in the admin interface :
see the form tag, and input tags :

<form name="objects" method="post" action={concat( '/infocollector/collectionlist/', $collection.contentobject_id )|ezurl}>
<input class="button" type="submit" name="RemoveCollectionsButton" value="{'Remove'|i18n( 'design/admin/infocollector/view' )}" title="{'Remove collection.'|i18n( 'design/admin/infocollector/view' )}" />
<input type="hidden" name="CollectionIDArray[]" value="{$collection.id}" />

You just have to paste them in your template, and I think, add in appropriate roles (for users that can remove info collection in the front office), the infocollector module.

When you click to this button, the next page that will be automatically loaded is the design/admin/templates/infocollector/confirmremoval.tpl : just look in this admin template, as for the first step, to retrieve form and input tags. This template shows a "confirm form". Copy this template in your front office design folder (to the same destination folder, and same name), and adapt it graphically (adapt HTML code, but not form and input tags).
When you confirm in this second page, the collection is removed, but you will be redirected to: design/admin/templates/infocollector/collectionlist/{$objectID} page automatically, which generally does not exist in a front office. This page use the infocollector/collectionlist.tpl, so you can copy it (like previously), and make a redirection in this page, where you want, for example.

I think this should work. If not, use the kernel/infocollector/collectionlist.php as a good model to make yourself a new module in an extension.

Gook luck !

Xavier Gouley
http://www.gxapplications.com/eng_blog/GX-Admin-s-Blog/