AdvertDetailTrait uses trait:short, trait:short, trait:short, trait:short
Table of Contents
Properties
- $advertLinksConfig : AdvertLinksConfig
- $advertParameterListFactory : AdvertParameterListFactory
- $expressPaymentFactory : ExpressPaymentFactory
- $expressPaymentManager : PaymentManager
- $linksPaymentItemManager : PaymentItemManager
- $recommendFormFactory : RecommendFormFactory
- $responseFormFactory : ResponseFormFactory
- $socialsShareFactory : SocialsShareFactory
- $tariffManager : TariffManager
- $expressPaymentCurrencies : array<int, object|null>
Methods
- actionDetail() : void
- createComponentAdvertParameterList() : AdvertParameterList
- createComponentRecommendForm() : RecommendForm
- createComponentResponseForm() : ResponseForm
- createComponentSocialsShare() : SocialsShare
- handleConfirm() : void
- Confirms the advert through the activation key from the URL (`?do=confirm&key=...` link of the e-mail `BZ_ADVERT_ACTIVATION_REQUEST`).
- handleConfirmAdvert() : void
- Confirms the advert directly from the edit page (Confirm tab).
- renderDetail() : void
- createComponentExpressPayment() : ExpressPayment
- findExpressPaymentTariffs() : iterable<string|int, ExpressTariffInterface>
- Express payment offers whatever the advert can still be boosted with, so the quick prices have to come with the tariff — see {@see ExpressPaymentTrait}.
- getExpressPaymentHeading() : string|null
- Section heading, or null for the component's own generic one.
- getExpressPaymentModuleCode() : string
- getExpressPaymentReference() : string|null
- getExpressPaymentRegionId() : int|null
- Payment region to offer, or null for every region that has the quick price switched on. Null is the default because an advert detail — unlike the payment page — carries no `pr` parameter, and `active` is already the per-region switch the administrator sets on the tariff.
- buildExpressPaymentItems() : array<int, ExpressPaymentItemDto>
- collectAdvertVisibilityIssues() : array<int, string>
- Returns the reasons why the advert is not publicly visible; an empty array means it is fine.
- findExpressPaymentCurrency() : object|null
- findExpressPaymentOffers() : array<string, array{smsText: string, phone: string}>
- Offers keyed by `tariffId|paymentRegionId` — the identity of a quick price row.
- hasPaidLinks() : bool
- True when the advert has an active, valid item of the "Show links" tariff (`AdvertLinksConfig`, default 4): the description then shows its web addresses as links.
- isAdvertOwner() : bool
- isExpressPaymentOffered() : bool
- A row exists for every region the moment a tariff is saved, so `active` alone is not enough — an untouched region row is active-less but also keyword-less, and without a keyword or a number there is nothing the visitor could send.
- prepareMetaDataForDetail() : void
- prepareMetaDataForList() : void
- prepareOgDataForDetail() : void
- prepareOgDataForList() : void
- prepareOtherAdverts() : void
- Loads the other adverts of the owner and the count of their published adverts for the seller card.
Properties
$advertLinksConfig
public
AdvertLinksConfig
$advertLinksConfig
Attributes
- #[Inject]
$advertParameterListFactory
public
AdvertParameterListFactory
$advertParameterListFactory
Attributes
- #[Inject]
$expressPaymentFactory
public
ExpressPaymentFactory
$expressPaymentFactory
Attributes
- #[Inject]
$expressPaymentManager
public
PaymentManager
$expressPaymentManager
Attributes
- #[Inject]
$linksPaymentItemManager
public
PaymentItemManager
$linksPaymentItemManager
Attributes
- #[Inject]
$recommendFormFactory
public
RecommendFormFactory
$recommendFormFactory
Attributes
- #[Inject]
$responseFormFactory
public
ResponseFormFactory
$responseFormFactory
Attributes
- #[Inject]
$socialsShareFactory
public
SocialsShareFactory
$socialsShareFactory
Attributes
- #[Inject]
$tariffManager
public
TariffManager
$tariffManager
Attributes
- #[Inject]
$expressPaymentCurrencies
private
array<int, object|null>
$expressPaymentCurrencies
= []
Currency per id, resolved once per request.
Methods
actionDetail()
public
actionDetail(string|int|null $slug, int $id, string $loc) : void
Parameters
- $slug : string|int|null
- $id : int
- $loc : string
createComponentAdvertParameterList()
public
createComponentAdvertParameterList() : AdvertParameterList
Return values
AdvertParameterListcreateComponentRecommendForm()
public
createComponentRecommendForm() : RecommendForm
Return values
RecommendFormcreateComponentResponseForm()
public
createComponentResponseForm() : ResponseForm
Return values
ResponseFormcreateComponentSocialsShare()
public
createComponentSocialsShare() : SocialsShare
Return values
SocialsSharehandleConfirm()
Confirms the advert through the activation key from the URL (`?do=confirm&key=...` link of the e-mail `BZ_ADVERT_ACTIVATION_REQUEST`).
public
handleConfirm() : void
IMPORTANT: the handler needs #[CrossOrigin]. Nette forces Requires(sameOrigin: true) on
every handle*(), and a click from a mail client is cross-site, so detectedCsrf() would
silently redirect without do/key and the handler would never run. The link is protected
by the key, not by the origin.
An unconfirmed advert is hidden from a guest and actionDetail() nulls $this->advert, so
the handler works only with the id from the URL. A guest cannot write updateColumn(confirmedAt)
(no updateColumns privilege), so everything goes through the Api action confirmByKey:
constant-time key check, deleted or banned = rejection, key consumption, ES and category
counts and a limit of failed attempts
(AdvertConfirmByKeyTrait).
The Api answer does not distinguish an unknown or deleted advert from a wrong key, so the Front does not either (one error message). A repeated click with the right key is a success.
Attributes
- #[CrossOrigin]
handleConfirmAdvert()
Confirms the advert directly from the edit page (Confirm tab).
public
handleConfirmAdvert() : void
renderDetail()
public
renderDetail(string|int|null $slug, int $id, string $loc) : void
Parameters
- $slug : string|int|null
- $id : int
- $loc : string
createComponentExpressPayment()
protected
createComponentExpressPayment() : ExpressPayment
Return values
ExpressPaymentfindExpressPaymentTariffs()
Express payment offers whatever the advert can still be boosted with, so the quick prices have to come with the tariff — see {@see ExpressPaymentTrait}.
protected
findExpressPaymentTariffs() : iterable<string|int, ExpressTariffInterface>
Return values
iterable<string|int, ExpressTariffInterface>getExpressPaymentHeading()
Section heading, or null for the component's own generic one.
protected
getExpressPaymentHeading() : string|null
Return values
string|nullgetExpressPaymentModuleCode()
protected
getExpressPaymentModuleCode() : string
Return values
stringgetExpressPaymentReference()
protected
getExpressPaymentReference() : string|null
Return values
string|nullgetExpressPaymentRegionId()
Payment region to offer, or null for every region that has the quick price switched on. Null is the default because an advert detail — unlike the payment page — carries no `pr` parameter, and `active` is already the per-region switch the administrator sets on the tariff.
protected
getExpressPaymentRegionId() : int|null
Return values
int|nullbuildExpressPaymentItems()
private
buildExpressPaymentItems() : array<int, ExpressPaymentItemDto>
Return values
array<int, ExpressPaymentItemDto>collectAdvertVisibilityIssues()
Returns the reasons why the advert is not publicly visible; an empty array means it is fine.
private
collectAdvertVisibilityIssues(Advert $advert) : array<int, string>
Parameters
- $advert : Advert
Return values
array<int, string>findExpressPaymentCurrency()
private
findExpressPaymentCurrency(int|null $currencyId) : object|null
Parameters
- $currencyId : int|null
Return values
object|nullfindExpressPaymentOffers()
Offers keyed by `tariffId|paymentRegionId` — the identity of a quick price row.
private
findExpressPaymentOffers(int $objectId) : array<string, array{smsText: string, phone: string}>
Parameters
- $objectId : int
Return values
array<string, array{smsText: string, phone: string}>hasPaidLinks()
True when the advert has an active, valid item of the "Show links" tariff (`AdvertLinksConfig`, default 4): the description then shows its web addresses as links.
private
hasPaidLinks(Advert $advert) : bool
Parameters
- $advert : Advert
Return values
boolisAdvertOwner()
private
isAdvertOwner(Advert $advert) : bool
Parameters
- $advert : Advert
Return values
boolisExpressPaymentOffered()
A row exists for every region the moment a tariff is saved, so `active` alone is not enough — an untouched region row is active-less but also keyword-less, and without a keyword or a number there is nothing the visitor could send.
private
isExpressPaymentOffered(TariffQuickPriceInterface $quickPrice, int|null $regionId) : bool
Parameters
- $quickPrice : TariffQuickPriceInterface
- $regionId : int|null
Return values
boolprepareMetaDataForDetail()
private
prepareMetaDataForDetail(Advert|null $entity, string $titlePrName, string $textPrName) : void
Parameters
- $entity : Advert|null
- $titlePrName : string
- $textPrName : string
prepareMetaDataForList()
private
prepareMetaDataForList([Category|null $category = null ]) : void
Parameters
- $category : Category|null = null
prepareOgDataForDetail()
private
prepareOgDataForDetail(Advert|null $entity, string $titlePrName, string $textPrName) : void
Parameters
- $entity : Advert|null
- $titlePrName : string
- $textPrName : string
prepareOgDataForList()
private
prepareOgDataForList([Category|null $category = null ]) : void
Parameters
- $category : Category|null = null
prepareOtherAdverts()
Loads the other adverts of the owner and the count of their published adverts for the seller card.
private
prepareOtherAdverts(Advert $advert) : void
IMPORTANT: the owner is looked up by insertUserId, not by e-mail. The Api masks the e-mail
on output (PersonalDataPolicy), so a filter by the masked e-mail never matches and the list
would always be empty. An anonymous advert (no owner account) has nothing to search by: the
list stays empty and the count card is not shown.
One query loads all published adverts of the owner: the count is their number (what the visitor really sees) and the list is the same without the one being displayed.
Parameters
- $advert : Advert