-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTopic4topicsFixture.php
More file actions
922 lines (896 loc) · 43.5 KB
/
Topic4topicsFixture.php
File metadata and controls
922 lines (896 loc) · 43.5 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
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
<?php
/**
* TopicFixture
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('TopicFixture', 'Topics.Test/Fixture');
/**
* TopicFixture
*
* ### テストデータ
* #### 掲示板
* - content_key_1 管理者が投稿(公開中)
* - content_key_2 一般1が投稿(未承認)
* - content_key_3 一般1が投稿(承認待ち⇒差し戻し)
* - content_key_4 一般1が投稿(承認待ち⇒公開)
* - content_key_5 一般1が投稿(承認待ち⇒公開⇒承認待ち(編集者が修正))
* #### ブログ(公開日のチェック)
* - content_key_9 管理者が投稿(公開中、現在)
* - content_key_10 管理者が投稿(公開中、未来)
* - content_key_11 管理者が投稿(公開中、過去1日前)
* - content_key_12 管理者が投稿(公開中、過去3日前)
* - content_key_13 管理者が投稿(公開中、過去7日前)
* - content_key_14 管理者が投稿(公開中、過去14日前)
* - content_key_15 管理者が投稿(公開中、過去30日前)
* - content_key_16 管理者が投稿(公開中、過去30日以上前)
* #### お知らせ(ブロックの公開状態、公開日のチェック)
* - content_key_17[block_id=3] ブロック公開
* - content_key_18[block_id=4] ブロック非公開
* - content_key_19[block_id=5] ブロック期限付き+期限内
* - content_key_20[block_id=6] ブロック期限付き+期限内(startのみ指定)
* - content_key_21[block_id=7] ブロック期限付き+期限内(endのみ指定)
* - content_key_22[block_id=8] ブロック期限付き+期限前
* - content_key_23[block_id=9] ブロック期限付き+期限切れ
* - content_key_24[block_id=10,room_id=6] 管理者プライベート
* - content_key_25[block_id=11,room_id=9] 一般1プライベート
* - content_key_26[block_id=12,room_id=12] ルーム2
* #### FAQ(カテゴリ)
* - content_key_27 カテゴリなし
* - content_key_28 カテゴリ1
* - content_key_29 カテゴリ1
* - content_key_30 カテゴリ2
* - content_key_31 存在しないカテゴリ
* #### 回覧板(イレギュラープラグイン)
* - content_key_32 ルームに参加している全会員(パブリック)
* - content_key_33 ルームに参加している全会員(ルーム2)
* - content_key_34 個別に選択(パブリック)
* - content_key_35 個別に選択(ルーム2, 参加していないユーザを含む)
* - content_key_36 回覧期間、期間内、回答期限なし
* - content_key_37 回覧期間、期間内、回答期限あり(未来)
* - content_key_54 回覧期間、期間内、回答期限あり(過去)
* - content_key_38 回覧期間、期間内(start、end指定なし)、回答期限なし
* - content_key_39 回覧期間、期間内(start、end指定なし)、回答期限あり(未来)
* - content_key_55 回覧期間、期間内(start、end指定なし)、回答期限あり(過去)
* - content_key_40 回覧期間、期間内(startのみ指定)、回答期限なし
* - content_key_41 回覧期間、期間内(startのみ指定)、回答期限あり(未来)
* - content_key_56 回覧期間、期間内(startのみ指定)、回答期限あり(過去)
* - content_key_42 回覧期間、期間内(endのみ指定)、回答期限なし
* - content_key_43 回覧期間、期間内(endのみ指定)、回答期限あり(未来)
* - content_key_57 回覧期間、期間内(endのみ指定)、回答期限あり(過去)
* - content_key_44 回覧期間、期間前、回答期限なし
* - content_key_45 回覧期間、期間前、回答期限あり(期間内)
* - content_key_58 回覧期間、期間前、回答期限あり(期間外)
* - content_key_46 回覧期間、期間終了(endのみ指定)、回答期限なし
* - content_key_47 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲内)
* - content_key_59 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲外)
* - content_key_48 回覧期間、期間終了(start,end指定)、回答期限なし
* - content_key_49 回覧期間、期間終了(start,end指定)、回答期限あり(範囲内)
* - content_key_60 回覧期間、期間終了(start,end指定)、回答期限あり(範囲外)
* #### カレンダー(イレギュラープラグイン)
* - content_key_70 プライベートの予定(共有なし)
* - content_key_71 プライベートの予定(共有あり)
* - content_key_72 パブリックの予定
* - content_key_73 会員全体の予定
* - content_key_74 ルームの予定
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Topics\Test\Fixture
*/
class Topic4topicsFixture extends TopicFixture {
/**
* Model name
*
* @var string
*/
public $name = 'Topic';
/**
* Full Table Name
*
* @var string
*/
public $table = 'topics';
/**
* Records
*
* @var array
*/
protected $_records = array(
//#### 掲示板
// - content_key_1 管理者が投稿(公開中)
// ** is_latest
array(
'id' => '1', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_1', 'content_id' => '1',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 1', 'title_icon' => '',
'summary' => 'Content Summary 1',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// ** is_active
array(
'id' => '2', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_1', 'content_id' => '1',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 1', 'title_icon' => '',
'summary' => 'Content Summary 1',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '0', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_2 一般1が投稿(未承認)
// ** is_latest
array(
'id' => '3', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_2', 'content_id' => '2',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 2', 'title_icon' => '',
'summary' => 'Content Summary 2',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '2',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
// - content_key_3 一般1が投稿(承認待ち⇒差し戻し)
// ** is_latest
array(
'id' => '4', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_3', 'content_id' => '3',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 3', 'title_icon' => '',
'summary' => 'Content Summary 3',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '4',
'created_user' => '4', 'created' => '2016-09-07 03:52:37',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_4 一般1が投稿(承認待ち⇒公開)
// ** is_latest
array(
'id' => '5', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_4', 'content_id' => '5',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 4', 'title_icon' => '',
'summary' => 'Content Summary 4',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '1',
'created_user' => '4', 'created' => '2016-09-07 03:52:37',
'modified_user' => '1', 'modified' => 'now()'
),
// ** is_active
array(
'id' => '6', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_4', 'content_id' => '5',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 4', 'title_icon' => '',
'summary' => 'Content Summary 4',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '0', 'status' => '1',
'created_user' => '4', 'created' => '2016-09-07 03:52:37',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_5 一般1が投稿(承認待ち⇒公開⇒承認待ち(編集者が修正))
// ** is_latest
array(
'id' => '7', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_5', 'content_id' => '8',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 5', 'title_icon' => '',
'summary' => 'Content Summary 5',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '2',
'created_user' => '4', 'created' => '2016-09-07 03:52:37',
'modified_user' => '3', 'modified' => 'now()'
),
// ** is_active
array(
'id' => '8', 'language_id' => '2', 'room_id' => '2', 'block_id' => '1', 'frame_id' => '1001',
'content_key' => 'content_key_5', 'content_id' => '7',
'category_id' => null, 'plugin_key' => 'test_bbses',
'title' => 'Content Title 5', 'title_icon' => '',
'summary' => 'Content Summary 5',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '0', 'status' => '1',
'created_user' => '4', 'created' => '2016-09-07 03:52:37',
'modified_user' => '1', 'modified' => 'now()'
),
//#### ブログ(公開日のチェック)
//本来、is_activeとis_latestで2レコード出来るが、ここでは公開日のチェックのため1レコードにする。
//content_key_10からcontent_key_16は、content_key_9をベースにinit()で作成する
//
// - content_key_9 管理者が投稿(公開中、現在)
// - content_key_10 管理者が投稿(公開中、未来)
// - content_key_11 管理者が投稿(公開中、過去1日前)
// - content_key_12 管理者が投稿(公開中、過去3日前)
// - content_key_13 管理者が投稿(公開中、過去7日前)
// - content_key_14 管理者が投稿(公開中、過去14日前)
// - content_key_15 管理者が投稿(公開中、過去30日前)
// - content_key_16 管理者が投稿(公開中、過去30日以上前)
array(
'id' => '9', 'language_id' => '2', 'room_id' => '2', 'block_id' => '2', 'frame_id' => '1002',
'content_key' => 'content_key_9', 'content_id' => '9',
'category_id' => null, 'plugin_key' => 'test_blogs',
'title' => 'Content Title 9', 'title_icon' => '',
'summary' => 'Content Summary 9',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
//#### お知らせ(ブロックの公開状態、公開日のチェック)
//本来、is_activeとis_latestで2レコード出来るが、ここでは公開日のチェックのため1レコードにする。
//
// - content_key_17[block_id=3] ブロック公開
// - content_key_18[block_id=4] ブロック非公開
// - content_key_19[block_id=5] ブロック期限付き+期限内
// - content_key_20[block_id=6] ブロック期限付き+期限内(startのみ指定)
// - content_key_21[block_id=7] ブロック期限付き+期限内(endのみ指定)
// - content_key_22[block_id=8] ブロック期限付き+期限前
// - content_key_23[block_id=9] ブロック期限付き+期限切れ
array(
'id' => '17', 'language_id' => '2', 'room_id' => '2', 'block_id' => '3', 'frame_id' => '1003',
'content_key' => 'content_key_17', 'content_id' => '17',
'category_id' => null, 'plugin_key' => 'test_announcements',
'title' => 'Content Title 17', 'title_icon' => '',
'summary' => 'Content Summary 17',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_24[block_id=10,room_id=6, frame_id=1010] 管理者プライベート
array(
'id' => '24', 'language_id' => '2', 'room_id' => '6', 'block_id' => '10', 'frame_id' => '1010',
'content_key' => 'content_key_24', 'content_id' => '24',
'category_id' => null, 'plugin_key' => 'test_announcements',
'title' => 'Content Title 24', 'title_icon' => '',
'summary' => 'Content Summary 24',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_25[block_id=11,room_id=9, frame_id=1011] 一般1プライベート
array(
'id' => '25', 'language_id' => '2', 'room_id' => '9', 'block_id' => '11', 'frame_id' => '1011',
'content_key' => 'content_key_25', 'content_id' => '25',
'category_id' => null, 'plugin_key' => 'test_announcements',
'title' => 'Content Title 25', 'title_icon' => '',
'summary' => 'Content Summary 25',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
// - content_key_26[block_id=12,room_id=12,frame_id=1012] ルーム2
array(
'id' => '26', 'language_id' => '2', 'room_id' => '12', 'block_id' => '3', 'frame_id' => '1012',
'content_key' => 'content_key_26', 'content_id' => '26',
'category_id' => null, 'plugin_key' => 'test_announcements',
'title' => 'Content Title 26', 'title_icon' => '',
'summary' => 'Content Summary 26',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
//#### FAQ(カテゴリ)
// - content_key_27 カテゴリなし
array(
'id' => '27', 'language_id' => '2', 'room_id' => '2', 'block_id' => '13', 'frame_id' => '1013',
'content_key' => 'content_key_27', 'content_id' => '27',
'category_id' => null, 'plugin_key' => 'test_faqs',
'title' => 'Content Title 27', 'title_icon' => '',
'summary' => 'Content Summary 27',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_28 カテゴリ1
array(
'id' => '28', 'language_id' => '2', 'room_id' => '2', 'block_id' => '13', 'frame_id' => '1013',
'content_key' => 'content_key_28', 'content_id' => '28',
'category_id' => '1', 'plugin_key' => 'test_faqs',
'title' => 'Content Title 28', 'title_icon' => '',
'summary' => 'Content Summary 28',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_29 カテゴリ1
array(
'id' => '29', 'language_id' => '2', 'room_id' => '2', 'block_id' => '13', 'frame_id' => '1013',
'content_key' => 'content_key_29', 'content_id' => '29',
'category_id' => '1', 'plugin_key' => 'test_faqs',
'title' => 'Content Title 29', 'title_icon' => '',
'summary' => 'Content Summary 29',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_30 カテゴリ2
array(
'id' => '30', 'language_id' => '2', 'room_id' => '2', 'block_id' => '13', 'frame_id' => '1013',
'content_key' => 'content_key_30', 'content_id' => '30',
'category_id' => '2', 'plugin_key' => 'test_faqs',
'title' => 'Content Title 30', 'title_icon' => '',
'summary' => 'Content Summary 30',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_31 存在しないカテゴリ
array(
'id' => '31', 'language_id' => '2', 'room_id' => '2', 'block_id' => '13', 'frame_id' => '1013',
'content_key' => 'content_key_31', 'content_id' => '31',
'category_id' => '9999', 'plugin_key' => 'test_faqs',
'title' => 'Content Title 31', 'title_icon' => '',
'summary' => 'Content Summary 31',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
//#### 回覧板(イレギュラープラグイン)
// - content_key_32[topic_id=32,50] ルームに参加している全会員(パブリック)
array(
'id' => '32', 'language_id' => '2', 'room_id' => '2', 'block_id' => '14', 'frame_id' => '1014',
'content_key' => 'content_key_32', 'content_id' => '32',
'category_id' => null, 'plugin_key' => 'test_circular_notices',
'title' => '', 'title_icon' => '',
'summary' => '',
'search_contents' => '', //init()でセット
'counts' => '1',
'path' => '', //init()でセット
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '0', 'is_answer' => '1', 'is_in_room' => '1',
'answer_period_start' => 'now()', 'answer_period_end' => null,
'is_active' => '0', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
array(
'id' => '50', 'plugin_key' => 'test_circular_notices',
'content_key' => 'content_key_32', 'content_id' => '32',
'is_active' => '1', 'is_latest' => '0',
),
// - content_key_33[topic_id=33,51] ルームに参加している全会員(ルーム2)
array(
'id' => '33', 'plugin_key' => 'test_circular_notices',
'room_id' => '12', 'block_id' => '15', 'frame_id' => '1015',
'is_active' => '0', 'is_latest' => '1',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
array(
'id' => '51', 'plugin_key' => 'test_circular_notices',
'room_id' => '12', 'block_id' => '15', 'frame_id' => '1015',
'content_key' => 'content_key_33', 'content_id' => '33',
'is_active' => '1', 'is_latest' => '0',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
// - content_key_34[topic_id=34,52] 個別に選択(パブリック)
array(
'id' => '34', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => null,
'is_active' => '0', 'is_latest' => '1',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
array(
'id' => '52', 'plugin_key' => 'test_circular_notices',
'content_key' => 'content_key_34', 'content_id' => '34',
'is_active' => '1', 'is_latest' => '0',
'created_user' => '4', 'created' => 'now()',
'modified_user' => '4', 'modified' => 'now()'
),
// - content_key_35[topic_id=35,53] 個別に選択(ルーム2, 参加していないユーザを含む)
array(
'id' => '35', 'plugin_key' => 'test_circular_notices',
'room_id' => '12', 'block_id' => '15', 'frame_id' => '1015',
'is_active' => '0', 'is_latest' => '1',
),
array(
'id' => '53', 'plugin_key' => 'test_circular_notices',
'room_id' => '12', 'block_id' => '15', 'frame_id' => '1015',
'content_key' => 'content_key_35', 'content_id' => '35',
'is_active' => '1', 'is_latest' => '0',
),
// - content_key_36 回覧期間、期間内、回答期限なし
array(
'id' => '36', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => 'future_7()',
'answer_period_start' => 'now()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_37 回覧期間、期間内、回答期限あり(未来)
array(
'id' => '37', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => 'future_7()',
'answer_period_start' => null, 'answer_period_end' => 'future()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_54 回覧期間、期間内、回答期限あり(過去)
array(
'id' => '54', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => 'future_7()',
'answer_period_start' => null, 'answer_period_end' => 'past()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_38 回覧期間、期間内(start、end指定なし)、回答期限なし
array(
'id' => '38', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => null,
'answer_period_start' => 'now()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_39 回覧期間、期間内(start、end指定なし)、回答期限あり(未来)
array(
'id' => '39', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => null,
'answer_period_start' => null, 'answer_period_end' => 'future()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_55 回覧期間、期間内(start、end指定なし)、回答期限あり(過去)
array(
'id' => '55', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => null,
'answer_period_start' => null, 'answer_period_end' => 'past()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_40 回覧期間、期間内(startのみ指定)、回答期限なし
array(
'id' => '40', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => null,
'answer_period_start' => 'now()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_41 回覧期間、期間内(startのみ指定)、回答期限あり(未来)
array(
'id' => '41', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => null,
'answer_period_start' => null, 'answer_period_end' => 'future()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_56 回覧期間、期間内(startのみ指定)、回答期限あり(過去)
array(
'id' => '56', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_7()', 'publish_end' => null,
'answer_period_start' => null, 'answer_period_end' => 'past()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_42 回覧期間、期間内(endのみ指定)、回答期限なし
array(
'id' => '42', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'future_7()',
'answer_period_start' => 'now()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_43 回覧期間、期間内(endのみ指定)、回答期限あり(未来)
array(
'id' => '43', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'future_7()',
'answer_period_start' => null, 'answer_period_end' => 'future()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_57 回覧期間、期間内(endのみ指定)、回答期限あり(過去)
array(
'id' => '57', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'future_7()',
'answer_period_start' => null, 'answer_period_end' => 'past()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_44 回覧期間、期間前、回答期限なし
array(
'id' => '44', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'future()', 'publish_end' => 'future_14()',
'answer_period_start' => 'future()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_45 回覧期間、期間前、回答期限あり(期間内)
array(
'id' => '45', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'future()', 'publish_end' => 'future_14()',
'answer_period_start' => null, 'answer_period_end' => 'future_7()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_58 回覧期間、期間前、回答期限あり(期間外)
array(
'id' => '58', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'future()', 'publish_end' => 'future_14()',
'answer_period_start' => null, 'answer_period_end' => 'past()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_46 回覧期間、期間終了(endのみ指定)、回答期限なし
array(
'id' => '46', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'past_3()',
'answer_period_start' => 'past_14()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_47 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲内)
array(
'id' => '47', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'past_3()',
'answer_period_start' => null, 'answer_period_end' => 'past_7()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_59 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲外)
array(
'id' => '59', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'now()', 'publish_end' => 'past_3()',
'answer_period_start' => null, 'answer_period_end' => 'past_1()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_48 回覧期間、期間終了(start,end指定)、回答期限なし
array(
'id' => '48', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_14()', 'publish_end' => 'past_3()',
'answer_period_start' => 'past_14()', 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_49 回覧期間、期間終了(start,end指定)、回答期限あり(範囲内)
array(
'id' => '49', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_14()', 'publish_end' => 'past_3()',
'answer_period_start' => null, 'answer_period_end' => 'past_7()',
'is_active' => '1', 'is_latest' => '1',
),
// - content_key_60 回覧期間、期間終了(start,end指定)、回答期限あり(範囲外)
array(
'id' => '60', 'plugin_key' => 'test_circular_notices',
'publish_start' => 'past_14()', 'publish_end' => 'past_3()',
'answer_period_start' => null, 'answer_period_end' => 'past_1()',
'is_active' => '1', 'is_latest' => '1',
),
//#### カレンダー(イレギュラープラグイン)
//本来、is_activeとis_latestで2レコード出来るが、ここでは公開日のチェックのため1レコードにする。
//
// - content_key_70 プライベートの予定(共有なし)
array(
'id' => '70', 'language_id' => '2', 'room_id' => '6', 'block_id' => '19', 'frame_id' => '1019',
'category_id' => null, 'plugin_key' => 'test_calendars',
'counts' => '1',
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_71 プライベートの予定(共有あり)
array(
'id' => '71', 'language_id' => '2', 'room_id' => '6', 'block_id' => '19', 'frame_id' => '1019',
'category_id' => null, 'plugin_key' => 'test_calendars',
'counts' => '1',
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '0',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_72 パブリックの予定
array(
'id' => '72', 'language_id' => '2', 'room_id' => '2', 'block_id' => '16', 'frame_id' => '1016',
'category_id' => null, 'plugin_key' => 'test_calendars',
'counts' => '1',
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_73 会員全体の予定
array(
'id' => '73', 'language_id' => '2', 'room_id' => '4', 'block_id' => '18', 'frame_id' => '1018',
'category_id' => null, 'plugin_key' => 'test_calendars',
'counts' => '1',
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
// - content_key_74 ルームの予定
array(
'id' => '74', 'language_id' => '2', 'room_id' => '12', 'block_id' => '17', 'frame_id' => '1017',
'category_id' => null, 'plugin_key' => 'test_calendars',
'counts' => '1',
'public_type' => '1', 'publish_start' => 'now()', 'publish_end' => null,
'is_no_member_allow' => '1', 'is_answer' => '0', 'is_in_room' => '1',
'answer_period_start' => null, 'answer_period_end' => null,
'is_active' => '1', 'is_latest' => '1', 'status' => '1',
'created_user' => '1', 'created' => 'now()',
'modified_user' => '1', 'modified' => 'now()'
),
);
/**
* Initialize the fixture.
*
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function init() {
parent::init();
$this->__now = gmdate('Y-m-d H:i:s');
$this->records = array();
$index = 0;
foreach ($this->_records as $record) {
if ($record['plugin_key'] === 'test_blogs') {
//#### ブログ(公開日のチェック)
// - content_key_9 管理者が投稿(公開中、現在)
$this->records[$index] = $this->__parseRecord($record);
$index++;
// - content_key_10 管理者が投稿(公開中、未来)
// - content_key_11 管理者が投稿(公開中、過去1日前)
// - content_key_12 管理者が投稿(公開中、過去3日前)
// - content_key_13 管理者が投稿(公開中、過去7日前)
// - content_key_14 管理者が投稿(公開中、過去14日前)
// - content_key_15 管理者が投稿(公開中、過去30日前)
// - content_key_16 管理者が投稿(公開中、過去30日以上前)
$publishTypes = ['future()', 'past_1()', 'past_3()', 'past_7()', 'past_14()', 'past_30()', 'past_31()'];
foreach ($publishTypes as $type) {
$record['id'] = $record['id'] + 1;
$record['title'] = 'Content Title ' . $record['id'];
$record['content_id'] = $record['id'];
$record['content_key'] = 'content_key_' . $record['id'];
$record['summary'] = 'Content Summary ' . $record['id'];
$record['publish_start'] = $type;
$record['created'] = $record['publish_start'];
$record['modified'] = $record['publish_start'];
$this->records[$index] = $this->__parseRecord($record);
$index++;
}
} elseif ($record['id'] === '17') {
//#### お知らせ(ブロックの公開状態、公開日のチェック)
// - content_key_17[block_id=3] ブロック公開
// - content_key_18[block_id=4] ブロック非公開
// - content_key_19[block_id=5] ブロック期限付き+期限内
// - content_key_20[block_id=6] ブロック期限付き+期限内(startのみ指定)
// - content_key_21[block_id=7] ブロック期限付き+期限内(endのみ指定)
// - content_key_22[block_id=8] ブロック期限付き+期限前
// - content_key_23[block_id=9] ブロック期限付き+期限切れ
// - content_key_24[block_id=10,room_id=6] 管理者プライベート
// - content_key_25[block_id=11,room_id=9] 一般1プライベート
// - content_key_26[block_id=12,room_id=12] ルーム2
$blockIds = ['3', '4', '5', '6', '7', '8', '9'];
foreach ($blockIds as $blockId) {
$record['title'] = 'Content Title ' . $record['id'];
$record['content_id'] = $record['id'];
$record['content_key'] = 'content_key_' . $record['id'];
$record['summary'] = 'Content Summary ' . $record['id'];
$record['block_id'] = $blockId;
$this->records[$index] = $this->__parseRecord($record);
$record['id'] = $record['id'] + 1;
$index++;
}
} elseif ($record['plugin_key'] === 'test_circular_notices') {
//#### 回覧板(イレギュラープラグイン)
// - content_key_32[topic_id=32,50] ルームに参加している全会員(パブリック)
// - content_key_33[topic_id=33,51] ルームに参加している全会員(ルーム2)
// - content_key_34[topic_id=34,52] 個別に選択(パブリック)
// - content_key_35[topic_id=35,53] 個別に選択(ルーム2, 参加していないユーザを含む)
// - content_key_36 回覧期間、期間内、回答期限なし
// - content_key_37 回覧期間、期間内、回答期限あり(未来)
// - content_key_37[topic_id=54] 回覧期間、期間内、回答期限あり(過去)
// - content_key_38 回覧期間、期間内(start、end指定なし)、回答期限なし
// - content_key_39 回覧期間、期間内(start、end指定なし)、回答期限あり(範囲内)
// - content_key_39[topic_id=55] 回覧期間、期間内(start、end指定なし)、回答期限あり(過去)
// - content_key_40 回覧期間、期間内(startのみ指定)、回答期限なし
// - content_key_41 回覧期間、期間内(startのみ指定)、回答期限あり(未来)
// - content_key_41[topic_id=56] 回覧期間、期間内(startのみ指定)、回答期限あり(過去)
// - content_key_42 回覧期間、期間内(endのみ指定)、回答期限なし
// - content_key_43 回覧期間、期間内(endのみ指定)、回答期限あり(未来)
// - content_key_43[topic_id=57] 回覧期間、期間内(endのみ指定)、回答期限あり(過去)
// - content_key_44 回覧期間、期間前、回答期限なし
// - content_key_45 回覧期間、期間前、回答期限あり(期間内)
// - content_key_45[topic_id=58] 回覧期間、期間前、回答期限あり(期間外)
// - content_key_46 回覧期間、期間終了(endのみ指定)、回答期限なし
// - content_key_47 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲内)
// - content_key_47[topic_id=59] 回覧期間、期間終了(endのみ指定)、回答期限あり(範囲外)
// - content_key_48 回覧期間、期間終了(start,end指定)、回答期限なし
// - content_key_49 回覧期間、期間終了(start,end指定)、回答期限あり(範囲内)
// - content_key_49[topic_id=60] 回覧期間、期間終了(start,end指定)、回答期限あり(範囲外)
if (! isset($circularNotice)) {
$circularNotice = $record;
}
$record['content_id'] = Hash::get($record, 'content_id', $record['id']);
$record['content_key'] = Hash::get($record, 'content_key', 'content_key_' . $record['id']);
$record['title'] = 'Content Title ' . $record['id'];
$record['summary'] = 'Content Summary ' . $record['id'];
$record = array_merge($circularNotice, $record);
$this->records[$index] = $this->__parseRecord($record);
$index++;
} elseif ($record['plugin_key'] === 'test_calendars') {
//#### カレンダー(イレギュラープラグイン)
// - content_key_70 プライベートの予定(共有なし)
// - content_key_71 プライベートの予定(共有あり)
// - content_key_72 パブリックの予定
// - content_key_73 会員全体の予定
// - content_key_74 ルームの予定
$record['content_id'] = Hash::get($record, 'content_id', $record['id']);
$record['content_key'] = Hash::get($record, 'content_key', 'content_key_' . $record['id']);
$record['title'] = 'Content Title ' . $record['id'];
$record['summary'] = 'Content Summary ' . $record['id'];
$record = array_merge($circularNotice, $record);
$this->records[$index] = $this->__parseRecord($record);
$index++;
} else {
$this->records[$index] = $this->__parseRecord($record);
$index++;
}
}
}
/**
* レコードデータの整形
*
* @param array $record レコードデータ
* @return array
*/
private function __parseRecord($record) {
$record['search_contents'] = serialize(array(
$record['title'], $record['summary']
));
$record['path'] = '/' . $record['plugin_key'] . '/' . $record['plugin_key'] .
'/view/' . $record['block_id'] . '/' . $record['content_key'];
$record['publish_start'] = $this->getDateTime($record['publish_start']);
$record['publish_end'] = $this->getDateTime($record['publish_end']);
$record['answer_period_start'] = $this->getDateTime($record['answer_period_start']);
$record['answer_period_end'] = $this->getDateTime($record['answer_period_end']);
$record['created'] = $this->getDateTime($record['created']);
$record['modified'] = $this->getDateTime($record['modified']);
return $record;
}
/**
* 日付取得
*
* @param string $value 日付データ
* @param string|null $now 現在時刻
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function getDateTime($value, $now = null) {
if ($now) {
$date = new DateTime($now);
} else {
$date = new DateTime($this->__now);
}
if ($value === 'now()') {
$value = $this->__now;
} elseif ($value === 'future()') {
$date->add(new DateInterval('P3D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'future_7()') {
$date->add(new DateInterval('P7D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'future_14()') {
$date->add(new DateInterval('P14D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_1()') {
$date->sub(new DateInterval('P1D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_3()' || $value === 'past()') {
$date->sub(new DateInterval('P3D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_7()') {
$date->sub(new DateInterval('P7D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_14()') {
$date->sub(new DateInterval('P14D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_30()') {
$date->sub(new DateInterval('P30D'));
$value = $date->format('Y-m-d H:i:s');
} elseif ($value === 'past_31()') {
$date->sub(new DateInterval('P31D'));
$value = $date->format('Y-m-d H:i:s');
}
return $value;
}
}