| @@ 383-422 (lines=40) @@ | ||
| 380 | * @param bool $forceQuery |
|
| 381 | * @return bool true if insertion is succesful, false if unsuccesful |
|
| 382 | */ |
|
| 383 | public function insertGmap($obj, $forceQuery = false) |
|
| 384 | { |
|
| 385 | $tablename = 'efqdiralpha1_gmaps'; |
|
| 386 | $keyName = 'id'; |
|
| 387 | if ($obj instanceof efqGmap) { |
|
| 388 | // Variable part of this function ends. From this line you can copy |
|
| 389 | // this function for similar object handling functions. |
|
| 390 | $obj->cleanVars(); |
|
| 391 | $cleanvars = $obj->cleanVars; |
|
| 392 | } else { |
|
| 393 | return false; |
|
| 394 | } |
|
| 395 | $countVars = count($cleanvars); |
|
| 396 | $i = 1; |
|
| 397 | $strFields = ''; |
|
| 398 | $strValues = ''; |
|
| 399 | foreach ($cleanvars as $k => $v) { |
|
| 400 | $strFields .= $k; |
|
| 401 | $strValues .= "'" . $v . "'"; |
|
| 402 | if ($i < $countVars) { |
|
| 403 | $strFields .= ', '; |
|
| 404 | $strValues .= ', '; |
|
| 405 | } |
|
| 406 | $i++; |
|
| 407 | } |
|
| 408 | $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues); |
|
| 409 | if ($forceQuery) { |
|
| 410 | if ($this->db->queryF($sql)) { |
|
| 411 | $itemid = $this->db->getInsertId(); |
|
| 412 | $obj->setVar($keyName, $itemid); |
|
| 413 | ||
| 414 | return true; |
|
| 415 | } |
|
| 416 | } else { |
|
| 417 | if ($this->db->query($sql)) { |
|
| 418 | $itemid = $this->db->getInsertId(); |
|
| 419 | $obj->setVar($keyName, $itemid); |
|
| 420 | ||
| 421 | return true; |
|
| 422 | } |
|
| 423 | } |
|
| 424 | ||
| 425 | return false; |
|
| @@ 218-257 (lines=40) @@ | ||
| 215 | * @return bool true if insertion is succesful, false if unsuccesful |
|
| 216 | * @internal param object $objListing object of type listing |
|
| 217 | */ |
|
| 218 | public function insertListingData($obj, $forceQuery = false) |
|
| 219 | { |
|
| 220 | $tablename = 'efqdiralpha1_data'; |
|
| 221 | $keyName = 'dataid'; |
|
| 222 | if ($obj instanceof efqListingData) { |
|
| 223 | // Variable part of this function ends. From this line you can copy |
|
| 224 | // this function for similar object handling functions. |
|
| 225 | $obj->cleanVars(); |
|
| 226 | $cleanvars = $obj->cleanVars; |
|
| 227 | } else { |
|
| 228 | return false; |
|
| 229 | } |
|
| 230 | $countVars = count($cleanvars); |
|
| 231 | $i = 1; |
|
| 232 | $strFields = ''; |
|
| 233 | $strValues = ''; |
|
| 234 | foreach ($cleanvars as $k => $v) { |
|
| 235 | $strFields .= $k; |
|
| 236 | $strValues .= "'" . $v . "'"; |
|
| 237 | if ($i < $countVars) { |
|
| 238 | $strFields .= ', '; |
|
| 239 | $strValues .= ', '; |
|
| 240 | } |
|
| 241 | $i++; |
|
| 242 | } |
|
| 243 | $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues); |
|
| 244 | if ($forceQuery) { |
|
| 245 | if ($this->db->queryF($sql)) { |
|
| 246 | $itemid = $this->db->getInsertId(); |
|
| 247 | $obj->setVar($keyName, $itemid); |
|
| 248 | ||
| 249 | return true; |
|
| 250 | } |
|
| 251 | } else { |
|
| 252 | if ($this->db->query($sql)) { |
|
| 253 | $itemid = $this->db->getInsertId(); |
|
| 254 | $obj->setVar($keyName, $itemid); |
|
| 255 | ||
| 256 | return true; |
|
| 257 | } |
|
| 258 | } |
|
| 259 | ||
| 260 | return false; |
|