Пример #1
0
 /**
  * Execute a command and return a response. Does not render
  * @param IRequest $Request
  * @return IResponse the execution response
  */
 function execute(IRequest $Request)
 {
     $SessionRequest = $Request;
     if (!$SessionRequest instanceof ISessionRequest) {
         throw new \Exception("Session required");
     }
     $Table = new ProductTable();
     $StatsQuery = $Table->select()->limit(50);
     $StatsTable = new HTMLPDOQueryTable($StatsQuery);
     $StatsTable->addColumn('product');
     $StatsTable->addColumn('type');
     $StatsTable->addColumn('total');
     $StatsTable->addColumn('account');
     $StatsTable->addColumn('description');
     $StatsTable->addColumn('fees');
     $StatsTable->addColumn('test-url');
     $StatsTable->addSearchColumn(ProductTable::COLUMN_ID, "product");
     $StatsTable->addSearchColumn(ProductTable::COLUMN_ACCOUNT_ID, "account");
     $StatsTable->addSortColumn(ProductTable::COLUMN_ID, "product");
     $StatsTable->addSortColumn(ProductTable::COLUMN_ACCOUNT_ID, "account");
     $StatsTable->validateRequest($Request);
     $Account = AbstractAccountType::loadFromSession($SessionRequest);
     if ($Account instanceof AdministratorAccount) {
     } else {
         if ($Account instanceof MerchantAccount) {
             $StatsQuery->where(ProductTable::COLUMN_ACCOUNT_ID, $Account->getID());
         } else {
             $StatsQuery->where(ProductTable::COLUMN_ACCOUNT_ID, -1);
         }
     }
     $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), $StatsTable, new HTMLButton('submit', 'Submit', 'submit')), "<br/>");
     return $Form;
 }
Пример #2
0
 /**
  * @param ISessionRequest $Request
  * @return ProductEntry[]
  */
 public static function loadSessionProducts(ISessionRequest $Request)
 {
     $ProductTable = new ProductTable();
     return $ProductTable->fetchAll(1);
 }