-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCalendarEvent.php
More file actions
748 lines (714 loc) · 22 KB
/
CalendarEvent.php
File metadata and controls
748 lines (714 loc) · 22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
<?php
/**
* CalendarEvent Model
*
* @property Room $Room
* @property User $User
* @property CalendarRrule $CalendarRrule
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author AllCreator Co., Ltd. <info@allcreator.net>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('CalendarsAppModel', 'Calendars.Model');
/**
* CalendarEvent Model
*
* @author AllCreator Co., Ltd. <info@allcreator.net>
* @package NetCommons\Calendars\Model
*
* 速度改善の修正に伴って発生したため抑制
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class CalendarEvent extends CalendarsAppModel {
/**
* use behaviors
*
* @var array
*/
public $actsAs = array(
'NetCommons.OriginalKey',
'NetCommons.Trackable',
'Calendars.CalendarValidate',
'Calendars.CalendarApp', //baseビヘイビア
'Calendars.CalendarInsertPlan', //Insert用
'Calendars.CalendarUpdatePlan', //Update用
'Calendars.CalendarDeletePlan', //Delete用
'Calendars.CalendarSearchPlan', //Search用
'Calendars.CalendarRoleAndPerm', //カレンダー役割・権限
'Workflow.Workflow',
'Workflow.WorkflowComment',
'Wysiwyg.Wysiwyg' => array(
'fields' => array('description'),
),
// 自動でメールキューの登録, 削除。ワークフロー利用時はWorkflow.Workflowより下に記述する
'Mails.MailQueue' => array(
'embedTags' => array(
'X-SUBJECT' => 'title',
'X-LOCATION' => 'location',
'X-CONTACT' => 'contact',
'X-BODY' => 'description',
'X-URL' => array(
'controller' => 'calendar_plans'
)
),
'workflowType' => 'workflow',
),
'Mails.MailQueueDelete',
//新着情報
'Topics.Topics' => array(
'fields' => array(
'path' => '/:plugin_key/calendar_plans/view/:content_key',
),
'search_contents' => array(
'title', 'location', 'contact', 'description'
),
),
//多言語
'M17n.M17n' => array(
'keyField' => false,
),
);
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'CalendarRrule' => array(
'className' => 'Calendars.CalendarRrule',
'foreignKey' => 'calendar_rrule_id',
'conditions' => '',
'fields' => '',
'order' => '',
),
'Language' => array(
'className' => 'Languages.Language',
'foreignKey' => 'language_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
);
/**
* hasMany associations
*
* @var array
*/
public $hasMany = array(
'CalendarEventShareUser' => array(
'className' => 'CalendarEventShareUser',
'foreignKey' => 'calendar_event_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => array('id' => 'ASC'),
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'CalendarEventContent' => array(
'className' => 'CalendarEventContent',
'foreignKey' => 'calendar_event_id',
'dependent' => true,
'conditions' => '',
'fields' => '',
'order' => array('id' => 'ASC'),
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
);
/**
* Validation rules
*
* @var array
*/
public $validate = array(
);
/**
* Constructor. Binds the model's database table to the object.
*
* @param bool|int|string|array $id Set this ID for this model on startup,
* can also be an array of options, see above.
* @param string $table Name of database table to use.
* @param string $ds DataSource connection name.
* @see Model::__construct()
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
public function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->loadModels([
'Block' => 'Blocks.Block',
]);
// すぐはずす
$this->Behaviors->unload('Mails.MailQueue');
$this->Behaviors->unload('Mails.MailQueueDelete');
$this->Behaviors->unload('Topics.Topics');
}
/**
* _doMergeWorkflowParamValidate
*
* Workflowパラメータ関連バリデーションのマージ
*
* @return void
*/
protected function _doMergeWorkflowParamValidate() {
$this->validate = array_merge($this->validate, array(
'language_id' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'status' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
'required' => true,
),
),
'is_active' => array(
'rule1' => array(
'rule' => 'boolean',
'message' => __d('net_commons', 'Invalid request.'),
),
),
'is_latest' => array(
'rule1' => array(
'rule' => 'boolean',
'message' => __d('net_commons', 'Invalid request.'),
),
),
));
}
/**
* Called during validation operations, before validation. Please note that custom
* validation rules can be defined in $validate.
*
* @param array $options Options passed from Model::save().
* @return bool True if validate operation should continue, false to abort
* @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
* @see Model::save()
*/
public function beforeValidate($options = array()) {
$this->validate = array_merge($this->validate, array(
'calendar_rrule_id' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'room_id' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'target_user' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'title' => array(
'rule1' => array(
'rule' => array('notBlank'),
'message' => __d('calendars', 'Please input title text.'),
),
),
'is_allday' => array(
'rule1' => array(
'rule' => array('boolean'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'start_date' => array(
'rule1' => array(
'rule' => array('checkYmd'),
'message' => __d('calendars', 'Invalid value.'),
),
'rule2' => array(
'rule' => array('checkMaxMinDate', 'start'),
'message' => __d('calendars', 'Out of range value.'),
),
),
'start_time' => array(
'rule1' => array(
'rule' => array('checkHis'),
'message' => __d('calendars', 'Invalid value.'),
),
),
'end_date' => array(
'rule1' => array(
'rule' => array('checkYmd'),
'message' => __d('calendars', 'Invalid value.'),
),
'rule2' => array(
'rule' => array('checkMaxMinDate', 'end'),
'message' => __d('calendars', 'Out of range value.'),
),
//CalendarActionPlanのvalidateでチェック済なので省略
//'complex1' => array(
// 'rule' => array('checkReverseStartEndDate'),
// 'message' => __d('calendars', 'Reverse about start and end date.'),
//),
),
'end_time' => array(
'rule1' => array(
'rule' => array('checkHis'),
'message' => __d('calendars', 'Invalid value.'),
),
),
'timezone_offset' => array(
'rule1' => array(
'rule' => array('checkTimezoneOffset'),
'message' => __d('calendars', 'Invalid value.'),
),
),
// link_id(int)からlink_key(string)に変えた
//'link_id' => array(
// 'rule1' => array(
// 'rule' => array('numeric'),
// 'message' => __d('net_commons', 'Invalid request.'),
// ),
//),
'recurrence_event_id' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
'exception_event_id' => array(
'rule1' => array(
'rule' => array('numeric'),
'message' => __d('net_commons', 'Invalid request.'),
),
),
));
$this->_doMergeWorkflowParamValidate(); //Workflowパラメータ関連validation
return parent::beforeValidate($options);
}
/**
* Returns true if all fields pass validation. Will validate hasAndBelongsToMany associations
* that use the 'with' key as well. Since _saveMulti is incapable of exiting a save operation.
*
* Will validate the currently set data. Use Model::set() or Model::create() to set the active data.
*
* @param array $options An optional array of custom options to be made available in the beforeValidate callback
* @return bool True if there are no errors
*/
public function validates($options = array()) {
if (isset($this->data['CalendarEvent']['room_id'])) {
CalendarPermissiveRooms::setCurrentPermission($this->data['CalendarEvent']['room_id']);
}
return parent::validates($options);
}
/**
* 自分もふくめた兄弟一覧を取得
*
* @param interger $rruleId 兄弟が共通にもつrruleのid
* @param interger $needLatest 最新に限定するかどうか。0:最新に限定しない。1:最新に限定する。
* @param int $languageId 言語ID
* @return array 兄弟一覧の配列
*/
public function getSiblings($rruleId, $needLatest = 0, $languageId = 0) {
if (empty($languageId)) {
$languageId = Current::read('Language.id');
}
$options = array(
'conditions' => array(
$this->alias . '.calendar_rrule_id' => $rruleId,
//$this->alias . '.is_latest' => 1,
//$this->alias . '.language_id' => $languageId,
'OR' => array(
$this->alias . '.language_id' => $languageId,
$this->alias . '.is_translation' => false
),
$this->alias . '.exception_event_id' => 0, //除外でない
),
//'recursive' => -1, //eventだけとる
'recursive' => 1, //belongsTo, hasOne, hasManyをとる
'callbacks' => false,
'order' => array($this->alias . '.dtstart' => 'ASC'),
);
if ($needLatest) {
$field = $this->alias . '.is_latest';
$options['conditions'][$field] = 1;
}
return $this->find('all', $options);
}
/**
* canDeleteContent
*
* 削除できる予定データか確認
*
* @param array $data 予定データ
* @return bool
*/
public function canDeleteContent($data) {
// 発行済み状態を取得
$isPublished = isset($data['CalendarEvent']['is_published'])
? $data['CalendarEvent']['is_published']
: false;
// 予定の対象ルームIDを取得
$roomId = isset($data['CalendarEvent']['room_id'])
? $data['CalendarEvent']['room_id']
: null;
// データの対象空間での発行権限を取得
$canPublish = CalendarPermissiveRooms::isPublishable($roomId);
// データの編集権限を取得
$canEdit = $this->canEditWorkflowContent($data);
// 発行済みだと
if ($isPublished) {
// 発行権限と編集権限の両方がないと削除できない
return ($canPublish && $canEdit);
} else {
// 未発行の場合
// 編集権限さえあれば良い
return $canEdit;
}
}
/**
* getEventById
*
* イベント情報の取得
*
* @param int $eventId $eventId
* @return array 取得したイベント情報配列
*/
public function getEventById($eventId) {
$conditions = array(
$this->alias . '.id' => $eventId,
);
$options = array(
'conditions' => $conditions,
'recursive' => 1, //belongsTo, hasOne, hasManyまで取得
);
$event = $this->find('first', $options);
if (!$event) {
CakeLog::error(
__d('calendars', 'There is no event. To continue the event in the blank.'));
$event = array();
return array(); //add
}
if (! $this->_isGetableEvent($event)) {
return array();
}
return $event;
}
/**
* getEventByKey
*
* イベント情報の取得
*
* @param string $eventKey $eventKey
* @return array 取得したイベント情報配列
*/
public function getEventByKey($eventKey) {
$conditions = array(
$this->alias . '.key' => $eventKey,
'OR' => array(
$this->alias . '.is_active' => true,
$this->alias . '.is_latest' => true,
)
);
$options = array(
'conditions' => $conditions,
'recursive' => 1, //belongsTo, hasOne, hasManyまで取得
'order' => array($this->alias . '.id DESC')
);
$events = $this->find('all', $options);
if (!$events) {
CakeLog::error(
__d('calendars', 'There is no event. To continue the event in the blank.'));
return array();
}
// 新しいもの順にチェック
foreach ($events as $event) {
if ($this->_isGetableEvent($event)) {
// 発行済みデータかどうかチェックし、値を追加する
$conditions[$this->alias . '.is_active'] = true;
$options = array(
'fields' => array(
'CalendarEvent.is_active',
'Room.space_id'
),
'conditions' => $conditions,
'recursive' => -1,
'joins' => array(
array(
'table' => 'rooms',
'alias' => 'Room',
'type' => 'LEFT',
'conditions' => array(
'CalendarEvent.room_id = Room.id'
)
)
),
);
$isPublished = $this->find('first', $options);
// 最終発行公開空間がプライベート空間であった時は「発行済みだよ」にしない
// プライベート空間での発行は「公開」と見なさないのである
$event[$this->alias]['is_published'] = false;
if ($isPublished) {
if ($isPublished['Room']['space_id'] != Space::PRIVATE_SPACE_ID) {
$event[$this->alias]['is_published'] =
$isPublished[$this->alias]['is_active'];
}
}
return $event;
}
}
// 該当のものが見つからなかったってこと
return array();
}
/**
* screenPlansUsingGetable($plans);
*
* 見てもよいイベント情報のみフィルターで通す
*
* @param array $plans plans
* @return array フィルター済のplans配列
*/
public function screenPlansUsingGetable($plans) {
$screendPlans = array();
foreach ($plans as $event) {
if ($this->_isGetableEvent($event)) {
$screendPlans[] = $event;
}
}
return $screendPlans;
}
/**
* _isGetableEvent
*
* 見てもよいイベント情報なのか判断する
*
* @param array &$event calendar event data
* @return bool
*/
protected function _isGetableEvent(&$event) {
// eventの空間取り出す
$roomId = $event['CalendarEvent']['room_id'];
// 作成者取り出す
$userId = $event['CalendarEvent']['created_user'];
// eventの空間でcreatableでかつ作成者または編集者以上
if ((CalendarPermissiveRooms::isCreatable($roomId) && $userId == Current::read('User.id')) ||
CalendarPermissiveRooms::isEditable($roomId)) {
// is_latestのものを返す
if ($event['CalendarEvent']['is_latest']) {
// 共有予定フラグを立てておく
$this->_setSharedFlag($event);
return true;
}
} else {
// 上記以外
// is_activeのものを返す
if ($event['CalendarEvent']['is_active']) {
// 共有予定フラグを立てておく
$this->_setSharedFlag($event);
return true;
}
}
return false;
}
/**
* _setSharedFlag
*
* 共有した、共有された予定である場合は、フラグを設定しておく
*
* @param array &$event イベント情報
* @return void
*/
protected function _setSharedFlag(&$event) {
$event[$this->alias]['pseudo_friend_share_plan'] = false; // 共有された
$event[$this->alias]['is_share'] = false; // 共有した
$userId = Current::read('User.id');
if (! empty($userId)) {
$isShare = false;
if (isset($event['CalendarEventShareUser'])) {
foreach ($event['CalendarEventShareUser'] as $item) {
if ((int)$item['share_user'] == $userId) {
$isShare = true;
break;
}
}
}
if ($isShare) {
$event[$this->alias]['pseudo_friend_share_plan'] = true;
} else {
if (! empty($event['CalendarEventShareUser'])) {
$event[$this->alias]['is_share'] = true;
}
}
}
}
/**
* prepareActiveForUpd
*
* eventデータの内、UPDATE時、is_active情報のみ整える。
*
* @param array &$event event
* @return void
*/
public function prepareActiveForUpd(&$event) {
if (! (isset($event['CalendarEvent']['id']) && $event['CalendarEvent']['id'] > 0)) {
//idがない。つまりINSERT用evnetデータの時は、なにもしない。
return;
}
//以後、eventがUPDATE用であることが担保される。
/////////////////////////////////////////////////////////
//ここで行うべきことは、is_activeの再調整処理のみ。 //
//作成者、作成日およびis_latestの調整は INSERTsave前の //
//prepareLatestCreatedForIns発行で処置済なので、UPDATE //
//ではなにもしなくてよい。 //
/////////////////////////////////////////////////////////
//is_activeのセット
$event['CalendarEvent']['is_active'] = false;
if ($event['CalendarEvent']['status'] === WorkflowComponent::STATUS_PUBLISHED) {
//statusが公開ならis_activeを付け替える
$event['CalendarEvent']['is_active'] = true;
//現状のis_activeを外す
$this->updateAll(
array('CalendarEvent' . '.is_active' => false),
array(
'CalendarEvent' . '.' . 'key' => $event['CalendarEvent']['key'],
//'CalendarEvent' . '.language_id' => (int)$event['CalendarEvent']['language_id'],
'OR' => array(
'CalendarEvent' . '.language_id' => $event['CalendarEvent']['language_id'],
'CalendarEvent' . '.is_translation' => false
),
'CalendarEvent' . '.is_active' => true,
'CalendarEvent' . '.' . 'id !=' =>
$event['CalendarEvent']['id'], //WFとの違い。update対象eventは除外。
)
);
}
}
/**
* prepareLatestCreatedForIns
*
* eventデータの内、INSERT時、is_latestとcreated,created_user情報のみ整える。
*
* @param array &$event event
* @param int $createdUserWhenUpd createdUserWhenUpd
* @return void
*/
public function prepareLatestCreatedForIns(&$event, $createdUserWhenUpd = null) {
if (isset($event['CalendarEvent']['id']) && $event['CalendarEvent']['id'] > 0) {
//idがある。つまりUPDATE用evnetデータの時は、なにもしない。
return;
}
//以後、eventがINSERT用であることが担保される。
///////////////////////////////////////////////////////
//ここで行うべきことは、作成者、作成日およびis_latest//
//の調整のみ。 //
///////////////////////////////////////////////////////
//作成者のコピー
$created = $this->find('first', array(
'recursive' => -1,
'fields' => array('created', 'created_user'),
'conditions' => array(
'key' => $event['CalendarEvent']['key']
),
));
//////////////////////////////////////////////////////////
//is_latestの真の調整は、UPDATEsave発行直前までdelay //
//させるため、ここでは暫定でfalse固定でいれておく。 //
// //
//⇒これ以降の編集の場合、正しく動作しないため、 //
// 既存データがあるときは、is_activeの付替え処理を行う //
//////////////////////////////////////////////////////////
if ($created) {
//既存データがあるときは、is_activeを更新する
$this->prepareActiveForUpd($event);
$event['CalendarEvent']['created'] = $created['CalendarEvent']['created'];
$event['CalendarEvent']['created_user'] = $created['CalendarEvent']['created_user'];
} else {
//新規の場合は、デフォルトoff
$event['CalendarEvent']['is_active'] = false; //is_activeの暫定offセット
}
//カレンダー独自の例外追加1)
//変更後の公開ルームidが、「元予定生成者の*ルーム」から「編集者・承認者(=ログイン者)の
//プライベート」に変化していた場合、created_userを、元予定生成者「から」編集者・承認者(=ログイン者)
//「へ」に変更すること。
//=>これを考慮したcreatedUserWhenUpdを使えばよい。
if ($createdUserWhenUpd !== null) {
$event['CalendarEvent']['created_user'] = $createdUserWhenUpd;
}
//is_latestのセット
$event['CalendarEvent']['is_latest'] = true;
//現状のis_latestを外す
$this->updateAll(
array('CalendarEvent' . '.is_latest' => false),
array(
'CalendarEvent' . '.' . 'key' => $event['CalendarEvent']['key'],
//'CalendarEvent' . '.language_id' => (int)$event['CalendarEvent']['language_id'],
'OR' => array(
'CalendarEvent' . '.language_id' => (int)$event['CalendarEvent']['language_id'],
'CalendarEvent' . '.is_translation' => false
),
'CalendarEvent' . '.is_latest' => true,
)
);
}
/**
* Called before each save operation, after validation. Return a non-true result
* to halt the save.
*
* @param array $options Options passed from Model::save().
* @return bool True if the operation should continue, false if it should abort
* @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforesave
* @see Model::save()
*/
public function beforeSave($options = array()) {
$content = isset($this->data['CalendarEvent']['description'])
? $this->data['CalendarEvent']['description']
: null;
if (empty($content)) {
return true;
}
$roomId = $this->data['CalendarEvent']['room_id'];
$newDescription = $this->consistentContent($content, $roomId);
if ($content != $newDescription) {
$this->data['CalendarEvent']['description'] = $newDescription;
}
return true;
}
/**
* Called after each successful save operation.
*
* @param bool $created True if this save created a new record
* @param array $options Options passed from Model::save().
* @return void
* @throws InternalErrorException
* @link http://book.cakephp.org/2.0/en/models/callback-methods.html#aftersave
* @see Model::save()
*/
public function afterSave($created, $options = array()) {
$content = isset($this->data['CalendarEvent']['description'])
? $this->data['CalendarEvent']['description']
: null;
$roomId = isset($this->data['CalendarEvent']['room_id'])
? $this->data['CalendarEvent']['room_id']
: null;
$blockKey = $this->Block->findByRoomIdAndPluginKey($roomId, 'calendars', ['key'], null, -1);
$updateDescription = [
'content_key' => isset($this->data['CalendarEvent']['key'])
? $this->data['CalendarEvent']['key']
: null,
'block_key' => isset($blockKey['Block']['key'])
? $blockKey['Block']['key']
: null,
'room_id' => $roomId
];
$this->updateUploadFile($content, $updateDescription);
}
}