ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Progress bar for CI Model

January 09, 2014 3:52am

Subscribe [4]
  • #1 / Jan 09, 2014 3:52am

    anishpsla

    9 posts

    I am developing a bulk mail application for a company for sending bill to it’s customers. The application want to about 1500 mails (10% increase per month) at a time. The email ids will be stored in a table. The model will read the mail ids from table and send mail to them. Naturally the process will take more time to complete. So a progress bar will help the user to know the present status.

    Please help me to setup a progress bar for the mail sending application

  • #2 / Jan 09, 2014 12:29pm

    CroNiX

    4713 posts

    You’d need javascript for that, using an interval timer to periodically fire off ajax requests to get the current percentage complete.

    So maybe once every 2-3 seconds, the ajax would send a request to a controller, which would return the percentage complete back to your progressbar widget so it can be updated.

    Most of this is javascript, and there are a million progressbar scripts out there so I can’t help with those details.  The only actual CI involved would be creating a method in a controller that the ajax will poll to return the percent complete of the current mail queue operation.

  • #3 / Jan 09, 2014 3:21pm

    jonez

    174 posts

    Another approach would be to process X records from the queue per request. Use recursion to fire AJAX calls and in their callbacks continue the loop until all records have been processed. During each step you can update your progress bar or report errors for each block. If you want to use real numbers you could have the first AJAX call count the queue, then when it returns start the recursive loop.

    Bootstrap and jQuery UI both have progress bar plugins if you are using either of those plugins.

  • #4 / Jan 10, 2014 1:10am

    anishpsla

    9 posts

    Thanks for your quick reply. Can you post CI part of the code. I already complete the Controller and Model part. I just need the code for sending reply to Ajax call.

  • #5 / Jan 10, 2014 4:07pm

    InsiteFX

    6819 posts

    see the progress bars in Bootstrap 3.0

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases