public function executeGenerateMP() { $content = BalanceSystem::genMassPayWM(); if (strlen($content) > 0) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); $fname = strftime('%Y-%m-%d_%H:%M', time()) . '_mass_payment.csv'; $this->getResponse()->clearHttpHeaders(); $this->getResponse()->setContentType('application/octet-stream', true); $this->getResponse()->setHttpHeader('Content-Transfer-Encoding', 'binary', true); $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename=' . $fname, TRUE); $this->getResponse()->sendHttpHeaders(); $this->getResponse()->setContent($content); return sfView::NONE; } else { $this->getUser()->setFlash('error', 'Отсутствуют суммы для выплаты, либо неверные номера кошельков у пользователей.'); $this->redirect('@payment_pusers'); } }
<div id="sf_admin_container"> <h1><?php echo __('Выплаты р_пользователям', array(), 'messages'); ?> </h1> <?php include_partial('balance/flashes'); ?> <div id="sf_admin_content"> <table cellspacing="0" width="100%"> <tr> <th width="20%">Итого к выплате</th> <th width="20%"> </th> <th width="20%"><?php echo number_format(BalanceSystem::genMassPayWM(false), 2, '.', ''); ?> </th> <th width="20%"><input type="button" value="Создать файл для массовых выплат" onclick="location.href='<?php echo url_for('@payment_getmp'); ?> '" /></th> <th> </th> </tr> <tr class="sf_admin_row odd"> <td colspan="3">Итого выплачено</td> <td> <form action="<?php echo url_for('@payment_processmp'); ?> " method="post" enctype="multipart/form-data">