Пример #1
0
 /**
  * Execute a command and return a response. Does not render
  * @param IRequest $Request
  * @return IResponse the execution response
  */
 function execute(IRequest $Request)
 {
     $Table = new AccountTable();
     $page = 0;
     $total = null;
     $row_count = 5;
     if (isset($Request[self::PARAM_PAGE])) {
         $page = $Request[self::PARAM_PAGE];
     }
     $offset = $page * $row_count;
     $Pagination = new HTMLPagination($row_count, $page, $total);
     $SearchQuery = $Table->select()->limit("{$row_count} OFFSET {$offset}");
     $SearchTable = new HTMLPDOQueryTable($SearchQuery);
     $SearchTable->addSearchColumn(AccountTable::COLUMN_ID, 'account');
     $SearchTable->addSearchColumn(AccountTable::COLUMN_STATUS, 'status');
     $SearchTable->addSearchColumn(AccountTable::COLUMN_NAME, 'name');
     $SearchTable->addSearchColumn(AccountTable::COLUMN_EMAIL, 'email');
     $SearchTable->validateRequest($Request);
     $Form = new HTMLForm(self::FORM_METHOD, $Request->getPath(), self::FORM_NAME, new HTMLMetaTag(HTMLMetaTag::META_TITLE, self::TITLE), new HTMLElement('fieldset', new HTMLElement('legend', 'legend-submit', self::TITLE), $SearchTable, $Pagination, "<br/><br/>", new HTMLButton('submit', 'Submit', 'submit')), "<br/>");
     return $Form;
 }
 function getFeesFieldSet()
 {
     $Table = new AccountTable();
     $Query = $Table->select(AccountTable::COLUMN_ID)->select(AccountTable::COLUMN_NAME)->select(AccountAffiliationTable::COLUMN_TYPE)->join(AccountAffiliationTable::TABLE_NAME, $Table::COLUMN_ID, AccountAffiliationTable::COLUMN_AFFILIATE_ID)->where(AccountAffiliationTable::COLUMN_ACCOUNT_ID, $this->getAccountID());
     $FieldsetFees = new HTMLElement('fieldset', 'fieldset-fees inline', new HTMLElement('legend', 'legend-fees', "Product Rates and Fees"), new HTMLAnchor(ManageAccount::getRequestURL($this->getAccountID()), "Add Affiliates"), "<br/><br/>");
     while ($row = $Query->fetch()) {
         list($accountID, $accountName, $accountType) = array_values($row);
         $accountTypeText = array_search($accountType, AccountAffiliationEntry::$TypeOptions);
         $FieldsetFees->addAll(new HTMLElement('label', 'label-' . self::PARAM_PRODUCT_FEE, "{$accountName} - {$accountTypeText}<br/>", new HTMLInputField(self::PARAM_PRODUCT_FEE . '[' . $accountID . ']', $this->fees[$accountID], new Attributes('placeholder', 'Set fee "9.99" or rate "%1.50"'), new RequiredValidation())), "<br/><br/>");
     }
     return $FieldsetFees;
 }