Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/landing/lib/controller/ |
Upload File : |
<?php namespace Bitrix\Landing\Controller; use \Bitrix\Landing\Rights; use \Bitrix\Landing\Note\Target; use \Bitrix\Landing\Note\Source; use \Bitrix\Landing\Site\Type; use \Bitrix\Main\Engine\Controller; use \Bitrix\Main\Error; class Note extends Controller { public function getDefaultPreFilters() { return []; } /** * Returns true if current user have 'edit' right. * @return bool */ protected static function canCreateNew(): bool { Type::setScope(Type::SCOPE_CODE_KNOWLEDGE); return Rights::hasAdditionalRight(Rights::ADDITIONAL_RIGHTS['create']); } /** * Returns available entities short list for note creating. * @return array */ public static function getTargetsAction(): array { return [ 'list' => Target::getShortList(), 'canCreateNew' => self::canCreateNew() ]; } /** * Creates new knowledge page and returns info about it. * @param int $kbId Knowledge id. * @param string $sourceType Source type. * @param int $sourceId Source id. * @param string $scope Scope. * @return array|null */ public function createNoteAction(int $kbId, string $sourceType, int $sourceId, ?string $scope = null): ?array { $result = null; if ($scope) { Type::setScope($scope); } if (check_bitrix_sessid()) { $result = Source::createFromSource($kbId, $sourceType, $sourceId); } if (is_array($result)) { return $result; } $this->addError(new Error('Error occurred during note creating.')); return null; } }