Changeset 1216 for cpc/trunk/project/apps
- Timestamp:
- Jul 1, 2010, 1:15:06 AM (11 years ago)
- Location:
- cpc/trunk/project/apps/frontend/modules/api
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/api/actions/actions.class.php
r1206 r1216 108 108 $this->multi = array(); 109 109 $this->res['depute'] = array(); 110 $this->res['depute']['id'] = $depute->id ;110 $this->res['depute']['id'] = $depute->id * 1; 111 111 $this->res['depute']['nom'] = $depute->nom; 112 112 $this->res['depute']['nom_de_famille'] = $depute->nom_de_famille; 113 113 $this->res['depute']['nom_circo'] = $depute->nom_circo; 114 $this->res['depute']['num_circo'] = $depute->num_circo ;114 $this->res['depute']['num_circo'] = $depute->num_circo * 1; 115 115 $this->res['depute']['mandat_debut'] = $depute->debut_mandat; 116 116 if ($depute->fin_mandat) -
cpc/trunk/project/apps/frontend/modules/api/templates/csvSuccess.php
r1198 r1216 30 30 if (is_array($res)) { 31 31 if (!isset($res[0])) { 32 return depile_assoc($res, $breakline, $multi); 32 if (array_keys($res)) 33 return depile_assoc($res, $breakline, $multi); 34 echo ";"; 35 return; 33 36 } 34 37 foreach($res as $r) { -
cpc/trunk/project/apps/frontend/modules/api/templates/jsonSuccess.php
r1195 r1216 1 1 <? 2 2 3 function depile_assoc($asso) { 4 $s = '{'; 5 foreach (array_keys($asso) as $k) { 6 $s .= '"'.$k.'":'; 7 $s .= depile($asso[$k]); 8 $s .= ","; 9 } 10 return substr($s, 0, -1).'}'; 11 } 12 13 function depile($res) { 14 if (is_array($res)) { 15 if (!isset($res[0])) { 16 return depile_assoc($res); 17 }else{ 18 $s = '['; 19 foreach($res as $r) { 20 $s .= depile($r).','; 21 } 22 return substr($s, 0, -1).']'; 23 } 24 }else{ 25 if (is_numeric($res)) { 26 return $res; 27 } 28 return '"'.$res.'"'; 29 } 30 } 31 32 echo depile($res); 3 echo json_encode($res);
Note: See TracChangeset
for help on using the changeset viewer.