Welcome Guest, Not a member yet? Register   Sign In
Progress bar for CI Model
#1

[eluser]anishpsla[/eluser]
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

[eluser]CroNiX[/eluser]
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

[eluser]jonez[/eluser]
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

[eluser]anishpsla[/eluser]
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

[eluser]InsiteFX[/eluser]
see the progress bars in Bootstrap 3.0




Theme © iAndrew 2016 - Forum software by © MyBB