在symfony 1中显示包含空行的行

时间:2014-06-01 09:47:46

标签: php doctrine symfony1

我是网络开发的新手,我想修改现有的项目。我想显示包含空值,默认值为零或空的行的行。这是行动中的代码.. < / p>

public function executeDetails(sfWebRequest $r) {
    if($this->getUser()->hasAttribute('extend_term_ch')) {
        $this->getUser()->getAttributeHolder()->remove('extend_term_ch');
    }
    $this->loan = Doctrine_Core::getTable('Loans')->findOneById($r->getParameter('id'));
    $this->debits = Doctrine_Core::getTable('CreditLogs')->getByLoanId($r->getParameter('id'));
}

和模板

<?php $totalAmount = 0 ?>
    <?php foreach($loan->Collections as $i=>$c): ?>
    <?php $totalAmount += $c->amount ?>
    <tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
        <td>
            <?php echo $c->mode_of_payment ?>
            <?php if($c->mode_of_payment == 'Cheque'): ?>
                <?php $cReferencedObj = $c->Cheques ?>
                <div class="small_detail info">
                    <span class="bold">(<?php echo $cReferencedObj->bank ?>, <?php echo $cReferencedObj->branch ?>) <?php echo $cReferencedObj->reference_number ?></span>
                </div><br />
            <?php endif; ?>
            <?php $replaced = $c->getReplacedCheque() ?>
            <?php if(!empty($replaced)): ?>
            <div class="small_detail info">
                Payment for <span class="bold">(<?php echo $replaced->bank ?>, <?php echo $replaced->branch ?>) <?php echo $replaced->reference_number ?></span>
            </div><br />
            <?php endif; ?>
        </td>
        <td><?php echo $c->batch_no ?></td>
        <td>
            PHP <?php echo number_format($c->amount, 2) ?>
            <?php if($c->mode_of_payment == 'Cheque' && !empty($c->Cheques->replaced_with)): ?>
                <?php $replaced = $c->Cheques->Replaced ?>
                <div class="small_detail info">
                    Replaced with <span class="bold">(<?php echo $replaced->bank ?>, <?php echo $replaced->branch ?>) <?php echo $replaced->reference_number ?></span>
                </div>
            <?php endif; ?>
        </td>
        <td><?php echo date('F d, Y', strtotime($c->date_created)) ?></td>
        <td><?php echo $c->created_by ?></td>
        <td><?php echo $c->date_created ?></td>
        <td>
            <?php if(in_array($c->mode_of_payment, array('Cheque', 'ATM', 'Direct Bank Transfer'))): ?>
            <span class="info">
                <a href="<?php echo url_for('loans/view_collection_details?id='.$c->id) ?>?height=350&width=500" class="thickbox">View Details</a>
            </span>
            <?php else: ?>
            <div class="small_detail info">
                Collector: <span class="bold"><?php echo $c->Collectors->lastname.', '.$c->Collectors->firstname ?></span>
            </div>
            <?php endif; ?>
            <?php if(in_array($loan->mode_of_payment, array('Cash', 'ATM')) && $sf_user->hasCredential('COLLECTIONS_ROLLBACK')): ?>
                <div class="small_detail bullet_go">
                    <a href="<?php echo url_for('loans/rollback?id='.$c->id.'&loan_id='.$loan->id) ?>" onclick="return confirm('Are you sure? This cannot be undone!')">Rollback Collection</a>
                </div>
            <?php endif; ?>
        </td>
    </tr>
    <?php endforeach; ?>
    <tr>
        <td colspan="6">Total Paid</td>
        <td>PHP <?php echo number_format($totalAmount, 2) ?></td>
    </tr>

这只会显示带有数据的行..显示空行的方式?例如,一个人必须在2014年4月1日至2014年3月10日的40天内偿还债务,然后出于某种原因,他做了不支付4月4日,6日,8日等等。我想显示那些日期4,6和8,并显示他未能支付的每个日期的错误,如“此日期不付款”。

Some table

0 个答案:

没有答案