static function getBookStores($libraryId) { $store = new BookStore(); if ($libraryId == -1) { $store->orderBy('weight'); } else { $store->query("SELECT {$store->__table}.* FROM {$store->__table} " . "INNER JOIN nearby_book_store ON ({$store->__table}.id=nearby_book_store.storeId) " . "WHERE libraryId={$libraryId} " . "ORDER BY weight"); } $list = array(); while ($store->fetch()) { $list[] = clone $store; } if (count($list) == 0) { $list = NearbyBookStore::getDefaultBookStores(); } return $list; }
static function getBookStores() { $library = Library::getActiveLibrary(); if ($library) { return NearbyBookStore::getBookStores($library->libraryId); } else { return NearbyBookStore::getDefaultBookStores(); } }