Example #1
0
 protected function _getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
 {
     $this->_aOptions['source'] = array();
     $sCurrency = $this->_oModule->_oConfig->getCurrencyCode();
     $iNextPayment = $this->_aAccount['paid'];
     $aPayment = $this->_oModule->_oDb->getPaymentHistory(array('type' => 'account_id_last', 'value' => $this->_aAccount['id']));
     if (!empty($aPayment) && is_array($aPayment)) {
         $this->_aOptions['source'][] = array('id' => 'last', 'title' => '_bx_sites_grid_overview_txt_payment_last', 'type' => '_bx_sites_txt_payment_type_' . $aPayment['type'], 'transaction' => $aPayment['transaction'], 'when' => bx_time_js($aPayment['when']), 'amount' => number_format($aPayment['amount'], 2) . ' ' . $sCurrency);
     }
     if (!empty($iNextPayment)) {
         $aAmount = 0;
         $fAmountTrial = $this->_oModule->_oConfig->getPaymentPrice(BX_SITES_PP_PERIOD_TRIAL);
         $fAmountRegular = $this->_oModule->_oConfig->getPaymentPrice(BX_SITES_PP_PERIOD_REGULAR);
         switch ($this->_aAccount['status']) {
             case BX_SITES_ACCOUNT_STATUS_PENDING:
                 $aAmount = $fAmountTrial != 0 ? $fAmountTrial : $fAmountRegular;
                 break;
             case BX_SITES_ACCOUNT_STATUS_TRIAL:
                 $aAmount = $fAmountRegular;
                 break;
             case BX_SITES_ACCOUNT_STATUS_ACTIVE:
                 $aAmount = $fAmountRegular;
                 break;
         }
         $this->_aOptions['source'][] = array('id' => 'next', 'title' => '_bx_sites_grid_overview_txt_payment_next', 'type' => '', 'transaction' => '', 'when' => bx_time_js($iNextPayment), 'amount' => number_format($aAmount, 2) . ' ' . $sCurrency);
     }
     return parent::_getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
 }