View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Track the progress of an import - ProjeQtOr
 
 

Track the progress of an import

More
22 May 2013 15:41 #1 by LEVA
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 ?

Please Log in or Create an account to join the conversation.

More
22 May 2013 18:21 #2 by babynus

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:

Babynus
Administrator of ProjeQtOr web site
The following user(s) said Thank You: LEVA

Please Log in or Create an account to join the conversation.

More
23 May 2013 08:25 - 23 May 2013 14:50 #3 by LEVA

babynus wrote:

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 :
<?php
if (function_exists('register_shutdown_function'))
{
	register_shutdown_function('ta_fonction');
}
else
{
	ta_fonction();
}
 
// On affiche un pixel transparent
header('Content-length: 85');
header('Content-type: image/gif');
print base64_decode(
	'R0lGODlhAQABALMAAAAAAIAAAACAA'.
	'ICAAAAAgIAAgACAgMDAwICAgP8AAA'.
	'D/AP//AAAA//8A/wD//wBiZCH5BAE'.
	'AAA8ALAAAAAABAAEAAAQC8EUAOw=='
);
flush();
exit;
?>

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 ?
Last edit: 23 May 2013 14:50 by LEVA.

Please Log in or Create an account to join the conversation.

More
23 May 2013 10:22 #4 by babynus
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 "<br>";

#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 "<span style='position: absolute;z-index:$current;background:#FFF;'>" . round($current / $total * 100) . "% </span>";
    myFlush();
    sleep(1);
}

/**
 * Flush output buffer
 */
function myFlush() {
    echo(str_repeat(' ', 256));
    if (@ob_get_contents()) {
        @ob_end_flush();
    }
    flush();
}

?>

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
23 May 2013 12:04 #5 by LEVA
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 :evil:

Please Log in or Create an account to join the conversation.

More
23 May 2013 13:35 #6 by babynus
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.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.038 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.