UnselectFeature.php 1.0 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. Lib::loadClass('FeatureAttrSelected');
  3. class Api_Process_P5_UnselectFeature { // 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. FeatureAttrSelected::unselect($typeName, $listPrimaryKeys);
  10. $listSelectedState = FeatureAttrSelected::getSelectState($typeName, $listPrimaryKeys);
  11. $totalSelected = FeatureAttrSelected::getTotalSelected($typeName);
  12. header('Content-Type: application/json');
  13. echo json_encode([
  14. 'type' => "success",
  15. 'msg' => "done",
  16. 'body' => [
  17. 'selected' => $listSelectedState,
  18. 'totalSelected' => $totalSelected,
  19. ]
  20. ]);
  21. exit;
  22. }
  23. }