Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Track the progress ...
 
Notifications
Clear all

Track the progress of an import

9 Posts
2 Users
0 Reactions
9,272 Views
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 
[#1175]

Hi babynus,

I managed to implement xlsx importation (If you are interested let me know) but I have another issue.
My needs require to import large files and the process can be very long. I would like to display something (a progress bar or just a text to begin with...) while data are stored in order to inform the user that it is working..

I tried to add some echo inside importable::import() but it displays my text at the end of the process.. not very usefull.
Actually, even an echo inside import.php displays at the end of the process...

Well I am not the best php developper so I guess there is something I missed.

Do you have a hint ?


 
Posted : 22 May 2013 17H41
babynus
(@babynus)
Posts: 14953
Main Contributor Admin
 

If you are interested let me know

Of course I am ! :woohoo:

Do you have a hint ?

It is not easy : In fact, you must interrupt import process to return a reply indicating the progress status, then automatically (in background) call the import phase. This means you must be able to get bacj to import and restart where you stopped (not from beginning).
It is not an easy process to implement. :sick:


 
Posted : 22 May 2013 20H21
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 

Do you have a hint ?

It is not easy : In fact, you must interrupt import process to return a reply indicating the progress status, then automatically (in background) call the import phase. This means you must be able to get bacj to import and restart where you stopped (not from beginning).
It is not an easy process to implement. :sick:

That is what I have seen some times on the net...

Things like :


Is this applicable ?

Not my priority for the moment, but I'll get back to it.

Or can't import() call a script or something that would update a display somewhere ?


 
Posted : 23 May 2013 10H25
babynus
(@babynus)
Posts: 14953
Main Contributor Admin
 

No, register_shutdown_function will not help, and it does not work on windows platforms.

but this one may help :

<?php

/**
 * Quick and easy progress script
 * The script will slow iterate through an array and display progress as it goes.
 */

#First progress
$array1  = array(2, 4, 56, 3, 3);
$current = 0;

foreach ($array1 as $element) {
    $current++;
    outputProgress($current, count($array1));
}
echo "
"; #Second progress $array2 = array(2, 4, 66, 54); $current = 0; foreach ($array2 as $element) { $current++; outputProgress($current, count($array2)); } /** * Output span with progress. * * @param $current integer Current progress out of total * @param $total integer Total steps required to complete */ function outputProgress($current, $total) { echo "" . round($current / $total * 100) . "% "; myFlush(); sleep(1); } /** * Flush output buffer */ function myFlush() { echo(str_repeat(' ', 256)); if (@ob_get_contents()) { @ob_end_flush(); } flush(); } ?>

 
Posted : 23 May 2013 12H22
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 

It works well on a blank page on a blank website. But I struggle to implement it in Project'Or RIA.

Actually, I made a custom blank view in Project'Or RIA to test my things.

When I go into my dev view, showWait() (or whatever it is ^^) spins for 10 seconds and then the two 100% appear at the top.. But no progression 🙁

Does showWait() or another fonction interfer with display ? Perhpas I should put then.. to sleep 👿


 
Posted : 23 May 2013 14H04
babynus
(@babynus)
Posts: 14953
Main Contributor Admin
 

Maybe it's due to the way script is called.
In Project'Or RIA, most calls are Ajax based.
Maybe a standard way would work better... This would involve the use of an iFRame as target.


 
Posted : 23 May 2013 15H35
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 

Alright thanks Babynus, I'll investigate this way 🙂


 
Posted : 23 May 2013 15H50
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 

I am stuck. I really don't know how to do this 🙁

The import button (and the script following) seems to block every actions I could make and I am unable to load any js files.

I made a iframe that point to another page wich should load a js file (and execute a function from it) and execute others js function (an alert..) directly.

And only the direct alert works, the js file seems to be ignored, despite all my tests...

I wanted to use the projectorRia js architecture and everything, but now I am just derping around...


 
Posted : 24 May 2013 13H29
LEVA
 LEVA
(@leva)
Posts: 54
Active Member
Topic starter
 

Hi, it's me again .. ^^

Despite all my efforts, I am still unable to achieve my goal. But I have hope..

I can't execute any php script while importation procedure is running.
I can't sleep importation procedure, it does not give any time to do something else.
I can't access any data without server access, and I don't have any since importation is running.. Javascript is not designed for SQL and AJAX needs a php file(ie. server access).

So my guess is that I am screwed if importation procedure stays like it is.

My idea (ie. hope..) is to take the import() function and to build it with Javascript and Ajax architecture.. but that is just an idea..

What do you think ?

PS : could proc_nice() work ? PS2 : Not on windows ..


 
Posted : 28 May 2013 14H39
Share:

Scroll to Top