Developing a component frontend update function/Import with summary screen

From Joomla! Documentation

< J3.x:Developing a component frontend update function
Developing a component frontend update function

24 Import with summary screen[edit]

24.1 Description[edit]

The previous step of this tutorial describes an import process that updates the database without feedback to the user about which records have been updated. In some cases you might want to have more control on this process, ranging from just displaying a summary of the updated records to an explicit acknowledgment for each intended change.

This step describes the simple case of displaying a page listing the changed records after the update. It is just an example for adding user validation to import functions.

24.2 The changes[edit]

24.2.1 Files:[edit]

  • README.md
  • helloworld.xml

Again, these files have been updated to reflect version info.

24.2.2 admin/views/helloworlds/view.html.php[edit]

A button is added for selecting checked import.

24.2.3 admin/views/helloimport[edit]

The button displays a separate view page for handling the import. The page contains a button to select the import file to upload. Execute the import by clicking the 'Upload' button, or cancel by clicking 'Go Back'.

24.2.4 admin/views/helloimport/tmpl/default.php[edit]

This layout contains the form with those buttons. The 'Upload' button submits the form and posts the import data to the server.

24.2.5 admin/views/helloimport/view.html.php[edit]

The view starts the layout template of the previous section, and also catches the posted data after clicking the 'Upload' button.

When posted data is received, it is imported into the database using the import_csv() and import_xls() methods, just like the controller did in the previous step 23.2.4 of this tutorial. In this step, however, these functions also create a table with the imported data which is then displayed in the current view.

24.3 Source files for this step[edit]

24.4 Testing the features of this step[edit]

  • Perform the same test as in the previous section 23.4 of this tutorial.
  • Verify that the table lists the changes from the uploaded import file.