Ignore:
Timestamp:
Jan 30, 2013, 9:58:22 AM (7 years ago)
Author:
goya
Message:

refacto api code to add task to generate dump of all amdmts for a bill

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/api/templates/xmlSuccess.php

    r2525 r3091  
    1 <?
    2 $alreadyline = 0;
    3 function depile_assoc($asso, $breakline) {
    4   global $alreadyline;
    5   foreach (array_keys($asso) as $k) {
    6     if (!$alreadyline && $k == $breakline) {
    7       echo "\n";
    8       $alreadyline = 1;
    9     }
    10     echo "<$k>";
    11     echo depile($asso[$k], $breakline);
    12     echo "</$k>";
    13     if ($k == $breakline) {
    14       echo "\n";
    15     }
    16   }
    17 }
    18 
    19 function depile($res, $breakline) {
    20   if (is_array($res)) {
    21     if (!isset($res[0])) {
    22       depile_assoc($res, $breakline);
    23     }else{
    24       foreach($res as $r) {
    25         depile($r, $breakline);
    26       }
    27     }
    28   }else{
    29     $res = str_replace('<', '&lt;', $res);
    30     $res = str_replace('>', '&gt;', $res);
    31     $res = str_replace('&', '&amp;', $res);
    32     echo $res;
    33   }
    34 }
    35 
    36 depile($res, $breakline);
     1<?php myTools::depile_xml($res, $breakline); ?>
Note: See TracChangeset for help on using the changeset viewer.