request->get('inlineMedicalEdit', 0); $openProgressEditId = (int)Yii::$app->request->get('inlineProgressEdit', 0); $layoutMode = isset($layoutMode) ? trim((string)$layoutMode) : 'default'; $isTabletLayout = $layoutMode === 'tablet'; $medicalVisitsUrl = $space->createUrl('/animal_management/animals/medical-visits', ['id' => (int)$animal->id]); $progressUpdatesUrl = $space->createUrl('/animal_management/animals/progress-updates', ['id' => (int)$animal->id]); $transferRequestUrl = $space->createUrl('/animal_management/animals/transfer', ['id' => (int)$animal->id]); $tabletBackUrl = $space->createUrl('/animal_management/animals/index', ['view' => 'tablet']); $transferById = []; foreach ($transfers as $transfer) { if ($transfer instanceof AnimalTransfer) { $transferById[(int)$transfer->id] = $transfer; } } $coverImageUrl = trim((string)$animalCoverImageUrl); $profileImageUrl = trim((string)($animalProfileImageUrl ?? '')); $hasCoverImage = $coverImageUrl !== '' && (preg_match('/^https?:\/\//i', $coverImageUrl) || substr($coverImageUrl, 0, 1) === '/'); $hasProfileImage = $profileImageUrl !== '' && (preg_match('/^https?:\/\//i', $profileImageUrl) || substr($profileImageUrl, 0, 1) === '/'); $statusLabel = Animal::statusOptions()[$animal->status] ?? (string)$animal->status; $detailFieldMap = [ 'name' => (string)$animal->getDisplayName(), 'species' => (string)$animal->species, 'breed' => (string)$animal->breed, 'sex' => (string)$animal->sex, 'status' => (string)$statusLabel, 'location_name' => (string)$animal->location_name, 'animal_uid' => (string)$animal->animal_uid, 'public_summary' => trim((string)$animal->public_summary), 'last_medical' => !empty($medicalVisits) ? DateDisplayHelper::format((string)$medicalVisits[0]->visit_at) : '', ]; $heroFieldValues = []; foreach ($detailHeroFields as $fieldKey) { $fieldKey = trim((string)$fieldKey); if ($fieldKey === '' || $fieldKey === 'name' || !array_key_exists($fieldKey, $detailFieldMap)) { continue; } $value = trim((string)$detailFieldMap[$fieldKey]); if ($value === '') { continue; } $heroFieldValues[] = $value; } $customHeroCount = 0; foreach ($customFieldValues as $customField) { if ($customHeroCount >= 3) { break; } $label = trim((string)($customField['label'] ?? '')); $value = trim((string)($customField['value'] ?? '')); if ($label === '' || $value === '') { continue; } $heroFieldValues[] = $label . ': ' . $value; $customHeroCount++; } if (class_exists(GalleryAssets::class)) { GalleryAssets::register($this); } $uiGalleryId = 'animal-gallery-' . (int)$animal->id; $showDonationSettingsButton = $canManage && $space->moduleManager->isEnabled('donations'); $existingDonationGoal = null; $profileTileOverlayAddonHtml = ''; if ($space->moduleManager->isEnabled('donations')) { $donationGoalClass = 'humhub\\modules\\donations\\models\\DonationGoal'; if (class_exists($donationGoalClass) && Yii::$app->db->schema->getTableSchema($donationGoalClass::tableName(), true) !== null ) { $existingDonationGoal = $donationGoalClass::find() ->where([ 'contentcontainer_id' => (int)$space->contentcontainer_id, 'goal_type' => $donationGoalClass::TYPE_ANIMAL, 'target_animal_id' => (int)$animal->id, ]) ->orderBy(['is_active' => SORT_DESC, 'id' => SORT_DESC]) ->one(); } } $profileDonationToggleInputId = 'animal-profile-donation-toggle-' . (int)$animal->id; $profileDonationInlineFormId = 'animal-profile-donation-inline-' . (int)$animal->id; $profileDonationFileFieldId = 'animal-profile-donation-image-file-' . (int)$animal->id; $profileDonationPreviewId = 'animal-profile-donation-image-preview-' . (int)$animal->id; $profileCreateInlineGoalUrl = $space->createUrl('/donations/settings/create-animal-goal-inline', [ 'animalId' => (int)$animal->id, ]); $profileGalleryUrls = []; foreach ($galleryItems as $galleryItem) { if (!$galleryItem instanceof AnimalGalleryItem) { continue; } $url = trim((string)$galleryItem->getImageUrl()); if ($url === '') { continue; } $profileGalleryUrls[] = $url; } $profileGalleryUrls = array_slice($profileGalleryUrls, 0, 8); $profileDefaultGoalTitle = Yii::t('DonationsModule.base', '{animalName} Care Fund', [ 'animalName' => (string)$animal->getDisplayName(), ]); $profileExistingGoalId = is_object($existingDonationGoal) ? (int)($existingDonationGoal->id ?? 0) : 0; $profileExistingGoalTitle = trim((string)(is_object($existingDonationGoal) ? ($existingDonationGoal->title ?? '') : '')); $profileExistingGoalTargetAmount = is_object($existingDonationGoal) ? (float)($existingDonationGoal->target_amount ?? 0) : 0.0; $profileExistingGoalDescription = trim((string)(is_object($existingDonationGoal) ? ($existingDonationGoal->description ?? '') : '')); $profileExistingGoalImage = trim((string)(is_object($existingDonationGoal) ? ($existingDonationGoal->image_path ?? '') : '')); $profileExistingGoalActive = is_object($existingDonationGoal) ? (int)($existingDonationGoal->is_active ?? 1) : 1; if ($profileExistingGoalTitle === '') { $profileExistingGoalTitle = $profileDefaultGoalTitle; } if (class_exists(AnimalTileRenderEvent::class) && $space->moduleManager->isEnabled('donations')) { $profileTileRenderEvent = new AnimalTileRenderEvent([ 'animal' => $animal, 'contentContainer' => $space, 'existingDonationGoal' => $existingDonationGoal, 'showDonationSettingsButton' => $showDonationSettingsButton, 'donationToggleInputId' => $profileDonationToggleInputId, 'donationInlineFormId' => $profileDonationInlineFormId, ]); Event::trigger(AnimalTileRenderEvent::class, AnimalTileRenderEvent::EVENT_RENDER_OVERLAY, $profileTileRenderEvent); $profileTileOverlayAddonHtml = $profileTileRenderEvent->getHtml(); } $profileInlineFormBackgroundStyle = 'padding:12px;border-top:1px solid #e6edf5;display:none;background:#fff;'; if ($profileExistingGoalImage !== '') { $profileInlineFormBackgroundStyle = 'padding:12px;border-top:1px solid #e6edf5;display:none;' . 'background-image:linear-gradient(rgba(255,255,255,0.35),rgba(255,255,255,0.45)),url(' . Html::encode($profileExistingGoalImage) . ');' . 'background-size:cover;background-position:center;'; } ?>
<?= Html::encode($animal->getDisplayName()) ?> <?= Html::encode($animal->getDisplayName()) ?>
getDisplayName()) ?>
public_summary)): ?>
public_summary)) ?>
'multipart/form-data', 'style' => 'margin:0;', ]) ?> request->csrfParam, Yii::$app->request->getCsrfToken()) ?> id) ?>
'form-control input-sm animal-profile-donation-inline-input', 'maxlength' => 190, 'required' => true, ]) ?>
0 ? (string)$profileExistingGoalTargetAmount : '', [ 'class' => 'form-control input-sm animal-profile-donation-inline-input', 'step' => '0.01', 'min' => '0', 'required' => true, ]) ?>
'form-control input-sm animal-profile-donation-inline-input', 'rows' => 2, ]) ?>
$profileDonationFileFieldId, 'class' => 'form-control input-sm js-animal-profile-donation-upload animal-profile-donation-inline-input', 'data-preview' => '#' . $profileDonationPreviewId, 'data-editor-bg' => '#' . $profileDonationInlineFormId, 'accept' => 'image/*', ]) ?>
0 ? Yii::t('DonationsModule.base', 'Update Goal') : Yii::t('DonationsModule.base', 'Save Goal'), ['class' => 'btn btn-primary btn-sm']) ?>
registerCss("#{$profileDonationToggleInputId}:checked ~ #{$profileDonationInlineFormId}{display:block !important;}"); $this->registerCss("#{$profileDonationInlineFormId} .animal-profile-donation-inline-input{background:rgba(255,255,255,0.34);border-color:rgba(165,178,195,0.72);color:#16202a;}\n" . "#{$profileDonationInlineFormId} .animal-profile-donation-inline-input::placeholder{color:rgba(31,41,55,0.72);}\n" . "#{$profileDonationInlineFormId} .animal-profile-donation-inline-gallery{background:rgba(255,255,255,0.16);padding:6px;border-radius:6px;pointer-events:auto;}\n" . "#{$profileDonationInlineFormId} .animal-profile-donation-gallery-radio{position:absolute;opacity:0;pointer-events:none;}\n" . "#{$profileDonationInlineFormId} .animal-profile-donation-gallery-radio:checked + label{border-color:#1f78c1 !important;box-shadow:0 0 0 2px rgba(31,120,193,0.32) !important;}"); $profileUploadPendingText = Json::htmlEncode(Yii::t('DonationsModule.base', 'Image will be uploaded with this goal.')); $profileNoImageText = Json::htmlEncode(Yii::t('DonationsModule.base', 'No image selected.')); $profileInlineJsNamespace = 'animalProfileDonationInlineToggle' . (int)$animal->id; $this->registerJs(<<'); } var profileInlineToggleSelector = '#$profileDonationToggleInputId'; var profileInlineFormSelector = '#$profileDonationInlineFormId'; syncProfileInlineEditor(profileInlineToggleSelector, profileInlineFormSelector); $(document).off('change.$profileInlineJsNamespace').on('change.$profileInlineJsNamespace', profileInlineToggleSelector, function() { syncProfileInlineEditor(profileInlineToggleSelector, profileInlineFormSelector); }); $(document).off('change.animalProfileDonationGallery').on('change.animalProfileDonationGallery', '.animal-profile-donation-gallery-radio', function() { var radio = $(this); if (!radio.is(':checked')) { return; } var previewSelector = radio.data('preview'); var editorSelector = radio.data('editor-bg'); var url = radio.val() || ''; setProfilePreview(previewSelector, url); setProfileEditorBackground(editorSelector, url); }); $(document).off('change.animalProfileDonationUpload').on('change.animalProfileDonationUpload', '.js-animal-profile-donation-upload', function() { var previewSelector = $(this).data('preview'); var editorSelector = $(this).data('editor-bg'); if (!previewSelector) { return; } var form = $(this).closest('form'); form.find('.animal-profile-donation-gallery-radio').prop('checked', false); var previousObjectUrl = $(this).data('object-url') || ''; if (previousObjectUrl && window.URL && window.URL.revokeObjectURL) { window.URL.revokeObjectURL(previousObjectUrl); } if (this.files && this.files.length > 0) { var objectUrl = ''; if (window.URL && window.URL.createObjectURL) { objectUrl = window.URL.createObjectURL(this.files[0]); $(this).data('object-url', objectUrl); } if (objectUrl) { setProfilePreview(previewSelector, objectUrl); setProfileEditorBackground(editorSelector, objectUrl); } else { $(previewSelector).text($profileUploadPendingText); } } else { $(this).data('object-url', ''); var selectedRadio = form.find('.animal-profile-donation-gallery-radio:checked').first(); var fallbackUrl = selectedRadio.length ? (selectedRadio.val() || '') : ''; setProfilePreview(previewSelector, fallbackUrl); setProfileEditorBackground(editorSelector, fallbackUrl); } }); })(); JS, \yii\web\View::POS_READY, 'animal-profile-donation-inline-' . (int)$animal->id); } $this->registerJs(<<<'JS' (function() { function getCsrfPayload() { var csrfParam = $('meta[name="csrf-param"]').attr('content') || ''; var csrfToken = $('meta[name="csrf-token"]').attr('content') || ''; var payload = {}; if (csrfParam && csrfToken) { payload[csrfParam] = csrfToken; } return payload; } function scrollInlineEditorIntoView(editor) { var $editor = $(editor); if (!$editor.length) { return; } var sideSpacing = parseFloat($editor.css('margin-left')); if (!(sideSpacing > 0)) { sideSpacing = parseFloat($editor.closest('.panel-body').css('padding-left')); } if (!(sideSpacing > 0)) { sideSpacing = 14; } var fixedHeaderHeight = 0; $('.navbar-fixed-top:visible, #topbar:visible, .topbar:visible, .layout-top-container:visible').each(function() { var h = $(this).outerHeight() || 0; if (h > fixedHeaderHeight) { fixedHeaderHeight = h; } }); var topReserve = Math.max(sideSpacing, 14) + Math.max(fixedHeaderHeight, 64) + 28; var top = Math.max(0, $editor.offset().top - topReserve); $('html, body').stop(true).animate({scrollTop: top}, 220); } function refreshPanels(selectors) { selectors = selectors || []; if (!selectors.length) { return $.Deferred().resolve().promise(); } return $.get(window.location.href).done(function(html) { var $doc = $('
').append($.parseHTML(html, document, true)); selectors.forEach(function(selector) { var $next = $doc.find(selector).first(); if ($next.length) { $(selector).replaceWith($next); } }); }); } window.addEventListener('message', function(event) { var data = event.data || {}; if (!data || typeof data !== 'object' || data.source !== 'animal-inline-editor') { return; } if (data.type === 'cancel') { if (data.collapseId) { $('#' + data.collapseId).collapse('hide'); } return; } if (data.type === 'saved') { if (data.collapseId) { $('#' + data.collapseId).collapse('hide'); } var selectors = $.isArray(data.refreshSelectors) && data.refreshSelectors.length ? data.refreshSelectors : ['#animal-medical-panel', '#animal-progress-panel', '#animal-gallery-panel']; refreshPanels(selectors); } }); $(document) .off('shown.bs.collapse.animalInlineScroll', '.animal-inline-editor') .on('shown.bs.collapse.animalInlineScroll', '.animal-inline-editor', function() { var $content = $(this).closest('.animal-feed-content'); if ($content.length) { $content.addClass('animal-feed-editing'); } scrollInlineEditorIntoView(this); }); $(document) .off('hidden.bs.collapse.animalInlineScroll', '.animal-inline-editor') .on('hidden.bs.collapse.animalInlineScroll', '.animal-inline-editor', function() { var $content = $(this).closest('.animal-feed-content'); if ($content.length) { $content.removeClass('animal-feed-editing'); } }); $('.animal-inline-editor.in').each(function() { var $content = $(this).closest('.animal-feed-content'); if ($content.length) { $content.addClass('animal-feed-editing'); } }); $(document).on('submit', '#animal-gallery-upload', function(event) { event.preventDefault(); var form = this; var filesInput = form.querySelector('#galleryImages'); var selectedCount = filesInput && filesInput.files ? filesInput.files.length : 0; if (selectedCount > 10) { window.alert('You can upload up to 10 images at a time.'); return; } var formData = new FormData(form); $.ajax({ url: form.action, type: 'POST', data: formData, processData: false, contentType: false }).done(function() { var shouldReopenModal = selectedCount > 0; if (form && typeof form.reset === 'function') { form.reset(); } $('#animal-gallery-manage-modal').modal('hide'); refreshPanels(['#animal-gallery-panel']).done(function() { if (shouldReopenModal) { $('#animal-gallery-manage-modal').modal('show'); } }); }); }); $(document).on('click', '.js-ajax-gallery-remove', function(event) { event.preventDefault(); var $link = $(this); var confirmText = $link.data('confirmMessage') || $link.data('confirm'); if (confirmText && !window.confirm(confirmText)) { return; } $.post($link.attr('href'), getCsrfPayload()).done(function() { refreshPanels(['#animal-gallery-panel']); }); }); })(); JS , \yii\web\View::POS_END); ?> registerJs(<<= 20) { window.clearInterval(retryTimer); } }, 250); window.addEventListener('resize', syncAnimalProfileHeroHeight); if (window.ResizeObserver) { var hero = document.getElementById('animal-profile-hero-media'); var overlayStack = hero ? hero.querySelector('[data-animal-tile-overlay-stack="1"]') : null; if (overlayStack) { var observer = new ResizeObserver(syncAnimalProfileHeroHeight); observer.observe(overlayStack); } } var inlineForm = document.getElementById(inlineFormId); if (inlineForm && window.MutationObserver) { var mutationObserver = new MutationObserver(syncAnimalProfileHeroHeight); mutationObserver.observe(inlineForm, { attributes: true, childList: true, subtree: true }); } var iframes = document.querySelectorAll('iframe'); for (var i = 0; i < iframes.length; i++) { iframes[i].addEventListener('load', syncAnimalProfileHeroHeight); } })(); JS , \yii\web\View::POS_READY, 'animal-profile-hero-height-' . (int)$animal->id); ?>
' . Yii::t('AnimalManagementModule.base', 'Add'), $space->createUrl('/animal_management/animals/medical-visits', ['id' => $animal->id, 'inlineMedicalAdd' => 1]) . '#medical-add-inline', [ 'class' => 'btn btn-xs animal-profile-action-pill', 'title' => Yii::t('AnimalManagementModule.base', 'Add Medical Visit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Add Medical Visit'), ]) ?>
'BP', 'oxygen' => 'O₂', ]; ?> getCustomFieldDisplayValues($canManage); $visitFieldsByKey = []; $additionalVisitFields = []; $medicalMedia = ''; foreach ($visitCustomValues as $customField) { $fieldKey = (string)($customField['field_key'] ?? ''); if (in_array($fieldKey, $hiddenMedicalKeys, true)) { continue; } $fieldValue = trim((string)($customField['value'] ?? '')); if ($fieldValue === '') { continue; } if ($fieldKey === 'medical_media_reference' || $fieldKey === 'media_reference') { $medicalMedia = $fieldValue; continue; } if (in_array($fieldKey, $knownMedicalKeys, true)) { $visitFieldsByKey[$fieldKey] = [ 'label' => (string)($medicalVitalLabelOverrides[$fieldKey] ?? ($customField['label'] ?? $fieldKey)), 'value' => $fieldValue, ]; continue; } $additionalVisitFields[] = [ 'label' => (string)($customField['label'] ?? $fieldKey), 'value' => $fieldValue, ]; } $hasMedicalMedia = $medicalMedia !== '' && (preg_match('/^https?:\/\//i', $medicalMedia) || substr($medicalMedia, 0, 1) === '/'); $visitDateDisplay = DateDisplayHelper::format((string)$visit->visit_at); ?>
<?= Yii::t('AnimalManagementModule.base', 'Medical media') ?>
visit_at) ?>
:
', '#medical-edit-inline-' . (int)$visit->id, [ 'class' => 'btn btn-xs btn-default animal-profile-action-icon-btn', 'data-toggle' => 'collapse', 'title' => Yii::t('AnimalManagementModule.base', 'Edit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Edit'), ] ) ?>
provider_name)): ?>
: provider_name) ?>
notes)): ?>
notes)) ?>
recommendations)): ?>
recommendations)) ?>
:
' . Yii::t('AnimalManagementModule.base', 'Add'), $space->createUrl('/animal_management/animals/progress-updates', ['id' => $animal->id, 'inlineProgressAdd' => 1]) . '#progress-add-inline', [ 'class' => 'btn btn-xs animal-profile-action-pill', 'title' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), ]) ?>
getCustomFieldDisplayValues($canManage); $mediaReference = ''; $progressCustomDisplayValues = []; foreach ($progressCustomValues as $customField) { if ((string)($customField['field_key'] ?? '') === 'media_reference') { $mediaReference = trim((string)$customField['value']); continue; } $progressCustomDisplayValues[] = $customField; } $hasMediaImage = $mediaReference !== '' && (preg_match('/^https?:\/\//i', $mediaReference) || substr($mediaReference, 0, 1) === '/'); ?>
<?= Yii::t('AnimalManagementModule.base', 'Progress media') ?>
update_at)) ?> weight) || !empty($update->vitals)): ?>
weight)): ?>: weight) ?> vitals)): ?>
', '#progress-edit-inline-' . (int)$update->id, [ 'class' => 'btn btn-xs btn-default animal-profile-action-icon-btn', 'data-toggle' => 'collapse', 'title' => Yii::t('AnimalManagementModule.base', 'Edit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Edit'), ] ) ?>
vitals)): ?>
vitals)) ?>
behavior_notes)): ?>
behavior_notes)) ?>
meal_plan_changes)): ?>
meal_plan_changes)) ?>
housing_changes)): ?>
housing_changes)) ?>
medical_concerns)): ?>
medical_concerns)) ?>
:
Transfers') ?> ' . Yii::t('AnimalManagementModule.base', 'Request Transfer'), $transferRequestUrl, [ 'class' => 'btn btn-xs animal-profile-action-pill', 'title' => Yii::t('AnimalManagementModule.base', 'Request Transfer'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Request Transfer'), ]) ?>
' . Yii::t('AnimalManagementModule.base', 'Transfer Form'), $transferRequestUrl, ['class' => 'btn btn-default btn-sm']) ?>
transfer_id; if ($transferId <= 0) { continue; } if (!isset($eventsByTransfer[$transferId])) { $eventsByTransfer[$transferId] = []; } $eventsByTransfer[$transferId][] = $transferEvent; } foreach ($eventsByTransfer as &$transferEventsGroup) { usort($transferEventsGroup, static function (AnimalTransferEvent $a, AnimalTransferEvent $b): int { return strcmp((string)$b->created_at, (string)$a->created_at); }); } unset($transferEventsGroup); $eventActionMap = [ AnimalTransferEvent::EVENT_REQUESTED => Yii::t('AnimalManagementModule.base', 'requested Transfer'), AnimalTransferEvent::EVENT_ACCEPTED => Yii::t('AnimalManagementModule.base', 'accepted Transfer'), AnimalTransferEvent::EVENT_DECLINED => Yii::t('AnimalManagementModule.base', 'declined Transfer'), AnimalTransferEvent::EVENT_COMPLETED => Yii::t('AnimalManagementModule.base', 'completed Transfer'), AnimalTransferEvent::EVENT_CANCELLED => Yii::t('AnimalManagementModule.base', 'cancelled Transfer'), ]; $eventBadgeMap = [ AnimalTransferEvent::EVENT_REQUESTED => ['label' => Yii::t('AnimalManagementModule.base', 'Requested'), 'class' => 'animal-profile-transfer-badge-requested'], AnimalTransferEvent::EVENT_ACCEPTED => ['label' => Yii::t('AnimalManagementModule.base', 'Accepted'), 'class' => 'animal-profile-transfer-badge-accepted'], AnimalTransferEvent::EVENT_DECLINED => ['label' => Yii::t('AnimalManagementModule.base', 'Declined'), 'class' => 'animal-profile-transfer-badge-declined'], AnimalTransferEvent::EVENT_COMPLETED => ['label' => Yii::t('AnimalManagementModule.base', 'Completed'), 'class' => 'animal-profile-transfer-badge-completed'], AnimalTransferEvent::EVENT_CANCELLED => ['label' => Yii::t('AnimalManagementModule.base', 'Cancelled'), 'class' => 'animal-profile-transfer-badge-cancelled'], ]; ?> $transferEventsGroup): ?> event_type : ''; $eventBadge = $eventBadgeMap[$latestType] ?? ['label' => Yii::t('AnimalManagementModule.base', 'Updated'), 'class' => 'animal-profile-transfer-badge-default']; $transferModel = $transferById[(int)$transferId] ?? null; $fromName = Yii::t('AnimalManagementModule.base', 'Unknown Rescue'); $toName = Yii::t('AnimalManagementModule.base', 'Unknown Rescue'); $fromUrl = ''; $toUrl = ''; $fromAvatarUrl = ''; $toAvatarUrl = ''; $careWindowText = ''; $receivingStatusDateText = ''; if ($transferModel instanceof AnimalTransfer) { $fromSpace = $transferModel->getFromSpace(); $toSpace = $transferModel->getToSpace(); if ($fromSpace !== null) { $fromName = (string)$fromSpace->name; $fromUrl = (string)$fromSpace->createUrl('/rescues'); if (method_exists($fromSpace, 'getProfileImage')) { $fromProfileImage = $fromSpace->getProfileImage(); if ($fromProfileImage !== null && method_exists($fromProfileImage, 'getUrl')) { $fromAvatarUrl = trim((string)$fromProfileImage->getUrl()); } } } if ($toSpace !== null) { $toName = (string)$toSpace->name; $toUrl = (string)$toSpace->createUrl('/rescues'); if (method_exists($toSpace, 'getProfileImage')) { $toProfileImage = $toSpace->getProfileImage(); if ($toProfileImage !== null && method_exists($toProfileImage, 'getUrl')) { $toAvatarUrl = trim((string)$toProfileImage->getUrl()); } } } $startTs = strtotime((string)$transferModel->created_at); $endRaw = trim((string)($transferModel->completed_at ?? '')); if ($endRaw === '') { $endRaw = trim((string)$transferModel->updated_at); } $endTs = $endRaw !== '' ? strtotime($endRaw) : false; if ($startTs !== false) { $careWindowText = date('m/d/y', $startTs); if ($endTs !== false) { $careWindowText .= ' - ' . date('m/d/y', $endTs); } } } if ($latestType === AnimalTransferEvent::EVENT_COMPLETED) { foreach ($transferEventsGroup as $candidateEvent) { if ((string)$candidateEvent->event_type === AnimalTransferEvent::EVENT_COMPLETED) { $completedTs = strtotime((string)$candidateEvent->created_at); if ($completedTs !== false) { $receivingStatusDateText = Yii::t('AnimalManagementModule.base', 'Completed {date}', [ 'date' => date('m/d/y', $completedTs), ]); } break; } } } elseif ($latestType === AnimalTransferEvent::EVENT_REQUESTED) { foreach ($transferEventsGroup as $candidateEvent) { if ((string)$candidateEvent->event_type === AnimalTransferEvent::EVENT_REQUESTED) { $requestedTs = strtotime((string)$candidateEvent->created_at); if ($requestedTs !== false) { $receivingStatusDateText = Yii::t('AnimalManagementModule.base', 'Requested {date}', [ 'date' => date('m/d/y', $requestedTs), ]); } break; } } } $fromNameHtml = $fromUrl !== '' ? Html::a(Html::encode($fromName), $fromUrl, ['class' => 'animal-profile-transfer-rescue-name']) : '' . Html::encode($fromName) . ''; $toNameHtml = $toUrl !== '' ? Html::a(Html::encode($toName), $toUrl, ['class' => 'animal-profile-transfer-rescue-name']) : '' . Html::encode($toName) . ''; $historyImageUrl = $hasCoverImage ? $coverImageUrl : ($hasProfileImage ? $profileImageUrl : ''); ?>
<?= Html::encode($animal->getDisplayName()) ?>
<?= Html::encode($fromName) ?>
<?= Html::encode($toName) ?>
created_at)); $eventActionText = $eventActionMap[(string)$transferEvent->event_type] ?? (string)$transferEvent->event_type; $transferActor = $transferEvent->createdByUser; $actorName = $transferActor ? (string)$transferActor->displayName : Yii::t('AnimalManagementModule.base', 'System'); $actorUrl = ($transferActor && method_exists($transferActor, 'getUrl')) ? (string)$transferActor->getUrl() : ''; $actorAvatarUrl = ''; if ($transferActor && method_exists($transferActor, 'getProfileImage')) { $actorProfileImage = $transferActor->getProfileImage(); if ($actorProfileImage !== null && method_exists($actorProfileImage, 'getUrl')) { $actorAvatarUrl = trim((string)$actorProfileImage->getUrl()); } } ?>
<?= Html::encode($actorName) ?>
'animal-profile-transfer-event-actor-name']) ?>