| @@ 410-452 (lines=43) @@ | ||
| 407 | * @param bool $id_as_key |
|
| 408 | * @return array |
|
| 409 | */ |
|
| 410 | public function &getObjects($criteria = null, $id_as_key = false) |
|
| 411 | { |
|
| 412 | $ret = array(); |
|
| 413 | $limit = $start = 0; |
|
| 414 | $sql = 'SELECT * FROM ' . $this->db->prefix('martin_auction'); |
|
| 415 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 416 | $sql .= ' ' . $criteria->renderWhere(); |
|
| 417 | if ($criteria->getSort() != '') { |
|
| 418 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 419 | } |
|
| 420 | $limit = $criteria->getLimit(); |
|
| 421 | $start = $criteria->getStart(); |
|
| 422 | } |
|
| 423 | $sql .= " order by apply_start_date DESC , auction_id DESC "; |
|
| 424 | //echo "<br />" . $sql . "<br />"; |
|
| 425 | $result = $this->db->query($sql, $limit, $start); |
|
| 426 | ||
| 427 | if (!$result) { |
|
| 428 | return $ret; |
|
| 429 | } |
|
| 430 | ||
| 431 | $theObjects = array(); |
|
| 432 | ||
| 433 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 434 | $auction = new MartinAuction(); |
|
| 435 | $auction->assignVars($myrow); |
|
| 436 | $theObjects[$myrow['auction_id']] =& $auction; |
|
| 437 | //var_dump($auction); |
|
| 438 | unset($auction); |
|
| 439 | } |
|
| 440 | //var_dump($theObjects); |
|
| 441 | ||
| 442 | foreach ($theObjects as $theObject) { |
|
| 443 | if (!$id_as_key) { |
|
| 444 | $ret[] =& $theObject; |
|
| 445 | } else { |
|
| 446 | $ret[$theObject->auction_id()] =& $theObject; |
|
| 447 | } |
|
| 448 | unset($theObject); |
|
| 449 | } |
|
| 450 | ||
| 451 | return $ret; |
|
| 452 | } |
|
| 453 | ||
| 454 | /** |
|
| 455 | * @get room list |
|
| @@ 388-430 (lines=43) @@ | ||
| 385 | * @param bool $id_as_key |
|
| 386 | * @return array |
|
| 387 | */ |
|
| 388 | public function &getObjects($criteria = null, $id_as_key = false) |
|
| 389 | { |
|
| 390 | $ret = array(); |
|
| 391 | $limit = $start = 0; |
|
| 392 | $sql = 'SELECT * FROM ' . $this->db->prefix('martin_group'); |
|
| 393 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 394 | $sql .= ' ' . $criteria->renderWhere(); |
|
| 395 | if ($criteria->getSort() != '') { |
|
| 396 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 397 | } |
|
| 398 | $limit = $criteria->getLimit(); |
|
| 399 | $start = $criteria->getStart(); |
|
| 400 | } |
|
| 401 | $sql .= " order by apply_start_date DESC , group_id DESC "; |
|
| 402 | //echo "<br />" . $sql . "<br />"; |
|
| 403 | $result = $this->db->query($sql, $limit, $start); |
|
| 404 | ||
| 405 | if (!$result) { |
|
| 406 | return $ret; |
|
| 407 | } |
|
| 408 | ||
| 409 | $theObjects = array(); |
|
| 410 | ||
| 411 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 412 | $group = new MartinGroup(); |
|
| 413 | $group->assignVars($myrow); |
|
| 414 | $theObjects[$myrow['group_id']] =& $group; |
|
| 415 | //var_dump($group); |
|
| 416 | unset($group); |
|
| 417 | } |
|
| 418 | //var_dump($theObjects); |
|
| 419 | ||
| 420 | foreach ($theObjects as $theObject) { |
|
| 421 | if (!$id_as_key) { |
|
| 422 | $ret[] =& $theObject; |
|
| 423 | } else { |
|
| 424 | $ret[$theObject->group_id()] =& $theObject; |
|
| 425 | } |
|
| 426 | unset($theObject); |
|
| 427 | } |
|
| 428 | ||
| 429 | return $ret; |
|
| 430 | } |
|
| 431 | ||
| 432 | /** |
|
| 433 | * @get room list |
|
| @@ 604-645 (lines=42) @@ | ||
| 601 | * @param bool $id_as_key |
|
| 602 | * @return array |
|
| 603 | */ |
|
| 604 | public function &getObjects($criteria = null, $id_as_key = false) |
|
| 605 | { |
|
| 606 | $ret = array(); |
|
| 607 | $limit = $start = 0; |
|
| 608 | $sql = 'SELECT * FROM ' . $this->db->prefix('martin_hotel'); |
|
| 609 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 610 | $sql .= ' ' . $criteria->renderWhere(); |
|
| 611 | if ($criteria->getSort() != '') { |
|
| 612 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 613 | } |
|
| 614 | $limit = $criteria->getLimit(); |
|
| 615 | $start = $criteria->getStart(); |
|
| 616 | } |
|
| 617 | //echo "<br />" . $sql . "<br />"; |
|
| 618 | $result = $this->db->query($sql, $limit, $start); |
|
| 619 | ||
| 620 | if (!$result) { |
|
| 621 | return $ret; |
|
| 622 | } |
|
| 623 | ||
| 624 | $theObjects = array(); |
|
| 625 | ||
| 626 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 627 | $hotel = new MartinHotel(); |
|
| 628 | $hotel->assignVars($myrow); |
|
| 629 | $theObjects[$myrow['hotel_id']] =& $hotel; |
|
| 630 | //var_dump($hotel); |
|
| 631 | unset($hotel); |
|
| 632 | } |
|
| 633 | //var_dump($theObjects); |
|
| 634 | ||
| 635 | foreach ($theObjects as $theObject) { |
|
| 636 | if (!$id_as_key) { |
|
| 637 | $ret[] =& $theObject; |
|
| 638 | } else { |
|
| 639 | $ret[$theObject->hotel_id()] =& $theObject; |
|
| 640 | } |
|
| 641 | unset($theObject); |
|
| 642 | } |
|
| 643 | ||
| 644 | return $ret; |
|
| 645 | } |
|
| 646 | ||
| 647 | /** |
|
| 648 | * @得到酒店列表 |
|
| @@ 334-375 (lines=42) @@ | ||
| 331 | * @param bool $id_as_key |
|
| 332 | * @return array |
|
| 333 | */ |
|
| 334 | public function &getObjects($criteria = null, $id_as_key = false) |
|
| 335 | { |
|
| 336 | $ret = array(); |
|
| 337 | $limit = $start = 0; |
|
| 338 | $sql = 'SELECT * FROM ' . $this->db->prefix('martin_hotel_city'); |
|
| 339 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 340 | $sql .= ' ' . $criteria->renderWhere(); |
|
| 341 | if ($criteria->getSort() != '') { |
|
| 342 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 343 | } |
|
| 344 | $limit = $criteria->getLimit(); |
|
| 345 | $start = $criteria->getStart(); |
|
| 346 | } |
|
| 347 | //echo "<br />" . $sql . "<br />"; |
|
| 348 | $result = $this->db->query($sql, $limit, $start); |
|
| 349 | ||
| 350 | if (!$result) { |
|
| 351 | return $ret; |
|
| 352 | } |
|
| 353 | ||
| 354 | $theObjects = array(); |
|
| 355 | ||
| 356 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 357 | $hotelcity = new MartinHotelcity(); |
|
| 358 | $hotelcity->assignVars($myrow); |
|
| 359 | $theObjects[$myrow['city_id']] =& $hotelcity; |
|
| 360 | //var_dump($hotelcity); |
|
| 361 | unset($hotelcity); |
|
| 362 | } |
|
| 363 | //var_dump($theObjects); |
|
| 364 | ||
| 365 | foreach ($theObjects as $theObject) { |
|
| 366 | if (!$id_as_key) { |
|
| 367 | $ret[] =& $theObject; |
|
| 368 | } else { |
|
| 369 | $ret[$theObject->city_id()] =& $theObject; |
|
| 370 | } |
|
| 371 | unset($theObject); |
|
| 372 | } |
|
| 373 | ||
| 374 | return $ret; |
|
| 375 | } |
|
| 376 | ||
| 377 | /** |
|
| 378 | * @get city tree |
|
| @@ 254-295 (lines=42) @@ | ||
| 251 | * @param bool $id_as_key |
|
| 252 | * @return array |
|
| 253 | */ |
|
| 254 | public function &getObjects($criteria = null, $id_as_key = false) |
|
| 255 | { |
|
| 256 | $ret = array(); |
|
| 257 | $limit = $start = 0; |
|
| 258 | $sql = 'SELECT * FROM ' . $this->db->prefix('martin_hotel_service_type'); |
|
| 259 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 260 | $sql .= ' ' . $criteria->renderWhere(); |
|
| 261 | if ($criteria->getSort() != '') { |
|
| 262 | $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 263 | } |
|
| 264 | $limit = $criteria->getLimit(); |
|
| 265 | $start = $criteria->getStart(); |
|
| 266 | } |
|
| 267 | //echo "<br />" . $sql . "<br />"; |
|
| 268 | $result = $this->db->query($sql, $limit, $start); |
|
| 269 | ||
| 270 | if (!$result) { |
|
| 271 | return $ret; |
|
| 272 | } |
|
| 273 | ||
| 274 | $theObjects = array(); |
|
| 275 | ||
| 276 | while ($myrow = $this->db->fetchArray($result)) { |
|
| 277 | $hotelservicetype = new MartinHotelServiceType(); |
|
| 278 | $hotelservicetype->assignVars($myrow); |
|
| 279 | $theObjects[$myrow['service_type_id']] =& $hotelservicetype; |
|
| 280 | //var_dump($hotelservicetype); |
|
| 281 | unset($hotelservicetype); |
|
| 282 | } |
|
| 283 | //var_dump($theObjects); |
|
| 284 | ||
| 285 | foreach ($theObjects as $theObject) { |
|
| 286 | if (!$id_as_key) { |
|
| 287 | $ret[] =& $theObject; |
|
| 288 | } else { |
|
| 289 | $ret[$theObject->service_type_id()] =& $theObject; |
|
| 290 | } |
|
| 291 | unset($theObject); |
|
| 292 | } |
|
| 293 | ||
| 294 | return $ret; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * @得到类别列表 |
|