Revision 6286,
912 bytes
checked in by acoutinho, 12 years ago
(diff) |
Ticket #2479 - Iconsistencia ao remover evento de duas agendas simultaneas
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[6286] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Remove and Update by criteria |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | $data = $_POST; |
---|
| 8 | |
---|
| 9 | require_once "api/controller.php"; |
---|
| 10 | |
---|
| 11 | Controller::addFallbackHandler(0, function($e) { |
---|
| 12 | throw $e; |
---|
| 13 | }); |
---|
| 14 | |
---|
| 15 | $result = array(); |
---|
| 16 | foreach ($data as $concept => &$content) { |
---|
| 17 | if (!is_array($content)) |
---|
| 18 | $content = array($content); |
---|
| 19 | |
---|
| 20 | foreach ($content as $key => $value) { |
---|
| 21 | $criteria = isset($value['filter']) ? isset($value['criteria']) ? |
---|
| 22 | array_merge($value['criteria'], array('filter' => $value['filter'])) : |
---|
| 23 | array('filter' => $value['filter']) : |
---|
| 24 | $value['criteria']; |
---|
| 25 | |
---|
| 26 | $service = ( isset($value['criteria']) && isset($value['criteria']['service']) ) ? $value['criteria']['service'] : false; |
---|
| 27 | |
---|
| 28 | try { |
---|
| 29 | $result[$concept][] = Controller::call($value['method'], Controller::URI($concept, false, $service), false, $criteria); |
---|
| 30 | } catch (Exception $e) { |
---|
| 31 | $result[$concept]['error'] = $e->getMessage(); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | echo json_encode($result); |
---|
Note: See
TracBrowser
for help on using the repository browser.