/** * Get the Register Form */ public function getForm() { if ($this->_form == null) { $accountGateway = new Accounts_Model_AccountGateway(); $form = $accountGateway->getForm('Register'); } return $this->_form; }
public function processModifyAction() { if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) { $this->_redirector->gotoRoute(array('controller' => 'index', 'module' => 'accounts'), 'admin'); } $return = array(); $accountGateway = new Accounts_Model_AccountGateway(); $form = $accountGateway->getForm('ModifyAccount'); $validForm = $form->isValid($this->_request->getParams()); // Check the form for validity if (!$validForm) { $return['formErrors'] = $form->getMessages(); } else { $form->removeElement('submit'); $account = $accountGateway->saveAccountDetails($form->getValues()); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->setNamespace('notifications')->addMessage('Account Modify.'); $return['redirect']['location'] = '/admin/accounts/'; } $this->_helper->json->sendJson($return); }
/** * Fetch chargify active billing * * @param int|string $id account_id * @return Accounts_Model_Billing|null */ public function fetchChargifyActiveBillingByUserId($id) { $this->checkAcl('read'); $accountGateway = new Accounts_Model_AccountGateway(); $billingId = $accountGateway->fetchBillingIdByUserId($id); $cache = Zend_Controller_Action_HelperBroker::getStaticHelper('Cache')->getManager()->getCache('database'); $cacheKey = md5('billingById_' . $billingId); // if ((!$billing = $cache->load($cacheKey))) { $table = new Accounts_Model_DbTable_Billing(); $select = $table->select(); $select->from($table)->where('billing_id = ?', $billingId); $row = $table->fetchRow($select); if (null === $row) { return null; } else { if (is_object($row)) { $billing = $row->toArray(); $chargify = Zend_Controller_Action_HelperBroker::getStaticHelper('Chargify'); $chargeData = $chargify->get_customer_subscriptions($billing['billing_chargifyid']); $billing['billing_ccfirstname'] = $chargeData[0]['credit_card']['first_name']; $billing['billing_cclastname'] = $chargeData[0]['credit_card']['last_name']; $billing['billing_cctype'] = $chargeData[0]['credit_card']['card_type']; $billing['billing_ccnum'] = $chargeData[0]['credit_card']['masked_card_number']; $billing['billing_expmonth'] = $chargeData[0]['credit_card']['expiration_month']; $billing['billing_expyear'] = $chargeData[0]['credit_card']['expiration_year']; // } // $cache->save($billing, $cacheKey, array('billing')); } } return $billing; }