Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function getLocationString(Apartment $model, $sep = ', ', $withAddress = false)
- {
- $locationArray = array();
- if (issetModule('location')) {
- if ($model->locCountry) {
- $locationArray[] = $model->locCountry->getStrByLang('name');
- }
- if ($model->locRegion) {
- if ($model->locCountry)
- $locationArray[] = $model->locRegion->getStrByLang('name');
- }
- if ($model->locCity) {
- $cityName = $model->locCity->getStrByLang('name');
- $regionName = ($model->locRegion) ? $model->locRegion->getStrByLang('name') : '';
- if (($model->locCountry || $model->locRegion) && ($cityName != $regionName)) {
- $locationArray[] = $cityName;
- }
- }
- } else {
- if (isset($model->city) && isset($model->city->name)) {
- $locationArray[] = $model->city->name;
- }
- }
- if ($withAddress && $model->canShowInView('address')) {
- $locationArray[] = $model->getStrByLang("address");
- }
- return implode($sep, $locationArray);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement