GetSelectedFeatures.php 973 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. Lib::loadClass('FeatureAttrSelected');
  3. class Api_Process_P5_GetSelectedFeatures { // TODO: extends Api_ProcessBase
  4. static function run($args, $responseForm) {
  5. $typeName = (!empty($args['typeName'][0])) ? $args['typeName'][0] : '';
  6. if (!$typeName) throw new Api_OwsException("Missing value for 'typeName'", 501, null, 'MissingParameterValue', 'request');
  7. $listPrimaryKeys = (!empty($args['primaryKey'])) ? $args['primaryKey'] : [];
  8. if (empty($listPrimaryKeys)) throw new Api_OwsException("Missing value for 'primaryKey'", 501, null, 'MissingParameterValue', 'request');
  9. $listSelectedState = FeatureAttrSelected::getSelectState($typeName, $listPrimaryKeys);
  10. $totalSelected = FeatureAttrSelected::getTotalSelected($typeName);
  11. header('Content-Type: application/json');
  12. echo json_encode([
  13. 'type' => "success",
  14. 'msg' => "done",
  15. 'body' => [
  16. 'selected' => $listSelectedState,
  17. 'totalSelected' => $totalSelected,
  18. ]
  19. ]);
  20. exit;
  21. }
  22. }