1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
promotion.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Controller;
4
5use Bitrix\Main\Engine\AutoWire\BinderArgumentException;
6use Bitrix\Main\Engine\AutoWire\ExactParameter;
7use Bitrix\Main\Engine\Controller;
8use Bitrix\Main\Error;
9use Bitrix\Socialnetwork\Promotion\AbstractPromotion;
10use Bitrix\Socialnetwork\Promotion\PromotionFactory;
11use Bitrix\Socialnetwork\Promotion\PromotionType;
12
13class Promotion extends Controller
14{
18 public function getAutoWiredParameters(): array
19 {
20 return [
22 AbstractPromotion::class,
23 'promotion',
24 function($className, $promotion): ?AbstractPromotion {
25 $promotionType = PromotionType::tryFrom($promotion);
26
27 if (!$promotionType)
28 {
29 $this->addError(new Error('Unknown promotion type'));
30
31 return null;
32 }
33
34 return (new PromotionFactory())->getByPromotionType($promotionType);
35 },
36 ),
37 ];
38 }
39
40 public function setViewedAction(AbstractPromotion $promotion): bool
41 {
42 $userId = (int)$this->getCurrentUser()?->getId();
43
44 if ($userId <= 0)
45 {
46 return false;
47 }
48
49 return $promotion->setViewed($userId);
50 }
51}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
addError(Error $error)
Определения controller.php:1070
Определения error.php:15
setViewedAction(AbstractPromotion $promotion)
Определения promotion.php:40
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804