94 lines
4.2 KiB
PHP
94 lines
4.2 KiB
PHP
<?php
|
|
|
|
use humhub\modules\space\models\Space;
|
|
use humhub\modules\space_profiles\components\TemplateRegistry;
|
|
use humhub\modules\space_profiles\models\SpaceProfile;
|
|
use yii\helpers\Html;
|
|
|
|
/* @var Space $space */
|
|
/* @var SpaceProfile|null $profile */
|
|
/* @var bool $isPublicRoute */
|
|
|
|
$backgroundStyle = '';
|
|
if ($profile && !empty($profile->background_image_path)) {
|
|
$backgroundStyle = 'background-image:url(' . Html::encode($profile->background_image_path) . ');background-size:cover;background-position:center;';
|
|
}
|
|
|
|
$searchBlockWidget = '\\humhub\\modules\\animal_management\\widgets\\SearchAnimalProfilesBlock';
|
|
$templateView = TemplateRegistry::resolveView($profile ? $profile->template_key : null);
|
|
$spaceDescription = trim((string)$space->about);
|
|
if ($spaceDescription === '') {
|
|
$spaceDescription = trim((string)$space->description);
|
|
}
|
|
|
|
if ($spaceDescription === '') {
|
|
$spaceDescription = trim((string)($profile?->description ?? ''));
|
|
}
|
|
?>
|
|
|
|
<div class="panel panel-default rescue-profile-scope" style="<?= $backgroundStyle ?>">
|
|
<div class="panel-body" style="background:rgba(255,255,255,0.93);border-radius:8px;">
|
|
<?php if (!empty($isPublicRoute) && $space->visibility !== Space::VISIBILITY_ALL): ?>
|
|
<div class="alert alert-warning">
|
|
<?= Yii::t('SpaceProfilesModule.base', 'This profile is visible to signed-in users based on the space privacy setting.') ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!$profile): ?>
|
|
<div class="alert alert-info">
|
|
<?= Yii::t('SpaceProfilesModule.base', 'This rescue has not published its profile yet.') ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<?= $this->render($templateView, [
|
|
'space' => $space,
|
|
'profile' => $profile,
|
|
'searchBlockWidget' => $searchBlockWidget,
|
|
]) ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php $this->beginBlock('sidebar'); ?>
|
|
<div class="panel panel-default">
|
|
<div class="panel-body">
|
|
<?php if (!$profile): ?>
|
|
<div class="text-muted">
|
|
<?= Yii::t('SpaceProfilesModule.base', 'Contact details will appear after the profile is published.') ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="font-weight:700;font-size:18px;text-align:center;margin-bottom:12px;">
|
|
<?= Html::encode($space->name) ?>
|
|
</div>
|
|
<div><?= Html::encode($profile->address) ?></div>
|
|
<div style="margin-bottom:10px;"><?= Html::encode($profile->city) ?>, <?= Html::encode($profile->state) ?> <?= Html::encode($profile->zip) ?></div>
|
|
<div style="margin-bottom:6px;">
|
|
<strong><?= Yii::t('SpaceProfilesModule.base', 'Email') ?>:</strong>
|
|
<a href="mailto:<?= Html::encode($profile->email) ?>"><?= Html::encode($profile->email) ?></a>
|
|
</div>
|
|
<div>
|
|
<strong><?= Yii::t('SpaceProfilesModule.base', 'Phone') ?>:</strong>
|
|
<a href="tel:<?= Html::encode(preg_replace('/[^0-9+]/', '', (string)$profile->phone) ?? '') ?>"><?= Html::encode($profile->phone) ?></a>
|
|
</div>
|
|
|
|
<?php if ($spaceDescription !== '' || trim((string)$profile->mission_statement) !== '' || trim((string)$profile->animals_we_accept) !== ''): ?>
|
|
<hr style="margin:12px 0;">
|
|
<?php endif; ?>
|
|
|
|
<?php if ($spaceDescription !== ''): ?>
|
|
<div style="margin-bottom:10px;"><?= nl2br(Html::encode($spaceDescription)) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (trim((string)$profile->mission_statement) !== ''): ?>
|
|
<div style="margin-bottom:4px;"><strong><?= Yii::t('SpaceProfilesModule.base', 'Mission Statement') ?>:</strong></div>
|
|
<div style="margin-bottom:10px;"><?= nl2br(Html::encode($profile->mission_statement)) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (trim((string)$profile->animals_we_accept) !== ''): ?>
|
|
<div style="margin-bottom:4px;"><strong><?= Yii::t('SpaceProfilesModule.base', 'Animals We Accept') ?>:</strong></div>
|
|
<div><?= nl2br(Html::encode($profile->animals_we_accept)) ?></div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php $this->endBlock(); ?>
|