Yii Framework Forum: Handle Of Long Running Process In Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Handle Of Long Running Process In Yii reach maximum execution time Rate Topic: -----

#1 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 214
  • Joined: 26-September 09

Posted 23 January 2013 - 02:53 AM

Dear All,

I have developed application for managing warehouse. It is simple in and out warehouse transaction. However, the item is about 900. The problem is when I generate monthly report, it will produce minimum 1800 rows (Initial balance and final stock). I always got reach maximum execution time. I have no idea how could I display the result on screen without reach maximum execution time.

One way that I can think of is to generate oflline into pdf/excel so that the user can see the report from a link. However, this approach has some limitation on how could I trigger the generation from web application.

Is there any yii way to do this?

Thank you in advance.


Daniel
0

#2 User is online   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,449
  • Joined: 04-March 10
  • Location:UK

Posted 23 January 2013 - 04:52 AM

This is a PHP or Apache configuration issue. Try this function first.
0

#3 User is offline   alex-w 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 25-November 10

Posted 23 January 2013 - 05:21 AM

I would use ajax.
Query how many results there will be then use ajax to request x amount of rows at a time.
0

#4 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 214
  • Joined: 26-September 09

Posted 23 January 2013 - 09:11 AM

View Postalex-w, on 23 January 2013 - 05:21 AM, said:

I would use ajax.
Query how many results there will be then use ajax to request x amount of rows at a time.



Hi,

Thank you for the great idea. However, how can I make x requests of ajax calls? I calculate that my algorithm is ok for around 50 items.

Cheers,

Daniel
0

#5 User is offline   alex-w 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 25-November 10

Posted 23 January 2013 - 10:01 AM

When the page is first requested get a count of all the rows that will be returned.

Then have an ajax request call a controller action and return 50 results.
Once this has been returned and rendered into the report request the next 50 then repeat until you have all records.
0

#6 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 214
  • Joined: 26-September 09

Posted 24 January 2013 - 08:45 AM

Hi,

I create a CActiveForm and submit the ajax call via ajax button.
....
<div class="actions">
    <?php echo CHtml::ajaxButton('Generate', $this->createUrl('/invoice/periodeInvoicing'), array(
        'type' => 'POST',
        'beforeSend' => 'function(data,status){ $("#invoice_btn").attr("disabled", "disabled"); $("#invoice_btn").removeClass("primary"); }',
        'success' => 'invoiceSaved'), array('id' => 'invoice_btn', 'class' => 'btn primary')); ?>
</div>
....


How could I iteratively submit the form (simulating ajaxButton click) ?

<script type="text/javascript">
    function invoiceSaved(data, textStatus, XMLHttpRequest) {
        $.fn.yiiGridView.update('invoice-grid');
        var obj = jQuery.parseJSON(data); 
        jQuery('#alert').bootAlert('alert', obj.status, obj.msg);
        if(obj.totInvoices <= 0) {
            $('.invoice-form').hide();
        } else {
             $('#invoice_btn').removeAttr('disabled');
             $('#invoice_btn').addClass('primary');
 ====> need code here to resubmit the form <=====
        }
    }
</script>


Cheers,

Daniel
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users