Пример #1
0
 public function getAction()
 {
     $account_dao = new AccountDao();
     $account_group_dao = new AccountGroupDao('account-group');
     $params = $this->getRequest()->getParams();
     $param_id = array_search('edit', $params);
     if (!empty($param_id) && $params[$param_id] === 'edit') {
         $account_dao = new AccountDao();
         $market_dao = new MarketDao();
         $account_config_dao = new AccountConfigDao('account_config');
         $account_group_list = $account_group_dao->getList();
         $account = $account_dao->get($param_id);
         $market = $market_dao->get($account['market_id']);
         //account config
         $account_config_list = $account_config_dao->getConfigListByAccountId($param_id);
         $this->getView()->assign('account', $account);
         $this->getView()->assign('account_group_list', $account_group_list);
         $this->getView()->assign('account_config_list', $account_config_list);
         $this->getView()->assign('market', $market);
         $this->getView()->display('accounts-edit.phtml');
         exit;
     }
     if (array_key_exists('new', $params)) {
         $account_group_dao = new AccountGroupDao('account-group');
         $market_dao = new MarketDao();
         $account_group_list = $account_group_dao->getList();
         $market_list = $market_dao->getList();
         //account config
         $account_config_list = array();
         foreach ($market_list as $market) {
             $account_config_list[$market['name']] = get_account_config_keys($market['name']);
         }
         $this->getView()->assign('account_group_list', $account_group_list);
         $this->getView()->assign('account_config_list', $account_config_list);
         $this->getView()->assign('market_list', $market_list);
         $this->getView()->display('accounts-new.phtml');
         exit;
     }
     $this->getView()->assign('account_list', $account_dao->getAccountList());
     $this->getView()->display('accounts.phtml');
 }
Пример #2
0
 public function getAction()
 {
     $market_dao = new MarketDao();
     $params = $this->getRequest()->getParams();
     $handle = array_search('edit', $params);
     if (!empty($handle) && $params[$handle] === 'edit') {
         $market = $market_dao->get($handle);
         if (empty($market)) {
             $this->redirect('/markets');
             exit;
         }
         $this->getView()->assign('market', $market);
         $this->getView()->display('markets-edit.phtml');
         exit;
     }
     if (array_key_exists('new', $params)) {
         $this->getView()->display('markets-new.phtml');
         exit;
     }
     $this->getView()->assign('market_list', $market_dao->getList());
     $this->getView()->display('markets.phtml');
 }