Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
note.php
1<?php
3
4use \Bitrix\Landing\Rights;
5use \Bitrix\Landing\Note\Target;
6use \Bitrix\Landing\Note\Source;
7use \Bitrix\Landing\Site\Type;
8use \Bitrix\Main\Engine\Controller;
9use \Bitrix\Main\Error;
10
11class Note extends Controller
12{
13 public function getDefaultPreFilters()
14 {
15 return [];
16 }
17
22 protected static function canCreateNew(): bool
23 {
24 Type::setScope(Type::SCOPE_CODE_KNOWLEDGE);
26 }
27
32 public static function getTargetsAction(): array
33 {
34 return [
35 'list' => Target::getShortList(),
36 'canCreateNew' => self::canCreateNew()
37 ];
38 }
39
48 public function createNoteAction(int $kbId, string $sourceType, int $sourceId, ?string $scope = null): ?array
49 {
50 $result = null;
51
52 if ($scope)
53 {
54 Type::setScope($scope);
55 }
56 if (check_bitrix_sessid())
57 {
58 $result = Source::createFromSource($kbId, $sourceType, $sourceId);
59 }
60 if (is_array($result))
61 {
62 return $result;
63 }
64
65 $this->addError(new Error('Error occurred during note creating.'));
66 return null;
67 }
68}
createNoteAction(int $kbId, string $sourceType, int $sourceId, ?string $scope=null)
Definition note.php:48
static hasAdditionalRight($code, $type=null, bool $checkExtraRights=false, bool $strict=false)
Definition rights.php:1025