Nextrek
Diff Revisions
287
vs
300
for /Android/SmartCharging/endPoints/LocalRepository.php
|
@@ -22,8 +22,8 @@ |
22 |
22 |
|
|
23 |
23 |
|
//echo "<br/>".$query."<br/>"; |
24 |
24 |
|
|
25 |
|
- |
/*imgs = $local->imgs; |
26 |
|
- |
$imgsToInsert = array();*/ |
|
25 |
+ |
$imgs = $local->imgs; |
|
26 |
+ |
$imgsToInsert = array(); |
27 |
27 |
|
|
28 |
28 |
|
try { |
29 |
29 |
|
$this->db->exec($queryLocal); |
|
@@ -33,10 +33,9 @@ |
33 |
33 |
|
$imgsToInsert[] = '("'.$id_locale.'", "'.$img.'")'; |
34 |
34 |
|
} |
35 |
35 |
|
|
36 |
|
- |
$queryImgs = "INSERT INTO immagini_locali(id_locale, img) VALUES" . implode(',', $imgsToInsert);*/ |
37 |
|
- |
//echo "<br/>".$queryImgs."<br/>"; |
|
36 |
+ |
$queryImgs = "INSERT INTO immagini_locali(id_locale, img) VALUES" . implode(',', $imgsToInsert); |
38 |
37 |
|
|
39 |
|
- |
//$this->db->exec($queryImgs); |
|
38 |
+ |
$this->db->exec($queryImgs);*/ |
40 |
39 |
|
|
41 |
40 |
|
$status["local_id"] = $id_locale; |
42 |
41 |
|
$status["return"] = 0; |
|
@@ -120,7 +119,7 @@ |
120 |
119 |
|
} |
121 |
120 |
|
} |
122 |
121 |
|
|
123 |
|
- |
public function addImage($id_local, $img) { |
|
122 |
+ |
/*public function addImage($id_local, $imgs) { |
124 |
123 |
|
$sql = "INSERT INTO immagini_locali(id_locale, img) |
125 |
124 |
|
VALUES (".$id_local.",'".$img."')"; |
126 |
125 |
|
|
|
@@ -130,6 +129,24 @@ |
130 |
129 |
|
} catch (PDOException $e) { |
131 |
130 |
|
echo $e->getMessage(); |
132 |
131 |
|
return 1; |
|
132 |
+ |
} |
|
133 |
+ |
}*/ |
|
134 |
+ |
|
|
135 |
+ |
public function addImages($id_local, $imgs) { |
|
136 |
+ |
try { |
|
137 |
+ |
foreach($imgs as $img) { |
|
138 |
+ |
$imgsToInsert[] = '("'.$id_local.'", "'.$img.'")'; |
|
139 |
+ |
} |
|
140 |
+ |
|
|
141 |
+ |
$queryImgs = "INSERT INTO immagini_locali(id_locale, img) VALUES" . implode(',', $imgsToInsert); |
|
142 |
+ |
//echo "<br/>".$queryImgs."<br/>"; |
|
143 |
+ |
|
|
144 |
+ |
$this->db->exec($queryImgs); |
|
145 |
+ |
return 0; |
|
146 |
+ |
|
|
147 |
+ |
} catch (PDOException $e) { |
|
148 |
+ |
echo $e->getMessage(); |
|
149 |
+ |
return 1; |
133 |
150 |
|
} |
134 |
151 |
|
} |
135 |
152 |
|
|