21 if (!Loader::includeModule(
'im'))
30 $this->
addError(
new Error(
"You dont have access to this action"));
45 $result[
'DEFAULT_TITLE'] = \CIMChat::getNextConferenceDefaultTitle();
52 if (!isset($payload->
getData()[
'fields']))
54 $this->
addError(
new Error(Loc::getMessage(
'IM_CONFERENCE_EDIT_CREATION_ERROR')));
66 $updatingResult = $this->updateConference(
$fields);
67 if (!$updatingResult->isSuccess())
69 $this->
addErrors($updatingResult->getErrors());
74 return $updatingResult;
77 $addingResult = $this->createConference($payload,
$fields);
78 if (!$addingResult->isSuccess())
80 $this->
addErrors($addingResult->getErrors());
85 $aliasData = $addingResult->getData()[
'ALIAS_DATA'];
88 'CHAT_ID' => $addingResult->getData()[
'CHAT_ID'],
89 'ALIAS' => $aliasData[
'ALIAS'],
90 'LINK' => $aliasData[
'LINK']
96 $updatingResult =
new Result();
97 $conference = ConferenceClass::getById(
$fields[
'ID']);
101 return $updatingResult->addError(
new Error(Loc::getMessage(
'IM_CONFERENCE_EDIT_ERROR_WRONG_ID')));
104 if (!$conference->canUserEdit(CurrentUser::get()->getId()))
106 return $updatingResult->addError(
new Error(Loc::getMessage(
'IM_CONFERENCE_EDIT_ERROR_CANT_EDIT')));
109 if ($conference->getOwnerId() !== (
int)$this->getCurrentUser()->getId())
111 return $updatingResult->addError(
new Error(Loc::getMessage(
'IM_CONFERENCE_EDIT_ERROR_CANT_EDIT')));
114 return $conference->update(
$fields);
117 private function createConference(JsonPayload $payload,
array $fields): Result
119 $addingResult =
new Result();
122 if (isset($payload->getData()[
'aliasData']))
124 $fields[
'ALIAS_DATA'] = $payload->getData()[
'aliasData'];
127 return ConferenceClass::add(
$fields);
133 foreach (
$fields as $field => $value)
135 if (is_array($value))
137 $data[$field] = self::recursiveWhiteList($value, $whiteList[$field],
true);
139 elseif ((is_array($whiteList) && in_array($field, $whiteList)) ||
$readOnly)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)