Compare commits
1213 Commits
1.5-branch
...
feature/en
Author | SHA1 | Date | |
---|---|---|---|
|
cea8308aea | ||
|
dcf896ef52 | ||
|
39dcc59a0c | ||
|
a7af30c378 | ||
|
9c8d813417 | ||
|
7169b4bfbb | ||
|
07c34d0860 | ||
|
ee40e1ffd2 | ||
1967d6ea4c | |||
0fe70d00ec | |||
|
7a33c37b51 | ||
|
a6c4b4eb55 | ||
3e57ff3ffa | |||
6cbbce03c4 | |||
ef98111a2f | |||
55fa16ce56 | |||
80ccb76794 | |||
|
0ce814cf52 | ||
|
f6d4d32ce4 | ||
937be1af3a | |||
|
43fb020272 | ||
|
f26fafb2f2 | ||
|
e1e3051d00 | ||
|
a659263af6 | ||
|
9333b6d2df | ||
4d0cfbb396 | |||
e9caa7b4b8 | |||
261acdfd24 | |||
17481798fb | |||
edb8aa1dfe | |||
93a67c9ab9 | |||
980a305456 | |||
0158c6f2ed | |||
ff5b0bc258 | |||
a133f56dce | |||
fa556bbba1 | |||
e8f3c499ee | |||
cfd9f1bab1 | |||
|
8011293b28 | ||
4562ed46db | |||
cd52f7e6e8 | |||
126ffc55bf | |||
f49c54d51f | |||
1410213258 | |||
35e0b98687 | |||
8f1091b8a3 | |||
c269bfe278 | |||
041b1dfc51 | |||
718d6c2375 | |||
158b572879 | |||
68059a9938 | |||
543f6b20dd | |||
ace3b1969e | |||
edc86af659 | |||
87ba68971c | |||
94bcbac06a | |||
74520330b1 | |||
|
935006eae3 | ||
|
165012b302 | ||
|
057db09847 | ||
|
063076d0cb | ||
|
bcf2b9d834 | ||
|
64d28106c8 | ||
85dda8b680 | |||
2e1201418a | |||
a9fb916843 | |||
e26e3ac67b | |||
562c72f7bb | |||
6602e1b286 | |||
b69aaeafd9 | |||
aa473b5f70 | |||
124e36b9d4 | |||
b88765c344 | |||
f3427d6754 | |||
df00ac66f5 | |||
2b12e61fbd | |||
151e8deaeb | |||
acbe93f9cf | |||
358410cde1 | |||
06c74ed5ed | |||
25c986cc61 | |||
cad8174333 | |||
6c8f1f77ff | |||
75c586fbf8 | |||
2cb9dfc250 | |||
3b2d4142c1 | |||
9a6bab7ba2 | |||
c2bbee299c | |||
f4db9be557 | |||
5449efdd97 | |||
7896d288e7 | |||
b98d6fa505 | |||
e4d1b951a3 | |||
ae8e5bc2e3 | |||
9b66f7a83f | |||
|
13d5b7078e | ||
37996651c4 | |||
|
679665d9db | ||
|
1d4edd5b7b | ||
|
f1c77277f3 | ||
6264171c0c | |||
902d8b52d3 | |||
caeb75ce13 | |||
2f27674e05 | |||
ce9070e641 | |||
5350a09951 | |||
31252461c9 | |||
73790db700 | |||
|
72795be040 | ||
fc2a2da75f | |||
|
e88e9b1a6f | ||
|
f7dea7f041 | ||
|
57a35f88be | ||
|
1b1eb45d15 | ||
|
65859f62f3 | ||
|
4cc308c936 | ||
|
2f28cb16ef | ||
|
73ee77b8b2 | ||
|
830cda64e0 | ||
|
3bc510d116 | ||
|
5f8a506c84 | ||
|
bbb9dc2561 | ||
|
b51575fc49 | ||
|
fee37b5af3 | ||
|
0afcf3d79e | ||
|
743b456030 | ||
0dbd42ba5b | |||
7efbf2fce8 | |||
9b1a66c992 | |||
|
cb897cfef1 | ||
|
bafbc2dd74 | ||
74541f360b | |||
20a14c9ff4 | |||
cdade50d76 | |||
d4f96ee25f | |||
ca33580831 | |||
64e37c5235 | |||
bf576e171c | |||
3f2fe6a138 | |||
f18ccce814 | |||
2386a35eb7 | |||
1fbda740a7 | |||
d35e1fe21e | |||
771b9eb616 | |||
4261ddcde4 | |||
6ee03b7ebb | |||
1217578202 | |||
c7b6788288 | |||
02f1d2ff8a | |||
bb677152c9 | |||
ad6519fb87 | |||
d08f2e0e11 | |||
73aeca0916 | |||
080a54231f | |||
b403569b16 | |||
3abfb02962 | |||
11a6d08023 | |||
69ecc42055 | |||
5f74c5297a | |||
34fcefa1bd | |||
c9e6935f15 | |||
21cc0007fb | |||
ebe3bc5f7b | |||
132f11298e | |||
21f75c8a63 | |||
c1e1f65715 | |||
|
5cc5e6a1f7 | ||
|
1f4735caac | ||
|
d672a29dda | ||
68ebd60bc8 | |||
4d12796289 | |||
857298b8b8 | |||
220f1ea0eb | |||
a88acd34fd | |||
8ae113c872 | |||
098a2ea620 | |||
6a62b46dec | |||
8bd75429c1 | |||
199e5a73d8 | |||
54d03275cf | |||
8683f8faf3 | |||
821b67723c | |||
ae1146c79c | |||
050c325195 | |||
5e0d869d9b | |||
32b8de8997 | |||
9f1f7ad3f7 | |||
9da4c1ebeb | |||
9b7a52064a | |||
faad3f5f47 | |||
|
7595d70ada | ||
|
484259c8ab | ||
|
a6e0b16032 | ||
|
9d34968b88 | ||
f548121312 | |||
1ecb1abc80 | |||
28a45992c6 | |||
c39097f164 | |||
30b127bc88 | |||
25d7fc36a4 | |||
03bd1674e1 | |||
b018a50a7e | |||
4440cf8a24 | |||
6bd7a0105d | |||
|
51c2408878 | ||
242c77a30c | |||
22aa4afc02 | |||
04e9e30972 | |||
d536da3581 | |||
27f49b2aa3 | |||
912a8d53af | |||
9ef397e935 | |||
eca8172c6d | |||
f3802e36b3 | |||
2f9c7c38b5 | |||
|
d73fd697dd | ||
f35889339d | |||
8e95166c24 | |||
30c53b17f7 | |||
2610730219 | |||
5dd99d201b | |||
d327dae9fa | |||
2bdbb20154 | |||
14bd211a5f | |||
35627203e6 | |||
f978636d57 | |||
e095cac7e0 | |||
c5b0d6e2bd | |||
|
905cb66011 | ||
eaac97221f | |||
|
893c38fba4 | ||
|
f867f4985d | ||
|
aebeefcf80 | ||
|
3fc6c0c479 | ||
|
ce854cb58f | ||
|
ed4f1344c2 | ||
|
86dbe527d8 | ||
|
69a56fb433 | ||
|
a7fad0ca1b | ||
|
9b8c34a9be | ||
5acc78507e | |||
1722cf721e | |||
75ba07f181 | |||
5b635fbe58 | |||
e0dc0a8fdb | |||
2aa13dceff | |||
ea477a9842 | |||
73653744d7 | |||
55264da092 | |||
38f5854c6d | |||
3c6d3f30d2 | |||
a6d6a962cd | |||
6256d6a19e | |||
8841af8d2b | |||
0a9b8ba0b0 | |||
9710f8be63 | |||
d872bf65dd | |||
c3ef8d112c | |||
f2a4347de7 | |||
51a4880fdb | |||
a4d22b0fcb | |||
8d051800a4 | |||
|
c0b59162a1 | ||
0e53a081c7 | |||
d76f6d716f | |||
f1d5d9840e | |||
f3eb418409 | |||
3e85529468 | |||
05798688d0 | |||
01f35eed04 | |||
aef97cca32 | |||
87e2ac9386 | |||
4a04628d5b | |||
0af78f814c | |||
929d40ff6e | |||
68f6642ff2 | |||
91e4d585ff | |||
eac42581a6 | |||
|
4e50d0ace9 | ||
|
0b54adeb59 | ||
|
5d23de4862 | ||
|
eda454cb9d | ||
6da8f1c107 | |||
4fb487dcef | |||
0d6a339b53 | |||
c6525be444 | |||
cb846891d6 | |||
2aed37757e | |||
444159b52a | |||
7aed8e83ea | |||
f7a807473d | |||
f8e91c325d | |||
a448405ce5 | |||
a4989f99d6 | |||
3f64db3b3a | |||
|
7ee5ca0753 | ||
41254db72f | |||
|
15e301b889 | ||
061a7dd537 | |||
|
c3926991ac | ||
|
ea0b2407df | ||
569679238c | |||
ed17f78da5 | |||
dfd9230541 | |||
65b751642f | |||
d6fd827f8b | |||
162b0099b2 | |||
e0b689174a | |||
edf4430fb1 | |||
040884a039 | |||
f7c08f02c2 | |||
|
2fe38945d2 | ||
cece152c0b | |||
4e31b3e424 | |||
109bf5ec5d | |||
4f3f16d9b0 | |||
|
fe5745831c | ||
3447117742 | |||
143f8f43fa | |||
36326a2a70 | |||
52637c2919 | |||
f3a8552829 | |||
bfdfd19711 | |||
|
efb9bc938a | ||
dcd1856ebb | |||
43f3270171 | |||
b7fcac8f39 | |||
e521d06702 | |||
a260274549 | |||
b37a7d2690 | |||
242c2b31a3 | |||
57c420e9dd | |||
ac67f56b09 | |||
b24eb93c57 | |||
0f59be04a7 | |||
54eb15ea35 | |||
a85f170e2d | |||
226f71ab2b | |||
a887326611 | |||
8ed2e7585d | |||
7a1ad24f0e | |||
|
b934c2eeaf | ||
de0e3f7dfd | |||
44c9a65505 | |||
038d7ad2e1 | |||
|
c1b727b1c8 | ||
a63c38b6aa | |||
8915c42008 | |||
503293a359 | |||
7bdf71315a | |||
6f5d457122 | |||
b4274264a7 | |||
8002725c87 | |||
2c9edf3741 | |||
3f562449e1 | |||
1cce39bcb5 | |||
c93d5ceb16 | |||
ad690db886 | |||
|
1b8462b40d | ||
|
8c98f2cf6e | ||
f3260f57a4 | |||
b4ad0128e4 | |||
e1c8278f71 | |||
|
ed3f46ce7f | ||
33457d3cbc | |||
6df8e6dec8 | |||
f9b8f13dd6 | |||
e919b4322e | |||
7503c845df | |||
3686a294d3 | |||
b6131379f9 | |||
e1fcc41ace | |||
f2a04cebe6 | |||
c693002ddb | |||
ee77c8540a | |||
a536d2780e | |||
f880598052 | |||
e7985ea52f | |||
f56dc65021 | |||
|
4770758aee | ||
90fe484d81 | |||
2b8bbe019d | |||
9e1c151402 | |||
088e522292 | |||
b8e6e98a74 | |||
2db847ada2 | |||
07e0692783 | |||
e78d53064b | |||
e6fcb5ff22 | |||
f02e33fda7 | |||
1bbec9efae | |||
3b53c4451c | |||
30f490959b | |||
|
0a894b0db1 | ||
c20e9507d5 | |||
f89c690f1b | |||
|
7819c1204c | ||
|
f61af9d02a | ||
|
e470a6a97e | ||
|
cd8c47449b | ||
120e7cade5 | |||
ac550e05e8 | |||
d6e7fadb4f | |||
|
2be1c08c44 | ||
|
86c177bbbb | ||
|
d426d28ba0 | ||
|
72e69fc0b3 | ||
cc8de353d4 | |||
4495a5d33b | |||
9dffe30aad | |||
d393e74896 | |||
daf083dc88 | |||
|
ce859697b5 | ||
|
1587c762f8 | ||
|
17c01d9b46 | ||
a1bb9ea352 | |||
|
a1895ec65f | ||
|
c5faa0b99d | ||
|
e9d142f3e8 | ||
|
91860afd80 | ||
|
bec0700d39 | ||
|
05d3d7f5c7 | ||
|
ebff36d257 | ||
|
a709b3afb6 | ||
|
69a3c6a9b2 | ||
|
8c33d876e8 | ||
|
1ec2fbcc16 | ||
|
bc4e29141b | ||
|
e90ea31683 | ||
|
7c99f0b3e0 | ||
|
c089960707 | ||
|
0b2f29f1e8 | ||
|
9a4f50472a | ||
|
7d1a1c4004 | ||
|
ebd58d4229 | ||
|
dd48795f64 | ||
3d45b6687f | |||
35e6d36ce0 | |||
4900c81c11 | |||
52472b0ec3 | |||
ec68e6f761 | |||
25bd170f6b | |||
6939b4a313 | |||
d18922ed98 | |||
e8bf242c42 | |||
2050460bb3 | |||
|
4add30e895 | ||
e1dbfdafd7 | |||
75becb2294 | |||
94e494361f | |||
cab3b1059d | |||
|
d27bdf68fb | ||
|
82b82920e1 | ||
4bb3eadf91 | |||
4c82e65c1f | |||
cf4d7df7ad | |||
86d13410c3 | |||
19fdf2a503 | |||
3a0c25c871 | |||
083338da8d | |||
37e5c9ceaa | |||
|
5448238697 | ||
|
c5250a1059 | ||
b2c1a7b8de | |||
49c6915c0a | |||
b4583fc6dc | |||
f7c508939c | |||
4cf77a9b0e | |||
a2160bef7d | |||
|
c2a4a95eba | ||
8641d6bdce | |||
5f4d513aa6 | |||
f47b15de39 | |||
7426dc02cf | |||
a570160aed | |||
6e81ef0065 | |||
e3cc76c689 | |||
b43f43fa0b | |||
7596bd5a06 | |||
f02d6df262 | |||
e4e2138765 | |||
395735e6f7 | |||
2c96c02261 | |||
53813f8f29 | |||
|
b8ef0d28f5 | ||
|
e973c4013f | ||
01f9d03b14 | |||
|
0f9a395dfc | ||
|
38ac3badef | ||
|
cda32fb925 | ||
|
58cb34f39b | ||
66426f5102 | |||
3445335b2d | |||
e52a9a4330 | |||
8adb05c24f | |||
b1207cbd3e | |||
|
09ed671734 | ||
93260ea36f | |||
|
8756982a78 | ||
a8f55e064d | |||
7df753f1cb | |||
b0fc4e190f | |||
928e0e1eed | |||
28e4b2abaf | |||
c5b21f360c | |||
2de8338651 | |||
fbec64664f | |||
6c81fe4ef2 | |||
520c0e0f96 | |||
2647d4c6a7 | |||
e7df62b373 | |||
c6a87f1286 | |||
d57cfe09c8 | |||
38cba4948b | |||
d765eecb8e | |||
a7e4900690 | |||
e98a5b88aa | |||
1b42656e0f | |||
b2ff470720 | |||
e9674dd334 | |||
0fcec73a62 | |||
69ea88a4d5 | |||
332178981a | |||
9539214d24 | |||
c5b4a44ff3 | |||
b7d6d29fac | |||
51e9b1fcf2 | |||
b490f4a82c | |||
9566ea89b1 | |||
425d51649f | |||
c32f730713 | |||
a48d6d2a0a | |||
16b155d449 | |||
985f067387 | |||
083f56bff0 | |||
8a83e8ed22 | |||
f526453ba3 | |||
cc40e7a99a | |||
aa05223a4e | |||
5bee607afb | |||
de240b099f | |||
36cdf4c220 | |||
34e5fbedf2 | |||
|
27c680bb03 | ||
|
03243605da | ||
|
48e2d2ceab | ||
|
777fb25860 | ||
|
03601b9707 | ||
25634ba12b | |||
01f24ecf1f | |||
a98056d31b | |||
bd7b4b3fdb | |||
a3395895cb | |||
1d6a8987e9 | |||
fa5d0fbd21 | |||
3a50aea138 | |||
24d8b55591 | |||
85c4560f22 | |||
c45390dd89 | |||
acff64c16f | |||
ba31927dc3 | |||
365a398743 | |||
ea4e3c715e | |||
0a17011cc3 | |||
0d9f3d7dba | |||
dcc6969310 | |||
f6801c0c4f | |||
813ecb0201 | |||
ae81e7be31 | |||
b79ec18a38 | |||
66e590972a | |||
3ca5018e45 | |||
6ea45e4d16 | |||
6b65c06ff5 | |||
2ea880c6fa | |||
18b2af113b | |||
c171561de6 | |||
d9759024ef | |||
ff5c1c1b5a | |||
ccc9995613 | |||
daec8c892c | |||
127f752e2c | |||
b796e94866 | |||
b8b509b6b3 | |||
11e6efee68 | |||
03b94c05b8 | |||
9612f23d9c | |||
5d533103dc | |||
527b658ca0 | |||
f619171120 | |||
28a2c0ea0b | |||
89d95a0eae | |||
7a0f7a4933 | |||
6bcdbaf668 | |||
a302749d00 | |||
0a0895584c | |||
43a8373a7c | |||
d7d8f2a60a | |||
142f8bdfb5 | |||
cb712f4814 | |||
cf27c2cb79 | |||
8de8f1afb7 | |||
dc1f8e9533 | |||
18fec8c491 | |||
3182c3607c | |||
e78855fe0c | |||
6efa795f2a | |||
371da5d9bf | |||
f4c556812e | |||
31ef7ba74f | |||
d81fc881af | |||
03ef68dc36 | |||
a86feafa53 | |||
aa40716898 | |||
76c9cd5be3 | |||
e841e9015c | |||
3bcb5fb3dd | |||
c34b992437 | |||
0149457fba | |||
728ea73bdf | |||
0cc951b296 | |||
60b48a97e2 | |||
a0e7105e83 | |||
1ef4a90989 | |||
3cd6d6af2b | |||
eaa0ad925f | |||
a2f6773f5a | |||
490ea5bd72 | |||
4a9db7839c | |||
3a6fdb3c3d | |||
a68577cc69 | |||
a4246d4eeb | |||
47516e0b5a | |||
e73c215ae8 | |||
5727629292 | |||
f28f34690b | |||
5ea4b4efe1 | |||
3ede278389 | |||
5712cf6f31 | |||
ec4f747cbb | |||
aa062fe786 | |||
e8086c454d | |||
8883560e5b | |||
5a2551ac4f | |||
842e3b96d8 | |||
772ce28859 | |||
e2d341f0bd | |||
1c89cc9568 | |||
e7ace387ca | |||
6d42196093 | |||
|
354a202d06 | ||
|
f35cb679b7 | ||
|
63dedb90f9 | ||
|
cde3c900df | ||
|
c1c3839c62 | ||
e6d54248d7 | |||
21d451626b | |||
c205bbddd3 | |||
8091173746 | |||
f38249026f | |||
d660eb9184 | |||
b49264aec4 | |||
2c35fb1e5b | |||
|
e91ddfae33 | ||
|
99b25e3abb | ||
cedf08b906 | |||
72c4eec43f | |||
49c8cc5cdb | |||
85032ce58f | |||
acf26ed5c8 | |||
ba28783f37 | |||
061a024151 | |||
84347ec982 | |||
ac73400a2d | |||
3b6750951c | |||
|
dca993834b | ||
6d3b366479 | |||
34a913e8e6 | |||
43d12a9647 | |||
5efb284c5b | |||
31e1a40cb7 | |||
|
c8507b4a13 | ||
|
a31e3ad6f6 | ||
743e342f25 | |||
f4a76f659e | |||
cd054fe6ef | |||
c0112bb5e9 | |||
ecb6006835 | |||
2870754fd0 | |||
|
e083ca7487 | ||
8cb150483a | |||
5ea0126a03 | |||
150b76a3f0 | |||
54240f81e8 | |||
82dbda8b5e | |||
cc2c3ae36d | |||
a1fc070bf7 | |||
6f80bd0d37 | |||
ef5296c33f | |||
41444f4157 | |||
3278d07137 | |||
31176f8bc8 | |||
5c9e88784f | |||
|
7cd7db6b02 | ||
0a89b5fc26 | |||
1839d829bc | |||
1cf0e51e9a | |||
c76e401021 | |||
2fee88bfce | |||
03cafbf4c6 | |||
01e93f7ba3 | |||
0b8a22ae46 | |||
42c2ac48d2 | |||
60cfa5ddd5 | |||
f4a2ab67c2 | |||
4f90561362 | |||
7ef534438e | |||
22efcf0c1d | |||
8029b9b8ff | |||
eae13ac3d8 | |||
d840deb5e2 | |||
|
0669da565c | ||
ea0ac6dc66 | |||
1c4f789414 | |||
99e2712cbc | |||
33b4d7eeac | |||
37f4adc2fc | |||
750c3315d7 | |||
e01794db68 | |||
580510e6b1 | |||
f63c4b42e0 | |||
b45191bd04 | |||
9f54665836 | |||
f162ed3911 | |||
|
b6ec28c146 | ||
|
20af1b180d | ||
|
ce34fea7e4 | ||
|
764d2cc87a | ||
|
84e2cc9e02 | ||
a0d36b8d78 | |||
e053bf999e | |||
3d0cb12a2d | |||
|
a1150dd0cf | ||
|
3989c4faff | ||
|
d5972d5a9d | ||
aa121d6dae | |||
e26ac0b3cc | |||
f7e3ab8824 | |||
041627cd77 | |||
448b99a652 | |||
675ae7fd5d | |||
ce28ad18b1 | |||
3d02785da2 | |||
e09fcf33b2 | |||
65a5c94c2f | |||
609a277f03 | |||
0affc534c5 | |||
bee6548d78 | |||
540661862a | |||
adbcbbb5b1 | |||
33c9cdeaf2 | |||
46293a9baf | |||
df1c8178ec | |||
20807f637d | |||
4ef9e57f25 | |||
b2048c0f84 | |||
d8a9881e63 | |||
4d328e849d | |||
b1a7c4dae6 | |||
9bc3c20383 | |||
61be9ca943 | |||
b2cbba4de8 | |||
94d446f5d4 | |||
dc657cbf99 | |||
3bc05ac2a6 | |||
d455c15e4f | |||
43b0bfa369 | |||
d3f7e9736b | |||
0fafc5e3a9 | |||
cdfbda147f | |||
e34afe1ee6 | |||
0b39391a73 | |||
92f3926bbf | |||
d62e83a63d | |||
d09f3c43c9 | |||
9dfb622836 | |||
7d87605142 | |||
b161548d53 | |||
a71e425012 | |||
2aa59d1cf3 | |||
1d8d7fa354 | |||
f05770235f | |||
f5f0e54261 | |||
8371487b2e | |||
7f2f9bbfae | |||
bcce10cf80 | |||
7b65aab185 | |||
a1996779e8 | |||
96dbd06b75 | |||
f5ca681dbc | |||
5c298c641e | |||
1aecc2fd3a | |||
c98c12051a | |||
b8bf9bebcd | |||
6c89f3920a | |||
298716d035 | |||
82da7159e1 | |||
f61d54d4cf | |||
320cbdf908 | |||
dbd8023885 | |||
7730f732ed | |||
d4948b176f | |||
9a9441fa85 | |||
f94fb0efc1 | |||
4d2f84a9bd | |||
2a5ee00b86 | |||
f7902dd940 | |||
a8befb13c3 | |||
5292f319be | |||
00c3d1cb97 | |||
b7eeebfd43 | |||
98f0ac545e | |||
f2f22c359f | |||
5ad3c659ee | |||
eefbd7ccce | |||
b2d3580e11 | |||
3c37924dc1 | |||
0a390eae98 | |||
1c9b38941f | |||
ec726ced19 | |||
fbaaa44ae6 | |||
eb506475fa | |||
8944d21652 | |||
f7b5e37079 | |||
d983247514 | |||
ed7b235321 | |||
43a975ae48 | |||
d4130b701e | |||
e3b5b46bd1 | |||
dbb2d5d883 | |||
13c69b83f7 | |||
533d27785e | |||
95682734dd | |||
b4847a6b61 | |||
544bd66000 | |||
98a3b38995 | |||
9b41d0d0e2 | |||
f707a649d1 | |||
2ed1de8629 | |||
3a710a7f31 | |||
755c5e5a22 | |||
5875c9f0f7 | |||
0092557d84 | |||
a709589229 | |||
153dad83f9 | |||
2fc3bb9c25 | |||
e07b5b1875 | |||
cd07426885 | |||
e517c72194 | |||
9c1169644f | |||
ed4975b41d | |||
95cee22a30 | |||
70efafc0f5 | |||
bf3c9ead2d | |||
e7c6e65c33 | |||
2cd48a5d91 | |||
91edb14fb2 | |||
f760943baa | |||
d8aa11a5af | |||
e082d35efb | |||
14da65dcdb | |||
09a2cea83b | |||
a17d396834 | |||
b111efb5c5 | |||
7d9de642ff | |||
2d92bc939b | |||
6a2b94b4c2 | |||
ced9d17d03 | |||
1c163df081 | |||
e0e0d3a56f | |||
4634dbf4e7 | |||
6734295be7 | |||
ff8632fc93 | |||
a2c12b41a9 | |||
e774f04d67 | |||
c1fbde131e | |||
7881efa5fe | |||
3f9939deb9 | |||
09bd534256 | |||
b179ebba72 | |||
a9faa81b89 | |||
651b528e8e | |||
bbdb183994 | |||
21ae1db7e0 | |||
c74f242050 | |||
f1d61470fe | |||
9b4a71ef8b | |||
4719fe50ea | |||
a4798e39b1 | |||
4527ed35a3 | |||
6ca6974456 | |||
1fa01474d8 | |||
d53e6b57a4 | |||
e05031a743 | |||
ba7abaebf5 | |||
c2c946221a | |||
96c598db46 | |||
651f80f003 | |||
930ab84a58 | |||
5245d9971e | |||
90540300c5 | |||
35640929f9 | |||
8d4d8f3a0d | |||
9952a885ed | |||
0d435dcd9b | |||
1c7dd27fca | |||
5a52eff3b9 | |||
208d4b789a | |||
4dcf8d1fb2 | |||
a70f91d12f | |||
43dedaf96b | |||
b001309778 | |||
415ad5dd21 | |||
9cccf86f92 | |||
5ba1c14f77 | |||
425ad22fbd | |||
7ae24da907 | |||
efee2dc2a9 | |||
6ccfa8a130 | |||
ad8c1bbe9f | |||
8933d7c61d | |||
91c965cda6 | |||
3a03d44e9a | |||
d39666bf8e | |||
2746d3e003 | |||
|
3033be78d2 | ||
|
f9723e587f | ||
9573f44001 | |||
c69d6d6bb8 | |||
4dc2aefb5b | |||
97d3afba9b | |||
ed22551313 | |||
|
d7cdeaa28e | ||
0db13ef9bb | |||
a812a0c132 | |||
3d1a12dc8b | |||
c5b1caefb6 | |||
|
c8c76e5a8d | ||
1d8f72bc14 | |||
a38208f5cf | |||
f394283531 | |||
137294d8b8 | |||
5f8037433d | |||
05868b398e | |||
9850bfba81 | |||
4316667bd2 | |||
fb5f3532a1 | |||
da682c22bc | |||
ae26f72057 | |||
97a4deb159 | |||
977aa92c55 | |||
de177e5764 | |||
59bf662886 | |||
3c5082dafb | |||
73a2c2d41a | |||
f833a08515 | |||
a92686d10b | |||
b03fc3558e | |||
e886d671c1 | |||
88fc2deb68 | |||
b082b36276 | |||
e785b36709 | |||
9ccb5292ee | |||
2422fb2ead | |||
9d05dcc9a3 | |||
2b63c51dee | |||
|
74372fcc1d | ||
f2a7c49fe4 | |||
79b9f0d274 | |||
d49c2ea36e | |||
8fe774de4f | |||
c3012b7f8a | |||
58f2a9d5e1 | |||
c29a3e3d80 | |||
30e0c663dc | |||
8618efc35a | |||
6fe4594d3c | |||
d2d85a3527 | |||
8275715b56 | |||
7ac7def366 | |||
3274ddb496 | |||
defc884e26 | |||
073a8cc5ea | |||
81f3b1acae | |||
be37d9d73a | |||
59668f45a2 | |||
c26b4f1ae7 | |||
5f4c15667c | |||
78910af913 | |||
49f921b2f8 | |||
f1c84fc8da | |||
b30755956f | |||
b5f346aa8f | |||
bba2f7214f | |||
9e3d3c145e | |||
ad45e71051 | |||
8c3c9c4a1f | |||
bd19110ecd | |||
55afcc2184 | |||
c2b5e0f767 | |||
8a6e7396ca | |||
ee8f303d25 | |||
27ca8a58d7 | |||
f2cfc12d7f | |||
aa9141be1d | |||
642ec803e8 | |||
7212f086cc | |||
cfae470089 | |||
|
3131b55f35 | ||
44487e3ea3 | |||
b2b6cb6d6a | |||
2ff22a73fa | |||
|
57bbf63d28 | ||
8bf4621911 | |||
156f306daa | |||
4578625bb2 | |||
c7ee9b8ebb | |||
ed3f0e9657 | |||
aa02597541 | |||
fda14a52e0 | |||
6d2ea8caab | |||
e2be8f119d | |||
29b7641528 | |||
31876ee8b6 | |||
2d295d8e43 | |||
1cf02cd1cc | |||
a36c612542 | |||
78acb56b43 | |||
07b5f2f2ff | |||
f8caaafa5a | |||
a10d48642f | |||
1e082677de | |||
15ff92257c | |||
835ead6ccd | |||
3c434852d5 | |||
91124893fd | |||
f71e273aae | |||
c235fb75a7 | |||
|
cbb50013b3 | ||
42c9a24472 | |||
d07cbb15da | |||
|
0337f252cd | ||
7abf403463 | |||
c861c48b37 | |||
a9522d5b4b | |||
735425f2fd | |||
d89e440784 | |||
d18f3dd3dd | |||
3042b1b0ca | |||
ca6f836195 | |||
7836ece3ee | |||
97d79c5a22 | |||
e1b5ec49f5 | |||
7b8f2d1206 | |||
d123e4137f | |||
bc30998164 | |||
403d1749e3 | |||
7de5cf03b6 | |||
cf93fc10fd | |||
9f168a3a3c | |||
49aeb075a4 | |||
d85a661253 | |||
|
2d76050589 | ||
|
29c729c7d7 | ||
|
f4c3282579 | ||
dec55131df | |||
70832d45e2 | |||
a052dd7d7c | |||
b0ca01b2ec | |||
4eb5f5a0c1 | |||
08f03a75b0 | |||
8a9a63905e | |||
5ccafcb73f | |||
8ced86c60e | |||
813f9e389f | |||
fe8ade2ca8 | |||
53a6ca3d6b | |||
6a57cd8388 | |||
1a98980ad0 | |||
372dbc94e3 | |||
05a404d5b4 | |||
20845bd737 | |||
4d166498e5 | |||
|
94f05ea5f4 | ||
8eacdbc5fa | |||
2b0bb364f5 | |||
4f1a47c920 | |||
534f11b15f | |||
4743e8b3b8 | |||
cbfeb4c04d | |||
ce6481b9f4 | |||
901fa399e9 | |||
786c3e6184 | |||
3b4e770130 | |||
9267518909 | |||
14e913cd7f | |||
e64e1e0fb1 | |||
b595efa0c9 | |||
38885e8a0d | |||
d23046edff | |||
|
f6a801cd47 | ||
|
61052639a8 | ||
|
2c08bf2c6c | ||
|
9fa208b93a | ||
|
d667c10d04 | ||
|
c6bfbd84ae | ||
|
4b0622f54c | ||
|
74a18166ef | ||
|
7a603f19bd | ||
53683cfd5f | |||
|
06c15fdc34 | ||
|
a88e8cb6f7 | ||
|
3934d18df3 | ||
|
2604c61866 | ||
|
3e3ac1c841 | ||
cb48b020f7 | |||
fdddf77a90 | |||
a7146a5991 | |||
|
1c7c7217cb | ||
|
70bc025ade | ||
|
42b2c8ad61 | ||
7dcb457050 | |||
48ab9afa69 | |||
|
44e2445013 | ||
1f408ce758 | |||
23b669b731 | |||
|
bf48f22bd9 | ||
|
54f4814953 | ||
|
0be232e202 | ||
799b612a72 | |||
|
4408eea3b3 | ||
|
1f11924be3 | ||
|
2b0872ab7d | ||
|
859e115de7 | ||
|
e7ceb805c6 | ||
|
7ae12df918 | ||
66c33f7feb | |||
dad59e3b04 | |||
ba2335d73e | |||
951b65b511 | |||
489d1a5819 | |||
319626bf7d | |||
|
39f186b4a6 | ||
|
2b965bafdf | ||
|
317acfa1a5 | ||
74bf42e350 | |||
458a2e71a5 | |||
ab36443943 | |||
d1140ba6d3 | |||
f2ea3edf29 | |||
9762df463f | |||
6ea5a9227d | |||
cd9b95c7ca | |||
21485649db | |||
3033845146 | |||
ceef7e746e | |||
f2e4146a43 | |||
8129f156de | |||
7e5945d6a1 | |||
cc6326bc15 | |||
ec446826a3 | |||
208bc43e1f | |||
63d994bc49 | |||
f6aaefd1e5 | |||
5c0a9090fa | |||
d323004329 | |||
168e12045c | |||
6d7567de01 | |||
|
f9ef4ab515 | ||
f70d3ef0b2 | |||
a271072f23 | |||
75cc85746e | |||
515b8a0762 | |||
|
91ca709cf9 | ||
|
9289a6304b | ||
a5ff98d855 | |||
24300c4ebc | |||
30afec9153 | |||
|
b424ec49bc | ||
0e5cf6fe86 | |||
74f2b23b54 | |||
e9667ef8d6 | |||
709794eab7 | |||
0a4b8daf26 | |||
d7cac3dd73 | |||
6346a9670d | |||
77e1540b83 | |||
74ab54ef46 | |||
6a5207597b | |||
a1466466ae | |||
ea56ff5a08 | |||
a0a6657d18 | |||
f148514750 | |||
43f7ba0e16 | |||
46f62fe3ec | |||
6501eba7da | |||
4ae4906754 | |||
721b93e209 | |||
cc4125078a | |||
ddea18ebd1 | |||
463dfb0bd6 | |||
e6af0db5f2 | |||
665e26cc8a |
19
.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
; top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
; Unix-style newlines
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = LF
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{php,html,twig}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
max_line_length = 80
|
||||
|
||||
[COMMIT_EDITMSG]
|
||||
max_line_length = 0
|
64
.env
Normal file
@@ -0,0 +1,64 @@
|
||||
##
|
||||
## Manually dump .env files in .env.local.php with
|
||||
## `$ composer symfony:dump-env prod`
|
||||
##
|
||||
|
||||
## Project environment
|
||||
APP_ENV=dev
|
||||
|
||||
## Enable debug
|
||||
APP_DEBUG=true
|
||||
|
||||
## Locale
|
||||
LOCALE=fr
|
||||
|
||||
## Framework secret
|
||||
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
||||
|
||||
## Symfony/swiftmailer
|
||||
MAILER_TRANSPORT=smtp
|
||||
MAILER_HOST=smtp
|
||||
MAILER_PORT=1025
|
||||
MAILER_CRYPT=
|
||||
MAILER_AUTH=
|
||||
MAILER_USER=
|
||||
MAILER_PASSWORD=
|
||||
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
||||
|
||||
## Notifications
|
||||
NOTIFICATION_HOST=localhost:8001
|
||||
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
||||
NOTIFICATION_FROM_NAME=Chill
|
||||
|
||||
## Gelf
|
||||
GELF_HOST=gelf
|
||||
GELF_PORT=12201
|
||||
|
||||
## OVH OpenStack Storage User/Role
|
||||
OS_USERNAME=
|
||||
OS_PASSWORD=
|
||||
OS_TENANT_ID=
|
||||
OS_REGION_NAME=GRA
|
||||
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
||||
|
||||
## OVH OpenStack Storage Container
|
||||
ASYNC_UPLOAD_TEMP_URL_KEY=
|
||||
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
||||
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
||||
|
||||
## Redis Cache
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
||||
|
||||
## Twilio
|
||||
TWILIO_SID=~
|
||||
TWILIO_SECRET=~
|
||||
|
||||
## DOCKER IMAGES REGISTRY
|
||||
#IMAGE_PHP=
|
||||
#IMAGE_NGINX=
|
||||
|
||||
## DOCKER IMAGES VERSION
|
||||
#VERSION=test
|
||||
VERSION=prod
|
6
.env.test
Normal file
@@ -0,0 +1,6 @@
|
||||
# variables for .env environement
|
||||
# those variables suits for gitlab-ci
|
||||
# Run tests from root to adapt your own environment
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8
|
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
.composer/*
|
||||
composer.phar
|
||||
composer.lock
|
||||
docs/build/
|
||||
.php_cs.cache
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
/.env.local
|
||||
/.env.local.php
|
||||
/.env.*.local
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
/public/bundles/
|
||||
/var/
|
||||
/vendor/
|
||||
/bin/
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
###> phpunit/phpunit ###
|
||||
/phpunit.xml
|
||||
.phpunit.result.cache
|
||||
###< phpunit/phpunit ###
|
||||
|
42
.gitlab-ci.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
|
||||
# Select what we should cache between builds
|
||||
cache:
|
||||
paths:
|
||||
- tests/app/vendor/
|
||||
|
||||
before_script:
|
||||
# add extensions to postgres
|
||||
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
# Install and run Composer
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php -d memory_limit=2G composer.phar install
|
||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||
- php -d memory_limit=2G tests/app/bin/console doctrine:fixtures:load -n
|
||||
- echo "before_script finished"
|
||||
|
||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
||||
services:
|
||||
- name: postgis/postgis:12-3.1-alpine
|
||||
alias: db
|
||||
- name: redis
|
||||
alias: redis
|
||||
|
||||
# Set any variables we need
|
||||
variables:
|
||||
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# fetch the chill-app using git submodules
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
REDIS_URL: redis://redis:6379
|
||||
|
||||
|
||||
# Run our tests
|
||||
test:
|
||||
script:
|
||||
- php -d memory_limit=3G bin/phpunit --colors=never
|
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
[submodule "_exts/sphinx-php"]
|
||||
path = _exts/sphinx-php
|
||||
url = https://github.com/fabpot/sphinx-php.git
|
||||
[submodule "tests/app"]
|
||||
path = tests/app
|
||||
url = https://gitlab.com/Chill-projet/chill-app.git
|
10
.readthedocs.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
version: 2
|
||||
|
||||
sphinx:
|
||||
configuration: docs/source/conf.py
|
||||
|
||||
python:
|
||||
version: 3.7
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
661
LICENSE
Normal file
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
9
README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Chill framework
|
||||
|
||||
Documentation of the Chill software.
|
||||
|
||||
The online documentation can be found at http://docs.chill.social
|
||||
|
||||
See the [`docs`][1] directory for more.
|
||||
|
||||
[1]: docs/README.md
|
93
composer.json
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "chill-project/chill-bundles",
|
||||
"type": "library",
|
||||
"description": "Most used bundles for chill-project",
|
||||
"keywords": [
|
||||
"chill",
|
||||
"social worker"
|
||||
],
|
||||
"license": "AGPL-3.0-only",
|
||||
"require": {
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||
"composer/package-versions-deprecated": "^1.10",
|
||||
"doctrine/doctrine-bundle": "^2.1",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||
"doctrine/orm": "^2.7",
|
||||
"drupol/php-conventions": "^5.0",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"knplabs/knp-menu": "^3.1",
|
||||
"knplabs/knp-menu-bundle": "^3.0",
|
||||
"knplabs/knp-time-bundle": "^1.12",
|
||||
"league/csv": "^9.6",
|
||||
"phpoffice/phpspreadsheet": "^1.16",
|
||||
"sensio/framework-extra-bundle": "^5.5",
|
||||
"symfony/asset": "4.*",
|
||||
"symfony/browser-kit": "^5.2",
|
||||
"symfony/css-selector": "^5.2",
|
||||
"symfony/expression-language": "4.*",
|
||||
"symfony/form": "4.*",
|
||||
"symfony/intl": "4.*",
|
||||
"symfony/monolog-bundle": "^3.5",
|
||||
"symfony/security-bundle": "4.*",
|
||||
"symfony/serializer": "^5.2",
|
||||
"symfony/swiftmailer-bundle": "^3.5",
|
||||
"symfony/templating": "4.*",
|
||||
"symfony/translation": "4.*",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"symfony/validator": "4.*",
|
||||
"symfony/webpack-encore-bundle": "^1.11",
|
||||
"symfony/workflow": "4.*",
|
||||
"symfony/yaml": "4.*",
|
||||
"twig/extra-bundle": "^2.12 || ^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.3",
|
||||
"twig/twig": "^2.12 || ^3.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||
"fakerphp/faker": "^1.13",
|
||||
"nelmio/alice": "^3.8",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"symfony/debug-bundle": "^5.1",
|
||||
"symfony/dotenv": "^5.1",
|
||||
"symfony/maker-bundle": "^1.20",
|
||||
"symfony/phpunit-bridge": "^5.2",
|
||||
"symfony/stopwatch": "^5.1",
|
||||
"symfony/var-dumper": "4.*",
|
||||
"symfony/web-profiler-bundle": "^5.0"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"vendor-dir": "tests/app/vendor"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
||||
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
||||
"Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle",
|
||||
"Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle",
|
||||
"Chill\\EventBundle\\": "src/Bundle/ChillEventBundle",
|
||||
"Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle",
|
||||
"Chill\\MainBundle\\": "src/Bundle/ChillMainBundle",
|
||||
"Chill\\PersonBundle\\": "src/Bundle/ChillPersonBundle",
|
||||
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\": "tests/app/src/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
}
|
||||
}
|
||||
}
|
5
docs/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
_exts
|
||||
build/*
|
||||
!build/git.txt
|
||||
*~
|
||||
.project
|
451
docs/LICENSE
Normal file
@@ -0,0 +1,451 @@
|
||||
|
||||
GNU Free Documentation License
|
||||
Version 1.3, 3 November 2008
|
||||
|
||||
|
||||
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
|
||||
<http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall
|
||||
subject (or to related matters) and contains nothing that could fall
|
||||
directly within that overall subject. (Thus, if the Document is in
|
||||
part a textbook of mathematics, a Secondary Section may not explain
|
||||
any mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
The "publisher" means any person or entity that distributes copies of
|
||||
the Document to the public.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no
|
||||
other conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to
|
||||
give them a chance to provide you with an updated version of the
|
||||
Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other
|
||||
documents released under this License, and replace the individual
|
||||
copies of this License in the various documents with a single copy
|
||||
that is included in the collection, provided that you follow the rules
|
||||
of this License for verbatim copying of each of the documents in all
|
||||
other respects.
|
||||
|
||||
You may extract a single document from such a collection, and
|
||||
distribute it individually under this License, provided you insert a
|
||||
copy of this License into the extracted document, and follow this
|
||||
License in all other respects regarding verbatim copying of that
|
||||
document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense, or distribute it is void, and
|
||||
will automatically terminate your rights under this License.
|
||||
|
||||
However, if you cease all violation of this License, then your license
|
||||
from a particular copyright holder is reinstated (a) provisionally,
|
||||
unless and until the copyright holder explicitly and finally
|
||||
terminates your license, and (b) permanently, if the copyright holder
|
||||
fails to notify you of the violation by some reasonable means prior to
|
||||
60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, receipt of a copy of some or all of the same material does
|
||||
not give you any rights to use it.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions of the
|
||||
GNU Free Documentation License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in
|
||||
detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation. If the Document
|
||||
specifies that a proxy can decide which future versions of this
|
||||
License can be used, that proxy's public statement of acceptance of a
|
||||
version permanently authorizes you to choose that version for the
|
||||
Document.
|
||||
|
||||
11. RELICENSING
|
||||
|
||||
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
|
||||
World Wide Web server that publishes copyrightable works and also
|
||||
provides prominent facilities for anybody to edit those works. A
|
||||
public wiki that anybody can edit is an example of such a server. A
|
||||
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
|
||||
means any set of copyrightable works thus published on the MMC site.
|
||||
|
||||
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
|
||||
license published by Creative Commons Corporation, a not-for-profit
|
||||
corporation with a principal place of business in San Francisco,
|
||||
California, as well as future copyleft versions of that license
|
||||
published by that same organization.
|
||||
|
||||
"Incorporate" means to publish or republish a Document, in whole or in
|
||||
part, as part of another Document.
|
||||
|
||||
An MMC is "eligible for relicensing" if it is licensed under this
|
||||
License, and if all works that were first published under this License
|
||||
somewhere other than this MMC, and subsequently incorporated in whole or
|
||||
in part into the MMC, (1) had no cover texts or invariant sections, and
|
||||
(2) were thus incorporated prior to November 1, 2008.
|
||||
|
||||
The operator of an MMC Site may republish an MMC contained in the site
|
||||
under CC-BY-SA on the same site at any time before August 1, 2009,
|
||||
provided the MMC is eligible for relicensing.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
177
docs/Makefile
Normal file
@@ -0,0 +1,177 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/chill-doc.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/chill-doc.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/chill-doc"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/chill-doc"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
35
docs/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
Chill documentation
|
||||
====================
|
||||
|
||||
Documentation of the Chill software.
|
||||
|
||||
The compiled documentation may be read at http://docs.chill.social
|
||||
|
||||
Compilation into HTML
|
||||
=====================
|
||||
|
||||
To compile this documentation :
|
||||
|
||||
1. Install [sphinx-doc](http://sphinx-doc.org)
|
||||
``` bash
|
||||
$ virtualenv .venv # creation of the virtual env (only the first time)
|
||||
$ source .venv/bin/activate # activate the virtual env
|
||||
(.venv) $ pip install -r requirements.txt
|
||||
```
|
||||
2. Install submodules : $ git submodule update --init;
|
||||
3. run `make html` from the root directory
|
||||
4. The base file is located on build/html/index.html
|
||||
``` bash
|
||||
$ cd build/html
|
||||
$ python -m http.server 8888 # will serve the site on the port 8888
|
||||
```
|
||||
|
||||
Contribute
|
||||
===========
|
||||
|
||||
Issue tracker : https://git.framasoft.org/groups/Chill-project/issues
|
||||
|
||||
Licence
|
||||
=======
|
||||
|
||||
This documentation is available under the [GNU Free Documentation Licence](http://www.gnu.org/licenses/fdl-1.3.en.html).
|
6
docs/requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
docutils==0.13.1
|
||||
Pygments==2.2.0
|
||||
sphinx==1.8.5
|
||||
git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php
|
||||
jsx-lexer===0.0.8
|
||||
sphinx_rtd_theme==0.5.0
|
BIN
docs/source/_static/access_control_model.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/source/_static/bundles/docStore/doc_store_classes.png
Normal file
After Width: | Height: | Size: 30 KiB |
46
docs/source/_static/bundles/docStore/doc_store_classes.puml
Normal file
@@ -0,0 +1,46 @@
|
||||
# diagramme de classe du module "docStore"
|
||||
|
||||
@startuml
|
||||
|
||||
title Diagramme de classe du module "docStore"
|
||||
|
||||
|
||||
package "PersonBundle" {
|
||||
class Person
|
||||
class Center
|
||||
class PersonDocument
|
||||
}
|
||||
|
||||
package "DocStoreBundle" {
|
||||
Document "many" --- "1" DocumentCategory
|
||||
}
|
||||
|
||||
Document <|-- "herite" PersonDocument
|
||||
|
||||
class "Document" {
|
||||
- int id
|
||||
- varchar_150 title
|
||||
- text description
|
||||
- ArrayCollection_DocumentCategory categories
|
||||
- varchar_150 content #link to openstack
|
||||
- Center center
|
||||
- Cercle cercle
|
||||
- User user
|
||||
- DateTime date # Creation date
|
||||
}
|
||||
|
||||
|
||||
class "DocumentCategory" {
|
||||
.. Primary Key ..
|
||||
- varchar_150 bundle_id
|
||||
- int internal_bundle_id
|
||||
==
|
||||
- json_array name
|
||||
- ArrayCollection_Document documents
|
||||
}
|
||||
|
||||
class "PersonDocument" {
|
||||
- Person person
|
||||
}
|
||||
|
||||
@enduml
|
BIN
docs/source/_static/bundles/group/group_classes_uml.png
Normal file
After Width: | Height: | Size: 50 KiB |
49
docs/source/_static/bundles/group/group_classes_uml.pu
Normal file
@@ -0,0 +1,49 @@
|
||||
# diagramme de classe du module "groupe"
|
||||
|
||||
@startuml
|
||||
|
||||
title Diagramme de classe du module "groupe"
|
||||
|
||||
package "PersonBundle" {
|
||||
class Person
|
||||
class Center
|
||||
}
|
||||
|
||||
package "GroupBundle" {
|
||||
Person "1" <-- Membership
|
||||
Membership "0..*" <--> "Group"
|
||||
Type "1" --> "1..*" Role
|
||||
Membership -right-> "1" Role
|
||||
Group -right-> "1" Type
|
||||
Group -left-> "1" Center
|
||||
}
|
||||
|
||||
class Membership {
|
||||
- role
|
||||
- person
|
||||
- group
|
||||
}
|
||||
note left: <b>Membership</b> relie les groupes aux\npersonnes. Chaque membership a un\n <b>role</b>, le rôle est à choisir\nparmi ceux possibles pour le <b>type</b> de <b>groupe</b>
|
||||
|
||||
class Group {
|
||||
- type
|
||||
- memberships
|
||||
- name
|
||||
- center
|
||||
}
|
||||
note left: Un groupe a un type qui est défini à sa création.
|
||||
|
||||
class Type {
|
||||
- roles
|
||||
}
|
||||
note right: Les types de groupe qu'il est possible de créer \nsont définis dans l'interface d'administration.\nExemple de type: "famille", "groupe de parole", "stage", ...
|
||||
|
||||
class Role {
|
||||
- name
|
||||
}
|
||||
note right: Pour chaque <b>Type</b> on définit des rôles\npossibles pour ce type de groupe. Par exemple, pour le\ntype "famille" on peut avoir les rôles <i>parents</i> et <i>enfants</i>.
|
||||
|
||||
|
||||
|
||||
|
||||
@enduml
|
123
docs/source/_static/code/exports/BirthdateFilter.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Chill\MainBundle\Form\Type\Export\FilterType;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
|
||||
class BirthdateFilter implements FilterInterface, ExportElementValidatedInterface
|
||||
{
|
||||
// add specific role for this filter
|
||||
public function addRole()
|
||||
{
|
||||
// we do not need any new role for this filter, so we return null
|
||||
return null;
|
||||
}
|
||||
|
||||
// we give information on which type of export this filter applies
|
||||
public function applyOn()
|
||||
{
|
||||
return 'person';
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Filter by person\'s birthdate';
|
||||
}
|
||||
|
||||
// we build a form to collect some parameters from the users
|
||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('date_from', DateType::class, array(
|
||||
'label' => "Born after this date",
|
||||
'data' => new \DateTime(),
|
||||
'attr' => array('class' => 'datepicker'),
|
||||
'widget'=> 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
));
|
||||
|
||||
$builder->add('date_to', DateType::class, array(
|
||||
'label' => "Born before this date",
|
||||
'data' => new \DateTime(),
|
||||
'attr' => array('class' => 'datepicker'),
|
||||
'widget'=> 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// the form created above must be validated. The process of validation
|
||||
// is executed here. This function is added by the interface
|
||||
// `ExportElementValidatedInterface`, and can be ignore if there is
|
||||
// no need for a validation
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
$date_from = $data['date_from'];
|
||||
$date_to = $data['date_to'];
|
||||
|
||||
if ($date_from === null) {
|
||||
$context->buildViolation('The "date from" should not be empty')
|
||||
//->atPath('date_from')
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if ($date_to === null) {
|
||||
$context->buildViolation('The "date to" should not be empty')
|
||||
//->atPath('date_to')
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if (
|
||||
($date_from !== null && $date_to !== null)
|
||||
&&
|
||||
$date_from >= $date_to
|
||||
) {
|
||||
$context->buildViolation('The date "date to" should be after the '
|
||||
. 'date given in "date from" field')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// here, we alter the query created by Export
|
||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
// we create the clause here
|
||||
$clause = $qb->expr()->between('person.birthdate', ':date_from',
|
||||
':date_to');
|
||||
|
||||
// we have to take care **not to** remove previous clauses...
|
||||
if ($where instanceof Expr\Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
// we add parameters from $data. $data contains the parameters from the form
|
||||
$qb->setParameter('date_from', $data['date_from']);
|
||||
$qb->setParameter('date_to', $data['date_to']);
|
||||
}
|
||||
|
||||
// here, we create a simple string which will describe the action of
|
||||
// the filter in the Response
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
return array('Filtered by person\'s birtdate: '
|
||||
. 'between %date_from% and %date_to%', array(
|
||||
'%date_from%' => $data['date_from']->format('d-m-Y'),
|
||||
'%date_to%' => $data['date_to']->format('d-m-Y')
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
119
docs/source/_static/code/exports/CountPerson.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Chill\PersonBundle\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class CountPerson implements ExportInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
)
|
||||
{
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return Declarations::PERSON_TYPE;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return "Count peoples by various parameters.";
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Count peoples";
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
{
|
||||
return new Role(PersonVoter::STATS);
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array())
|
||||
{
|
||||
// we gather all center the user choose.
|
||||
$centers = array_map(function($el) { return $el['center']; }, $acl);
|
||||
|
||||
$qb = $this->entityManager->createQueryBuilder();
|
||||
|
||||
$qb->select('COUNT(person.id) AS export_result')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
->join('person.center', 'center')
|
||||
->andWhere('center IN (:authorized_centers)')
|
||||
->setParameter('authorized_centers', $centers);
|
||||
;
|
||||
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
{
|
||||
// this array match the result keys in the query. We have only
|
||||
// one column.
|
||||
return array('export_result');
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
||||
// the Closure which will be executed by the formatter.
|
||||
return function($value) {
|
||||
switch($value) {
|
||||
case '_header':
|
||||
// we have to process specifically the '_header' string,
|
||||
// which will be used by the formatter to show a column title
|
||||
return $this->getTitle();
|
||||
default:
|
||||
// for all value, we do not process them and return them
|
||||
// immediatly
|
||||
return $value;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
return array(FormatterInterface::TYPE_TABULAR);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {
|
||||
// this export does not add any form
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
// explain the export manager which formatters and filters are allowed
|
||||
return array(Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN);
|
||||
}
|
||||
|
||||
}
|
35
docs/source/_static/code/installation/docker-compose.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
version: '2'
|
||||
services:
|
||||
fpm:
|
||||
image: dev-activity-person-report
|
||||
links:
|
||||
- db
|
||||
- redis
|
||||
- logstash:gelf
|
||||
environment:
|
||||
- ADMIN_PASSWORD=admin
|
||||
# add a link to custom.yml if needed
|
||||
# volumes:
|
||||
# - /tmp/custom.yml:/var/www/chill/app/config/custom.yml
|
||||
redis:
|
||||
image: redis
|
||||
db:
|
||||
image: chill/database
|
||||
logstash:
|
||||
image: logstash
|
||||
command: logstash -e 'input { gelf { } } output { stdout{ } }'
|
||||
expose:
|
||||
- "12201/udp"
|
||||
volumes:
|
||||
- /var/log/logstash
|
||||
nginx:
|
||||
image: nginx
|
||||
links:
|
||||
- fpm
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
volumes_from:
|
||||
- fpm:ro
|
||||
ports:
|
||||
- 8080:80
|
||||
|
71
docs/source/_static/code/installation/nginx.conf
Normal file
@@ -0,0 +1,71 @@
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
gzip off;
|
||||
|
||||
#include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
upstream phpfcgi {
|
||||
server fpm:9000;
|
||||
# server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
#server_name symfony2;
|
||||
root /var/www/chill/web;
|
||||
|
||||
error_log /var/log/nginx/symfony2.error.log;
|
||||
access_log /var/log/nginx/symfony2.access.log;
|
||||
|
||||
# strip app.php/ prefix if it is present
|
||||
rewrite ^/app\.php/?(.*)$ /$1 permanent;
|
||||
|
||||
location / {
|
||||
index app.php;
|
||||
try_files $uri @rewriteapp;
|
||||
}
|
||||
|
||||
location @rewriteapp {
|
||||
rewrite ^(.*)$ /app.php/$1 last;
|
||||
}
|
||||
|
||||
# pass the PHP scripts to FastCGI server from upstream phpfcgi
|
||||
location ~ ^/(app|app_dev|config)\.php(/|$) {
|
||||
fastcgi_pass phpfcgi;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param HTTPS off;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
docs/source/_static/puml/exports/form_steps.png
Normal file
After Width: | Height: | Size: 70 KiB |
82
docs/source/_static/puml/exports/form_steps.puml
Normal file
@@ -0,0 +1,82 @@
|
||||
@startuml
|
||||
|
||||
actor User
|
||||
participant Controller
|
||||
participant ExportFormType as eft
|
||||
participant ExportManager as em
|
||||
participant SelectedExport as se
|
||||
participant AggregatorFormType as aft
|
||||
collections aggregators as a
|
||||
participant FilterFormType as fft
|
||||
collections filters as f
|
||||
|
||||
|
||||
User -> Controller: request "/exports/new/<id of the export>?step=export"
|
||||
|
||||
activate Controller
|
||||
Controller -> eft: build the form (AbstractType::buildForm)
|
||||
|
||||
activate eft
|
||||
eft -> em: get the export
|
||||
|
||||
activate em
|
||||
em -> eft: return the SelectedExport
|
||||
deactivate em
|
||||
|
||||
eft -> se: get the Export Type
|
||||
|
||||
activate se
|
||||
se -> eft: return the export Type (a string)
|
||||
deactivate se
|
||||
|
||||
eft -> aft: build the subform 'aggregators'
|
||||
activate aft
|
||||
|
||||
aft -> em: get aggregators for this export type
|
||||
activate em
|
||||
em -> aft: return a collection of aggregators
|
||||
deactivate em
|
||||
|
||||
loop for each aggregator
|
||||
aft -> a: build eventual subform for the aggregator
|
||||
activate a
|
||||
a -> a: append enventually his form
|
||||
a -> aft
|
||||
deactivate a
|
||||
end
|
||||
|
||||
aft -> eft
|
||||
deactivate aft
|
||||
|
||||
eft -> fft: build the subform 'filters'
|
||||
activate fft
|
||||
|
||||
fft -> em: get filters for this export type
|
||||
activate em
|
||||
em -> fft: return a collection for filters
|
||||
deactivate em
|
||||
|
||||
loop for each filter
|
||||
fft -> f: build eventual subform for the filter
|
||||
activate f
|
||||
f -> f: append eventually his form
|
||||
f -> fft
|
||||
deactivate f
|
||||
end
|
||||
|
||||
fft -> eft
|
||||
deactivate fft
|
||||
|
||||
eft -> se: build eventual subform for the export itsefl
|
||||
activate se
|
||||
se -> se: append eventually his form
|
||||
se -> eft
|
||||
deactivate se
|
||||
|
||||
se -> Controller: return a well-build form
|
||||
deactivate se
|
||||
|
||||
Controller -> User: render the page with the form
|
||||
deactivate Controller
|
||||
@enduml
|
||||
|
BIN
docs/source/_static/puml/exports/processing_export.png
Normal file
After Width: | Height: | Size: 178 KiB |
164
docs/source/_static/puml/exports/processing_export.puml
Normal file
@@ -0,0 +1,164 @@
|
||||
@startuml
|
||||
|
||||
participant Controller
|
||||
participant ExportManager as em
|
||||
participant SelectedExport as se
|
||||
participant Formatter as f
|
||||
collections aggregators as aa
|
||||
collections filters as ff
|
||||
|
||||
activate Controller
|
||||
Controller -> em: ExportManager::generate(string 'export_alias', Centers[], $data, $formatterdata)
|
||||
activate em
|
||||
note left
|
||||
$data contains the data
|
||||
from the export form
|
||||
(export form + aggregators form +
|
||||
filters forms)
|
||||
end note
|
||||
|
||||
|
||||
em -> se: Export::initiateQuery($modifiers, $acl, $data)
|
||||
activate se
|
||||
note left
|
||||
$modifiers contains the selected modifiers
|
||||
and their data. Usually you can ignore this.
|
||||
$acl contains the list of selected centers. The
|
||||
export must check that the user has the right
|
||||
to compute the export for this center
|
||||
$data the data from the export form (if the export
|
||||
build a form with `buildForm` function
|
||||
end note
|
||||
|
||||
create Query as q
|
||||
se -> q: the export will create a query
|
||||
se -> em: return the query
|
||||
deactivate se
|
||||
|
||||
alt The query is a "native sql query"
|
||||
|
||||
note over em, se
|
||||
When the export create a native query, there aren't any filters
|
||||
or aggregators which can alter the query.
|
||||
|
||||
We immediatly get the results from the query.
|
||||
end note
|
||||
|
||||
else "The query is a query builder"
|
||||
|
||||
note over em, se
|
||||
As the query is a query builder, filters and formatters
|
||||
will be able to alter the query.
|
||||
end note
|
||||
|
||||
loop for each filter selected by user
|
||||
em -> ff: FilterInterface::alterQuery(query, $data)
|
||||
activate ff
|
||||
note over em, ff
|
||||
The filter will alter query, adding his own clause (i.e. WHERE clause). It is
|
||||
his responsability to avoid removing clauses added by other filters / aggregators.
|
||||
|
||||
The ExportManager will also transmit the $data filled by the user (if the
|
||||
filter has a form) to each filter / aggregator.
|
||||
end note
|
||||
ff -> q: append some clauses
|
||||
deactivate ff
|
||||
end
|
||||
|
||||
loop for each aggregator selected by user
|
||||
note over em, aa
|
||||
As of filter, aggregators will append their
|
||||
own clauses in the query (usually GROUP BY clause).
|
||||
end note
|
||||
em -> aa: AggregatorInterface::alterQuery(query, data)
|
||||
activate aa
|
||||
|
||||
aa -> q: append some clauses
|
||||
deactivate aa
|
||||
end
|
||||
end alt
|
||||
|
||||
note over se
|
||||
The query is now ready. We will fetch the results from databases.
|
||||
|
||||
The Export is responsible for getting the results
|
||||
end note
|
||||
|
||||
em -> se: Export::getResult(query, $data)
|
||||
activate se
|
||||
|
||||
se -> q: getResult()
|
||||
activate q
|
||||
q -> se: return result
|
||||
destroy q
|
||||
|
||||
se -> em: return result
|
||||
deactivate se
|
||||
|
||||
em -> f: FormatterInterface::getResponse()
|
||||
activate f
|
||||
|
||||
note over f, ff
|
||||
The formatter will ask the export, and each aggregators the keys they
|
||||
are responsible for.
|
||||
|
||||
Then, for each of those keys, he will ask to each participant
|
||||
(Export or aggregator) a Closure, which will render the value in
|
||||
results into a human readable string.
|
||||
end note
|
||||
|
||||
f -> se: getQueryKeys
|
||||
activate se
|
||||
se -> f: return string[]
|
||||
|
||||
loop for each keys the export is responsible for
|
||||
f -> se: ExportInterface::getLabel()
|
||||
create "closure for key export" as closuree
|
||||
se -> closuree: create a closure
|
||||
se -> f: return closure
|
||||
end
|
||||
|
||||
loop for each aggregator
|
||||
f -> aa: getQueryKeys()
|
||||
activate aa
|
||||
aa -> f: return string[]
|
||||
deactivate aa
|
||||
|
||||
loop for each keys the aggregator is responsible for
|
||||
f -> aa: getLabel()
|
||||
activate aa
|
||||
create "closure for key aggregators" as closureg
|
||||
aa -> closureg: create a closure
|
||||
aa -> f: return closure
|
||||
deactivate aa
|
||||
end
|
||||
end
|
||||
|
||||
loop over results
|
||||
note over f, closureg
|
||||
Each row in result will be transformed in a human readable format by the closure.
|
||||
|
||||
The human readable string will be appended by the Formatter in his response (a Spreadsheet, CSV file, ...)
|
||||
end note
|
||||
|
||||
f -> closuree: call
|
||||
activate closuree
|
||||
closuree -> f: return a human readable format for this value
|
||||
deactivate closuree
|
||||
|
||||
f -> closureg: call
|
||||
activate closureg
|
||||
closureg -> f: return a human readable format for the value
|
||||
deactivate g
|
||||
|
||||
f -> f: append the result in his response
|
||||
end
|
||||
|
||||
f -> em: return a Response
|
||||
deactivate f
|
||||
|
||||
em -> Controller: return a Response
|
||||
deactivate em
|
||||
deactivate Controller
|
||||
|
||||
@enduml
|
BIN
docs/source/_static/puml/pagination-sequence.png
Normal file
After Width: | Height: | Size: 15 KiB |
20
docs/source/_static/puml/pagination-sequence.puml
Normal file
@@ -0,0 +1,20 @@
|
||||
@startuml
|
||||
|
||||
actor "controller, service, ..." as x
|
||||
participant "paginator"
|
||||
participant "Request"
|
||||
|
||||
x -> paginator: getCurrentPage()
|
||||
activate paginator
|
||||
|
||||
paginator -> Request: read the `page` parameter in GET request
|
||||
activate Request
|
||||
Request -> paginator
|
||||
deactivate Request
|
||||
|
||||
paginator -> paginator: construct a page object for current page number
|
||||
paginator -> x: return the `page`
|
||||
deactivate paginator
|
||||
|
||||
@enduml
|
||||
|
After Width: | Height: | Size: 306 KiB |
BIN
docs/source/_static_sources/access_control_model.dia
Normal file
71
docs/source/bundles/activity.rst
Normal file
@@ -0,0 +1,71 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _activity-bundle:
|
||||
|
||||
Activity bundle
|
||||
###############
|
||||
|
||||
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Entities provided
|
||||
*****************
|
||||
|
||||
.. todo::
|
||||
|
||||
Describe the entities provided.
|
||||
|
||||
|
||||
Configuration options
|
||||
*********************
|
||||
|
||||
Those options are available under `chill_activity` key.
|
||||
|
||||
Example of configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_activity:
|
||||
form:
|
||||
time_duration:
|
||||
- { label: '12 minutes', seconds: 720 }
|
||||
- { label: '30 minutes', seconds: 1800 }
|
||||
|
||||
form.time_duration *array*
|
||||
The duration which might be suggested when the user create or update an activity. The value must be an array of object, where each object must have a :code:`label` and a :code:`seconds` key. The label provide which is shown to user (the label will be translated, if possible) and the seconds the duration.
|
||||
|
||||
Example: see the example above
|
||||
|
||||
Default value: the values available are 5, 10, 15, 20, 25, 30, 45 minutes, and 1 hour, 1 hour 15, 1 hour 30, 1 hour 45 and 2 hours.
|
||||
|
||||
.. _activity-bundle-macros:
|
||||
|
||||
Macros
|
||||
******
|
||||
|
||||
Activity reason sticker
|
||||
=======================
|
||||
|
||||
Macro file
|
||||
`ChillActivityBundle:ActivityReason:macro.html.twig`
|
||||
Macro envelope
|
||||
:code:`reason(r)`
|
||||
|
||||
:code:`p` is an instance of :class:`Chill\ActivityBundle\Entity\ActivityReason`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an activity reason.
|
||||
Example usage :
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||
|
||||
{{ m.reason(r) }}
|
441
docs/source/bundles/custom-fields.rst
Normal file
@@ -0,0 +1,441 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _custom-fields-bundle:
|
||||
|
||||
Custom fields bundle
|
||||
====================
|
||||
|
||||
This bundle provides the ability to add custom fields to existing entities.
|
||||
|
||||
Those custom fields contains extra data and will be stored in the DB, along with other data's entities. It may be string, text, date, ... or a link to an existing entities.
|
||||
|
||||
In the database, custom fields are stored in json format.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The full specification discussed `here. <https://redmine.champs-libres.coop/issues/239>`_
|
||||
|
||||
`JSON Type on postgresql documentation <http://www.postgresql.org/docs/9.3/static/datatype-json.html>`_
|
||||
The documentation of json type, which is used to store data in the database.
|
||||
|
||||
.. contents:: Table of contents
|
||||
:depth: 4
|
||||
:local:
|
||||
|
||||
Custom Fields concepts
|
||||
----------------------
|
||||
|
||||
Custom fields are extra data which may be added to entities by user. If a developer implements custom fields on a entity, users will be able to add more fields on this entity.
|
||||
|
||||
Example: the `person bundle` allows to record `firstname`, `lastname`, `date of birth` fields. But users need to store information about the kind of house he has (if he owns his house, if he rents it, ...). Custom fields allows to create those fields.
|
||||
|
||||
Automatically, those fields are added at the person form. They are also printed in the person view and in exports.
|
||||
|
||||
Custom fields and custom fields group
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Custom fields are associated to a custom fields group. When a user want to add custom fields on an entity, he must first create a custom fields group and associate this field with an entity. Then he may add add custom fields to this groups.
|
||||
|
||||
Some entities needs a **default** custom fields group. For instance, the default custom fields group will be printed on the main form for person, and will be appended on the main person view. Some bundle does not use this feature (i.e. the `report` bundle).
|
||||
|
||||
.. note::
|
||||
|
||||
In the future of the `person bundle`, other custom fields group will be added in forms accessible from the menu, allowing users to completely customize and separate their entities.
|
||||
|
||||
Allow custom fields on an entity
|
||||
--------------------------------
|
||||
|
||||
As a developer, you must allow your users to add custom fields on your entities.
|
||||
|
||||
.. warning::
|
||||
For having custom fields, the class of the entity must contain a variable for storing the custom data. **By convention this variable must be called $cFData**
|
||||
|
||||
|
||||
Create a json field on your entity
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Declare a json field in your database :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
Chill\CustomFieldsBundle\Entity\BlopEntity:
|
||||
type: entity
|
||||
# ...
|
||||
fields:
|
||||
cFData:
|
||||
type: json_array
|
||||
|
||||
Create the field accordingly in the class logic :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Entity;
|
||||
|
||||
/**
|
||||
* BlopEntity
|
||||
*/
|
||||
class BlopEntity
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $cFData;
|
||||
|
||||
/**
|
||||
* You must set a setter in order to save automatically custom
|
||||
* fields from forms, using Form Component
|
||||
*
|
||||
* @param array $cFData
|
||||
* @return BlopEntity
|
||||
*/
|
||||
public function setCFData(array $cFData)
|
||||
{
|
||||
$this->cFData = $cFData;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* You also must create a getter in order to let Form
|
||||
* component populate form fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCFData()
|
||||
{
|
||||
return $this->cFData;
|
||||
}
|
||||
|
||||
Declare your customizable entity in configuration
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This step is necessary to allow user to create custom fields group associated with this entity.
|
||||
|
||||
Two methods are available.
|
||||
|
||||
The recommended method is to do it in DependencyInjection/Extension class. It is recommended as your bundle will be well set up (for custom field) in every chill installation that use it.
|
||||
|
||||
The discouraged method is to declare via the app/config.yml file. This is very quick to set up for a given chill installation but it is not done automatically : in every chill installation that use your bundle, this step has to be performed.
|
||||
|
||||
In app/config.yml file (discouraged)
|
||||
""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This method is discouraged but explained first as it helps to undersand the recommended method.
|
||||
|
||||
Add those file under `chill_custom_fields` section :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_custom_fields:
|
||||
customizables_entities:
|
||||
- { class: Chill\YourBundleBundle\Entity\BlopEntity, name: blop_entity }
|
||||
|
||||
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
|
||||
* The class, which is a full FQDN class path
|
||||
|
||||
Automatically, in DependencyInjection/Extension class (recommended)
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This is the recommended way for declaring customizable classes.
|
||||
|
||||
You can prepend configuration of `custom fields bundle` from the class `YourBundle\DependencyInjection\YourBundleExtension`. **Note** that you also have to implements `Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface` on this class to make the `prepend` function being taken into account.
|
||||
|
||||
Example here :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
|
||||
'name' => 'blop_entity',)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
|
||||
* The class, which is a full FQDN class path
|
||||
|
||||
.. seealso::
|
||||
|
||||
`How to simplify configuration of multiple bundles <http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html>`_
|
||||
A cookbook page about prepending configuration.
|
||||
|
||||
|
||||
Adding options to your custom fields groups
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You may add options to the groups associated with an entity.
|
||||
|
||||
In `config.yml` the declaration should be :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_custom_fields:
|
||||
customizables_entities:
|
||||
-
|
||||
class: Chill\YourBundleBundle\Entity\BlopEntity
|
||||
name: BlopEntity
|
||||
options:
|
||||
# this will create a "myFieldKey" field as text, with a maxlength attribute to 150 (see http://symfony.com/doc/master/reference/forms/types/text.html)
|
||||
myFieldKey: {form_type: text, form_options: {attr: [maxlength: 150]}}
|
||||
|
||||
In the `PrependExtensionInterface::prepend` function, the options key will be added in the configuration definition :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
|
||||
'name' => 'BlopEntity',
|
||||
'options' => array(
|
||||
'myFieldKey' => [ 'form_type' => 'text', 'form_options' => [ 'attr' => [ 'maxlength' => 150 ] ]
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
**Example :** the entity `Report` from **ReportBundle** has to pick some custom fields belonging to a group to print them in *summaries* the timeline page. The definition will use the special type `custom_fields_group_linked_custom_field` which will add a select input with all fields associated with the current custom fields group :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
class ChillReportExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\ReportBundle\Entity\Report',
|
||||
'name' => 'ReportEntity',
|
||||
'options' => array(
|
||||
'summary_fields' => array(
|
||||
'form_type' => 'custom_fields_group_linked_custom_fields',
|
||||
'form_options' =>
|
||||
[
|
||||
'multiple' => true,
|
||||
'expanded' => false
|
||||
]
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Note that `custom_fields_group_linked_custom_fields` does not create any input on `CustomFieldsGroup` creation : there aren't any fields associated with the custom fields just after the group creation... You have to add custom fields and associate them with the newly created group to see them appears.
|
||||
|
||||
Rendering custom fields and custom fields group in a template
|
||||
-------------------------------------------------------------
|
||||
|
||||
.. warning::
|
||||
Each custom field can be `active` or not. Only `active` custom fields has to be dislayed.
|
||||
|
||||
For rendering custom fields, two function are available :
|
||||
|
||||
* `chill_custom_field_widget` to render the widget. This function is defined on a customFieldType basis.
|
||||
* `chill_custom_field_label` to render the label. You can customize the label rendering by choosing the layout you would like to use.
|
||||
* `chill_custom_field_is_empty` indicates if the content of the custom fields is empty (return a boolean)
|
||||
|
||||
For rendering custom fields group, a function is available :
|
||||
|
||||
* `chill_custom_fields_group_widget` to render the widget. It will display the custom fields of the group in a dd / dt structure.
|
||||
|
||||
chill_custom_field_label
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The signature is :
|
||||
|
||||
* `CustomField` **$customField** a customField instance
|
||||
* `array` **params** the parameters for rendering. Currently, 'label_layout' allow to choose a different label. Default is 'ChillCustomFieldsBundle:CustomField:render_label.html.twig'
|
||||
|
||||
Examples
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_custom_field_label(customField) }}
|
||||
|
||||
|
||||
|
||||
chill_custom_field_widget
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomField **$customField** a customField instance
|
||||
* string **$documentType** the type of document. Default to `html`.
|
||||
|
||||
Examples:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_custom_field_widget(entity.customFields, customField) }}
|
||||
|
||||
chill_custom_field_is_empty
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomField **$customField** a customField instance
|
||||
|
||||
Examples :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{%- if chill_custom_field_is_empty(cFData, customField) == false -%}
|
||||
|
||||
|
||||
chill_custom_fields_group_widget
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function only display custom fields that are `active`.
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomFieldsGroup **$customFieldsGroup** the custom field group to render
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_custom_fields_group_widget(entity.cFData, entity.customFieldsGroup) }}
|
||||
|
||||
Custom Fields's form
|
||||
--------------------
|
||||
|
||||
You should simply use the 'custom_field' type in a template, with the group you would like to render in the `group` option's type.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class ReportType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$entityManager = $options['em'];
|
||||
|
||||
$builder
|
||||
->add('user')
|
||||
->add('date', 'date',
|
||||
array('required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
#add the custom fields :
|
||||
->add('cFData', 'custom_field',
|
||||
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\ReportBundle\Entity\Report'
|
||||
));
|
||||
|
||||
$resolver->setRequired(array(
|
||||
'em',
|
||||
'cFGroup',
|
||||
));
|
||||
|
||||
$resolver->setAllowedTypes(array(
|
||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
||||
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'chill_reportbundle_report';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Available configuration
|
||||
------------------------
|
||||
|
||||
Those options are available in the configuration, under the `chill_custom_field` key.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_custom_field:
|
||||
show_empty_values_in_views: false
|
||||
|
||||
show_empty_values_in_views *boolean*:
|
||||
Allow to hide / show empty values in views. The aim of this configuration parameter is to hide (or show) empty values when :term:`custom fields group` are rendered.
|
||||
|
||||
Default value : `true`
|
||||
|
||||
Glossary
|
||||
--------
|
||||
|
||||
.. glossary::
|
||||
|
||||
custom fields group
|
||||
A group of custom fields
|
29
docs/source/bundles/event.rst
Normal file
@@ -0,0 +1,29 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _event-bundle:
|
||||
|
||||
Event bundle
|
||||
############
|
||||
|
||||
Template & Menu
|
||||
===============
|
||||
|
||||
The event bundle has a special template with a specific menu for actions on
|
||||
events. This menu is called `event`.
|
||||
|
||||
ChillEventBundle::layout.html.twig
|
||||
----------------------------------
|
||||
|
||||
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig` and add the menu `event`
|
||||
|
||||
It proposes a new block :
|
||||
|
||||
* event_content
|
||||
|
||||
* where to display content relative to the event.
|
49
docs/source/bundles/group.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _group-bundle:
|
||||
|
||||
Group bundle
|
||||
############
|
||||
|
||||
Allow to group people in a group. This group may be a family, an activity group, ...
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Entities
|
||||
********
|
||||
|
||||
.. figure:: /_static/bundles/group/group_classes_uml.png
|
||||
|
||||
|
||||
.. _group-bundle-macros:
|
||||
|
||||
Macros
|
||||
******
|
||||
|
||||
Group sticker
|
||||
==============
|
||||
|
||||
Macro file
|
||||
`ChillGroupBundle:Group:macro.html.twig`
|
||||
Macro name
|
||||
:code:`_render`
|
||||
Macro envelope
|
||||
:code:`group`, instance of :class:`Chill\GroupBundle\Entity\CGroup`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent group.
|
||||
Example usage :
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% import 'ChillGroupBundle:Group:macro.html.twig' as m %}
|
||||
|
||||
{{ m._render(g) }}
|
||||
|
||||
|
29
docs/source/bundles/index.rst
Normal file
@@ -0,0 +1,29 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Bundles documentation
|
||||
###############################
|
||||
|
||||
You will find here documentation about bundles working with Chill.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Main bundle <main.rst>
|
||||
Custom Fields bundle <custom-fields.rst>
|
||||
Person bundle <person.rst>
|
||||
Report bundle <report.rst>
|
||||
Activity bundle <activity.rst>
|
||||
Group bundle <group.rst>
|
||||
Event bundle <event.rst>
|
||||
Ldap bundle (synchronisation between ldap and database) <ldap.rst>
|
||||
|
||||
Your bundle here ?
|
||||
-------------------
|
||||
|
||||
The contributors still do not have a policy about those bundle integration, but we would like to be very open on this subject. Please write to us `or open an issue <https://redmine.champs-libres.coop/projects/chill/issues>`_.
|
204
docs/source/bundles/ldap.rst
Normal file
@@ -0,0 +1,204 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _ldap-bundle:
|
||||
|
||||
LDAP bundle
|
||||
###########
|
||||
|
||||
This bundle binds the database with an ldap directory.
|
||||
|
||||
The bundle synchronize the ldap directory with users in the database. It also
|
||||
provides a way to check user credentials against the ldap directory.
|
||||
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Current limitations
|
||||
*******************
|
||||
|
||||
- The length of the ldap dn must be < 255 characters
|
||||
- if the username extracted from the ldap is updated, the changes are not reflected in the database and remains the same
|
||||
|
||||
|
||||
Entities provided
|
||||
*****************
|
||||
|
||||
This bundle provides only one entity : :class:`Chill\\LdapBundle\\Entity\\UserLdapBinding`
|
||||
|
||||
How the synchronizer works ?
|
||||
****************************
|
||||
|
||||
#. The synchronizer performs a query on :code:`dn` and :code:`query` defined in the :ref:`configuration <configuration>`.
|
||||
#. For each entry returned by the query, it looks if the :code:`dn` exists in the database
|
||||
|
||||
#. If the entry does not exists :
|
||||
|
||||
#. the synchronizer looks for user with same username as defined by :code:`username_attr`, and bind it with the :code:`dn` if it exists.
|
||||
#. else, a user is created with username defined by :code:`username_attr` (if the ldap contains more than one attribute, the first attribute returned is used)
|
||||
|
||||
#. if a user exists which is already binded with the :code:`dn`, the entry is ignored.
|
||||
|
||||
#. The synchronizer looks for dn existing in database and which were not returned by the query performed in 1.
|
||||
|
||||
#. If they exists, those user are set to :code:`enabled=false`: they are not allowed to login.
|
||||
|
||||
Installation
|
||||
************
|
||||
|
||||
This bundle requires :
|
||||
|
||||
- PHP LDAP ext
|
||||
- :code:`symfony/ldap` with minimal version 3.1. Note that, currently, Chill uses Symfony 2.8: you should add the dependency on this single package manually
|
||||
|
||||
In your composer.json, for stable version :
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "~1.0"
|
||||
}
|
||||
|
||||
|
||||
|
||||
And for dev version :
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "dev-master@dev"
|
||||
}
|
||||
|
||||
|
||||
.. _configuration:
|
||||
|
||||
Configuration
|
||||
**************
|
||||
|
||||
Configuration of the bundle
|
||||
============================
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# Default configuration for extension with alias: "chill_ldap"
|
||||
chill_ldap:
|
||||
server: # Required
|
||||
|
||||
# the host of the ldap directory
|
||||
host: ~ # Required, Example: localhost
|
||||
|
||||
# the port to reach the ldap directory
|
||||
port: 389
|
||||
|
||||
# the version of the ldap directory
|
||||
version: 3
|
||||
|
||||
# Is the use of ssl required to establish connection
|
||||
use_ssl: false
|
||||
|
||||
# Is the use of startssl required to establish connection
|
||||
use_starttls: false
|
||||
|
||||
# the user to bind to dn directory. Required for searching existing users.
|
||||
bind_dn: ~ # Required, Example: cn=user,dn=chill,dn=social
|
||||
|
||||
# the user's password to bind to dn directory.
|
||||
bind_password: ~ # Required, Example: paSSw0rD
|
||||
user_query: # Required
|
||||
|
||||
# The DN where the query is executed
|
||||
dn: ~ # Example: ou=People,dc=champs-libres,dc=coop
|
||||
|
||||
# The query which will allow to retrieve users
|
||||
query: ~ # Example: (&(objectClass=inetOrgPerson)(userPassword=*))
|
||||
|
||||
# The attribute which will provide username (=login)
|
||||
username_attr: cn
|
||||
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_ldap:
|
||||
server:
|
||||
# host, bind_dn and bind_password are imported from parameters.yml
|
||||
host: "%ldap_host%"
|
||||
bind_dn: "%ldap_bind_dn%"
|
||||
bind_password: "%ldap_bind_password%"
|
||||
user_query:
|
||||
dn: dc=champs-libres,dc=coop
|
||||
query: "(&(objectClass=inetOrgPerson)(userPassword=*))"
|
||||
|
||||
|
||||
Configuration of the security part of chill
|
||||
============================================
|
||||
|
||||
Simply add the following config in the firewall of the security bundle :
|
||||
`chill_ldap_form_login: ~`. This config is located in `app/config/security.yml`
|
||||
|
||||
Example of a configuration :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# in app/config/security.yml
|
||||
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
|
||||
default:
|
||||
anonymous: ~
|
||||
# enable the login check by a form, agaisnt the database
|
||||
form_login:
|
||||
csrf_parameter: _csrf_token
|
||||
csrf_token_id: authenticate
|
||||
csrf_provider: form.csrf_provider
|
||||
# enable the login check by a form, against the ldap
|
||||
chill_ldap_form_login: ~ # this is the line you should add
|
||||
|
||||
|
||||
Note that, if you enable the login check by form **and** by the ldap,
|
||||
the password will be checked against the database **and** against the ldap.
|
||||
If one of them match, the login will succeed.
|
||||
|
||||
If you want to completely disable login check against the database,
|
||||
simply remove the :code:`form_login` entry and all his options.
|
||||
|
||||
.. _command-and-crontab:
|
||||
|
||||
Command and crontab
|
||||
===================
|
||||
|
||||
Synchronize the database :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console chill:ldap:synchronize
|
||||
|
||||
|
||||
For getting more debug message :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console chill:ldap:synchronize -vvv
|
||||
|
||||
|
||||
|
||||
You should run this command regularly (using crontab or
|
||||
`systemd timer <https://www.freedesktop.org/software/systemd/man/systemd.timer.html#>`_)
|
||||
to synchronize ldap and database automatically.
|
||||
|
||||
|
||||
|
49
docs/source/bundles/main.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _main-bundle:
|
||||
|
||||
Main bundle
|
||||
###########
|
||||
|
||||
This bundle is **required** for running Chill.
|
||||
|
||||
This bundle provide :
|
||||
|
||||
* Access control model (users, groups, and all concepts)
|
||||
* ...
|
||||
|
||||
|
||||
.. warning::
|
||||
|
||||
this section is incomplete.
|
||||
|
||||
.. _main-bundle-macros:
|
||||
|
||||
Macros
|
||||
******
|
||||
|
||||
Address sticker
|
||||
===============
|
||||
|
||||
Macro file
|
||||
`ChillMainBundle:Address:macro.html.twig`
|
||||
Macro name
|
||||
:code:`_render`
|
||||
Macro envelope
|
||||
:code:`address`, instance of :class:`Chill\MainBundle\Entity\Address`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an address.
|
||||
Example usage :
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% import 'ChillMainBundle:Address:macro.html.twig' as m %}
|
||||
|
||||
{{ m._render(address) }}
|
||||
|
233
docs/source/bundles/person.rst
Normal file
@@ -0,0 +1,233 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _person-bundle:
|
||||
|
||||
Person bundle
|
||||
#############
|
||||
|
||||
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Entities provided
|
||||
*****************
|
||||
|
||||
.. todo::
|
||||
|
||||
describe entities provided by person bundle
|
||||
|
||||
|
||||
Search terms
|
||||
************
|
||||
|
||||
The class `Chill\PersonBundle\Search\PersonSearch` provide the search module.
|
||||
|
||||
Domain
|
||||
======
|
||||
|
||||
The search upon "person" is provided by default. The `@person` domain search may be omitted.
|
||||
|
||||
* `@person` is the domain search for people.
|
||||
|
||||
|
||||
Arguments
|
||||
=========
|
||||
|
||||
* `firstname` : provide the search on firstname. Example : `firstname:Depardieu`. May match part of the firstname (`firsname:dep` will match Depardieu)
|
||||
* `lastname` : provide the search on lastname. May match part of the lastname.
|
||||
* `birthdate` : provide the search on the birthdate. Example : `birthdate:1996-01-19`
|
||||
* `gender`: performs search on man/woman. The accepted values are `man` or `woman`.
|
||||
* `nationality` : performs search on nationality. Value must be a country code `as described in ISO 3166 <http://www.iso.org/iso/fr/home/standards/country_codes.htm>`_. Example : `nationality:FR`.
|
||||
|
||||
Default
|
||||
=======
|
||||
|
||||
The default search is performed on firstname and/or lastname. Both are concatened before search. If values are separated by spaces, the clause `AND` is used : the search `dep ge` will match 'Gérard Depardieu` or 'Jean Depagelles', but not 'Charline Depardieu' (missing 'Ge' in word).
|
||||
|
||||
Configuration options
|
||||
*********************
|
||||
|
||||
Those options are available under `chill_person` key.
|
||||
|
||||
Example of configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person:
|
||||
validation:
|
||||
birthdate_not_after: P15Y
|
||||
person_fields:
|
||||
# note: visible is the default config. This key may be omitted if visible is chosen.
|
||||
nationality: hidden
|
||||
email: hidden
|
||||
place_of_birth: visible
|
||||
phonenumber: hidden
|
||||
country_of_birth: hidden
|
||||
marital_status: visible
|
||||
spoken_languages: hidden
|
||||
address: visible
|
||||
|
||||
birthdate_not_after *string*
|
||||
The period duration before today during which encoding birthdate is not possible. The period is a string matching the format of `ISO_8601`, which is also use to build `DateInterval classes <http://php.net/manual/en/dateinterval.construct.php>`_.
|
||||
|
||||
Example: `P1D`, `P18Y`
|
||||
|
||||
Default value: `P1D` which means that birthdate before the current day (= yesterday) are allowed.
|
||||
|
||||
person_fields *array*
|
||||
This define the visibility of some fields. By default, all fields are visible, but you can choose to hide some of them. Available keys are :
|
||||
|
||||
* `nationality`
|
||||
* `country_of_birth`
|
||||
* `place_of_birth`
|
||||
* `phonenumber`
|
||||
* `email`
|
||||
* `marital_status`
|
||||
* `spoken_languages`
|
||||
* `address`
|
||||
|
||||
Possibles values: `hidden` or `visible` (all other value will raise an Exception).
|
||||
|
||||
Default value : `visible`, which means that all fields are visible.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person:
|
||||
person_fields:
|
||||
nationality: hidden
|
||||
email: hidden
|
||||
phonenumber: hidden
|
||||
|
||||
.. note::
|
||||
If all the field of a "box" are hidden, the whole box does not appears. Example: if the fields `phonenumber` and `email` are hidden, the title `Contact information` will be hidden in the UI.
|
||||
|
||||
.. note::
|
||||
If you hide multiple fields, for a better integration you may want to override the template, for a better appeareance. See `the symfony documentation <http://symfony.com/doc/current/book/templating.html#overriding-bundle-templates>`_ about this feature.
|
||||
|
||||
.. _person-bundle-macros:
|
||||
|
||||
Macros
|
||||
******
|
||||
|
||||
Sticker for a person
|
||||
=====================
|
||||
|
||||
Macro file
|
||||
`ChillPersonBundle:Person:macro.html.twig`
|
||||
Macro envelope
|
||||
:code:`render(p, withLink=false)`
|
||||
|
||||
:code:`p` is an instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
:code:`withLink` :class:`boolean`
|
||||
When to use this macro ?
|
||||
When you want to represent a person.
|
||||
Example usage :
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% import "ChillPersonBundle:Person:macro.html.twig" as person_ %}
|
||||
|
||||
{{ person_.render(person, true) }}
|
||||
|
||||
Layout events and delegated blocks
|
||||
***********************************
|
||||
|
||||
:code:`chill_block.person_post_vertical_menu` event
|
||||
====================================================
|
||||
|
||||
This event is available to add content below of the vertical menu (on the right).
|
||||
|
||||
The context is :
|
||||
|
||||
- :code:`person` : the current person which is rendered. Instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
Widgets
|
||||
*******
|
||||
|
||||
Add a list of person on homepage
|
||||
================================
|
||||
|
||||
The bundle provide a way to add a list of accompanyied person on the homepage:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
widgets:
|
||||
homepage:
|
||||
-
|
||||
order: 10
|
||||
widget_alias: person_list
|
||||
person_list:
|
||||
# customize the number of items
|
||||
number_of_items: 20
|
||||
|
||||
# only active
|
||||
only_active: true
|
||||
|
||||
# you can add some filtering class, which will implements
|
||||
# Chill\PersonBundle\PersonListWidget\PersonFilteringInterface
|
||||
filtering_class: "\Hepc\HomepagePersonFiltering"
|
||||
|
||||
# when the view is overriden, you can add some custom fields
|
||||
# to the view
|
||||
custom_fields: [school-2fb5440e-192c-11e6-b2fd-74d02b0c9b55]
|
||||
|
||||
Commands
|
||||
********
|
||||
|
||||
|
||||
:code:`chill:person:move`
|
||||
=========================
|
||||
|
||||
.. code-block:: txt
|
||||
|
||||
Usage:
|
||||
chill:person:move [options]
|
||||
|
||||
Options:
|
||||
-f, --from=FROM The person id to delete, all associated data will be moved before
|
||||
-t, --to=TO The person id which will received data
|
||||
--dump-sql dump sql to stdout
|
||||
--force execute sql instead of dumping it
|
||||
-h, --help Display this help message
|
||||
-q, --quiet Do not output any message
|
||||
-V, --version Display this application version
|
||||
--ansi Force ANSI output
|
||||
--no-ansi Disable ANSI output
|
||||
-n, --no-interaction Do not ask any interactive question
|
||||
-e, --env=ENV The Environment name. [default: "dev"]
|
||||
--no-debug Switches off debug mode.
|
||||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
|
||||
Help:
|
||||
Move all the associated entities on a "from" person to a "to" person and remove the old person
|
||||
|
||||
Move all the entities associated to a person onto another one, and remove the old person.
|
||||
|
||||
.. warning::
|
||||
|
||||
Some entities are ignored and will be deleted:
|
||||
|
||||
- the accompanying periods ;
|
||||
- the data attached to a person entity: name, address, date of birth, etc. Thos should be merge before the move.
|
||||
|
||||
It is advised to run first the command with the :code:`dump-sql` option and, then, use the :code:`force` option.
|
||||
|
||||
The moving and suppression is executed inside a transaction, ensuring no data loss if the migration fails.
|
||||
|
||||
.. note::
|
||||
|
||||
Using bash and awk, it is easy to use a TSV file (values separated by a tab, not a comma) to create move commands. Assuming our file is named :code:`twins.tsv` and contains two columns: the first one with :code:`from` ids, and the second one with :code:`to` ids:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
awk '{ print "php app/console chill:person:move --dump-sql --from " $1 " --to " $2;}' twins.tsv
|
46
docs/source/bundles/report.rst
Normal file
@@ -0,0 +1,46 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _report-bundle:
|
||||
|
||||
Report bundle
|
||||
#############
|
||||
|
||||
This bundle provides the ability to record report about people. We use custom fields to let user add fields to reports.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
.. todo::
|
||||
|
||||
The documentation about report is not writtend
|
||||
|
||||
Concepts
|
||||
========
|
||||
|
||||
|
||||
Search
|
||||
======
|
||||
|
||||
Domain
|
||||
------
|
||||
|
||||
* `@report` is the domain search for reports.
|
||||
|
||||
|
||||
Arguments
|
||||
---------
|
||||
|
||||
* `date` : The date of the report
|
||||
|
||||
Default
|
||||
-------
|
||||
|
||||
The report's date is the default value.
|
||||
|
||||
An error is thrown if an argument `date` and a default is used.
|
417
docs/source/conf.py
Normal file
@@ -0,0 +1,417 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# chill-doc documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Sep 28 22:04:08 2014.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
if not on_rtd:
|
||||
# sys.path.append(os.path.abspath('./../_exts/sphinx-php'))
|
||||
pass
|
||||
|
||||
|
||||
# adding PhpLexer
|
||||
try:
|
||||
from sphinx.highlighting import lexers
|
||||
from pygments.lexers.compiled import CLexer
|
||||
from pygments.lexers.web import PhpLexer
|
||||
php_lexer_available = True
|
||||
except ImportError:
|
||||
php_lexer_available = False
|
||||
print('specific import not available')
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.todo',
|
||||
]
|
||||
|
||||
# desactivated
|
||||
# try:
|
||||
# import sensio.sphinx.refinclude
|
||||
# except ImportError:
|
||||
# print('sensio.sphinx.refinclude is not available')
|
||||
# else:
|
||||
# extensions += ['sensio.sphinx.refinclude']
|
||||
#
|
||||
# try:
|
||||
# import sensio.sphinx.configurationblock
|
||||
# except ImportError:
|
||||
# print('sensio.sphinx.configurationblock is not available')
|
||||
# else:
|
||||
# extensions += ['sensio.sphinx.configurationblock']
|
||||
#
|
||||
# try:
|
||||
# import sensio.sphinx.phpcode
|
||||
# except ImportError:
|
||||
# print('sensio.sphinx.phpcode')
|
||||
# else:
|
||||
# extensions += ['sensio.sphinx.phpcode']
|
||||
#
|
||||
# try:
|
||||
# import sensio.sphinx.bestpractice
|
||||
# except ImportError:
|
||||
# print('sensio.sphinx.bestpractice is not avaialble')
|
||||
# else:
|
||||
# extensions += ['sensio.sphinx.bestpractice']
|
||||
|
||||
#add configuration for api url
|
||||
|
||||
# api_url = 'http://api.chill.social/master/%s'
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'Chill Documentation'
|
||||
copyright = '2014-2016, Champs-Libres, published under the terms of the GNU Free Documentation License, Version 1.3'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '2.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '2.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
# -- Settings for symfony doc extension ---------------------------------------------------
|
||||
if php_lexer_available:
|
||||
# enable highlighting for PHP code not between ``<?php ... ?>`` by default
|
||||
lexers['php'] = PhpLexer(startinline=True)
|
||||
lexers['php-annotations'] = PhpLexer(startinline=True)
|
||||
lexers['php-standalone'] = PhpLexer(startinline=True)
|
||||
lexers['php-symfony'] = PhpLexer(startinline=True)
|
||||
lexers['varnish3'] = CLexer()
|
||||
lexers['varnish4'] = CLexer()
|
||||
config_block = {
|
||||
'varnish3': 'Varnish 3',
|
||||
'varnish4': 'Varnish 4'
|
||||
}
|
||||
# use PHP as the primary domain
|
||||
primary_domain = 'php'
|
||||
# set url for API links
|
||||
api_url = 'http://api.symfony.com/master/%s'
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default' #overriden if run locally, see end of file
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'chill-docdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
'papersize': 'a4paper'
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'chill-doc.tex', 'chill-doc Documentation',
|
||||
'Champs-Libres', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'chill-doc', 'chill-doc Documentation',
|
||||
['Champs-Libres'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'chill-doc', 'chill-doc Documentation',
|
||||
'Champs-Libres', 'chill-doc', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
|
||||
# -- Options for Epub output ----------------------------------------------
|
||||
|
||||
# Bibliographic Dublin Core info.
|
||||
epub_title = 'Chill Documentation'
|
||||
epub_author = 'Champs-Libres'
|
||||
epub_publisher = 'Champs-Libres'
|
||||
epub_copyright = '2014-2016, Champs-Libres'
|
||||
|
||||
# The basename for the epub file. It defaults to the project name.
|
||||
#epub_basename = 'chill-doc'
|
||||
|
||||
# The HTML theme for the epub output. Since the default themes are not optimized
|
||||
# for small screen space, using the same theme for HTML and epub output is
|
||||
# usually not wise. This defaults to 'epub', a theme designed to save visual
|
||||
# space.
|
||||
#epub_theme = 'epub'
|
||||
|
||||
# The language of the text. It defaults to the language option
|
||||
# or en if the language is not set.
|
||||
#epub_language = ''
|
||||
|
||||
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||
#epub_scheme = ''
|
||||
|
||||
# The unique identifier of the text. This can be a ISBN number
|
||||
# or the project homepage.
|
||||
#epub_identifier = ''
|
||||
|
||||
# A unique identification for the text.
|
||||
#epub_uid = ''
|
||||
|
||||
# A tuple containing the cover image and cover page html template filenames.
|
||||
#epub_cover = ()
|
||||
|
||||
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
|
||||
#epub_guide = ()
|
||||
|
||||
# HTML files that should be inserted before the pages created by sphinx.
|
||||
# The format is a list of tuples containing the path and title.
|
||||
#epub_pre_files = []
|
||||
|
||||
# HTML files shat should be inserted after the pages created by sphinx.
|
||||
# The format is a list of tuples containing the path and title.
|
||||
#epub_post_files = []
|
||||
|
||||
# A list of files that should not be packed into the epub file.
|
||||
epub_exclude_files = ['search.html']
|
||||
|
||||
# The depth of the table of contents in toc.ncx.
|
||||
#epub_tocdepth = 3
|
||||
|
||||
# Allow duplicate toc entries.
|
||||
#epub_tocdup = True
|
||||
|
||||
# Choose between 'default' and 'includehidden'.
|
||||
#epub_tocscope = 'default'
|
||||
|
||||
# Fix unsupported image types using the PIL.
|
||||
#epub_fix_images = False
|
||||
|
||||
# Scale large images.
|
||||
#epub_max_image_width = 0
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#epub_show_urls = 'inline'
|
||||
|
||||
# If false, no index is generated.
|
||||
#epub_use_index = True
|
||||
|
||||
|
||||
|
||||
#-- Options for todo
|
||||
|
||||
todo_include_todos = True
|
||||
|
||||
#-- include template if not on RTD
|
||||
|
||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
|
||||
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
|
314
docs/source/development/access_control_model.rst
Normal file
@@ -0,0 +1,314 @@
|
||||
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Access controle model
|
||||
**********************
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Concepts
|
||||
========
|
||||
|
||||
Every time an entity is created, viewed or updated, the software check if the user has the permission to make this action. The decision is made with three parameters :
|
||||
|
||||
- the type of entity ;
|
||||
- the entity's center ;
|
||||
- the entity'scope
|
||||
|
||||
The user must be granted access to the action on this particular entity, with this scope and center.
|
||||
|
||||
From an user point of view
|
||||
--------------------------
|
||||
|
||||
The software is design to allow fine tuned access rights for complicated installation and team structure. The administrators may also decide that every user has the right to see all resources, where team have a more simple structure.
|
||||
|
||||
Here is an overview of the model.
|
||||
|
||||
Chill can be multi-center
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Chill is designed to be installed once for social center who work with multiple teams separated, or for social services's federation who would like to share the same installation of the software for all their members.
|
||||
|
||||
This was required for cost reduction, but also to ease the generation of statistics agregated across federation's members, or from the central unit of the social center with multiple teams.
|
||||
|
||||
Otherwise, it is not required to create multiple center: Chill can also work for one center.
|
||||
|
||||
Obviously, users working in the different centers are not allowed to see the entities (_persons_, _reports_, _activities_) of other centers. But users may be attached to multiple centers: consequently they will be able to see the entities of the multiple centers they are attached to.
|
||||
|
||||
Inside center, scope divide team
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Users are attached to one or more center and, inside to those center, there may exists differents scopes. The aim of those _scopes_ is to divide the whole team of social worker amongst different departement, for instance: the social team, the psychologist team, the nurse team, the administrative team, ... Each team is granted of different rights amongst scope. For instance, the social team may not see the _activities_ of the psychologist team. The administrative team may see the date & time's activities, but is not allowed to see the detail of those entities (the personal notes, ...).
|
||||
|
||||
The administrator is responsible of creating those scopes and team. *He may also decide to not define a division inside his team*: he creates only one scope and all entities will belong to this scope, all users will be able to see all entities.
|
||||
|
||||
As entities have only one scopes, if some entities must be shared across two different teams, the administrator will have to create a scope *shared* by two different team, and add the ability to create, view, or update this scope to those team.
|
||||
|
||||
Example: if some activities must be seen and updated between nurses and psychologists, the administrator will create a scope "nurse and psy" and add the ability for both team "nurse" and "psychologist" to "create", "see", and "update" the activities belonging to scope "nurse and psy".
|
||||
|
||||
The concepts translated into code
|
||||
-----------------------------------
|
||||
|
||||
.. figure:: /_static/access_control_model.png
|
||||
|
||||
Schema of the access control model
|
||||
|
||||
Chill handle **entities**, like *persons*, *reports* (associated to *persons*), *activities* (also associated to *_persons*), ... On creation, those entities are linked to one center and, eventually, to one scope. They implements the interface `HasCenterInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Somes entities are linked to a center through the entity they are associated with. For instance, *activities* or *reports* are associated to a *person*, and the person is associated to a *center*. The *report*'s *center* is always the *person*'s *center*.
|
||||
|
||||
Entities may be associated with a scope. In this case, they implement the `HasScopeInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Currently, only the *person* entity is not associated with a scope.
|
||||
|
||||
At each step of his lifetime (creation, view of the entity and eventually of his details, update and, eventually, deletion), the right of the user are checked. To decide wether the user is granted right to execute the action, the software must decide with those elements :
|
||||
|
||||
- the entity's type;
|
||||
- the entity's center ;
|
||||
- the entity's scope, if it exists,
|
||||
- and, obviously, a string representing the action
|
||||
|
||||
All those action are executed through symfony voters and helpers.
|
||||
|
||||
How to check authorization ?
|
||||
----------------------------
|
||||
|
||||
Just use the symfony way-of-doing, but do not forget to associate the entity you want to check access. For instance, in controller :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
class MyController extends Controller
|
||||
{
|
||||
|
||||
public function viewAction($entity)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('CHILL_ENTITY_SEE', $entity);
|
||||
|
||||
//... go on with this action
|
||||
}
|
||||
}
|
||||
|
||||
And in template :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ if is_granted('CHILL_ENTITY_SEE', entity) %}print something{% endif %}
|
||||
|
||||
Retrieving reachable scopes and centers
|
||||
----------------------------------------
|
||||
|
||||
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` helps you to get centers and scope reachable by a user.
|
||||
|
||||
Those methods are intentionnaly build to give information about user rights:
|
||||
|
||||
- getReachableCenters: to get reachable centers for a user
|
||||
- getReachableScopes : to get reachable scopes for a user
|
||||
|
||||
.. note::
|
||||
|
||||
The service is reachable through the Depedency injection with the key `chill.main.security.authorization.helper`. Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$helper = $container->get('chill.main.security.authorization.helper');
|
||||
|
||||
.. todo::
|
||||
|
||||
Waiting for a link between our api and this doc, we invite you to read the method signatures `here <https://github.com/Chill-project/Main/blob/add_acl/Security/Authorization/AuthorizationHelper.php>`_
|
||||
|
||||
Adding your own roles
|
||||
=====================
|
||||
|
||||
Extending Chill will requires you to define your own roles and rules for your entities. You will have to define your own voter to do so.
|
||||
|
||||
To create your own roles, you should:
|
||||
|
||||
* implement your own voter. This voter will have to extends the :class:`Chill\\MainBundle\\Security\\AbstractChillVoter`. As defined by Symfony, this voter must be declared as a service and tagged with `security.voter`;
|
||||
* declare the role through implementing a service tagged with `chill.role` and implementing :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Both operation may be done through a simple class: you can implements :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface` and :class:`Chill\\MainBundle\\Security\\AbstractChillVoter` on the same class. See live example: :class:`Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter`, and similar examples in the `PersonBundle` and `ReportBundle`.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`How to Use Voters to Check User Permissions <http://symfony.com/doc/current/cookbook/security/voters_data_permission.html>`_
|
||||
|
||||
From the symfony cookbook
|
||||
|
||||
`New in Symfony 2.6: Simpler Security Voters <http://symfony.com/blog/new-in-symfony-2-6-simpler-security-voters>`_
|
||||
|
||||
From the symfony blog
|
||||
|
||||
|
||||
Declare your role
|
||||
------------------
|
||||
|
||||
To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
interface ProvideRoleInterface
|
||||
{
|
||||
/**
|
||||
* return an array of role provided by the object
|
||||
*
|
||||
* @return string[] array of roles (as string)
|
||||
*/
|
||||
public function getRoles();
|
||||
|
||||
/**
|
||||
* return roles which doesn't need
|
||||
*
|
||||
* @return string[] array of roles without scopes
|
||||
*/
|
||||
public function getRolesWithoutScope();
|
||||
}
|
||||
|
||||
|
||||
Then declare your service with a tag `chill.role`. Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
your_service:
|
||||
class: Chill\YourBundle\Security\Authorization\YourVoter
|
||||
tags:
|
||||
- { name: chill.role }
|
||||
|
||||
|
||||
Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||
|
||||
class PersonVoter implements ProvideRoleInterface
|
||||
{
|
||||
const CREATE = 'CHILL_PERSON_CREATE';
|
||||
const UPDATE = 'CHILL_PERSON_UPDATE';
|
||||
const SEE = 'CHILL_PERSON_SEE';
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
return array(self::CREATE, self::UPDATE, self::SEE);
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
{
|
||||
return array(self::CREATE, self::UPDATE, self::SEE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Implement your voter
|
||||
--------------------
|
||||
|
||||
Inside this class, you might use the :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` to check permission (do not re-invent the wheel). This is a real-world example:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Security\Authorization;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
|
||||
|
||||
class ReportVoter extends AbstractChillVoter
|
||||
{
|
||||
const CREATE = 'CHILL_REPORT_CREATE';
|
||||
const SEE = 'CHILL_REPORT_SEE';
|
||||
const UPDATE = 'CHILL_REPORT_UPDATE';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $helper;
|
||||
|
||||
public function __construct(AuthorizationHelper $helper)
|
||||
{
|
||||
$this->helper = $helper;
|
||||
}
|
||||
|
||||
protected function getSupportedAttributes()
|
||||
{
|
||||
return array(self::CREATE, self::SEE, self::UPDATE);
|
||||
}
|
||||
protected function getSupportedClasses()
|
||||
{
|
||||
return array('Chill\ReportBundle\Entity\Report');
|
||||
}
|
||||
protected function isGranted($attribute, $report, $user = null)
|
||||
{
|
||||
if (! $user instanceof \Chill\MainBundle\Entity\User){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->helper->userHasAccess($user, $report, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
Then, you will have to declare the service and tag it as a voter :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.report.security.authorization.report_voter:
|
||||
class: Chill\ReportBundle\Security\Authorization\ReportVoter
|
||||
arguments:
|
||||
- "@chill.main.security.authorization.helper"
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
||||
|
||||
Adding role hierarchy
|
||||
---------------------
|
||||
|
||||
You should prepend Symfony's security component directly from your code.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\DependencyInjection;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||
|
||||
/**
|
||||
* This is the class that loads and manages your bundle configuration
|
||||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
||||
*/
|
||||
class ChillReportExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependRoleHierarchy($container);
|
||||
}
|
||||
|
||||
protected function prependRoleHierarchy(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('security', array(
|
||||
'role_hierarchy' => array(
|
||||
'CHILL_REPORT_UPDATE' => array('CHILL_REPORT_SEE'),
|
||||
'CHILL_REPORT_CREATE' => array('CHILL_REPORT_SEE')
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
747
docs/source/development/api.rst
Normal file
@@ -0,0 +1,747 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _api:
|
||||
|
||||
API
|
||||
###
|
||||
|
||||
Chill provides a basic framework to build REST api.
|
||||
|
||||
Basic configuration
|
||||
*******************
|
||||
|
||||
Configure a route
|
||||
=================
|
||||
|
||||
Follow those steps to build a REST api:
|
||||
|
||||
1. Create your model;
|
||||
2. Configure the API;
|
||||
|
||||
You can also:
|
||||
|
||||
* hook into the controller to customize some steps;
|
||||
* add more route and steps
|
||||
|
||||
.. note::
|
||||
|
||||
Useful links:
|
||||
|
||||
* `How to use annotation to configure serialization <https://symfony.com/doc/current/serializer.html>`_
|
||||
* `How to create your custom normalizer <https://symfony.com/doc/current/serializer/custom_normalizer.html>`_
|
||||
|
||||
Auto-loading the routes
|
||||
=======================
|
||||
|
||||
Ensure that those lines are present in your file `app/config/routing.yml`:
|
||||
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_cruds:
|
||||
resource: 'chill_main_crud_route_loader:load'
|
||||
type: service
|
||||
|
||||
|
||||
Create your model
|
||||
=================
|
||||
|
||||
Create your model on the usual way:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\OriginRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass=OriginRepository::class)
|
||||
* @ORM\Table(name="chill_person_accompanying_period_origin")
|
||||
*/
|
||||
class Origin
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="date_immutable", nullable=true)
|
||||
*/
|
||||
private $noActiveAfter;
|
||||
|
||||
// .. getters and setters
|
||||
|
||||
}
|
||||
|
||||
|
||||
Configure api
|
||||
=============
|
||||
|
||||
Configure the api using Yaml (see the full configuration: :ref:`api_full_configuration`):
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/packages/chill_main.yaml
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/accompanying-period/origin'
|
||||
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
|
||||
name: accompanying_period_origin
|
||||
base_role: 'ROLE_USER'
|
||||
actions:
|
||||
_index:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
|
||||
.. note::
|
||||
|
||||
If you are working on a shared bundle (aka "The chill bundles"), you should define your configuration inside the class :code:`ChillXXXXBundleExtension`, using the "prependConfig" feature:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Class ChillPersonExtension
|
||||
* Loads and manages your bundle configuration
|
||||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
||||
* @package Chill\PersonBundle\DependencyInjection
|
||||
*/
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependCruds($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
protected function prependCruds(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'apis' => [
|
||||
[
|
||||
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class,
|
||||
'name' => 'accompanying_period_origin',
|
||||
'base_path' => '/api/1.0/person/accompanying-period/origin',
|
||||
'controller' => \Chill\PersonBundle\Controller\OpeningApiController::class,
|
||||
'base_role' => 'ROLE_USER',
|
||||
'actions' => [
|
||||
'_index' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true
|
||||
],
|
||||
],
|
||||
'_entity' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
The :code:`_index` and :code:`_entity` action
|
||||
*********************************************
|
||||
|
||||
The :code:`_index` and :code:`_entity` action are default actions:
|
||||
|
||||
* they will call a specific method in the default controller;
|
||||
* they will generate defined routes:
|
||||
|
||||
Index:
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__index`
|
||||
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin.{_format}`
|
||||
|
||||
Entity:
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__entity`
|
||||
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin/{id}.{_format}`
|
||||
|
||||
Role
|
||||
****
|
||||
|
||||
By default, the key `base_role` is used to check ACL. Take care of creating the :code:`Voter` required to take that into account.
|
||||
|
||||
For index action, the role will be called with :code:`NULL` as :code:`$subject`. The retrieved entity will be the subject for single queries.
|
||||
|
||||
You can also define a role for each method. In this case, this role is used for the given method, and, if any, the base role is taken into account.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/packages/chill_main.yaml
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/bla/bla'
|
||||
class: 'Chill\PersonBundle\Entity\Blah'
|
||||
name: bla
|
||||
actions:
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
roles:
|
||||
GET: MY_ROLE_SEE
|
||||
HEAD: MY ROLE_SEE
|
||||
|
||||
Customize the controller
|
||||
************************
|
||||
|
||||
You can customize the controller by hooking into the default actions. Take care of extending :code:`Chill\MainBundle\CRUD\Controller\ApiController`.
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class OpeningApiController extends ApiController
|
||||
{
|
||||
protected function customizeQuery(string $action, Request $request, $qb): void
|
||||
{
|
||||
$qb->where($qb->expr()->gt('e.noActiveAfter', ':now'))
|
||||
->orWhere($qb->expr()->isNull('e.noActiveAfter'));
|
||||
$qb->setParameter('now', new \DateTime('now'));
|
||||
}
|
||||
}
|
||||
|
||||
And set your controller in configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/accompanying-period/origin'
|
||||
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
|
||||
name: accompanying_period_origin
|
||||
# add a controller
|
||||
controller: 'Chill\PersonBundle\Controller\OpeningApiController'
|
||||
base_role: 'ROLE_USER'
|
||||
actions:
|
||||
_index:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
_entity:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
|
||||
Create your own actions
|
||||
***********************
|
||||
|
||||
You can add your own actions:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
# add a custom participation:
|
||||
participation:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
single-collection: single
|
||||
|
||||
The key :code:`single-collection` with value :code:`single` will add a :code:`/{id}/ + "action name"` (in this example, :code:`/{id}/participation`) into the path, after the base path. If the value is :code:`collection`, no id will be set, but the action name will be append to the path.
|
||||
|
||||
Then, create the corresponding action into your controller:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
protected ValidatorInterface $validator;
|
||||
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher, $validator)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
public function participationApi($id, Request $request, $_format)
|
||||
{
|
||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||
$accompanyingPeriod = $this->getEntity('participation', $id, $request);
|
||||
$person = $this->getSerializer()
|
||||
->deserialize($request->getContent(), Person::class, $_format, []);
|
||||
|
||||
if (NULL === $person) {
|
||||
throw new BadRequestException('person id not found');
|
||||
}
|
||||
|
||||
$this->onPostCheckACL('participation', $request, $accompanyingPeriod, $_format);
|
||||
|
||||
switch ($request->getMethod()) {
|
||||
case Request::METHOD_POST:
|
||||
$participation = $accompanyingPeriod->addPerson($person);
|
||||
break;
|
||||
case Request::METHOD_DELETE:
|
||||
$participation = $accompanyingPeriod->removePerson($person);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("This method is not supported");
|
||||
}
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
|
||||
if ($errors->count() > 0) {
|
||||
// only format accepted
|
||||
return $this->json($errors);
|
||||
}
|
||||
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->json($participation);
|
||||
}
|
||||
}
|
||||
|
||||
Managing association
|
||||
********************
|
||||
|
||||
ManyToOne association
|
||||
=====================
|
||||
|
||||
In ManyToOne association, you can add associated entities using the :code:`PATCH` request. By default, the serializer deserialize entities only with their id and discriminator type, if any.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
curl -X 'PATCH' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2668.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
# see the data sent to the server: \
|
||||
-d '{
|
||||
"type": "accompanying_period",
|
||||
"id": 2668,
|
||||
"origin": { "id": 11 }
|
||||
}'
|
||||
|
||||
ManyToMany associations
|
||||
=======================
|
||||
|
||||
In OneToMany association, you can easily create route for adding and removing entities, using :code:`POST` and :code:`DELETE` requests.
|
||||
|
||||
Prepare your entity, creating the methods :code:`addYourEntity` and :code:`removeYourEntity`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriod Class
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="chill_person_accompanying_period")
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "accompanying_period"=AccompanyingPeriod::class
|
||||
* })
|
||||
*/
|
||||
class AccompanyingPeriod
|
||||
{
|
||||
/**
|
||||
* @var Collection
|
||||
* @ORM\ManyToMany(
|
||||
* targetEntity=Scope::class,
|
||||
* cascade={}
|
||||
* )
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $scopes;
|
||||
|
||||
public function addScope(Scope $scope): self
|
||||
{
|
||||
$this->scopes[] = $scope;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeScope(Scope $scope): void
|
||||
{
|
||||
$this->scopes->removeElement($scope);
|
||||
}
|
||||
|
||||
|
||||
Create your route into the configuration:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
scope:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
PATCH: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
PATCH: null
|
||||
controller_action: null
|
||||
path: null
|
||||
single-collection: single
|
||||
|
||||
This will create a new route, which will accept two methods: DELETE and POST:
|
||||
|
||||
.. code-block:: raw
|
||||
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Property | Value |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Route Name | chill_api_single_accompanying_course_scope |
|
||||
| Path | /api/1.0/person/accompanying-course/{id}/scope.{_format} |
|
||||
| Path Regex | {^/api/1\.0/person/accompanying\-course/(?P<id>[^/]++)/scope\.(?P<_format>[^/]++)$}sD |
|
||||
| Host | ANY |
|
||||
| Host Regex | |
|
||||
| Scheme | ANY |
|
||||
| Method | POST|DELETE |
|
||||
| Requirements | {id}: \d+ |
|
||||
| Class | Symfony\Component\Routing\Route |
|
||||
| Defaults | _controller: csapi_accompanying_course_controller:scopeApi |
|
||||
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
Then, create the controller action. Call the method:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
|
||||
class MyController extends ApiController
|
||||
{
|
||||
public function scopeApi($id, Request $request, string $_format): Response
|
||||
{
|
||||
return $this->addRemoveSomething('scope', $id, $request, $_format, 'scope', Scope::class, [ 'groups' => [ 'read' ] ]);
|
||||
}
|
||||
}
|
||||
|
||||
This will allow to add a scope by his id, and delete them.
|
||||
|
||||
Curl requests:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# add a scope with id 5
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2868/scope.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"type": "scope",
|
||||
"id": 5
|
||||
}'
|
||||
|
||||
# remove a scope with id 5
|
||||
curl -X 'DELETE' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2868/scope.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"id": 5,
|
||||
"type": "scope"
|
||||
}'
|
||||
|
||||
Deserializing an association where multiple types are allowed
|
||||
=============================================================
|
||||
|
||||
Sometimes, multiples types are allowed as association to one entity:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
class Resource
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $thirdParty;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $person;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $resource Person|ThirdParty
|
||||
*/
|
||||
public function setResource($resource): self
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ThirdParty|Person
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->person ?? $this->thirdParty;
|
||||
}
|
||||
}
|
||||
|
||||
This is not well taken into account by the Symfony serializer natively.
|
||||
|
||||
You must, then, create your own CustomNormalizer. You can help yourself using this:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ResourceRepository;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||
|
||||
|
||||
class AccompanyingPeriodResourceNormalizer implements DenormalizerInterface, DenormalizerAwareInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
use ObjectToPopulateTrait;
|
||||
|
||||
public function __construct(ResourceRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function denormalize($data, string $type, string $format = null, array $context = [])
|
||||
{
|
||||
// .. snipped for brevity
|
||||
|
||||
if ($resource === NULL) {
|
||||
$resource = new Resource();
|
||||
}
|
||||
|
||||
if (\array_key_exists('resource', $data)) {
|
||||
$res = $this->denormalizer->denormalize(
|
||||
$data['resource'],
|
||||
// call for a "multiple type"
|
||||
DiscriminatedObjectDenormalizer::TYPE,
|
||||
$format,
|
||||
// into the context, we add the list of allowed types:
|
||||
[
|
||||
DiscriminatedObjectDenormalizer::ALLOWED_TYPES =>
|
||||
[
|
||||
Person::class, ThirdParty::class
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$resource->setResource($res);
|
||||
}
|
||||
|
||||
return $resource;
|
||||
}
|
||||
|
||||
|
||||
public function supportsDenormalization($data, string $type, string $format = null)
|
||||
{
|
||||
return $type === Resource::class;
|
||||
}
|
||||
}
|
||||
|
||||
Serialization for collection
|
||||
****************************
|
||||
|
||||
A specific model has been defined for returning collection:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"count": 49,
|
||||
"results": [
|
||||
],
|
||||
"pagination": {
|
||||
"more": true,
|
||||
"next": "/api/1.0/search.json&q=xxxx......&page=2",
|
||||
"previous": null,
|
||||
"first": 0,
|
||||
"items_per_page": 1
|
||||
}
|
||||
}
|
||||
|
||||
Where this is relevant, this model should be re-used in custom controller actions.
|
||||
|
||||
In custom actions, this can be achieved quickly by assembling results into a :code:`Chill\MainBundle\Serializer\Model\Collection`. The pagination information is given by using :code:`Paginator` (see :ref:`Pagination <pagination-ref>`).
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
|
||||
class MyController extends AbstractController
|
||||
{
|
||||
|
||||
protected function serializeCollection(PaginatorInterface $paginator, $entities): Response
|
||||
{
|
||||
$model = new Collection($entities, $paginator);
|
||||
|
||||
return $this->json($model, Response::HTTP_OK, [], $context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.. _api_full_configuration:
|
||||
|
||||
Full configuration example
|
||||
**************************
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
name: accompanying_course
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
_entity:
|
||||
roles:
|
||||
GET: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
HEAD: null
|
||||
POST: null
|
||||
DELETE: null
|
||||
PUT: null
|
||||
controller_action: null
|
||||
path: null
|
||||
single-collection: single
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
POST: false
|
||||
DELETE: false
|
||||
PUT: false
|
||||
participation:
|
||||
methods:
|
||||
POST: true
|
||||
DELETE: true
|
||||
GET: false
|
||||
HEAD: false
|
||||
PUT: false
|
||||
roles:
|
||||
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
|
||||
GET: null
|
||||
HEAD: null
|
||||
PUT: null
|
||||
controller_action: null
|
||||
# the requirements for the route. Will be set to `[ 'id' => '\d+' ]` if left empty.
|
||||
requirements: []
|
||||
path: null
|
||||
single-collection: single
|
||||
base_role: null
|
||||
|
||||
|
104
docs/source/development/assets.rst
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _forms:
|
||||
|
||||
Assets
|
||||
#######
|
||||
|
||||
The Chill assets (js, css, images, …) can be managed by `Webpack Encore`_, which is a thin wrapper for `Webpack`_ in Symfony applications.
|
||||
|
||||
Installation
|
||||
************
|
||||
|
||||
Webpack Encore needs to be run in a Node.js environment, using the Yarn package manager. This Node.js environment can be set up using a node docker image. The bash script `docker-node.sh` set up a Node.js environment with an adequate configuration. Launch this container by typing:
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ bash docker-node.sh
|
||||
|
||||
In this NodeJS environment, install all the assets required by Chill with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn install
|
||||
|
||||
This command will install all the packages that are listed in `package.json`.
|
||||
|
||||
Any further required dependencies can be installed using the Yarn package. For instance, jQuery is installed by:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn add jquery --dev
|
||||
|
||||
|
||||
Usage
|
||||
*****
|
||||
|
||||
Organize your assets
|
||||
--------------------
|
||||
|
||||
Chill assets usually lives under the `/Resources/public` folder of each Chill bundle. The Webpack configuration set up in `webpack.config.js` automatically loads the required assets from the Chill bundles that are used.
|
||||
|
||||
For adding your own assets to Webpack, you must add an entry in the `webpack.config.js` file. For instance, the following entry will output a file `main.js` collecting the js code (and possibly css, image, etc.) from `./assets/main.js`.
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
.addEntry('main', './assets/main.js')
|
||||
|
||||
To gather the css files, simply connect them to your js file, using `require`. The css file is seen as a dependency of your js file. :
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// assets/js/main.js
|
||||
require('../css/app.css');
|
||||
|
||||
For finer configuration of webpack encore, we refer to the above-linked documentation.
|
||||
|
||||
|
||||
Compile the assets
|
||||
------------------
|
||||
|
||||
To compile the assets, run this line in the NodeJS container:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn run encore dev
|
||||
|
||||
While developing, you can tell Webpack Encore to continuously watch the files you are modifying:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn run encore dev --watch
|
||||
|
||||
|
||||
Use the assets in the templates
|
||||
--------------------------------
|
||||
|
||||
Any entry defined in the webpack.config.js file can be linked to your application using the symfony `asset` helper:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<head>
|
||||
...
|
||||
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
<script src="{{ asset('build/app.js') }}"></script>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore
|
||||
.. _Webpack: https://webpack.js.org/
|
34
docs/source/development/create-a-new-bundle.rst
Normal file
@@ -0,0 +1,34 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _create-new-bundle:
|
||||
|
||||
Create a new bundle
|
||||
*******************
|
||||
|
||||
Create your own bundle is not a trivial task.
|
||||
|
||||
The easiest way to achieve this is seems to be :
|
||||
|
||||
1. Prepare a fresh installation of the chill project, in a new directory
|
||||
2. Create a new bundle in this project, in the src directory
|
||||
3. Initialize a git repository **at the root bundle**, and create your initial commit.
|
||||
4. Register the bundle with composer/packagist. If you do not plan to distribute your bundle with packagist, you may use a custom repository for achieve this [#f1]_
|
||||
5. Move to a development installation, made as described in the :ref:`installation-for-development` section, and add your new repository to the composer.json file
|
||||
6. Work as :ref:`usual <editing-code-and-commiting>`
|
||||
|
||||
.. warning::
|
||||
|
||||
This part of the doc is not yet tested
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
.. [#f1] Be aware that we use the Affero GPL Licence, which ensure that all users must have access to derivative works done with this software.
|
522
docs/source/development/crud.rst
Normal file
@@ -0,0 +1,522 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _crud:
|
||||
|
||||
CRUD
|
||||
####
|
||||
|
||||
Chill provide an API to create a basic CRUD.
|
||||
|
||||
One can follow those steps to create a CRUD for one entity:
|
||||
|
||||
1. create your model and your form ;
|
||||
2. configure the crud ;
|
||||
3. customize the templates if required ;
|
||||
4. customize some steps of the controller if required ;
|
||||
|
||||
|
||||
An example with the ``ClosingMotive`` (PersonBundle) in the admin part of Chill:
|
||||
|
||||
Auto-loading the routes
|
||||
***********************
|
||||
|
||||
Ensure that those lines are present in your file `app/config/routing.yml`:
|
||||
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_cruds:
|
||||
resource: 'chill_main_crud_route_loader:load'
|
||||
type: service
|
||||
|
||||
|
||||
|
||||
Create your model
|
||||
*****************
|
||||
|
||||
Create your model on the usual way (in this example, ORM informations are stored in yaml file):
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* ClosingMotive give an explanation why we closed the Accompanying period
|
||||
*/
|
||||
class ClosingMotive
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var self
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
/**
|
||||
* child Accompanying periods
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $ordering = 0.0;
|
||||
|
||||
|
||||
// getters and setters come here
|
||||
|
||||
}
|
||||
|
||||
The form:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\PersonBundle\Form\Type\ClosingMotivePickerType;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
class ClosingMotiveType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class, [
|
||||
'label' => 'Nom'
|
||||
])
|
||||
->add('active', CheckboxType::class, [
|
||||
'label' => 'Actif ?',
|
||||
'required' => false
|
||||
])
|
||||
->add('ordering', NumberType::class, [
|
||||
'label' => 'Ordre d\'apparition',
|
||||
'required' => true,
|
||||
'scale' => 5
|
||||
])
|
||||
->add('parent', ClosingMotivePickerType::class, [
|
||||
'label' => 'Parent',
|
||||
'required' => false,
|
||||
'placeholder' => 'closing_motive.any parent',
|
||||
'multiple' => false,
|
||||
'only_leaf' => false
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('class', \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Configure the crud
|
||||
******************
|
||||
|
||||
The crud is configured using the key ``crud`` under ``chill_main``
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
cruds:
|
||||
-
|
||||
# the class which is concerned by the CRUD
|
||||
class: '\Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class'
|
||||
# give a name for the crud. This will be used internally
|
||||
name: closing_motive
|
||||
# add a base path for the
|
||||
base_path: /admin/closing-motive
|
||||
# this is the form class
|
||||
form_class: 'Chill\PersonBundle\Form\ClosingMotiveType::class'
|
||||
# you can override the controller to configure some parts
|
||||
# if you do not configure anything here, the default CRUDController will be used
|
||||
controller: 'Chill\PersonBundle\Controller\AdminClosingMotiveController::class'
|
||||
# this is a list of action you can configure
|
||||
# by default, the actions `index`, `view`, `new` and `edit` are automatically create
|
||||
# you can add more actions or configure some details about them
|
||||
actions:
|
||||
index:
|
||||
# the default template for index is very poor,
|
||||
# you will need to override it
|
||||
template: '@ChillPerson/ClosingMotive/index.html.twig'
|
||||
# the role required for this role
|
||||
role: ROLE_ADMIN
|
||||
new:
|
||||
role: ROLE_ADMIN
|
||||
# by default, the template will only show the form
|
||||
# you can override it
|
||||
template: '@ChillPerson/ClosingMotive/new.html.twig'
|
||||
edit:
|
||||
role: ROLE_ADMIN
|
||||
template: '@ChillPerson/ClosingMotive/edit.html.twig'
|
||||
|
||||
To leave the bundle auto-configure the ``chill_main`` bundle, you can `prepend the configuration of the ChillMain Bundle <https://symfony.com/doc/current/bundles/prepend_extension.html>`_:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
// skipped here
|
||||
}
|
||||
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependCruds($container);
|
||||
}
|
||||
|
||||
protected function prependCruds(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'cruds' => [
|
||||
[
|
||||
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class,
|
||||
'name' => 'closing_motive',
|
||||
'base_path' => '/admin/closing-motive',
|
||||
'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class,
|
||||
'controller' => \Chill\PersonBundle\Controller\AdminClosingMotiveController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'template' => '@ChillPerson/ClosingMotive/index.html.twig',
|
||||
'role' => 'ROLE_ADMIN'
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/ClosingMotive/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillPerson/ClosingMotive/edit.html.twig',
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Customize templates
|
||||
*******************
|
||||
|
||||
The current template are quite basic. You can override and extends them.
|
||||
|
||||
For a better inclusion, you can embed them instead of extending them.
|
||||
|
||||
For index. Note that we extend here the `admin` layout, not the default one:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
||||
{# we customize the table headers #}
|
||||
{% block table_entities_thead_tr %}
|
||||
<th>{{ 'Ordering'|trans }}</th>
|
||||
<th>{{ 'Label'|trans }}</th>
|
||||
<th>{{ 'Active'|trans }}</th>
|
||||
<th> </th>
|
||||
{% endblock %}
|
||||
|
||||
{% block table_entities_tbody %}
|
||||
{# we customize the content of the table #}
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td>{{ entity.ordering }}</td>
|
||||
<td>{{ entity|chill_entity_render_box }}</td>
|
||||
<td>{{ entity.active }}</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_new', { 'parent_id': entity.id } ) }}" class="sc-button bt-new">{{ 'closing_motive.new child'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
|
||||
For edit template:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% as we are in the admin layout, we override the admin content with the CRUD content %}
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{# we do not have "view" page. We empty the corresponding block #}
|
||||
{% block content_form_actions_view %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
|
||||
For new template:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block admin_content %}
|
||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
|
||||
Customize some steps in the controller
|
||||
**************************************
|
||||
|
||||
Some steps may be customized by overriding the default controller and some methods. Here, we will override the way the entity is created, and the ordering of the "index" page:
|
||||
|
||||
* we will associate a parent ClosingMotive to the element if a parameter `parent_id` is found ;
|
||||
* we will order the ClosingMotive by the ``ordering`` property
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
|
||||
/**
|
||||
* Controller for closing motives
|
||||
*
|
||||
*/
|
||||
class AdminClosingMotiveController extends CRUDController
|
||||
{
|
||||
protected function createEntity($action, Request $request): object
|
||||
{
|
||||
// we first create an entity "the usual way"
|
||||
$entity = parent::createEntity($action, $request);
|
||||
|
||||
if ($request->query->has('parent_id')) {
|
||||
// if we find the parent_id parameter, we add the corresponding
|
||||
// parent to the newly created entity
|
||||
$parentId = $request->query->getInt('parent_id');
|
||||
|
||||
$parent = $this->getDoctrine()->getManager()
|
||||
->getRepository($this->getEntityClass())
|
||||
->find($parentId);
|
||||
|
||||
if (NULL === $parent) {
|
||||
throw $this->createNotFoundException('parent id not found');
|
||||
}
|
||||
|
||||
$entity->setParent($parent);
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
// by default, the query is an instance of QueryBuilder
|
||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||
return $query->orderBy('e.ordering', 'ASC');
|
||||
}
|
||||
}
|
||||
|
||||
How-to and questions
|
||||
********************
|
||||
|
||||
Which role is required for each action ?
|
||||
========================================
|
||||
|
||||
By default, each action will use:
|
||||
|
||||
1. the role defined under the action key ;
|
||||
2. the base role as upper, with the action name appended:
|
||||
|
||||
Example: if the base role is ``CHILL_BUNDLE_ENTITY``, the role will become:
|
||||
|
||||
* ``CHILL_BUNDLE_ENTITY_VIEW`` for the ``view`` action ;
|
||||
* ``CHILL_BUNDLE_ENTITY_INDEX`` for the ``index`` action.
|
||||
|
||||
The entity will be passed to the role:
|
||||
|
||||
* for the ``view`` and ``edit`` action: the entity fetched from database
|
||||
* for the ``new`` action: the entity which is created (you can override default values using
|
||||
* for index action (or if you re-use the ``indexAction`` method: ``null``
|
||||
|
||||
How to add some route and actions ?
|
||||
===================================
|
||||
|
||||
Add them under the action key:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
cruds:
|
||||
-
|
||||
# snipped
|
||||
actions:
|
||||
myaction: ~
|
||||
|
||||
The method `myactionAction` will be called by the parameter.
|
||||
|
||||
Inside this action, you can eventually call another internal method:
|
||||
|
||||
* ``indexAction`` for a list of items ;
|
||||
* ``viewAction`` for a view
|
||||
* ``editFormAction`` for an edition
|
||||
* ``createFormAction`` for a creation
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace CSConnectes\SPBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use CSConnectes\SPBundle\Form\CSPersonPersonalSituationType;
|
||||
use CSConnectes\SPBundle\Form\CSPersonDispositifsType;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CSPersonController extends OneToOneEntityPersonCRUDController
|
||||
{
|
||||
public function personalSituationEdit(Request $request, $id)
|
||||
{
|
||||
return $this->formEditAction(
|
||||
'ps_situation_edit',
|
||||
$request,
|
||||
$id,
|
||||
CSPersonPersonalSituationType::class
|
||||
);
|
||||
}
|
||||
|
||||
public function personalSituationView(Request $request, $id): Response
|
||||
{
|
||||
return $this->viewAction('ps_situation_view', $request, $id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
How to create a CRUD for entities associated to persons
|
||||
=======================================================
|
||||
|
||||
The bundle person provide some controller and template you can override, instead of the ones present in the mainbundle:
|
||||
|
||||
* :code:`Chill\PersonBundle\CRUD\Controller\EntityPersonCRUDController` for entities linked with a one-to-may association to :code:`Person` class ;
|
||||
* :code:`Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController` for entities linked with a one-to-one association to :code:`Person` class.
|
||||
|
||||
There are also template defined under ``@ChillPerson/CRUD/`` namespace.
|
||||
|
||||
Those controller assume that:
|
||||
|
||||
* the entity provide the method :code:`getPerson` and :code:`setPerson` ;
|
||||
* the `index`'s id path will be the id of the person, and the ids in `view` and `edit` path will be the id of the entity ;
|
||||
|
||||
This bundle also use by default the templates inside ``@ChillPerson/CRUD/``.
|
||||
|
||||
|
||||
Reference
|
||||
*********
|
||||
|
||||
Configuration reference
|
||||
=======================
|
||||
|
||||
|
||||
.. code-block:: txt
|
||||
|
||||
chill_main:
|
||||
cruds:
|
||||
|
||||
# Prototype
|
||||
-
|
||||
class: ~ # Required
|
||||
controller: Chill\MainBundle\CRUD\Controller\CRUDController
|
||||
name: ~ # Required
|
||||
base_path: ~ # Required
|
||||
base_role: null
|
||||
form_class: null
|
||||
actions:
|
||||
|
||||
# Prototype
|
||||
name:
|
||||
|
||||
# the method name to call in the route. Will be set to the action name if left empty.
|
||||
controller_action: null # Example: 'action'
|
||||
|
||||
# the path that will be **appended** after the base path. Do not forget to add arguments for the method. Will be set to the action name, including an `{id}` parameter if left empty.
|
||||
path: null # Example: /{id}/my-action
|
||||
|
||||
# the requirements for the route. Will be set to `[ 'id' => '\d+' ]` if left empty.
|
||||
requirements: []
|
||||
|
||||
# the role that will be required for this action. Override option `base_role`
|
||||
role: null
|
||||
|
||||
# the template to render the view
|
||||
template: null
|
||||
|
||||
Twig default block
|
||||
==================
|
||||
|
||||
This part should be documented.
|
||||
|
121
docs/source/development/embeddable-comments.rst
Normal file
@@ -0,0 +1,121 @@
|
||||
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Embeddable comments
|
||||
###################
|
||||
|
||||
Those embeddable comments is a comment with some metadata:
|
||||
|
||||
* the one who updated the comment (the comment itself, and not the whole entity);
|
||||
* the date and time for the last update (again, the comment itself, and not the whole entity).
|
||||
|
||||
We make usage of `embeddables <https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/tutorials/embeddables.html>`_.
|
||||
|
||||
Embed the comment
|
||||
=================
|
||||
|
||||
The comment may be embedded into the entity:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class Activity
|
||||
*
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class Activity
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
}
|
||||
}
|
||||
|
||||
Note on relation to :class:`User`
|
||||
=================================
|
||||
|
||||
The embeddable proposed by Doctrine does not support relationship to other entities. The entity Comment is able to render a user's id, but not an User object.
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$activity->getComment()->getUserId(); // return user id of the last author
|
||||
|
||||
$activity->getComment()->getUser(); // does not work !
|
||||
|
||||
|
||||
Usage into form
|
||||
===============
|
||||
|
||||
Use the :class:`Chill\MainBundle\Form\Type\CommentType` to load the form widget:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ActivityBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('comment', CommentType::class, [
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Render the comment
|
||||
==================
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ activity.comment|chill_entity_render_box }}
|
||||
|
||||
|
244
docs/source/development/exports.rst
Normal file
@@ -0,0 +1,244 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Exports
|
||||
*******
|
||||
|
||||
Export is an important issue for the Chill software : users should be able to :
|
||||
|
||||
- compute statistics about their activity ;
|
||||
- list "things" which make part of their activities.
|
||||
|
||||
The `main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The issue where this framework was discussed <https://git.framasoft.org/Chill-project/Chill-Main/issues/9>`_
|
||||
Provides some information about the pursued features and architecture.
|
||||
|
||||
Concepts
|
||||
========
|
||||
|
||||
|
||||
Some vocabulary: 3 "Export elements"
|
||||
------------------------------------
|
||||
|
||||
Four terms are used for this framework :
|
||||
|
||||
exports
|
||||
provides some basic operation on the date. Two kind of exports are available :
|
||||
|
||||
- computed data : it may be "the number of people", "the number of activities", "the duration of activities", ...
|
||||
- list data : it may be "the list of people", "the list of activity", ...
|
||||
|
||||
filters
|
||||
The filters make a filter on the date: it removes some information the user doesn't want to introduce in the computation done by export. In other word, filters make a filter...
|
||||
|
||||
Example of filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ...
|
||||
|
||||
aggregators
|
||||
The aggregator aggregates the data into some group (some software use the term 'bucket').
|
||||
|
||||
Example of aggregator : "group people by gender", "group people by nationality", "group activity by type", ...
|
||||
|
||||
formatters
|
||||
The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client.
|
||||
|
||||
Example of formatter: "format data as CSV", "format data as ods spreadsheet", ...
|
||||
|
||||
Anatomy of an export
|
||||
---------------------
|
||||
|
||||
An export may be explained as a sentence, where each part of this sentence refers to one or multiple exports element. Examples :
|
||||
|
||||
**Example 1**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender, and format them in a CSV spreadsheet.
|
||||
|
||||
Here :
|
||||
|
||||
- *count the number of people* is the export part
|
||||
- *having at least one activity* is the filter part
|
||||
- *group them by nationality* is the aggregator part
|
||||
- *group them by gender* is a second aggregator part
|
||||
- *format the date in a CSV spreadsheet* is the formatter part
|
||||
|
||||
Note that :
|
||||
|
||||
- aggregators, filters, exports and aggregators are cross-bundle. Here the bundle *activity* provides a filter which apply on an export provided by the person bundle ;
|
||||
- there may exists multiple aggregator or filter for one export. Currently, only one export is allowed.
|
||||
|
||||
The result might be :
|
||||
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| Nationality | Gender | Number of people |
|
||||
+=======================+================+===========================+
|
||||
| Russian | Male | 12 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| Russian | Female | 24 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| France | Male | 110 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| France | Female | 150 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
|
||||
**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in a OpenDocument spreadsheet.
|
||||
|
||||
Here :
|
||||
|
||||
- *count the average duration of an activity* is the export part
|
||||
- *activity with type meeting* is a filter part
|
||||
- *activity which occurs between the 1st of June and the 31st of December* is a filter
|
||||
- *group them by week* is the aggregator part
|
||||
- *format the date in an OpenDocument spreadsheet* is the formatter part
|
||||
|
||||
The result might be :
|
||||
|
||||
+-----------------------+----------------------+
|
||||
| Week | Number of activities |
|
||||
+=======================+======================+
|
||||
| 2015-10 | 10 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-11 | 12 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-12 | 10 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-13 | 9 |
|
||||
+-----------------------+----------------------+
|
||||
|
||||
Authorization and exports
|
||||
-------------------------
|
||||
|
||||
Exports, filters and aggregators should not make see data the user is not allowed to see.
|
||||
|
||||
In other words, developers are required to take care of user authorization for each export.
|
||||
|
||||
It should exists a special role that should be granted to users which are allowed to build exports. For more simplicity, this role should apply on center, and should not requires special circles.
|
||||
|
||||
How does the magic works ?
|
||||
===========================
|
||||
|
||||
To build an export, we rely on the capacity of the database to execute queries with aggregate (i.e. GROUP BY) and filter (i.e. WHERE) instructions.
|
||||
|
||||
An export is an SQL query which is initiated by an export, and modified by aggregators and filters.
|
||||
|
||||
.. note::
|
||||
|
||||
**Example**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender
|
||||
|
||||
1. The report initiate the query
|
||||
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
|
||||
2. The filter add a where and join clause :
|
||||
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
|
||||
3. The aggregator "nationality" add a GROUP BY clause and a column in the SELECT statement:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality
|
||||
|
||||
4. The aggregator "gender" do the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement :
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, people.gender, count(people.*)
|
||||
FROM people RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality, gender
|
||||
|
||||
Each filter, aggregator and filter may collect parameters from the user by providing a form. This form is appended to the export form. Here is an example.
|
||||
|
||||
.. figure:: /_static/screenshots/development/export_form-fullpage.png
|
||||
|
||||
The screenshot show the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which allow to show a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other filter, which are unchecked, does not show the subform.
|
||||
|
||||
Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also open a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
|
||||
|
||||
The Export Manager
|
||||
------------------
|
||||
|
||||
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which register all exports, aggregators, filters and formatters.
|
||||
|
||||
The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` to each export request.
|
||||
|
||||
|
||||
The export form step
|
||||
--------------------
|
||||
|
||||
The form step allow to build a form, aggregating different parts of the module.
|
||||
|
||||
The building of forms is separated between different subform, which are responsible for rendering their part of the form (aggregators, filters, and export).
|
||||
|
||||
.. figure:: /_static/puml/exports/form_steps.png
|
||||
:scale: 40%
|
||||
|
||||
The formatter form step
|
||||
-----------------------
|
||||
|
||||
The formatter form is processed *after* the user filled the export form. It is built the same way, but receive in parameters the data entered by the user on the previous step (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators).
|
||||
|
||||
Processing the export
|
||||
---------------------
|
||||
|
||||
The export process may be explained by this schema :
|
||||
|
||||
.. figure:: /_static/puml/exports/processing_export.png
|
||||
:scale: 40%
|
||||
|
||||
(Click to enlarge)
|
||||
|
||||
|
||||
Export, formatters and filters explained
|
||||
========================================
|
||||
|
||||
Exports
|
||||
-------
|
||||
|
||||
This is an example of the ``CountPerson`` export :
|
||||
|
||||
.. literalinclude:: /_static/code/exports/CountPerson.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
* **Line 36**: the ``getType`` function return a string. This string will be used to find the aggregtors and filters which will apply to this export.
|
||||
* **Line 41**: a simple description to help user to understand what your export does.
|
||||
* **Line 46**: The title of the export. A summary of what your export does.
|
||||
* **Line 51**: The list of roles requires to execute this export.
|
||||
* **Line 56**: We initiate the query here...
|
||||
* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` object in one array
|
||||
* **Line 63**: We create the query, with a query builder.
|
||||
* **Line 74**: We simply returns the result, but take care of hydrating the results as an array.
|
||||
* **Line 103**: return the list of formatters types which are allowed to apply on this filter
|
||||
|
||||
Filters
|
||||
-------
|
||||
|
||||
This is an example of the *filter by birthdate*. This filter ask some information in a form (`buildForm` is not empty), and this form must be validated. To performs this validations, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`:
|
||||
|
||||
.. literalinclude:: /_static/code/exports/BirthdateFilter.php
|
||||
:language: php
|
||||
|
||||
.. todo::
|
||||
|
||||
Continue to explain the export framework
|
||||
|
||||
.. _main bundle: https://git.framasoft.org/Chill-project/Chill-Main
|
42
docs/source/development/forms.rst
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _forms:
|
||||
|
||||
Forms and form types
|
||||
####################
|
||||
|
||||
Date picker
|
||||
***********
|
||||
|
||||
Class
|
||||
:class:`Chill\MainBundle\Form\Type\ChillDateType`
|
||||
Extend
|
||||
:class:`Symfony\Component\Form\Extension\Core\Type\DateType`
|
||||
|
||||
|
||||
Usage :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
|
||||
$builder->add('date' ChillDateType::class);
|
||||
|
||||
Text editor
|
||||
***********
|
||||
|
||||
Add a text editor (by default).
|
||||
|
||||
Class
|
||||
:class:`Chill\MainBundle\Form\Type\ChillTextareaType`
|
||||
Options
|
||||
* :code:`disable_editor` to disable text editor
|
||||
|
||||
|
54
docs/source/development/index.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Development
|
||||
###########
|
||||
|
||||
As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and things we provide to encounter our needs.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Instructions to create a new bundle <create-a-new-bundle.rst>
|
||||
CRUD (Create - Update - Delete) for one entity <crud.rst>
|
||||
Helpers for building a REST API <api.rst>
|
||||
Routing <routing.rst>
|
||||
Menus <menus.rst>
|
||||
Forms <forms.rst>
|
||||
Access control model <access_control_model.rst>
|
||||
Messages to users <messages-to-users.rst>
|
||||
Pagination <pagination.rst>
|
||||
Localisation <localisation.rst>
|
||||
Logging <logging.rst>
|
||||
Database migrations <migrations.rst>
|
||||
Searching <searching.rst>
|
||||
Timelines <timelines.rst>
|
||||
Exports <exports.rst>
|
||||
Embeddable comments <embeddable-comments.rst>
|
||||
Run tests <run-tests.rst>
|
||||
Useful snippets <useful-snippets.rst>
|
||||
manual/index.rst
|
||||
Assets <assets.rst>
|
||||
|
||||
Layout and UI
|
||||
**************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Render entities automatically <render-entity.rst>
|
||||
Layout / Template usage <user-interface/layout-template-usage.rst>
|
||||
Classes and mixins <user-interface/css-classes.rst>
|
||||
Widgets <user-interface/widgets.rst>
|
||||
Javascript function <user-interface/js-functions.rst>
|
||||
|
||||
|
||||
Help, I am lost !
|
||||
*****************
|
||||
|
||||
Write an email at info@champs-libres.coop, and we will help you !
|
49
docs/source/development/localisation.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Localisation
|
||||
*************
|
||||
|
||||
Language in url
|
||||
===============
|
||||
|
||||
Language should be present in URL, conventionnaly as first argument.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
/fr/your/url/here
|
||||
|
||||
This allow users to change from one language to another one on each page, which may be useful in multilanguages teams. If the installation is single-language, the language switcher will not appears.
|
||||
|
||||
This is an example of routing defined in yaml :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_general_edit:
|
||||
pattern: /{_locale}/person/{person_id}/general/edit
|
||||
defaults: {_controller: ChillPersonBundle:Person:edit }
|
||||
|
||||
|
||||
Date and time
|
||||
==============
|
||||
|
||||
The `Intl extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_ is enabled on the Chill application.
|
||||
|
||||
You may format date and time using the `localizeddate` function :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
date|localizeddate('long', 'none')
|
||||
|
||||
By default, we prefer using the `long` format for date formatting.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Documentation for Intl Extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_
|
||||
Read the complete doc for the Intl extension.
|
||||
|
50
docs/source/development/logging.rst
Normal file
@@ -0,0 +1,50 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Logging
|
||||
*******
|
||||
|
||||
.. seealso::
|
||||
|
||||
Symfony documentation: `How to user Monolog to write logs <http://symfony.com/doc/current/cookbook/logging/monolog.html>`_
|
||||
The symfony cookbook page about logging.
|
||||
|
||||
|
||||
A channel for custom logging has been created to store sensitive data.
|
||||
|
||||
The channel is named ``chill``.
|
||||
|
||||
The installer of chill should be aware that this channel may contains sensitive data and encrypted during backup.
|
||||
|
||||
Logging to channel `chill`
|
||||
============================
|
||||
|
||||
You should use the service named ``chill.main.logger``, as this :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$logger = $this->get('chill.main.logger');
|
||||
|
||||
You should store data into context, not in the log himself, which should remains the same for the action.
|
||||
|
||||
Example of usage :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$logger->info("An action has been performed about a person", array(
|
||||
'person_lastname' => $person->getLastName(),
|
||||
'person_firstname' => $person->getFirstName(),
|
||||
'person_id' => $person->getId(),
|
||||
'by_user' => $user->getUsername()
|
||||
));
|
||||
|
||||
For further processing, it is a good idea to separate all fields (like firstname, lastname, ...) into different context keys.
|
||||
|
||||
By convention, you should store the username of the user performing the action under the ``by_user`` key.
|
||||
|
17
docs/source/development/manual/index.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Developer manual
|
||||
*****************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
routing-and-menus.rst
|
||||
|
||||
|
143
docs/source/development/manual/routing-and-menus.rst
Normal file
@@ -0,0 +1,143 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Routing and menus
|
||||
*****************
|
||||
|
||||
|
||||
The *Chill*'s architecture allows to choose bundle on each installation. This may lead to a huge diversity of installations, and a the developper challenge is to make his code working with all those possibles installations.
|
||||
|
||||
*Chill* uses menus to let users access easily to the most used functionalities. For instance, when you land on a "Person" page, you may access directly to his activities, notes, documents, ... in a single click on a side menu.
|
||||
|
||||
For a developer, it is easy to extend this menu with his own entries.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Symfony documentation about routing <http://symfony.com/doc/current/book/routing.html>`_
|
||||
This documentation should be read before diving into those lines
|
||||
|
||||
`Routes dans Chill <https://redmine.champs-libres.coop/issues/179>`_ (FR)
|
||||
The issue where we discussed routes. In French.
|
||||
|
||||
Create routes
|
||||
==============
|
||||
|
||||
.. note::
|
||||
|
||||
We recommand using `yaml` to define routes. We have not tested the existing other ways to create routes (annotations, ...). Help wanted.
|
||||
|
||||
The first step is as easy as create a route in symfony, and add some options in his description :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main_dummy_0:
|
||||
pattern: /dummy/{personId}
|
||||
defaults: { _controller: CLChillMainBundle:Default:index }
|
||||
options:
|
||||
#we begin menu information here :
|
||||
menus:
|
||||
foo: #must appears in menu named 'foo'
|
||||
order: 500 #the order will be '500'
|
||||
label: foolabel #the label shown on menu. Will be translated
|
||||
otherkey: othervalue #you may add other informations, as needed by your layout
|
||||
bar: #must also appears in menu named 'bar'
|
||||
order: 500
|
||||
label: barlabel
|
||||
|
||||
The mandatory parameters under the `menus` definition are :
|
||||
|
||||
* `name`: the menu's name, defined as an key for the following entries
|
||||
* `order`. Note: if we have duplicate order's values, the order will be incremented. We recommand using big intervals within orders and publishing the orders in your documentation
|
||||
* `label`: the text which will be rendered inside the `<a>` tag. The label should be processed trough the `trans` filter (`{{ route.label|trans }}`)
|
||||
|
||||
You *may* also add other keys, which will be used optionally in the way the menu is rendered. See
|
||||
|
||||
.. warning::
|
||||
|
||||
Although all keys will be kept from your `yaml` definition to your menu template, we recommend not using those keys, which are reserved for a future implementations of Chill :
|
||||
|
||||
* `helper`, a text to help user or add more informations to him
|
||||
* `access` : which will run a test with `Expression Langage <http://symfony.com/doc/current/components/expression_language/index.html>`_ to determine if the user has the ACL to show the menu entry ;
|
||||
* `condition`, which will test with the menu context if the entry must appears
|
||||
|
||||
Show menu in twig templates
|
||||
===========================
|
||||
|
||||
To show our previous menu in the twig template, we invoke the `chill_menu` function. This will render the `foo` menu :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo') }}
|
||||
|
||||
Passing variables
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
If your routes need arguments, i.e. an entity id, you should pass the as argument to the chill_menu function. If your route's pattern is `/person/{personId}`, your code become :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'args' : { 'personId' : person.id } } ) }}
|
||||
|
||||
Of course, `person` is a variable you must define in your code, which should have an `id` accessible property (i.e. : `$person->getId()`).
|
||||
|
||||
.. note::
|
||||
|
||||
Be aware that your arguments will be passed to all routes in a menu. If a route does not require `personId` in his pattern, the route will become `/pattern?personId=XYZ`. This should not cause problem in your application.
|
||||
|
||||
.. warning::
|
||||
|
||||
It is a good idea to reuse the same parameter's name in your pattern, to avoid collision. Prefer `/person/{personId}` to `/person/{id}`.
|
||||
|
||||
If you don't do that and another developer create a bundle with `person/{personId}/{id}` where `{id}` is the key for something else, this will cause a lot of trouble...
|
||||
|
||||
Rendering active entry
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Now, you want to render differently the *active* route of the menu [#f1]_. You should, in your controller or template, add the active route in your menu :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'activeRouteKey' : 'chill_main_dummy_0' } ) }}
|
||||
|
||||
On menu creation, the route wich has the key `chill_main_dummy_0` will be rendered on a different manner.
|
||||
|
||||
Define your own template
|
||||
-------------------------
|
||||
|
||||
By default, the menu is rendered with the default template, which is a simple `ul` list. You may create your own templates :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
#MyBundle/Resources/views/Menu/MyMenu.html.twig
|
||||
<ul class="myMenu">
|
||||
{% for route in routes %}
|
||||
<li><a href="{{ path(route.key, args ) }}" class="{%- if activeRouteKey == route.key -%}active{%- endif -%}">{{ route.label|trans }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Arguments available in your template :
|
||||
|
||||
* The `args` value are the value passed in the 'args' arguments requested by the `chill_menu` function.
|
||||
* `activeRouteKey` is the key of the currently active route.
|
||||
* `routes` is an array of routes. The array has this structure: `routes[order] = { 'key' : 'the_route_key', 'label' : 'the route label' }` The order is *resolved*: in case of collision (two routes from different bundles having the same order), the order will be incremented. You may find in the array your own keys (`{ 'otherkey' : 'othervalue'}` in the example above).
|
||||
|
||||
Then, you will call your own template with the `layout` argument :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'layout' : 'MyBundle:Menu:MyMenu.html.twig' } ) }}
|
||||
|
||||
.. note::
|
||||
|
||||
Take care of specifying the absolute path to layout in the function.
|
||||
|
||||
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
.. [#f1] In the default template, the currently active entry will be rendered with an "active" class : `<li class="active"> ... </li>`
|
123
docs/source/development/menus.rst
Normal file
@@ -0,0 +1,123 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
.. _menus :
|
||||
|
||||
Menus
|
||||
*****
|
||||
|
||||
Chill has created his own menu system
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Routes dans Chill [specification] <https://redmine.champs-libres.coop/issues/179>`_
|
||||
The issue wich discussed the implementation of routes.
|
||||
|
||||
Concepts
|
||||
========
|
||||
|
||||
.. warning::
|
||||
|
||||
to be written
|
||||
|
||||
|
||||
|
||||
Add a menu in a template
|
||||
========================
|
||||
|
||||
In your twig template, use the `chill_menu` function :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ chill_menu('person', {
|
||||
'layout': 'ChillPersonBundle::menu.html.twig',
|
||||
'args' : {'id': person.id },
|
||||
'activeRouteKey': 'chill_person_view'
|
||||
}) }}
|
||||
|
||||
The available arguments are:
|
||||
|
||||
* `layout` : a custom layout. Default to `ChillMainBundle:Menu:defaultMenu.html.twig`
|
||||
* `args` : those arguments will be passed through the url generator.
|
||||
* `activeRouteKey` must be the route key name.
|
||||
|
||||
.. note::
|
||||
|
||||
The argument `activeRouteKey` may be a twig variable, defined elsewhere in your template, even in child templates.
|
||||
|
||||
|
||||
|
||||
Create an entry in an existing menu
|
||||
===================================
|
||||
|
||||
If a route belongs to a menu, you simply add this to his definition in routing.yml :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_history_list:
|
||||
pattern: /person/{person_id}/history
|
||||
defaults: { _controller: ChillPersonBundle:History:list }
|
||||
options:
|
||||
#declare menus
|
||||
menus:
|
||||
# the route should be in 'person' menu :
|
||||
person:
|
||||
#and have those arguments :
|
||||
order: 100
|
||||
label: menu.person.history
|
||||
|
||||
* `order` (mandatory) : the order in the menu. It is preferrable to increment by far more than 1.
|
||||
* `label` (mandatory) : a translatable string.
|
||||
* `helper` (optional) : a text to help people to understand what does the menu do. Not used in default implementation.
|
||||
* `condition` (optional) : an `Expression Language <http://symfony.com/doc/current/components/expression_language/index.html> `_ which will make the menu appears or not. Typically, it may be used to say "show this menu only if the person concerned is more than 18". **Not implemented yet**.
|
||||
* `access` (optional) : an Expression Language to evalute the possibility, for the user, to show this menu according to Access Control Model. **Not implemented yet.**
|
||||
|
||||
You may add additional keys, but should not use the keys described above.
|
||||
|
||||
You may add the same route to multiple menus :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_history_list:
|
||||
pattern: /person/{person_id}/history
|
||||
defaults: { _controller: ChillPersonBundle:History:list }
|
||||
options:
|
||||
menus:
|
||||
menu1:
|
||||
order: 100
|
||||
label: menu.person.history
|
||||
menu2:
|
||||
order: 100
|
||||
label: another.label
|
||||
|
||||
|
||||
|
||||
Customize menu rendering
|
||||
========================
|
||||
|
||||
You may customize menu rendering by using the `layout` option.
|
||||
|
||||
.. warning ::
|
||||
|
||||
TODO : this part should be written.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. _caveats :
|
||||
|
||||
Caveats
|
||||
=======
|
||||
|
||||
Currently, you may pass arguments globally to each menu, and they will be all passed to route url. This means that :
|
||||
|
||||
* the argument name in the route entry must match the argument key in menu declaration in twig template
|
||||
* if an argument is missing to generate an url, the url generator will throw a `Symfony\Component\Routing\Exception\MissingMandatoryParametersException`
|
||||
* if the argument name is not declared in route entry, it will be added to the url, (example: `/my/route?additional=foo`)
|
129
docs/source/development/messages-to-users.rst
Normal file
@@ -0,0 +1,129 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Messages to users, flashbags and buttons
|
||||
****************************************
|
||||
|
||||
|
||||
.. _flashbags :
|
||||
|
||||
Flashbags
|
||||
==========
|
||||
|
||||
The four following levels are defined :
|
||||
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|Key |Intent |
|
||||
+===========+==============================================================================================+
|
||||
|alert |A message not linked with the user action, but which should require an action or a |
|
||||
| |correction. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|success |The user action succeeds. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|notice |A simple message to give information to the user. The message may be linked or not linked with|
|
||||
| |the user action. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|warning |A message linked with an action, the user should correct. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|error |The user's action failed: he must correct something to process the action. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Flash Messages on Symfony documentation <http://symfony.com/doc/current/book/controller.html#flash-messages>`_
|
||||
Learn how to use flash messages in controller.
|
||||
|
||||
|
||||
Buttons
|
||||
========
|
||||
|
||||
Some actions are available to decorate ``a`` links and ``buttons``.
|
||||
|
||||
To add the action on button, use them as class along with ``sc-button`` :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create">Create an entity</a>
|
||||
|
||||
<button class="sc-button bt-submit" type="submit">Submit</button>
|
||||
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Action | Class | Description |
|
||||
+===========+================+==============================================================================+
|
||||
| Submit | ``bt-submit`` | Submit a form. Use only if action is not "save". |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Create | ``bt-create`` | - Link to a form to create an entity (alias: ``bt-new``) |
|
||||
| | or ``bt-new`` | - Submitting this form will create a new entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Reset | ``bt-reset`` | Reset a form |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Delete | ``bt-delete`` | - Link to a form to delete an entity |
|
||||
| | | - Submitting this form will remove the entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Edit | ``bt-edit`` or | Link to a form to edit an entity |
|
||||
| | ``bt-update`` | |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Save | ``bt-save`` | Submitting this form will save change on the entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Action | ``bt-action`` | Generic link to an action |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Cancel | ``bt-cancel`` | Cancel an action and go back to another page |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
|
||||
Styling buttons
|
||||
---------------
|
||||
|
||||
Small buttons, mainly to use inline
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<p><a class="sc-button bt-create bt-small">You button</a></p>
|
||||
|
||||
You can omit content and show a button with an icon only :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create"></a>
|
||||
|
||||
You can hide content and show it only on hover
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create has-hidden"><span class="show-on-hover">Showed when mouse pass on</span></a>
|
||||
|
||||
You can customize the icon :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create change-icon"><i class="fa fa-icon"></i>Button with custom icon</a>
|
||||
|
||||
Grouping buttons
|
||||
----------------
|
||||
|
||||
Grouping buttons can be done using ``ul.record_actions`` element (an ``ul`` list with class ``record_actions``):
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<ul class="record_actions">
|
||||
|
||||
<li class="cancel">
|
||||
<a class="sc-button bt-cancel">Cancel</a>
|
||||
<li>
|
||||
|
||||
<li>
|
||||
<a class="sc-button bt-save">Save</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
The element with the ``cancel`` class will be set in first position.
|
||||
|
||||
Inside table, the space between elements will be shorter.
|
||||
|
||||
You can add the class ``record_actions_small`` if you want shorter space between elements.
|
||||
|
101
docs/source/development/migrations.rst
Normal file
@@ -0,0 +1,101 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Database Migrations
|
||||
********************
|
||||
|
||||
Every bundle potentially brings his own database operations : to persist entities, developers have to create database schema, creating indexes,...
|
||||
|
||||
Those schema might be changed (the less is the better) from time to time.
|
||||
|
||||
Consequence: each bundle should bring his own migration files, which will bring the database consistent with the operation you will run in your code. They will be gathered into the app installation, ready to be executed by the chill's installer.
|
||||
|
||||
Currently, we use `doctrine migration`_ to manage those migration files. A `composer`_ script located in the **chill standard** component will copy the migrations from your bundle to the doctrne migration's excepted directory after each install and/or update operation.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The `doctrine migration`_ documentation
|
||||
Learn concepts about migrations files and scripts and the doctrine ORM
|
||||
|
||||
The `doctrine migration bundle`_ documentation
|
||||
Learn about doctrine migration integration with Symfony framework
|
||||
|
||||
Shipping migration files
|
||||
========================
|
||||
|
||||
Migrations files should be shipped under the Resource/migrations directory. You could customize the migration directory by adding extra information in your composer.json:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"extra": {
|
||||
"migration-source": "path/to/my/dir"
|
||||
}
|
||||
|
||||
The class namespace should be `Application\Migrations`, as expected by doctrine migration. Only the files which will be executed by doctrine migration will be moved: they must have the pattern `VersionYYYYMMDDHHMMSS.php` where YYYY is the year, MM the month, DD the day, HH the hour, MM the month and SS the second of creation.
|
||||
|
||||
They will be moved automatically by composer when you install or update a bundle.
|
||||
|
||||
Executing migration files
|
||||
==========================
|
||||
|
||||
The installers will have to execute migrations files manually, running
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console doctrine:migrations:status #will give the current status of the database
|
||||
php app/console doctrine:migrations:migrate #process the update
|
||||
|
||||
|
||||
Updating migration files
|
||||
=========================
|
||||
|
||||
.. warning::
|
||||
|
||||
After an installation, migration files will be executed and registered as executed in the database (the version timestamp is recorded into the :title:`migrations_versions` table). If you update your migration file code, the file will still be considered as "executed" by doctrine migration, which will not offers the possibility to run the migration again.
|
||||
|
||||
Consequently, updating migration file should only be considered during development phase, and not published on public git branches. If you want to edit your database schema, you should create a new migration file, with a new timestamp, which will proceed to your schema adaptations.
|
||||
|
||||
Every time a migration file is discovered, the composer'script will check if the migration exists in the local migration directory. If yes, the script will compare two file for changes (using a md5 hash). If migrations are discovered, the script will ask the installer to know if he must replace the file or ignore it.
|
||||
|
||||
.. note::
|
||||
|
||||
You can manually run composer script by launching `composer run-script post-update-cmd` from your root chill installation's directory.
|
||||
|
||||
|
||||
.. _doctrine migration: http://www.doctrine-project.org/projects/migrations.html
|
||||
.. _doctrine migration bundle : http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
|
||||
.. _composer : https://getcomposer.org
|
||||
|
||||
Tips for development
|
||||
====================
|
||||
|
||||
Migration and data
|
||||
------------------
|
||||
|
||||
Each time you create a migration script, you should ensure that it will not lead to data losing. Eventually, feel free to use intermediate steps.
|
||||
|
||||
Generation
|
||||
----------
|
||||
|
||||
You can generate migration file from the command line, using those commands:
|
||||
|
||||
* `php app/console doctrine:migrations:diff` to generate a migration file by comparing your current database to your mapping information
|
||||
* `php app/console doctrine:migrations:generate` to generate a blank migration file.
|
||||
|
||||
Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resources/migrations` into your bundle directory.
|
||||
|
||||
Comments and documentation
|
||||
--------------------------
|
||||
|
||||
As files are copied from your bundle to the `app/DoctrineMigrations` directory, the link between your bundle and the copied file will be unclear. Please add all relevant documentation which will allow future developers to make a link between your file and your bundle.
|
||||
|
||||
Inside the script
|
||||
-----------------
|
||||
|
||||
The script which move the migrations files to app directory `might be found here
|
||||
<https://github.com/Champs-Libres/ComposerBundleMigration/blob/master/Composer/Migrations.php>
|
191
docs/source/development/pagination.rst
Normal file
@@ -0,0 +1,191 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
.. _pagination-ref:
|
||||
|
||||
Pagination
|
||||
##########
|
||||
|
||||
The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow you to easily divide results list on different pages.
|
||||
|
||||
A simple example
|
||||
****************
|
||||
|
||||
In the controller, get the :code:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
|
||||
|
||||
|
||||
.. literalinclude:: pagination/example.php
|
||||
:language: php
|
||||
|
||||
|
||||
Then, render the pagination using the dedicated twig function.
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
{% extends "ChillPersonBundle::layout.html.twig" %}
|
||||
|
||||
{% block title 'Item list'|trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
|
||||
<table>
|
||||
|
||||
{# ... your items here... #}
|
||||
|
||||
</table>
|
||||
|
||||
{% if items|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
The function :code:`chill_pagination` will, by default, render a link to the 10 previous page (if they exists) and the 10 next pages (if they exists). Assuming that we are on page 5, the function will render a list to ::
|
||||
|
||||
Previous 1 2 3 4 **5** 6 7 8 9 10 11 12 13 14 Next
|
||||
|
||||
Understanding the magic
|
||||
=======================
|
||||
|
||||
Where does the :code:`$paginator` get the page number ?
|
||||
-------------------------------------------------------
|
||||
|
||||
Internally, the :code:`$paginator` object has a link to the :code:`Request` object, and it reads the :code:`page` parameter which contains the current page number. If this parameter is not present, the :code:`$paginator` assumes that we are on page 1.
|
||||
|
||||
.. figure:: /_static/puml/pagination-sequence.png
|
||||
|
||||
The :code:`$paginator` get the current page from the request.
|
||||
|
||||
Where does the :code:`$paginator` get the number of items per page ?
|
||||
--------------------------------------------------------------------
|
||||
|
||||
As above, the :code:`$paginator` can get the number of items per page from the :code:`Request`. If none is provided, this is given by the configuration which is, by default, 50 items per page.
|
||||
|
||||
:code:`PaginatorFactory`, :code:`Paginator` and :code:`Page`
|
||||
************************************************************
|
||||
|
||||
:code:`PaginatorFactory`
|
||||
========================
|
||||
|
||||
The :code:`PaginatorFactory` may create more than one :code:`Paginator` in a single action. Those :code:`Paginator` instance may redirect to different routes and/or routes parameters.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// create a paginator for the route 'my_route' with some parameters (arg1 and arg2)
|
||||
$paginatorMyRoute = $paginatorFactory->create($total, 'my_route', array('arg1' => 'foo', 'arg2' => $bar);
|
||||
|
||||
Those parameters will override the current parameters.
|
||||
|
||||
The :code:`PaginatorFactory` has also some useful shortcuts :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// get current page number
|
||||
$paginatorFactory->getCurrentPageNumber( )
|
||||
// get the number of items per page **for the current request**
|
||||
$paginatorFactory->getCurrentItemsPerPage( )
|
||||
// get the number of the first item **for the current page**
|
||||
$paginatorFactory->getCurrentPageFirstItemNumber( )
|
||||
|
||||
|
||||
Working with :code:`Paginator` and :code:`Page`
|
||||
===============================================
|
||||
|
||||
The paginator has some function to give the number of pages are required to displayed all the results, and give some information about the number of items per page :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// how many page count this paginator ?
|
||||
$paginator->countPages(); // return 20 in our example
|
||||
|
||||
// we may get the number of items per page
|
||||
$paginator->getItemsPerPage(); // return 20 in our example
|
||||
|
||||
A :code:`Paginator` instance create instance of :code:`Page`, each :code:`Page`, which is responsible for generating the URL to the page number it represents. Here are some possibilities using :code:`Page` and :code:`Paginator` :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// get the current page
|
||||
$page = $paginator->getCurrentPage();
|
||||
// on which page are we ?
|
||||
$page->getNumber(); // return 5 in this example (we are on page 5)
|
||||
// generate the url for page 5
|
||||
$page->generateUrl(); // return '/<your route here>?page=5
|
||||
// what is the first item number on this page ?
|
||||
$page->getFistItemNumber(); // return 101 in our example (20 items per page)
|
||||
// what is the last item number on this page ?
|
||||
$page->getLastItemNumber(); // return 120 in our example
|
||||
|
||||
// we can access directly the next and current page
|
||||
if ($paginator->hasNextPage()) {
|
||||
$next = $paginator->getNextPage();
|
||||
}
|
||||
if ($paginator->hasPreviousPage()) {
|
||||
$previous = $paginator->getPreviousPage();
|
||||
}
|
||||
|
||||
// we can access directly to a given page number
|
||||
if ($paginator->hasPage(10)) {
|
||||
$page10 = $paginator->getPage(10);
|
||||
}
|
||||
|
||||
// we can iterate over our pages through a generator
|
||||
foreach ($paginator->getPagesGenerator() as $page) {
|
||||
$page->getNumber();
|
||||
}
|
||||
|
||||
// check that a page object is the current page
|
||||
$paginator->isCurrentPage($page); // return false
|
||||
|
||||
.. warning::
|
||||
|
||||
When calling a page which does not exists, the :code:`Paginator` will throw a `RuntimeException`. Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// our last page is 10
|
||||
$paginator->getPage(99); // out of range => throw `RuntimeException`
|
||||
|
||||
// our current page is 1 (the first page)
|
||||
$paginator->getPreviousPage; // does not exists (the fist page is always 1) => throw `RuntimeException`
|
||||
|
||||
.. note::
|
||||
|
||||
When you create a :code:`Paginator` for the current route and route parameters, the :code:`Page` instances will keep the same parameters and routes :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// assuming our route is 'my_route', for the pattern '/my/{foo}/route',
|
||||
// and the current route is '/my/value/route?arg2=bar'
|
||||
|
||||
// create a paginator for the current route and route parameters :
|
||||
$paginator = $paginatorFactory->create($total);
|
||||
|
||||
// get the next page
|
||||
if ($paginator->hasNext()) {
|
||||
$next = $paginator->getNextPage();
|
||||
|
||||
// get the route to the page
|
||||
$page->generateUrl(); // will print 'my/value/route?arg2=bar&page=2'
|
||||
}
|
||||
|
||||
|
||||
Having a look to the `full classes documentation may provide some useful information <http://api.chill.social/Chill-Main/master/namespace-Chill.MainBundle.Pagination.html>`_.
|
||||
|
||||
|
||||
Customizing the rendering of twig's :code:`chill_pagination`
|
||||
************************************************************
|
||||
|
||||
You can provide your own layout for rendering the pagination: provides your twig template as a second argument :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ chill_pagination(paginator, 'MyBundle:Pagination:MyTemplate.html.twig') }}
|
||||
|
||||
The template will receive the :code:`$paginator` as :code:`paginator` variable. Let's have a look `at the current template <https://framagit.org/Chill-project/Chill-Main/blob/master/Resources/views/Pagination/long.html.twig>`_.
|
||||
|
42
docs/source/development/pagination/example.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MyBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class ItemController extends Controller {
|
||||
|
||||
public function yourAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
// first, get the number of total item are available
|
||||
$total = $em
|
||||
->createQuery("SELECT COUNT (item.id) FROM ChillMyBundle:Item item")
|
||||
->getSingleScalarResult();
|
||||
|
||||
// get the PaginatorFactory
|
||||
$paginatorFactory = $this->get('chill_main.paginator_factory');
|
||||
|
||||
// create a pagination instance. This instance is only valid for
|
||||
// the current route and parameters
|
||||
$paginator = $paginatorFactory->create($total);
|
||||
|
||||
// launch your query on item. Limit the query to the results
|
||||
// for the current page using the paginator
|
||||
$items = $em->createQuery("SELECT item FROM ChillMyBundle:Item item WHERE <your clause>")
|
||||
// use the paginator to get the first item number
|
||||
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())
|
||||
// use the paginator to get the number of items to display
|
||||
->setMaxResults($paginator->getItemsPerPage());
|
||||
|
||||
return $this->render('ChillMyBundle:Item:list.html.twig', array(
|
||||
'items' => $items,
|
||||
'paginator' => $paginator
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
154
docs/source/development/render-entity.rst
Normal file
@@ -0,0 +1,154 @@
|
||||
|
||||
Rendering entity automatically
|
||||
##############################
|
||||
|
||||
Some entity need to be rendered automatically for a couple of times: a person, a user, ...
|
||||
|
||||
One can use some twig filter to render those entities:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ person|chill_entity_render_box }}
|
||||
|
||||
Define a renderer
|
||||
=================
|
||||
|
||||
By default, the object passed through the renderer will be rendered using the :code:`__toString()` method. To customize this behaviour, you have to define a service and tag it using :code:`chill.render_entity`.
|
||||
|
||||
The rendered is implemented using :class:`Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface`. This interface has 3 methods:
|
||||
|
||||
* :code:`public function supports($entity, array $options): bool`: return true if the :code:`$entity` given in parameter, with custom options, is supported by this renderer;
|
||||
* :code:`public function renderString($entity, array $options): string`: render the entity as a single string, for instance in a select list;
|
||||
* :code:`public function renderBox($entity, array $options): string`: render the entity in an html box.
|
||||
|
||||
.. warning::
|
||||
|
||||
The HTML returned by :code:`renderBox` **MUST BE SAFE** of any XSS injection.
|
||||
|
||||
:class:`Chill\MainBundle\Templating\Entity\AbstractChillEntityRender` provides some useful methods to get the opening and closing boxes that should be used.
|
||||
|
||||
Usage about rendering comment:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
class CommentRender extends AbstractChillEntityRender
|
||||
{
|
||||
/**
|
||||
* @var \Chill\MainBundle\Repository\UserRepository
|
||||
*/
|
||||
private $userRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EngineInterface
|
||||
*/
|
||||
private $engine;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
EngineInterface $engine
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CommentEmbeddable $entity
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderBox($entity, array $options): string
|
||||
{
|
||||
// default options
|
||||
$options = \array_merge([
|
||||
'user' => [],
|
||||
'disable_markdown' => false,
|
||||
'limit_lines' => null,
|
||||
'metadata' => true
|
||||
], $options);
|
||||
|
||||
if ($entity->getUserId()) {
|
||||
$user = $this->userRepository->find($entity->getUserId());
|
||||
}
|
||||
|
||||
return $this->engine
|
||||
->render(
|
||||
'@ChillMain/Entity/CommentEmbeddable.html.twig',
|
||||
[
|
||||
'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'),
|
||||
'closing_box' => $this->getDefaultClosingBox(),
|
||||
'user' => $user ?? NULL,
|
||||
'comment' => $entity,
|
||||
'options' => $options
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CommentEmbeddable $entity
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderString($entity, array $options): string
|
||||
{
|
||||
return $entity->getComment();
|
||||
}
|
||||
|
||||
public function supports($entity, array $options): bool
|
||||
{
|
||||
return $entity instanceof CommentEmbeddable;
|
||||
}
|
||||
}
|
||||
|
||||
Logic inside the template:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ opening_box|raw }}
|
||||
<div>
|
||||
{# logic for rendering #}
|
||||
</div>
|
||||
{{ closing_box|raw }}
|
||||
|
||||
Usage in templates
|
||||
==================
|
||||
|
||||
For rendering entity as a box:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ entity|chill_entity_render_box }}
|
||||
|
||||
For rendering entity as a string:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ entity|chill_entity_render_string }}
|
||||
|
||||
Available renderer and options
|
||||
==============================
|
||||
|
||||
:code:`Person` (Person Bundle)
|
||||
------------------------------
|
||||
|
||||
* no options
|
||||
|
||||
:code:`CommentEmbeddable` (Main Bundle)
|
||||
---------------------------------------
|
||||
|
||||
Options:
|
||||
|
||||
* :code:`user`: options which will be passed to "user" renderer
|
||||
* :code:`disable_markdown`: disable markdown renderer, default to :code:`FALSE`
|
||||
* :code:`limit_lines` (integer) limit the number of lines. Default to :code:`NULL`. May be an integer.
|
||||
* :code:`metadata` (boolean): show the last updating user and last updating date. Default to :code:`TRUE`.
|
||||
|
68
docs/source/development/routing.rst
Normal file
@@ -0,0 +1,68 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Routing
|
||||
#######
|
||||
|
||||
Our goal is to ease the installation of the different bundle. Users should not have to dive into complicated config files to install bundles.
|
||||
|
||||
A routing loader available for all bundles
|
||||
===========================================
|
||||
|
||||
A Chill bundle may rely on the Routing Loader defined in ChillMain.
|
||||
|
||||
The loader will load `yml` or `xml` files. You simply have to add them into `chill_main` config
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
# ... other stuff here
|
||||
routing:
|
||||
resources:
|
||||
- @ChillMyBundle/Resources/config/routing.yml
|
||||
|
||||
Load routes automatically
|
||||
-------------------------
|
||||
|
||||
But this force users to modify config files. To avoid this, you may prepend config implementing the `PrependExtensionInterface` in the `YourBundleExtension` class. This is an example from **chill main** bundle :
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
|
||||
class ChillMainExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
|
||||
//add current route to chill main
|
||||
//this is where the resource is added automatically in the config
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
'resources' => array(
|
||||
'@ChillMainBundle/Resources/config/routing.yml'
|
||||
)
|
||||
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
68
docs/source/development/run-tests.rst
Normal file
@@ -0,0 +1,68 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Run tests
|
||||
*********
|
||||
|
||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||
|
||||
From chill app
|
||||
==============
|
||||
|
||||
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# run into a container
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# execute all tests suites
|
||||
bin/phpunit
|
||||
# .. or execute a single test
|
||||
bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php
|
||||
|
||||
You can also run tests in a single command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php bin/phpunit
|
||||
|
||||
|
||||
Tests from a bundle (chill-bundles)
|
||||
-----------------------------------
|
||||
|
||||
Those tests needs the whole symfony app to execute Application Tests (which test html page).
|
||||
|
||||
For ease, the app is cloned using a :code:`git submodule`, which clone the main app into :code:`tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||
|
||||
You may boostrap the tests fro the chill bundle this way:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# ensure to be located into the environement (provided by docker suits well)
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# go to chill subdirectory
|
||||
cd vendor/chill-project/chill-bundles
|
||||
# install submodule
|
||||
git submodule init
|
||||
git submodule update
|
||||
# install composer and dependencies
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
# run tests
|
||||
bin/phpunit
|
||||
|
||||
.. note::
|
||||
|
||||
If you are on a fresh install, you will need to migrate database schema.
|
||||
|
||||
The path to console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
tests/app/bin/console doctrine:migrations:migrate
|
||||
tests/app/bin/console doctrine:fixtures:load
|
||||
|
276
docs/source/development/searching.rst
Normal file
@@ -0,0 +1,276 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Searching
|
||||
*********
|
||||
|
||||
Chill should provide information needed by users when they need it. Searching within bundle, entities,... is an important feature to achieve this goal.
|
||||
|
||||
The Main Bundle provide interfaces to ease the developer work. It will also attempt that search will work in the same way accross bundles.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Our blog post about searching (in French) <http://blog.champs-libres.coop/vie-des-champs/2015/01/06/va-chercher-chill-la-recherche-dans-chill-logiciel-libre-service-social.html>`_
|
||||
This blog post give some information for end-users about searching.
|
||||
|
||||
`The issue about search behaviour <https://redmine.champs-libres.coop/issues/377>`_
|
||||
Where the search behaviour is defined.
|
||||
|
||||
Searching in a glance for developers
|
||||
====================================
|
||||
|
||||
Chill suggests to use an easy-to-learn language search.
|
||||
|
||||
.. note::
|
||||
|
||||
We are planning to provide a form to create automatically search pattern according to this language. Watch the `issue regarding this feature <https://redmine.champs-libres.coop/issues/389>`_.
|
||||
|
||||
The language is an association of search terms. Search terms may contains :
|
||||
|
||||
- **a domain**: this is "the domain you want to search" : it may some entities like people, reports, ... Example : `@person` to search accross people, `@report` to browse reports, ... The search pattern may have **a maximum of one** domain by search, providing more should throw an error, and trigger a warning for users.
|
||||
- **arguments and their values** : This is "what you search". Arguments narrow the search to specific fields : username, date of birth, nationality, ... The syntax is `argument:value`. I.e.: ` birthdate:2014-12-15`, `firstname:Depardieu`, ... **Arguments are optional**. If the value of an argument contains spaces or characters like punctuation, quotes ("), the value should be provided between parenthesis : `firstname:(Van de snoeck)`, `firstname:(M'bola)`, ...
|
||||
- **default value** : this the "rest" of the search, not linked with any arguments or domain. Example : `@person dep` (`dep` is the "default value"), or simply `dep` if any domain is provided (which is perfectly acceptable). If a string is not idenfied as argument or domain, it will be present in the "default" term.
|
||||
|
||||
If a search pattern (provided by the user) does not contains any domain, the search must be run across default domain/search modules.
|
||||
|
||||
A domain may be supported by different search modules. For instance, if you provide the domain `@person`, the end-user may receive results of exact firstname/lastname, but also result with spelling suggestion, ... **But** if results do not fit into the first page (if you have 75 results and the screen show only 50 results), the next page should contains only the results from the required module.
|
||||
|
||||
For instance : a user search across people by firstname/lastname, the exact spelling contains 10 results, the "spelling suggestion" results contains 75 names, but show only the first 50. If the user want to see the last 25, the next screen should not contains the results by firstname/lastname.
|
||||
|
||||
Allowed characters as arguments
|
||||
===============================
|
||||
|
||||
In order to execute regular expression, the allowed chararcters in arguments are a-z characters, numbers, and the sign '-'. Spaces and special characters like accents are note allowed (the accents are removed during parsing).
|
||||
|
||||
Special characters and uppercase
|
||||
================================
|
||||
|
||||
The search should not care about lowercase/uppercase and accentued characters. Currently, they are removed automatically by the `chill.main.search_provider`.
|
||||
|
||||
Implementing search module for dev
|
||||
===================================
|
||||
|
||||
To implement a search module, you should :
|
||||
|
||||
- create a class which implements the `Chill\MainBundle\Search\SearchInterface` class. An abstract class `Chill\MainBundle\Search\AbstractSearch` will provide useful assertions for parsing date string to `DateTime` objects, ...
|
||||
- register the class as a service, and tag the service with `chill.search` and an appropriate alias
|
||||
|
||||
The search logic is provided under the `/search` route.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The implementation of a search module in Person bundle <https://github.com/Chill-project/Person/blob/master/Search/PersonSearch.php>`_
|
||||
An example of implementationhttps://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php
|
||||
|
||||
.. note::
|
||||
|
||||
**Internals explained** : the services tagged with `chill.search` are gathered into the `chill.main.search_provider` service during compilation (`see the compiler pass <https://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php>`_).
|
||||
|
||||
The `chill.main.search_provider` service allow to :
|
||||
|
||||
- retrieve all results (as html string) for all search module concerned by the search (according to the domain provided or modules marked as default)
|
||||
- retrieve result for one search module
|
||||
|
||||
The SearchInterface class
|
||||
-------------------------
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Search;
|
||||
|
||||
use Chill\MainBundle\Search\AbstractSearch;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Chill\MainBundle\Search\ParsingException;
|
||||
|
||||
class PersonSearch extends AbstractSearch
|
||||
{
|
||||
|
||||
// indicate which domain you support
|
||||
// you may respond TRUE to multiple domain, according to your logic
|
||||
public function supports($domain, $format='html')
|
||||
{
|
||||
return 'person' === $domain;
|
||||
}
|
||||
|
||||
// if your domain must be called when no domain is provided, should return true
|
||||
public function isActiveByDefault()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if multiple module respond to the same domain, indicate an order for your search.
|
||||
public function getOrder()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
||||
// This is where your search logic should be executed.
|
||||
// This method must return an HTML string (a string with HTML tags)
|
||||
// see below about the structure of the $term array
|
||||
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = array(), $format = 'html')
|
||||
{
|
||||
return $this->container->get('templating')->render('ChillPersonBundle:Person:list.html.twig',
|
||||
array(
|
||||
// you should implements the `search` function somewhere :-)
|
||||
'persons' => $this->search($terms, $start, $limit, $options),
|
||||
// recomposePattern is available in AbstractSearch class
|
||||
'pattern' => $this->recomposePattern($terms, array('nationality',
|
||||
'firstname', 'lastname', 'birthdate', 'gender'), $terms['_domain']),
|
||||
// you should implement the `count` function somewhere :-)
|
||||
'total' => $this->count($terms)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Values for :code:`$options`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
:code:`$options` is an array with the following keys:
|
||||
|
||||
- :code:`SearchInterface::SEARCH_PREVIEW_OPTION` (bool): if the current view is a preview (the first 5 results) or not ;
|
||||
- :code:`SearchInterface::REQUEST_QUERY_PARAMETERS` (bool): some parameters added to the query (under the key :code:`SearchInterface::REQUEST_QUERY_KEY_ADD_PARAMETERS`) and that can be interpreted. Used, for instance, when calling a result in json format when searching for interactive picker form.
|
||||
|
||||
|
||||
|
||||
|
||||
Structure of array `$term`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The array term is parsed automatically by the `main.chill.search_provider` service.
|
||||
|
||||
.. note::
|
||||
If you need to parse a search pattern, you may use the function `parse($pattern)` provided by the service.
|
||||
|
||||
The array `$term` have the following structure after parsing :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'_domain' => 'person', //the domain, without the '@'
|
||||
'argument1' => 'value', //the argument1, with his value
|
||||
'argument2' => 'my value with spaces', //the argument2
|
||||
'_default' => 'abcde ef' // the default term
|
||||
);
|
||||
|
||||
The original search would have been : `@person argument1:value argument2:(my value with spaces) abcde ef`
|
||||
|
||||
.. warning::
|
||||
The search values are always unaccented.
|
||||
|
||||
Returning a result in json
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The json format is mainly used by "select2" widgets.
|
||||
|
||||
When returning a result in json, the SearchInterface should only return an array with following keys:
|
||||
|
||||
- :code:`more` (bool): if the search has more result than the current page ;
|
||||
- :code:`results` (array): a list of result, where:
|
||||
|
||||
- :code:`text` (string): the text that should be displayed in browser ;
|
||||
- :code:`id` (string): the id of the entity.
|
||||
|
||||
|
||||
|
||||
Register the service
|
||||
--------------------
|
||||
|
||||
You should add your service in the configuration, and add a `chill.search` tag and an alias.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.person.search_person:
|
||||
class: Chill\PersonBundle\Search\PersonSearch
|
||||
#your logic here
|
||||
tags:
|
||||
- { name: chill.search, alias: 'person_regular' }
|
||||
|
||||
The alias will be used to get the results narrowed to this search module, in case of pagination (see above).
|
||||
|
||||
Parsing date
|
||||
============
|
||||
|
||||
The class `Chill\MainBundle\Search\AbstractSearch` provides a method to parse date :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
//from subclasses
|
||||
$date = $this->parseDate($string);
|
||||
|
||||
`$date` will be an instance of `DateTime <http://php.net/manual/en/class.datetime.php>`_.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The possibility to add periods instead of date <https://redmine.champs-libres.coop/issues/390>`_
|
||||
Which may be a future improvement for search with date.
|
||||
|
||||
Exceptions
|
||||
==========
|
||||
|
||||
The logic of the search is handled by the controller for the `/search` path.
|
||||
|
||||
You should throw those Exception from your instance of `SearchInterface` if needed :
|
||||
|
||||
Chill\MainBundle\Search\ParsingException
|
||||
If the terms does not fit your search logic (for instance, conflicting terms)
|
||||
|
||||
Expected behaviour
|
||||
==================
|
||||
|
||||
Operators between multiple terms
|
||||
--------------------------------
|
||||
|
||||
Multiple terms should be considered are "AND" instructions :
|
||||
|
||||
@person nationality:RU firstname:dep
|
||||
the people having the Russian nationality AND having DEP in their name
|
||||
|
||||
@person birthdate:2015-12-12 charles
|
||||
the people having 'charles' in their name or firstname AND born on December 12 2015
|
||||
|
||||
Spaces in default
|
||||
-----------------
|
||||
|
||||
Spaces in default terms should be considered as "AND" instruction
|
||||
|
||||
@person charle dep
|
||||
people having "dep" AND "charles" in their firstname or lastname. Match "Charles Depardieu" but not "Gérard Depardieu" ('charle' is not present)
|
||||
|
||||
Rendering
|
||||
---------
|
||||
|
||||
The rendering should contains :
|
||||
|
||||
- the total number of results ;
|
||||
- the search pattern in the search language. The aim of this is to let users learn the search language easily.
|
||||
- a title
|
||||
|
||||
Frequently Asked Questions (FAQ)
|
||||
================================
|
||||
|
||||
Why renderResults returns an HTML string and not structured array ?
|
||||
It seems that the form of results may vary (according to access-right logic, ...) and is not easily structurable
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
384
docs/source/development/timelines.rst
Normal file
@@ -0,0 +1,384 @@
|
||||
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Timelines
|
||||
*********
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
Concept
|
||||
=======
|
||||
|
||||
From an user point of view
|
||||
--------------------------
|
||||
|
||||
Chill has two objectives :
|
||||
|
||||
* make the administrative tasks more lightweight ;
|
||||
* help social workers to have all information they need to work
|
||||
|
||||
To reach this second objective, Chill provides a special view: **timeline**. On a timeline view, information is gathered and shown on a single page, from the most recent event to the oldest one.
|
||||
|
||||
The information gathered is linked to a *context*. This *context* may be, for instance :
|
||||
|
||||
* a person : events linked to this person are shown on the page ;
|
||||
* a center: events linked to a center are shown. They may concern different peoples ;
|
||||
* ...
|
||||
|
||||
In other word, the *context* is the kind of argument that will be used in the event's query.
|
||||
|
||||
Let us recall that only the data the user has allowed to see should be shown.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The issue where the subject was first discussed <https://redmine.champs-libres.coop/issues/224>`_
|
||||
|
||||
|
||||
For developers
|
||||
--------------
|
||||
|
||||
The `Main` bundle provides interfaces and services to help to build timelines.
|
||||
|
||||
If a bundle wants to *push* information in a timeline, it should be create a service which implements `Chill\MainBundle\Timeline\TimelineProviderInterface`, and tag is with `chill.timeline` and arguments defining the supported context (you may use multiple `chill.timeline` tags in order to support multiple context with a single service/class).
|
||||
|
||||
If a bundle wants to provide a new context for a timeline, the service `chill.main.timeline_builder` will helps to gather timeline's services supporting the defined context, and run queries across the models.
|
||||
|
||||
.. _understanding-queries :
|
||||
|
||||
Understanding queries
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Due to the fact that timelines should show only the X last events from Y differents tables, queries for a timeline may consume a lot of resources: at first on the database, and then on the ORM part, which will have to deserialize DB data to PHP classes, which may not be used if they are not part of the "last X events".
|
||||
|
||||
To avoid such load on database, the objects are queried in two steps :
|
||||
|
||||
1. An UNION request which gather the last X events, ordered by date. The data retrieved are the ID, the date, and a string key: a type. This type discriminates the data type.
|
||||
2. The PHP objects are queried by ID, the type helps the program to link id with the kind of objects.
|
||||
|
||||
Those methods should ensure that only X PHP objects will be gathered and build by the ORM.
|
||||
|
||||
What does the master timeline builder service ?
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When the service `chill.main.timeline_builder` is instanciated, the service is informed of each service taggued with `chill.timeline` tags. Then,
|
||||
|
||||
1. The service build an UNION query by assembling column and tables names provided by the `fetchQuery` result ;
|
||||
2. The UNION query is run, the result contains an id and a type for each row (see :ref:`above <understanding-queries>`)
|
||||
3. The master service gather all id with the same type. Then he searches for the `chill.timeline`'s service which will be able to get the entities. Then, the entities will be fetched using the `fetchEntities` function. All entities are gathered in one query ;
|
||||
4. The information to render entities in HTML is gathered by passing entity, one by one, on `getEntityTemplate` function.
|
||||
|
||||
Pushing events to a timeline
|
||||
=============================
|
||||
|
||||
To push events on a timeline :
|
||||
|
||||
1. Create a class which implements `Chill\MainBundle\Timeline\TimelineProviderInterface` ;
|
||||
2. Define the class as a service, and tag the service with `chill.timeline`, and define the context associated with this timeline (you may add multiple tags for different contexts).
|
||||
|
||||
Implementing the TimelineProviderInterface
|
||||
------------------------------------------
|
||||
|
||||
The has the following signature :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\Timeline;
|
||||
|
||||
interface TimelineProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $context
|
||||
* @param mixed[] $args the argument to the context.
|
||||
* @return TimelineSingleQuery
|
||||
* @throw \LogicException if the context is not supported
|
||||
*/
|
||||
public function fetchQuery($context, array $args);
|
||||
|
||||
/**
|
||||
* Indicate if the result type may be handled by the service
|
||||
*
|
||||
* @param string $type the key present in the SELECT query
|
||||
* @return boolean
|
||||
*/
|
||||
public function supportsType($type);
|
||||
|
||||
/**
|
||||
* fetch entities from db into an associative array. The keys **MUST BE**
|
||||
* the id
|
||||
*
|
||||
* All ids returned by all SELECT queries
|
||||
* (@see TimeLineProviderInterface::fetchQuery) and with the type
|
||||
* supported by the provider (@see TimelineProviderInterface::supportsType)
|
||||
* will be passed as argument.
|
||||
*
|
||||
* @param array $ids an array of id
|
||||
* @return mixed[] an associative array of entities, with id as key
|
||||
*/
|
||||
public function getEntities(array $ids);
|
||||
|
||||
/**
|
||||
* return an associative array with argument to render the entity
|
||||
* in an html template, which will be included in the timeline page
|
||||
*
|
||||
* The result must have the following key :
|
||||
*
|
||||
* - `template` : the template FQDN
|
||||
* - `template_data`: the data required by the template
|
||||
*
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* array(
|
||||
* 'template' => 'ChillMyBundle:timeline:template.html.twig',
|
||||
* 'template_data' => array(
|
||||
* 'accompanyingPeriod' => $entity,
|
||||
* 'person' => $args['person']
|
||||
* )
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* `$context` and `$args` are defined by the bundle which will call the timeline
|
||||
* rendering.
|
||||
*
|
||||
* @param type $entity
|
||||
* @param type $context
|
||||
* @param array $args
|
||||
* @return mixed[]
|
||||
* @throws \LogicException if the context is not supported
|
||||
*/
|
||||
public function getEntityTemplate($entity, $context, array $args);
|
||||
|
||||
}
|
||||
|
||||
|
||||
The `fetchQuery` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The fetchQuery function help to build the UNION query to gather events. This function should return an instance of :code:`TimelineSingleQuery`. For you convenience, this object may be build using an associative array with the following keys:
|
||||
|
||||
* `id` : the name of the id column
|
||||
* `type`: a string to indicate the type
|
||||
* `date`: the name of the datetime column, used to order entities by date
|
||||
* `FROM`: the FROM clause. May contains JOIN instructions
|
||||
* `WHERE`: the WHERE clause;
|
||||
* `parameters`: the parameters to pass to the query
|
||||
|
||||
The parameters should be replaced into the query by :code:`?`. They will be replaced into the query using prepared statements.
|
||||
|
||||
`$context` and `$args` are defined by the bundle which will call the timeline rendering. You may use them to build a different query depending on this context.
|
||||
|
||||
For instance, if the context is `'person'`, the args will be this array :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'person' => $person //a \Chill\PersonBundle\Entity\Person entity
|
||||
);
|
||||
|
||||
For the context :code:`center`, the args will be:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'centers' => [ ] // an array of \Chill\MainBundle\Entity\Center entities
|
||||
);
|
||||
|
||||
|
||||
You should find in the bundle documentation which contexts are arguments the bundle defines.
|
||||
|
||||
.. note::
|
||||
|
||||
We encourage to use `ClassMetaData` to define column names arguments. If you change your column names, changes will be reflected automatically during the execution of your code.
|
||||
|
||||
Example of an implementation :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
use Chill\MainBundle\Timeline\TimelineSingleQuery;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* Provide report for inclusion in timeline
|
||||
*
|
||||
*/
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EntityManager
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
public function __construct(EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function fetchQuery($context, array $args)
|
||||
{
|
||||
$this->checkContext($context);
|
||||
|
||||
$metadata = $this->em->getClassMetadata('ChillReportBundle:Report');
|
||||
|
||||
return TimelineSingleQuery::fromArray([
|
||||
'id' => $metadata->getColumnName('id'),
|
||||
'type' => 'report',
|
||||
'date' => $metadata->getColumnName('date'),
|
||||
'FROM' => $metadata->getTableName(),
|
||||
'WHERE' => sprintf('%s = ?',
|
||||
$metadata
|
||||
->getAssociationMapping('person')['joinColumns'][0]['name'])
|
||||
)
|
||||
'parameters' => [ $args['person']->getId() ]
|
||||
]);
|
||||
}
|
||||
|
||||
//....
|
||||
|
||||
|
||||
}
|
||||
|
||||
The `supportsType` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function indicate to the master `chill.main.timeline_builder` service (which orchestrate the build of UNION queries) that the service supports the type indicated in the result's array of the `fetchQuery` function.
|
||||
|
||||
The implementation of our previous example will be :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
|
||||
//...
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsType($type)
|
||||
{
|
||||
return $type === 'report';
|
||||
}
|
||||
|
||||
//...
|
||||
}
|
||||
|
||||
The `getEntities` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is where the service must fetch entities from database and return them to the master service.
|
||||
|
||||
The results **must be** an array where the id given by the UNION query (remember `fetchQuery`).
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class TimelineReportProvider implements TimelineProviderInterface
|
||||
{
|
||||
|
||||
public function getEntities(array $ids)
|
||||
{
|
||||
$reports = $this->em->getRepository('ChillReportBundle:Report')
|
||||
->findBy(array('id' => $ids));
|
||||
|
||||
$result = array();
|
||||
foreach($reports as $report) {
|
||||
$result[$report->getId()] = $report;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
The `getEntityTemplate` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is where the master service will collect information to render the entity.
|
||||
|
||||
The result must be an associative array with :
|
||||
|
||||
- **template** is the FQDN of the template ;
|
||||
- **template_data** is an associative array where keys are the variables'names for this template, and values are the values.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'template' => 'ChillMyBundle:timeline:template.html.twig',
|
||||
'template_data' => array(
|
||||
'period' => $entity,
|
||||
'person' => $args['person']
|
||||
)
|
||||
);
|
||||
|
||||
The template must, obviously, exists. Example :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
<p><i class="fa fa-folder-open"></i> {{ 'An accompanying period is opened for %person% on %date%'|trans({'%person%': person, '%date%': period.dateOpening|localizeddate('long', 'none') } ) }}</p>
|
||||
|
||||
|
||||
Create a timeline with his own context
|
||||
======================================
|
||||
|
||||
You have to create a Controller which will execute the service `chill.main.timeline_builder`. Using the `Chill\MainBundle\Timeline\TimelineBuilder::getTimelineHTML` function, you will get an HTML representation of the timeline, which you may include with twig `raw` filter.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class TimelinePersonController extends Controller
|
||||
{
|
||||
|
||||
public function personAction(Request $request, $person_id)
|
||||
{
|
||||
$person = $this->getDoctrine()
|
||||
->getRepository('ChillPersonBundle:Person')
|
||||
->find($person_id);
|
||||
|
||||
if ($person === NULL) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
||||
(
|
||||
'timeline' => $this->get('chill.main.timeline_builder')
|
||||
->getTimelineHTML('person', array('person' => $person)),
|
||||
'person' => $person
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
73
docs/source/development/useful-snippets.rst
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Useful snippets
|
||||
###############
|
||||
|
||||
Dependency Injection
|
||||
********************
|
||||
|
||||
Configure route automatically
|
||||
=============================
|
||||
|
||||
Add the route for the current bundle automatically on the main app.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
|
||||
|
||||
class ChillMyExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
// ...
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependRoutes($container);
|
||||
|
||||
}
|
||||
|
||||
public function prependRoutes(ContainerBuilder $container)
|
||||
{
|
||||
//add routes for custom bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
'resources' => array(
|
||||
'@ChillMyBundle/Resources/config/routing.yml'
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Security
|
||||
********
|
||||
|
||||
Get the circles a user can reach
|
||||
================================
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
$authorizationHelper = $this->get('chill.main.security.authorization.helper');
|
||||
$circles = $authorizationHelper
|
||||
->getReachableCircles(
|
||||
$this->getUser(), # from a controller
|
||||
new Role('CHILL_ROLE'),
|
||||
$center
|
||||
);
|
||||
|
||||
|
||||
Controller
|
||||
**********
|
||||
|
||||
Secured controller for person
|
||||
=============================
|
||||
|
||||
.. literalinclude:: useful-snippets/controller-secured-for-person.php
|
||||
:language: php
|
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\HealthBundle\Controller;
|
||||
|
||||
use Chill\HealthBundle\Security\Authorization\ConsultationVoter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class ConsultationController extends Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @param int $id personId
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws type
|
||||
*/
|
||||
public function listAction($id)
|
||||
{
|
||||
/* @var $person \Chill\PersonBundle\Entity\Person */
|
||||
$person = $this->get('chill.person.repository.person')
|
||||
->find($id);
|
||||
|
||||
if ($person === null) {
|
||||
throw $this->createNotFoundException("The person is not found");
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
/* @var $authorizationHelper \Chill\MainBundle\Security\Authorization\AuthorizationHelper */
|
||||
$authorizationHelper = $this->get('chill.main.security.'
|
||||
. 'authorization.helper');
|
||||
|
||||
$circles = $authorizationHelper->getReachableCircles(
|
||||
$this->getUser(),
|
||||
new Role(ConsultationVoter::SEE),
|
||||
$person->getCenter()
|
||||
);
|
||||
|
||||
// create a query which take circles into account
|
||||
$consultations = $this->getDoctrine()->getManager()
|
||||
->createQuery('SELECT c FROM ChillHealthBundle:Consultation c '
|
||||
. 'WHERE c.patient = :person AND c.circle IN(:circles) '
|
||||
. 'ORDER BY c.date DESC')
|
||||
->setParameter('person', $person)
|
||||
->setParameter('circles', $circles)
|
||||
->getResult();
|
||||
|
||||
return $this->render('ChillHealthBundle:Consultation:list.html.twig', array(
|
||||
'person' => $person,
|
||||
'consultations' => $consultations
|
||||
));
|
||||
}
|
||||
}
|
||||
|
77
docs/source/development/user-interface/css-classes.rst
Normal file
@@ -0,0 +1,77 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
CSS classes and mixins
|
||||
######################
|
||||
|
||||
The stylesheet are based on the framework `ScratchCSS <https://github.com/Champs-Libres/ScratchCSS>`_.
|
||||
|
||||
We added some useful classes and mixins for the Chill usage.
|
||||
|
||||
CSS Classes
|
||||
************
|
||||
|
||||
|
||||
Statement "empty data"
|
||||
======================
|
||||
|
||||
CSS Selector
|
||||
:code:`.chill-no-data-statement`
|
||||
In which case will you use this selector ?
|
||||
When a list is empty, and a message fill the list to inform that the data is empty
|
||||
Example usage
|
||||
.. code-block:: html+jinja
|
||||
|
||||
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
|
||||
|
||||
|
||||
Quotation of user text
|
||||
=======================
|
||||
|
||||
CSS Selector
|
||||
:code:`blockquote.chill-user-quote`
|
||||
In which case will you use this selector ?
|
||||
When you quote text that were filled by the user in a form.
|
||||
Example usage
|
||||
.. code-block:: html+jinja
|
||||
|
||||
<blockquote class="chill-user-quote">{{ entity.remark|nl2br }}</blockquote>
|
||||
|
||||
Boxes
|
||||
=====
|
||||
|
||||
CSS Selector
|
||||
:code:`chill__box`
|
||||
In which case will you use this selector ?
|
||||
When displaying some data in a nice box
|
||||
Example usage
|
||||
.. code-block:: html+twig
|
||||
|
||||
<span class="chill__box green">A nice box with green background</span>
|
||||
<span class="chill__box red">A nice box with red background</span>
|
||||
|
||||
|
||||
|
||||
Mixins
|
||||
******
|
||||
|
||||
|
||||
Entity decorator
|
||||
=================
|
||||
|
||||
Mixin
|
||||
:code:`@mixin entity($background-color, $color: white)`
|
||||
In which case including this mixin ?
|
||||
When you create a `sticker`, a sort of label to represent a text in a way that the user can associate immediatly with a certain type of class / entity.
|
||||
Example usage
|
||||
.. code-block:: sass
|
||||
|
||||
span.entity.entity-activity.activity-reason {
|
||||
@include entity($chill-pink, white);
|
||||
}
|
261
docs/source/development/user-interface/js-functions.rst
Normal file
@@ -0,0 +1,261 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Javascript functions
|
||||
####################
|
||||
|
||||
Some function may be useful to manipulate elements on the page.
|
||||
|
||||
Show-hide elements according to a form state
|
||||
*********************************************
|
||||
|
||||
The module ``ShowHide`` will allow you to show/hide part of your page using a specific test.
|
||||
|
||||
This must be use inside a javascript module.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
In this module, the module will listen to all input given in the ``container_from`` div, and will show or hide the content of the ``container_target`` according to the result of the ``test`` function.
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
<div id="container_from">
|
||||
{{ form_row(form.accompagnementRQTHDate) }}
|
||||
</div>
|
||||
|
||||
<div id="container_target">
|
||||
{{ form_row(form.accompagnementComment) }}
|
||||
</div>
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||
|
||||
var
|
||||
from = document.getElementById("container_from"),
|
||||
target = document.getElementById("container_target")
|
||||
;
|
||||
|
||||
new ShowHide({
|
||||
froms: [from], // the value of from should be an iterable
|
||||
container: [target], // the value of container should be an iterable
|
||||
test: function(froms, event) {
|
||||
// iterate over each element of froms
|
||||
for (let f of froms.values()) {
|
||||
// get all input inside froms
|
||||
for (let input of f.querySelectorAll('input').values()) {
|
||||
if (input.value === 'autre') {
|
||||
return input.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
Once instantiated, the class ``ShowHide`` will:
|
||||
|
||||
1. get all input from each element inside the ``froms`` values
|
||||
2. attach an event listener (by default, ``change``) to each input inside each entry in ``froms``
|
||||
3. each time the event is fired, launch the function ``test``
|
||||
4. show the element in the container given in ``container``, if the result of ``test`` is true, or hide them otherwise.
|
||||
|
||||
The test is also launched when the page is loaded.
|
||||
|
||||
Show/hide while the user enter data: using the ``input`` event
|
||||
==============================================================
|
||||
|
||||
One can force to use another event on the input elements, instead of the default ``'change'`` event.
|
||||
|
||||
For achieving this, use the `event_name` option.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
new ShowHide({
|
||||
froms: froms,
|
||||
test: test_function,
|
||||
container: containers ,
|
||||
// using this option, we use the event `input` instead of `change`
|
||||
event_name: 'input'
|
||||
});
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. literalinclude:: js-functions/show_hide.js
|
||||
:language: javascript
|
||||
|
||||
|
||||
Using Show/Hide in collections forms
|
||||
====================================
|
||||
|
||||
Using show / hide in collection forms implies:
|
||||
|
||||
* to launch show/hide manually for each entry when the page is loaded ;
|
||||
* to catch when an entry is added to the form ;
|
||||
|
||||
As the show/hide is started manually and not on page load, we add the option ``load_event: null`` to the options:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
new ShowHide({
|
||||
load_event: null,
|
||||
froms: [ from ],
|
||||
container: [ container ],
|
||||
test: my_test_function
|
||||
});
|
||||
|
||||
.. note::
|
||||
|
||||
When using ``load_event: null`` inside the options, the value of event will be ``null`` as second argument for the test function.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
my_test_function(froms, event) {
|
||||
// event will be null on first launch
|
||||
}
|
||||
|
||||
Example usage: here, we would like to catch for element inside a CV form, where the user may add multiple formation entries.
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||
|
||||
// we factorize the creation of show hide element in this function.
|
||||
var make_show_hide = function(entry) {
|
||||
let
|
||||
obtained = entry.querySelector('[data-diploma-obtained]'),
|
||||
reconnue = entry.querySelector('[data-diploma-reconnue]')
|
||||
;
|
||||
new ShowHide({
|
||||
load_event: null,
|
||||
froms: [ obtained ],
|
||||
container: [ reconnue ],
|
||||
test: my_test_function
|
||||
});
|
||||
};
|
||||
|
||||
// this code is fired when an entry is added on the page
|
||||
window.addEventListener('collection-add-entry', function(e) {
|
||||
// if the form contains multiple collection, we filter them here:
|
||||
if (e.detail.collection.dataset.collectionName === 'formations') {
|
||||
make_show_hide(e.detail.entry);
|
||||
}
|
||||
});
|
||||
|
||||
// on page load, we create a show/hide
|
||||
window.addEventListener('load', function(_e) {
|
||||
let
|
||||
formations = document.querySelectorAll('[data-formation-entry]')
|
||||
;
|
||||
|
||||
for (let f of formations.values()) {
|
||||
make_show_hide(f);
|
||||
}
|
||||
});
|
||||
|
||||
Handling encapsulated show/hide elements
|
||||
========================================
|
||||
|
||||
This module allow to handle encapsulated show/hide elements. For instance :
|
||||
|
||||
* in a first checkbox list, a second checkbox list is shown if some element is checked ;
|
||||
* in this second checkbox list, a third input is shown if some element is checked inside the second checkbox list.
|
||||
|
||||
As a consequence, if the given element in the first checkbox list is unchecked, the third input must also be hidden.
|
||||
|
||||
Example: when a situation professionnelle is ``en activite``, the second element ``type contrat`` must be shown if ``en_activite`` is checked. Inside ``type_contrat``, ``type_contrat_aide`` should be shown when ``contrat_aide`` is checked.
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<div id="situation_prof">
|
||||
<input type="radio" name="situationProfessionnelle" value="" checked="checked" />
|
||||
<input type="radio" name="situationProfessionnelle" value="sans_emploi" />
|
||||
<input type="radio" name="situationProfessionnelle" value="en_activite" />
|
||||
</div>
|
||||
|
||||
|
||||
<div id="type_contrat">
|
||||
<input type="checkbox" name="typeContrat[]" value="cdd" />
|
||||
<input type="checkbox" name="typeContrat[]" value="cdi" />
|
||||
<input type="checkbox" name="typeContrat[]" value="contrat_aide" />
|
||||
</div>
|
||||
|
||||
<div id="type_contrat_aide">
|
||||
<input type="text" name="typeContratAide" />
|
||||
</div>
|
||||
|
||||
The JS code will be:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||
// we search for the element within the DOM
|
||||
// NOTE: all the elements should be searched before instanciating the showHides.
|
||||
// if not, the elements **may** have disappeared from the DOM
|
||||
|
||||
var
|
||||
situation_prof = document.getElementById('situation_prof'),
|
||||
type_contrat = document.getElementById('type_contrat'),
|
||||
type_contrat_aide = document.getElementById('type_contrat_aide'),
|
||||
;
|
||||
|
||||
// the first show/hide will apply on situation_prof
|
||||
new ShowHide({
|
||||
// the id will help us to keep a track of the element
|
||||
id: 'situation_prof_type_contrat',
|
||||
froms: [situation_prof],
|
||||
container: [type_contrat],
|
||||
test: function(froms) {
|
||||
for (let f of froms.values()) {
|
||||
for (let input of f.querySelectorAll('input').values()) {
|
||||
if (input.value === 'en_activite') {
|
||||
return input.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// the show/hide will apply on "contrat aide"
|
||||
var show_hide_contrat_aide = new ShowHide({
|
||||
froms: [type_contrat],
|
||||
container: [type_contrat_aide],
|
||||
test: function(froms) {
|
||||
for (let f of froms.values()) {
|
||||
for (let input of f.querySelectorAll('input').values()) {
|
||||
if (input.value === 'contrat_aide') {
|
||||
return input.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// we handle here the case when the first show-hide is changed: the third input must also disappears
|
||||
window.addEventListener('show-hide-hide', function (e) {
|
||||
if (e.detail.id = 'situation_prof_type_contrat') {
|
||||
// we force the 3rd element to disappears
|
||||
show_hide_contrat_aide.forceHide();
|
||||
}
|
||||
});
|
||||
|
||||
// when the first show-hide is changed, it makes appears the second one.
|
||||
// we check here that the second show-hide is processed.
|
||||
window.addEventListener('show-hide-show', function (e) {
|
||||
if (e.detail.id = 'situation_prof_type_contrat') {
|
||||
show_hide_contrat_aide.forceCompute();
|
||||
}
|
||||
});
|
@@ -0,0 +1,39 @@
|
||||
import { ShowHide } from 'ShowHide/show_hide.js';
|
||||
|
||||
var
|
||||
div_accompagnement = document.getElementById("form_accompagnement"),
|
||||
div_accompagnement_comment = document.getElementById("form_accompagnement_comment"),
|
||||
div_caf_id = document.getElementById("cafId"),
|
||||
div_caf_inscription_date = document.getElementById("cafInscriptionDate"),
|
||||
;
|
||||
|
||||
// let show/hide the div_accompagnement_comment if the input with value `'autre'` is checked
|
||||
new ShowHide({
|
||||
"froms": [div_accompagnement],
|
||||
"test": function(froms, event) {
|
||||
for (let el of froms.values()) {
|
||||
for (let input of el.querySelectorAll('input').values()) {
|
||||
if (input.value === 'autre') {
|
||||
return input.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
"container": [div_accompagnement_comment]
|
||||
});
|
||||
|
||||
// let show the date input only if the the id is filled
|
||||
new ShowHide({
|
||||
froms: [ div_caf_id ],
|
||||
test: function(froms, event) {
|
||||
for (let el of froms.values()) {
|
||||
return el.querySelector("input").value !== "";
|
||||
}
|
||||
},
|
||||
container: [ div_caf_inscription_date ],
|
||||
// using this option, we use the event `input` instead of `change`
|
||||
event_name: 'input'
|
||||
});
|
||||
|
225
docs/source/development/user-interface/layout-template-usage.rst
Normal file
@@ -0,0 +1,225 @@
|
||||
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
|
||||
Layout / Template usage
|
||||
#######################
|
||||
|
||||
We recommand the use of the existing layouts to ensure the consistency of the design. This section explains the different templates and how to use it.
|
||||
|
||||
The layouts are twig templates.
|
||||
|
||||
Twig templating helper
|
||||
======================
|
||||
|
||||
`chill_print_or_message`
|
||||
------------------------
|
||||
|
||||
Print a value or use a default template if the value is empty.
|
||||
|
||||
The template can be customized.
|
||||
|
||||
Two default templates are registered:
|
||||
|
||||
- :code:`default`, do not decorate the value ;
|
||||
- :code:`blockquote`: wrap the value into a blockquote if exists
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
{{ "This is a message"|chill_print_or_message("No message") }}
|
||||
<!-- will print "This is a message" -->
|
||||
|
||||
{{ ""|chill_print_or_message("No message")}}
|
||||
<!-- will print <span class="chill-no-data-statement">No message</span> -->
|
||||
|
||||
{{ "This is a comment\n with multiples lines"|chill_print_or_message("No comment", 'blockquote') }}
|
||||
<!-- will print <blockquote class="chill-user-quote">This is a comment<br/>with multiples lines</blockquote> -->
|
||||
|
||||
When customizing the template, two arguments are passed to the template:
|
||||
|
||||
- :code:`value`: the actual value ;
|
||||
- :code:`message`: the message, given as argument
|
||||
|
||||
Routing with return path
|
||||
------------------------
|
||||
|
||||
Three twig function are available for creating routes and handling "return path".
|
||||
|
||||
**Rationale**: When building a "CRUD" (CReate, Update, Delete of an entity), you would like to allow people to go back on some custom cancel page when coming for another place of an application. For instance, if you are in the timeline and show an activity, you would like that the user go back to the timeline when pressing the "return" button at the bottom of the page, instead of going back to the "activity list" page.
|
||||
|
||||
Using those function, a :code:`returnPath` parameter will be added in the path generated. It will be used instead of the default one in the subsequente pages.
|
||||
|
||||
- :code:`chill_path_add_return_path(name, parameters = [], relative = false)`: will create a path with current page as return path (users will go back to the current page on the next page) ;
|
||||
- :code:`chill_return_path_or(name, parameters = [], relative = false)`: will create a path to the return path if present, or build the path according to the given parameters ;
|
||||
- :code:`chill_path_forward_return_path(name, parameters = [], relative = false)`: will create a path and adding the return path that is present for the current page, *forwarding* the return path to the next page. This is useful if you are on a "show" page with a return path (by instance, the "timeline" page), you place a link to the *edit* page and want users to go back to the "timeline" page on the edit page.
|
||||
|
||||
|
||||
- :code:`chill_return_path_or`:
|
||||
|
||||
|
||||
Organisation of the layouts
|
||||
===========================
|
||||
|
||||
ChillMainBundle::layout.html.twig
|
||||
---------------------------------
|
||||
|
||||
This is the base layout. It includes the most import css / js files. It display a page with
|
||||
|
||||
* a horizontal navigation menu
|
||||
* a place for content
|
||||
* a footer
|
||||
|
||||
|
||||
The layout containts blocks, that are :
|
||||
|
||||
* title
|
||||
|
||||
* to display title
|
||||
|
||||
* css
|
||||
|
||||
* where to add some custom css
|
||||
|
||||
* navigation_section_menu
|
||||
|
||||
* place where to insert the section menu in the navigation menu (by default the navigation menu is inserted)
|
||||
|
||||
* navigation_search_bar
|
||||
|
||||
* place where to insert a search bar in the navigation menu (by default the search bar is inserted)
|
||||
|
||||
* top_banner
|
||||
|
||||
* place where to display a banner below the navigation menu (this place is use to display the details of the person)
|
||||
|
||||
* sublayout_containter
|
||||
|
||||
* place between the header and the footer that can be used to create a new layout (with vertical menu for example)
|
||||
|
||||
* content
|
||||
|
||||
* place where to display the content (flash message are included outside of this block)
|
||||
|
||||
* js
|
||||
|
||||
* where to add some custom javascript
|
||||
|
||||
|
||||
ChillMainBundle::layoutWithVerticalMenu.html.twig
|
||||
-------------------------------------------------
|
||||
|
||||
This layout extends `ChillMainBundle::layout.html.twig`. It replaces the block `layout_content` and divides this block for displaying a vertical menu and some content.
|
||||
|
||||
It proposes 2 new blocks :
|
||||
|
||||
* layout_wvm_content
|
||||
|
||||
* where to display the page content
|
||||
|
||||
* vertical_menu_content
|
||||
|
||||
* where to place the vertical menu
|
||||
|
||||
|
||||
ChillMainBundle::Admin/layout.html.twig
|
||||
---------------------------------------
|
||||
|
||||
This layout extends `ChillMainBundle::layout.html.twig`. It hides the search bar, remplaces the `section menu` with the `admin section menu`.
|
||||
|
||||
It proposes a new block :
|
||||
|
||||
* admin_content
|
||||
|
||||
* where to display the admin content
|
||||
|
||||
|
||||
ChillMainBundle::Admin/layoutWithVerticalMenu.html.twig
|
||||
-------------------------------------------------------
|
||||
|
||||
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig`. It do the same changes than `ChillMainBundle::Admin/layout.html.twig` : hiding the search bar, remplacing the `section menu` with the `admin section menu`.
|
||||
|
||||
It proposes a new block :
|
||||
|
||||
* admin_content
|
||||
|
||||
* where to display the admin content
|
||||
|
||||
ChillPersonBundle::layout.html.twig
|
||||
-----------------------------------
|
||||
|
||||
This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the person details in the block `top_banner`, set the menu `person` as the vertical menu.
|
||||
|
||||
It proposes 1 new block :
|
||||
|
||||
* personcontent
|
||||
|
||||
* where to display the information of the person
|
||||
|
||||
|
||||
ChillMainBundle::Export/layout.html.twig
|
||||
----------------------------------------
|
||||
|
||||
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig` and set the menu `export` as the vertical menu.
|
||||
|
||||
It proposes 1 new block :
|
||||
|
||||
* export_content
|
||||
|
||||
* where to display the content of the export
|
||||
|
||||
Useful template and helpers
|
||||
===========================
|
||||
|
||||
Macros
|
||||
------
|
||||
|
||||
Every bundle may bring their own macro to print resources with uniformized styles.
|
||||
|
||||
See :
|
||||
|
||||
- :ref:`Macros in person bundle <person-bundle-macros>` ;
|
||||
- :ref:`Macros in activity bundle <activity-bundle-macros>` ;
|
||||
- :ref:`Macros in group bundle <group-bundle-macros>` ;
|
||||
- :ref:`Macros in main bundle <main-bundle-macros>` ;
|
||||
|
||||
Templates
|
||||
---------
|
||||
|
||||
ChillMainBundle::Util:confirmation_template.html.twig
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This template show a confirmation template before making dangerous things. You can add your own message and title, or define those message by yourself in another template.
|
||||
|
||||
The accepted parameters are :
|
||||
|
||||
- `title` (string) a title for the page. Not mandatory (it won't be rendered if not defined)
|
||||
- `confirm_question` (string) a confirmation question. This question will not be translated into the template, and may be printed as raw. Not mandatory (it won't be rendered if not defined)
|
||||
- `form` : (:class:`Symfony\Component\Form\FormView`) a form wich **must** contains an input named `submit`, which must be a :class:`Symfony\Component\Form\Extension\Core\Type\SubmitType`. Mandatory
|
||||
- `cancel_route` : (string) the name of a route if the user want to cancel the action
|
||||
- `cancel_parameters` (array) the parameters for the route defined in `cancel_route`
|
||||
|
||||
|
||||
Usage :
|
||||
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
|
||||
{
|
||||
# a title, not mandatory
|
||||
'title' : 'Remove membership'|trans,
|
||||
# a confirmation question, not mandatory
|
||||
'confirm_question' : 'Are you sure you want to remove membership ?'|trans
|
||||
# a route for "cancel" button (mandatory)
|
||||
'cancel_route' : 'chill_group_membership_by_person',
|
||||
# the parameters for 'cancel' route (default to {} )
|
||||
'cancel_parameters' : { 'person_id' : membership.person.id },
|
||||
# the form which will send the deletion. This form
|
||||
# **must** contains a SubmitType
|
||||
'form' : form
|
||||
} ) }}
|
333
docs/source/development/user-interface/widgets.rst
Normal file
@@ -0,0 +1,333 @@
|
||||
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Widgets
|
||||
##############################################
|
||||
|
||||
Rationale
|
||||
=========
|
||||
|
||||
Widgets are useful if you want to publish content on a page provided by another bundle.
|
||||
|
||||
|
||||
Examples :
|
||||
|
||||
- you want to publish a list of people on the homepage ;
|
||||
- you may want to show the group belonging (see :ref:`group-bundle`) below of the vertical menu, only if the bundle is installed.
|
||||
|
||||
The administrator of the chill instance may configure the presence of widget. Although, some widget are defined by default (see :ref:`declaring-widget-by-default`).
|
||||
|
||||
Concepts
|
||||
========
|
||||
|
||||
A bundle may define *place(s)* where a widget may be rendered.
|
||||
|
||||
In a single *place*, zero, one or more *widget* may be displayed.
|
||||
|
||||
Some *widget* may require some *configuration*, and some does not require any configuration.
|
||||
|
||||
Example:
|
||||
|
||||
=========================================== ======== ============================= =======================================
|
||||
Use case place place defined by... widget provided by...
|
||||
=========================================== ======== ============================= =======================================
|
||||
Publishing a list of people on the homepage homepage defined by :ref:`main-bundle` widget provided by :ref:`person-bundle`
|
||||
=========================================== ======== ============================= =======================================
|
||||
|
||||
|
||||
|
||||
Creating a widget without configuration
|
||||
========================================
|
||||
|
||||
To add a widget, you should :
|
||||
|
||||
- define your widget, implementing :class:`Chill\MainBundle\Templating\Widget\WidgetInterface` ;
|
||||
- declare your widget with tag `chill_widget`.
|
||||
|
||||
|
||||
Define the widget class
|
||||
-----------------------
|
||||
|
||||
Define your widget class by implemeting :class:`Chill\MainBundle\Templating\Widget\WidgetInterface`.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Widget;
|
||||
|
||||
use Chill\MainBundle\Templating\Widget\WidgetInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Add a button "add a person"
|
||||
*
|
||||
*/
|
||||
class AddAPersonWidget implements WidgetInterface
|
||||
{
|
||||
public function render(
|
||||
\Twig_Environment $env,
|
||||
$place,
|
||||
array $context,
|
||||
array $config
|
||||
) {
|
||||
// this will render a link to the page "add a person"
|
||||
return $env->render("ChillPersonBundle:Widget:homepage_add_a_person.html.twig");
|
||||
}
|
||||
}
|
||||
|
||||
Arguments are :
|
||||
|
||||
- :code:`$env` the :class:`\Twig_Environment`, which you can use to render your widget ;
|
||||
- :code:`$place` a string representing the place where the widget is rendered ;
|
||||
- :code:`$context` the context given by the template ;
|
||||
- :code:`$config` the configuration which is, in this case, always an empty array (see :ref:`creating-a-widget-with-config`).
|
||||
|
||||
.. note::
|
||||
|
||||
The html returned by the :code:`render` function will be considered as html safe. You should strip html before returning it. See also `How to escape output in template <http://symfony.com/doc/current/templating/escaping.html>`_.
|
||||
|
||||
|
||||
Declare your widget
|
||||
-------------------
|
||||
|
||||
Declare your widget as a service and add it the tag :code:`chill_widget`:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
service:
|
||||
chill_person.widget.add_person:
|
||||
class: Chill\PersonBundle\Widget\AddAPersonWidget
|
||||
tags:
|
||||
- { name: chill_widget, alias: add_person, place: homepage }
|
||||
|
||||
|
||||
The tag must contains those arguments :
|
||||
|
||||
- :code:`alias`: an alias, which will be used to reference the widget into the config
|
||||
- :code:`place`: a place where this widget is authorized
|
||||
|
||||
If you want your widget to be available on multiple places, you should add one tag with each place.
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
Once your widget is correctly declared, your widget should be available in configuration.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ php app/console config:dump-reference chill_main
|
||||
# Default configuration for extension with alias: "chill_main"
|
||||
chill_main:
|
||||
[...]
|
||||
# register widgets on place "homepage"
|
||||
homepage:
|
||||
|
||||
# the ordering of the widget. May be a number with decimal
|
||||
order: ~ # Required, Example: 10.58
|
||||
|
||||
# the widget alias (see your installed bundles config). Possible values are (maybe incomplete) : person_list, add_person
|
||||
widget_alias: ~ # Required
|
||||
|
||||
If you want to add your widget by default, see :ref:`declaring-widget-by-default`.
|
||||
|
||||
.. _creating-a-widget-with-config:
|
||||
|
||||
Creating a widget **with** configuration
|
||||
========================================
|
||||
|
||||
You can declare some configuration with your widget, which allow administrators to add their own configuration.
|
||||
|
||||
To add some configuration, you will :
|
||||
|
||||
- declare a widget as defined above ;
|
||||
- optionnaly declare it as a service ;
|
||||
- add a widget factory, which will add configuration to the bundle which provide the place.
|
||||
|
||||
|
||||
Declare your widget class
|
||||
-------------------------
|
||||
|
||||
Declare your widget. You can use some configuration elements in your process, as used here :
|
||||
|
||||
.. literalinclude:: ./widgets/ChillPersonAddAPersonWidget.php
|
||||
:language: php
|
||||
|
||||
Declare your widget as a service
|
||||
--------------------------------
|
||||
|
||||
You can declare your widget as a service. Not tag is required, as the service will be defined by the :code:`Factory` during next step.
|
||||
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill_person.widget.person_list:
|
||||
class: Chill\PersonBundle\Widget\PersonListWidget
|
||||
arguments:
|
||||
- "@chill.person.repository.person"
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@chill.main.security.authorization.helper"
|
||||
- "@security.token_storage"
|
||||
# this widget is defined by the PersonListWidgetFactory
|
||||
|
||||
You can eventually skip this step and declare your service into the container through the factory (see above).
|
||||
|
||||
Declare your widget factory
|
||||
---------------------------
|
||||
|
||||
The widget factory must implements `Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface`. For your convenience, an :class:`Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory` will already implements some easy method.
|
||||
|
||||
.. literalinclude:: ./widgets/ChillPersonAddAPersonListWidgetFactory.php
|
||||
:language: php
|
||||
|
||||
.. note::
|
||||
You can declare your widget into the container by overriding the `createDefinition` method. By default, this method will return the already existing service definition with the id given by :code:`getServiceId`. But you can create or adapt programmatically the definition. `See the symfony doc on how to do it <http://symfony.com/doc/current/service_container/definitions.html#working-with-a-definition>`_.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
public function createDefinition(ContainerBuilder $containerBuilder, $place, $order, array $config)
|
||||
{
|
||||
$definition = new \Symfony\Component\DependencyInjection\Definition('my\Class');
|
||||
// create or adapt your definition here
|
||||
|
||||
return $definition;
|
||||
}
|
||||
|
||||
You must then register your factory into the :code:`Extension` class which provide the place. This is done in the :code: `Bundle` class.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
# Chill/PersonBundle/ChillPersonBundle.php
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\PersonBundle\Widget\PersonListWidgetFactory;
|
||||
|
||||
class ChillPersonBundle extends Bundle
|
||||
{
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->getExtension('chill_main')
|
||||
->addWidgetFactory(new PersonListWidgetFactory());
|
||||
}
|
||||
}
|
||||
|
||||
.. _declaring-widget-by-default:
|
||||
|
||||
Declaring a widget by default
|
||||
=============================
|
||||
|
||||
Use the ability `to prepend configuration of other bundle <http://symfony.com/doc/current/bundles/prepend_extension.html>`_. A living example here :
|
||||
|
||||
.. literalinclude:: ./widgets/ChillPersonExtension.php
|
||||
:language: php
|
||||
|
||||
|
||||
Defining a place
|
||||
================
|
||||
|
||||
Add your place in template
|
||||
--------------------------
|
||||
|
||||
A place should be defined by using the :code:`chill_widget` function, which take as argument :
|
||||
|
||||
- :code:`place` (string) a string defining the place ;
|
||||
- :code:`context` (array) an array defining the context.
|
||||
|
||||
The context should be documented by the bundle. It will give some information about the context of the page. Example: if the page concerns a people, the :class:`Chill\PersonBundle\Entity\Person` class will be in the context.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{# an empty context on homepage #}
|
||||
{{ chill_widget('homepage', {} }}
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{# defining a place 'right column' with the person currently viewed
|
||||
{{ chill_widget('right_column', { 'person' : person } }}
|
||||
|
||||
|
||||
Declare configuration for you place
|
||||
-----------------------------------
|
||||
|
||||
In order to let other bundle, or user, to define the widgets inside the given place, you should open a configuration. You can use the Trait :class:`Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait`, which provide the method `addWidgetConfiguration($place, ContainerBuilder $container)`.
|
||||
|
||||
Example :
|
||||
|
||||
.. literalinclude:: ./widgets/ChillMainConfiguration.php
|
||||
:language: php
|
||||
:emphasize-lines: 17, 30, 32, 52
|
||||
:linenos:
|
||||
|
||||
.. _example-chill-main-extension:
|
||||
|
||||
You should also adapt the :class:`DependencyInjection\*Extension` class to add ContainerBuilder and WidgetFactories :
|
||||
|
||||
.. literalinclude:: ./widgets/ChillMainExtension.php
|
||||
:language: php
|
||||
:emphasize-lines: 25-39, 48-49, 56
|
||||
:linenos:
|
||||
|
||||
- line 25-39: we implements the method required by :class:`Chill\MainBundle\DependencyInjection\Widget\HasWidgetExtensionInterface` ;
|
||||
- line 48-49: we record the configuration of widget into container's parameter ;
|
||||
- line 56 : we create an instance of :class:`Configuration` (declared above)
|
||||
|
||||
Compile the possible widget using Compiler pass
|
||||
-----------------------------------------------
|
||||
|
||||
For your convenience, simply extends :class:`Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass`. This class provides a `doProcess(ContainerBuildere $container, $extension, $parameterName)` method which will do the job for you:
|
||||
|
||||
- :code:`$container` is the container builder
|
||||
- :code:`$extension` is the extension name
|
||||
- :code:`$parameterName` is the name of the parameter which contains the configuration for widgets (see :ref:`the example with ChillMain above <example-chill-main-extension>`.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass;
|
||||
|
||||
/**
|
||||
* Compile the service definition to register widgets.
|
||||
*
|
||||
*/
|
||||
class WidgetsCompilerPass extends AbstractWidgetsCompilerPass {
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$this->doProcess($container, 'chill_main', 'chill_main.widgets');
|
||||
}
|
||||
}
|
||||
|
||||
As explained `in the symfony docs <http://symfony.com/doc/current/service_container/compiler_passes.html>`_, you should register your Compiler Pass into your bundle :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\MainBundle\DependencyInjection\CompilerPass\WidgetsCompilerPass;
|
||||
|
||||
|
||||
class ChillMainBundle extends Bundle
|
||||
{
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
$container->addCompilerPass(new WidgetsCompilerPass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
# Chill\MainBundle\DependencyInjection\Configuration.php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Configure the main bundle
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
|
||||
use AddWidgetConfigurationTrait;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var ContainerBuilder
|
||||
*/
|
||||
private $containerBuilder;
|
||||
|
||||
|
||||
public function __construct(array $widgetFactories = array(),
|
||||
ContainerBuilder $containerBuilder)
|
||||
{
|
||||
// we register here widget factories (see below)
|
||||
$this->setWidgetFactories($widgetFactories);
|
||||
// we will need the container builder later...
|
||||
$this->containerBuilder = $containerBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('chill_main');
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
|
||||
// ...
|
||||
|
||||
->arrayNode('widgets')
|
||||
->canBeDisabled()
|
||||
->children()
|
||||
// we declare here all configuration for homepage place
|
||||
->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder))
|
||||
->end() // end of widgets/children
|
||||
->end() // end of widgets
|
||||
->end() // end of root/children
|
||||
->end() // end of root
|
||||
;
|
||||
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
#Chill\MainBundle\DependencyInjection\ChillMainExtension.php
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
|
||||
use Chill\MainBundle\DependencyInjection\Configuration;
|
||||
|
||||
/**
|
||||
* This class load config for chillMainExtension.
|
||||
*/
|
||||
class ChillMainExtension extends Extension implements Widget\HasWidgetFactoriesExtensionInterface
|
||||
{
|
||||
/**
|
||||
* widget factory
|
||||
*
|
||||
* @var WidgetFactoryInterface[]
|
||||
*/
|
||||
protected $widgetFactories = array();
|
||||
|
||||
public function addWidgetFactory(WidgetFactoryInterface $factory)
|
||||
{
|
||||
$this->widgetFactories[] = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return WidgetFactoryInterface[]
|
||||
*/
|
||||
public function getWidgetFactories()
|
||||
{
|
||||
return $this->widgetFactories;
|
||||
}
|
||||
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
// configuration for main bundle
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
// add the key 'widget' without the key 'enable'
|
||||
$container->setParameter('chill_main.widgets',
|
||||
array('homepage' => $config['widgets']['homepage']));
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||
{
|
||||
return new Configuration($this->widgetFactories, $container);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
# Chill/PersonBundle/Widget/PersonListWidgetFactory
|
||||
|
||||
namespace Chill\PersonBundle\Widget;
|
||||
|
||||
use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
|
||||
|
||||
/**
|
||||
* add configuration for the person_list widget.
|
||||
*/
|
||||
class PersonListWidgetFactory extends AbstractWidgetFactory
|
||||
{
|
||||
/*
|
||||
* append the option to the configuration
|
||||
* see http://symfony.com/doc/current/components/config/definition.html
|
||||
*
|
||||
*/
|
||||
public function configureOptions($place, NodeBuilder $node)
|
||||
{
|
||||
$node->booleanNode('only_active')
|
||||
->defaultTrue()
|
||||
->end();
|
||||
$node->integerNode('number_of_items')
|
||||
->defaultValue(50)
|
||||
->end();
|
||||
$node->scalarNode('filtering_class')
|
||||
->defaultNull()
|
||||
->end();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* return an array with the allowed places where the widget can be rendered
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getAllowedPlaces()
|
||||
{
|
||||
return array('homepage');
|
||||
}
|
||||
|
||||
/*
|
||||
* return the widget alias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWidgetAlias()
|
||||
{
|
||||
return 'person_list';
|
||||
}
|
||||
|
||||
/*
|
||||
* return the service id for the service which will render the widget.
|
||||
*
|
||||
* this service must implements `Chill\MainBundle\Templating\Widget\WidgetInterface`
|
||||
*
|
||||
* the service must exists in the container, and it is not required that the service
|
||||
* has the `chill_main` tag.
|
||||
*/
|
||||
public function getServiceId(ContainerBuilder $containerBuilder, $place, $order, array $config)
|
||||
{
|
||||
return 'chill_person.widget.person_list';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
# Chill/PersonBundle/Widget/PersonListWidget.php
|
||||
|
||||
namespace Chill\PersonBundle\Widget;
|
||||
|
||||
use Chill\MainBundle\Templating\Widget\WidgetInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
/**
|
||||
* add a widget with person list.
|
||||
*
|
||||
* The configuration is defined by `PersonListWidgetFactory`
|
||||
*/
|
||||
class PersonListWidget implements WidgetInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Repository for persons
|
||||
*
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $personRepository;
|
||||
|
||||
/**
|
||||
* The entity manager
|
||||
*
|
||||
* @var EntityManager
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* the authorization helper
|
||||
*
|
||||
* @var AuthorizationHelper;
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TokenStorage
|
||||
*/
|
||||
protected $tokenStorage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var UserInterface
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
public function __construct(
|
||||
EntityRepository $personRepostory,
|
||||
EntityManager $em,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorage $tokenStorage
|
||||
) {
|
||||
$this->personRepository = $personRepostory;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->entityManager = $em;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $place
|
||||
* @param array $context
|
||||
* @param array $config
|
||||
* @return string
|
||||
*/
|
||||
public function render(\Twig_Environment $env, $place, array $context, array $config)
|
||||
{
|
||||
$qb = $this->personRepository
|
||||
->createQueryBuilder('person');
|
||||
|
||||
// show only the person from the authorized centers
|
||||
$and = $qb->expr()->andX();
|
||||
$centers = $this->authorizationHelper
|
||||
->getReachableCenters($this->getUser(), new Role(PersonVoter::SEE));
|
||||
$and->add($qb->expr()->in('person.center', ':centers'));
|
||||
$qb->setParameter('centers', $centers);
|
||||
|
||||
|
||||
// add the "only active" where clause
|
||||
if ($config['only_active'] === true) {
|
||||
$qb->join('person.accompanyingPeriods', 'ap');
|
||||
$or = new Expr\Orx();
|
||||
// add the case where closingDate IS NULL
|
||||
$andWhenClosingDateIsNull = new Expr\Andx();
|
||||
$andWhenClosingDateIsNull->add((new Expr())->isNull('ap.closingDate'));
|
||||
$andWhenClosingDateIsNull->add((new Expr())->gte(':now', 'ap.openingDate'));
|
||||
$or->add($andWhenClosingDateIsNull);
|
||||
// add the case when now is between opening date and closing date
|
||||
$or->add(
|
||||
(new Expr())->between(':now', 'ap.openingDate', 'ap.closingDate')
|
||||
);
|
||||
$and->add($or);
|
||||
$qb->setParameter('now', new \DateTime(), Type::DATE);
|
||||
}
|
||||
|
||||
// adding the where clause to the query
|
||||
$qb->where($and);
|
||||
|
||||
$qb->setFirstResult(0)->setMaxResults($config['number_of_items']);
|
||||
|
||||
$persons = $qb->getQuery()->getResult();
|
||||
|
||||
return $env->render(
|
||||
'ChillPersonBundle:Widget:homepage_person_list.html.twig',
|
||||
array('persons' => $persons)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return UserInterface
|
||||
*/
|
||||
private function getUser()
|
||||
{
|
||||
// return a user
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
# Chill/PersonBundle/DependencyInjection/ChillPersonExtension.php
|
||||
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Chill\MainBundle\DependencyInjection\MissingBundleException;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
|
||||
/**
|
||||
* This is the class that loads and manages your bundle configuration
|
||||
*
|
||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
|
||||
*/
|
||||
class ChillPersonExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Add a widget "add a person" on the homepage, automatically
|
||||
*
|
||||
* @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'widgets' => array(
|
||||
'homepage' => array(
|
||||
array(
|
||||
'widget_alias' => 'add_person',
|
||||
'order' => 2
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
86
docs/source/index.rst
Normal file
@@ -0,0 +1,86 @@
|
||||
.. chill-doc documentation master file, created by
|
||||
sphinx-quickstart on Sun Sep 28 22:04:08 2014.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Welcome to Chill documentation!
|
||||
=====================================
|
||||
|
||||
Chill is a free software for social workers.
|
||||
|
||||
Chill rely on the php framework `Symfony <http://symfony.com>`_.
|
||||
|
||||
Contents of this documentation:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
installation/index.rst
|
||||
development/index.rst
|
||||
Bundles <bundles/index.rst>
|
||||
|
||||
Let's talk together !
|
||||
======================
|
||||
|
||||
You may talk to developers using the matrix room: `https://app.element.io/#/room/#chill-social-admin:matrix.org`_
|
||||
|
||||
Contribute
|
||||
==========
|
||||
|
||||
|
||||
* `Issue tracker <https://gitlab.com/groups/Chill-project/issues>`_ You may want to dispatch the issue in the multiple projects. If you do not know in which project is located your bug / feature request, use the project Chill-Main.
|
||||
|
||||
|
||||
User manual
|
||||
===========
|
||||
|
||||
An user manual exists in French and currently focuses on describing the main concept of the software.
|
||||
|
||||
`Read (and contribute) to the manual <https://fr.wikibooks.org/wiki/Chill>`_
|
||||
|
||||
Available bundles
|
||||
=================
|
||||
|
||||
* Chill-app | https://gitlab.com/Chill-project/Chill-app This is the skeleton of the project. It does contains only few code, but information about configuration of your instance ;
|
||||
* Chill-bundle: contains the main bundles, the most used in an instance. This means:
|
||||
* chill-main, the main framework,
|
||||
* Chill Person, to deal with persons,
|
||||
* chill custom fields, to add custom fields to some entities,
|
||||
* chill activity: to add activities to people,
|
||||
* chill report: to add report to people,
|
||||
* chill event: to gather people into events,
|
||||
* chill docs store: to store documents to people, but also entities,
|
||||
* chill task: to register task with people,
|
||||
* chill third party: to register third parties,
|
||||
* chill family members: to register family members
|
||||
|
||||
You will also found the following projects :
|
||||
|
||||
* The website https://chill.social : https://gitlab.com/Chill-project/chill.social
|
||||
|
||||
And various project to build docker containers with Chill.
|
||||
|
||||
TODO in documentation
|
||||
=====================
|
||||
|
||||
.. todolist::
|
||||
|
||||
Licence
|
||||
========
|
||||
|
||||
The project is available under the `GNU AFFERO GENERAL PUBLIC LICENSE v3`_.
|
||||
|
||||
This documentation is published under the `GNU Free Documentation License (FDL) v1.3`_
|
||||
|
||||
|
||||
.. _GNU AFFERO GENERAL PUBLIC LICENSE v3: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
.. _GNU Free Documentation License (FDL) v1.3: http://www.gnu.org/licenses/fdl-1.3.html
|
||||
|
259
docs/source/installation/index.rst
Normal file
@@ -0,0 +1,259 @@
|
||||
.. chill-doc documentation master file, created by
|
||||
sphinx-quickstart on Sun Sep 28 22:04:08 2014.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
.. Copyright (C) 2014-2019 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Installation & Usage
|
||||
####################
|
||||
|
||||
|
||||
Requirements
|
||||
************
|
||||
|
||||
- This project use `docker <https://docker.com>`_ to be run. As a developer, use `docker-compose <https://docs.docker.com/compose/overview/>`_ to bootstrap a dev environment in a glance. You do not need any other dependencies ;
|
||||
- Make is used to automate scripts.
|
||||
|
||||
Installation in development mode
|
||||
********************************
|
||||
|
||||
1. Get the code
|
||||
===============
|
||||
|
||||
Clone or download the chill-app project and `cd` into the main directory.
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://gitlab.com/Chill-Projet/chill-app.git
|
||||
cd chill-app
|
||||
|
||||
|
||||
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
|
||||
|
||||
2. Prepare your variables
|
||||
=========================
|
||||
|
||||
Have a look at the variable in ``.env.dist`` and in ``app/config/parameters.yml.dist`` and check if you need to adapt them. If they do not adapt with your need, or if some are missing:
|
||||
|
||||
1. copy the file as ``.env``: ``cp .env.dist .env``
|
||||
2. you may replace some variables inside ``.env``
|
||||
|
||||
**Note**: If you intend to use the bundle ``Chill-Doc-Store``, you will need to configure and install an openstack object storage container with temporary url middleware. You will have to configure `secret keys <https://docs.openstack.org/swift/latest/api/temporary_url_middleware.html#secret-keys>`_.
|
||||
|
||||
3. Run the bootstrap script
|
||||
===========================
|
||||
|
||||
This script can be run using `make`
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make init
|
||||
|
||||
This script will :
|
||||
|
||||
1. force docker-compose to, eventually, pull the base images and build the image used by this project ;
|
||||
2. run an install script to download `composer <https://getcomposer.org>`_ ;
|
||||
3. install the php dependencies
|
||||
4. build assets
|
||||
|
||||
|
||||
4. Start the project
|
||||
====================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose up
|
||||
|
||||
**On the first run** (and after each upgrade), you must execute *post update commands* and run database migrations. With a container up and running, execute the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make migrate
|
||||
|
||||
Chill will be available at ``http://localhost:8001.`` Currently, there isn't any user or data. To add fixtures, run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load --purge-with-truncate
|
||||
|
||||
There are several users available:
|
||||
|
||||
- ``center a_social``
|
||||
- ``center b_social``
|
||||
|
||||
The password is always ``password``.
|
||||
|
||||
Now, read `Operations` below.
|
||||
|
||||
Operations
|
||||
**********
|
||||
|
||||
Build assets
|
||||
============
|
||||
|
||||
run those commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make build-assets
|
||||
|
||||
How to execute the console ?
|
||||
============================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php bin/console
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php bin/console
|
||||
|
||||
How to create the database schema (= run migrations) ?
|
||||
======================================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php bin/console doctrine:migrations:migrate
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php bin/console doctrine:migrations:migrate
|
||||
|
||||
|
||||
How to read the email sent by the program ?
|
||||
===========================================
|
||||
|
||||
Go at ``http://localhost:8005`` and you should have access to mailcatcher.
|
||||
|
||||
In case of you should click on a link in the email, be aware that you should remove the "s" from https.
|
||||
|
||||
How to load fixtures ? (development mode only)
|
||||
==============================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php bin/console doctrine:fixtures:load
|
||||
|
||||
How to open a terminal in the project
|
||||
=====================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php /bin/bash
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php /bin/bash
|
||||
|
||||
How to run composer ?
|
||||
=====================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php ./composer.phar
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php ./composer.phar
|
||||
|
||||
How to access to PGADMIN ?
|
||||
==========================
|
||||
|
||||
Pgadmin is installed with docker-compose.
|
||||
|
||||
You can access it at ``http://localhost:8002``.
|
||||
|
||||
Credentials:
|
||||
|
||||
- login: admin@chill.social
|
||||
- password: password
|
||||
|
||||
How to run tests ?
|
||||
==================
|
||||
|
||||
Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place.
|
||||
|
||||
**Note**: some bundle require the fixture to be executed. See the dedicated _how-tos_.
|
||||
|
||||
Exemple, for running test inside `main` bundle:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# mount into the php image
|
||||
docker-compose run --user $(id -u) php /bin/bash
|
||||
# cd into main directory
|
||||
cd vendor/chill-project/main
|
||||
# download deps
|
||||
php ../../../composer.phar install
|
||||
# run tests
|
||||
/vendor/bin/phpunit
|
||||
|
||||
How to run webpack interactively
|
||||
================================
|
||||
|
||||
Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted.
|
||||
|
||||
Build the documentation API
|
||||
===========================
|
||||
|
||||
A basic configuration of `sami <https://github.com/FriendsOfPhp/Sami>`_ is embedded within the project.
|
||||
|
||||
A configuration file for `phpDocumentor <https://www.phpdoc.org>`_ is present.
|
||||
|
||||
Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run
|
||||
====================================================================================================================================================================
|
||||
|
||||
Run :code:`make build-assets`
|
||||
|
||||
Running in production
|
||||
*********************
|
||||
|
||||
Currently, to run this software in production, the *state of the art* is the following :
|
||||
|
||||
1. Run the software locally and tweak the configuration to your needs ;
|
||||
2. Build the image and store them into a private container registry. This can be done using :code:`make build-and-push-image`.
|
||||
|
||||
To be sure to target the correct container registry, you have to adapt the values ``IMAGE_NGINX`` and ``IMAGE_PHP`` date in the ``.env`` file.
|
||||
3. Run the image on your production server, using docker-compose or eventually docker stack. You have to customize the variable set in docker-compose.
|
||||
|
||||
See also the :ref:`running-production-tips-and-tricks` below.
|
||||
|
||||
.. warning::
|
||||
|
||||
In production, you **must** set those variables:
|
||||
|
||||
* ``APP_ENV`` to ``prod``
|
||||
* ``APP_DEBUG`` to ``false``
|
||||
|
||||
There are security issues if you keep the same variable than for production.
|
||||
|
||||
|
||||
.. _running-production-tips-and-tricks:
|
||||
|
||||
Tips and tricks
|
||||
===============
|
||||
|
||||
Operation on database (backups, running custom sql, replication) are easier to set when run outside of a container. If you run into a container, take care of the volume where data are stored.
|
||||
|
||||
The PHP sessions are stored inside redis. This is useful if you distribute the traffic amongst different php server: they will share same sessions if a request goes into a different instance of the container.
|
||||
|
||||
When the PHP servers are shared across multiple instances, take care that some data is stored into redis: the same redis server should be reachable by all instances.
|
||||
|
||||
It is worth having an eye on the configuration of logstash container.
|
||||
|
||||
|
||||
Design principles
|
||||
*****************
|
||||
|
||||
Why the DB URL is set in environment, and not in parameters.yml ?
|
||||
=================================================================
|
||||
|
||||
Because, at startup, a script does check the db is up and, if not, wait for a couple of seconds before running ``entrypoint.sh``. For avoiding double configuration, the configuration of the PHP app takes his configuration from environment also (and it will be standard in future releases, with symfony 4.0).
|
||||
|
22
grumphp.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
imports:
|
||||
- { resource: tests/app/vendor/drupol/php-conventions/config/php73/grumphp.yml }
|
||||
|
||||
parameters:
|
||||
tasks.license.name: AGPL-3.0
|
||||
tasks.license.holder: Champs-Libres
|
||||
tasks.phpstan.configuration: phpstan.neon
|
||||
tasks.phpstan.ignore_patterns:
|
||||
- /src\/Bundle\/(.*)\/migrations/
|
||||
- /src\/Bundle\/(.*)\/Resources/
|
||||
- /src\/Bundle\/(.*)\/Tests/
|
||||
- /src\/Bundle\/(.*)\/Test/
|
||||
- /src\/Bundle\/(.*)\/config/
|
||||
- /src\/Bundle\/(.*)\/translations/
|
||||
- /src\/Bundle\/(.*)\/DataFixtures/
|
||||
- /^docs/
|
||||
- /^tests/
|
||||
skip_tasks:
|
||||
- composer_require_checker
|
||||
- phpcsfixer
|
||||
- phpcs
|
||||
- twigcs
|
23979
phpstan-baseline.neon
Normal file
3
phpstan.neon
Normal file
@@ -0,0 +1,3 @@
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
46
phpunit.xml.dist
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/app/tests/bootstrap.php"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="MainBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="PersonBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
|
||||
<!-- test for export will be runned later -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Export/*</exclude>
|
||||
<!-- we are rewriting accompanying periods... Work in progress -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingPeriodControllerTest.php</exclude>
|
||||
<!-- we are rewriting address, Work in progress -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonAddressControllerTest.php</exclude>
|
||||
<!-- find a solution to create multiple configs -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php</exclude>
|
||||
<!-- temporarily removed, the time to find a fix -->
|
||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<listeners>
|
||||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||
</listeners>
|
||||
|
||||
<!-- Run `composer require symfony/panther` before enabling this extension -->
|
||||
<!--
|
||||
<extensions>
|
||||
<extension class="Symfony\Component\Panther\ServerExtension" />
|
||||
</extensions>
|
||||
-->
|
||||
</phpunit>
|
2022
psalm-baseline.xml
Normal file
16
psalm.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="7"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="psalm-baseline.xml"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="tests/" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
@@ -22,10 +22,12 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
@@ -33,27 +35,44 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ActivityBundle\Form\ActivityType;
|
||||
|
||||
/**
|
||||
* Activity controller.
|
||||
* Class ActivityController
|
||||
*
|
||||
* @package Chill\ActivityBundle\Controller
|
||||
*/
|
||||
class ActivityController extends Controller
|
||||
class ActivityController extends AbstractController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
|
||||
/**
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* ActivityController constructor.
|
||||
*
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param AuthorizationHelper $authorizationHelper
|
||||
*/
|
||||
public function __construct(EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Activity entities.
|
||||
*
|
||||
@@ -69,7 +88,7 @@ class ActivityController extends Controller
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||
|
||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
||||
$reachableScopes = $this->authorizationHelper
|
||||
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||
$person->getCenter());
|
||||
|
||||
@@ -78,13 +97,13 @@ class ActivityController extends Controller
|
||||
array('person' => $person, 'scope' => $reachableScopes),
|
||||
array('date' => 'DESC')
|
||||
);
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => Activity::class,
|
||||
'action' => 'list'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
||||
'activities' => $activities,
|
||||
'person' => $person
|
||||
@@ -222,14 +241,14 @@ class ActivityController extends Controller
|
||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
'action' => 'show'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
|
||||
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
|
||||
'person' => $person,
|
||||
'entity' => $entity,
|
||||
@@ -262,7 +281,7 @@ class ActivityController extends Controller
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
@@ -320,7 +339,7 @@ class ActivityController extends Controller
|
||||
$deleteForm = $this->createDeleteForm($id, $person);
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => Activity::class,
|
||||
'element_id' => $entity->getId(),
|
||||
@@ -337,7 +356,7 @@ class ActivityController extends Controller
|
||||
$this->get('translator')
|
||||
->trans('Success : activity updated!')
|
||||
);
|
||||
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
|
||||
}
|
||||
|
||||
@@ -381,13 +400,12 @@ class ActivityController extends Controller
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$logger = $this->get('chill.main.logger');
|
||||
|
||||
$logger->notice("An activity has been removed", array(
|
||||
$this->logger->notice("An activity has been removed", array(
|
||||
'by_user' => $this->getUser()->getUsername(),
|
||||
'activity_id' => $activity->getId(),
|
||||
'person_id' => $activity->getPerson()->getId(),
|
||||
'remark' => $activity->getRemark(),
|
||||
'comment' => $activity->getComment()->getComment(),
|
||||
'scope_id' => $activity->getScope()->getId(),
|
||||
'reasons_ids' => $activity->getReasons()
|
||||
->map(function ($ar) { return $ar->getId(); })
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
@@ -13,7 +13,7 @@ use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
|
||||
* ActivityReasonCategory controller.
|
||||
*
|
||||
*/
|
||||
class ActivityReasonCategoryController extends Controller
|
||||
class ActivityReasonCategoryController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
@@ -13,7 +13,7 @@ use Chill\ActivityBundle\Form\ActivityReasonType;
|
||||
* ActivityReason controller.
|
||||
*
|
||||
*/
|
||||
class ActivityReasonController extends Controller
|
||||
class ActivityReasonController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ class ActivityReasonController extends Controller
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason_show', array('id' => $entity->getId())));
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $entity->getId())));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
|
||||
@@ -167,7 +167,7 @@ class ActivityReasonController extends Controller
|
||||
if ($editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason_edit', array('id' => $id)));
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $id)));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
|
||||
|
@@ -3,17 +3,17 @@
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Form\ActivityTypeType;
|
||||
|
||||
/**
|
||||
* ActivityType controller.
|
||||
* Class ActivityTypeController
|
||||
*
|
||||
* @package Chill\ActivityBundle\Controller
|
||||
*/
|
||||
class ActivityTypeController extends Controller
|
||||
class ActivityTypeController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
/**
|
||||
* Controller for activity configuration
|
||||
@@ -29,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @author Champs Libres <info@champs-libres.coop>
|
||||
*/
|
||||
class AdminController extends Controller
|
||||
class AdminController extends AbstractController
|
||||
{
|
||||
public function indexActivityAction()
|
||||
{
|
||||
|
@@ -2,20 +2,20 @@
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
*
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Faker\Factory as FakerFactory;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||
@@ -41,25 +41,25 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
|
||||
{
|
||||
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
|
||||
|
||||
/**
|
||||
* @var \Faker\Generator
|
||||
* @var \Faker\Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->faker = FakerFactory::create('fr_FR');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
{
|
||||
return 16400;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a random scope
|
||||
*
|
||||
*
|
||||
* @return \Chill\MainBundle\Entity\Scope
|
||||
*/
|
||||
private function getRandomScope()
|
||||
@@ -67,10 +67,10 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
||||
$scopeRef = LoadScopes::$references[array_rand(LoadScopes::$references)];
|
||||
return $this->getReference($scopeRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a random activityType
|
||||
*
|
||||
*
|
||||
* @return \Chill\ActivityBundle\Entity\ActivityType
|
||||
*/
|
||||
private function getRandomActivityType()
|
||||
@@ -78,27 +78,27 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
||||
$typeRef = LoadActivityType::$references[array_rand(LoadActivityType::$references)];
|
||||
return $this->getReference($typeRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a random activityReason
|
||||
*
|
||||
*
|
||||
* @return \Chill\ActivityBundle\Entity\ActivityReason
|
||||
*/
|
||||
private function getRandomActivityReason(array $excludingIds)
|
||||
{
|
||||
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
|
||||
|
||||
|
||||
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds)) {
|
||||
// we have a reason which should be excluded. Find another...
|
||||
return $this->getRandomActivityReason($excludingIds);
|
||||
}
|
||||
|
||||
|
||||
return $this->getReference($reasonRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a random user
|
||||
*
|
||||
*
|
||||
* @return \Chill\MainBundle\Entity\User
|
||||
*/
|
||||
private function getRandomUser()
|
||||
@@ -106,7 +106,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
||||
$userRef = array_rand(LoadUsers::$refs);
|
||||
return $this->getReference($userRef);
|
||||
}
|
||||
|
||||
|
||||
public function newRandomActivity($person)
|
||||
{
|
||||
$activity = (new Activity())
|
||||
@@ -117,24 +117,24 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
||||
->setType($this->getRandomActivityType())
|
||||
->setScope($this->getRandomScope())
|
||||
->setAttendee($this->faker->boolean())
|
||||
->setRemark('A remark');
|
||||
|
||||
;
|
||||
|
||||
$usedId = array();
|
||||
for ($i = 0; $i < rand(0, 4); $i++) {
|
||||
$reason = $this->getRandomActivityReason($usedId);
|
||||
$usedId[] = $reason->getId();
|
||||
$activity->addReason($reason);
|
||||
}
|
||||
|
||||
|
||||
return $activity;
|
||||
}
|
||||
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
$persons = $this->container->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillPersonBundle:Person')
|
||||
->findAll();
|
||||
|
||||
|
||||
foreach($persons as $person) {
|
||||
$activityNbr = rand(0,3);
|
||||
for($i = 0; $i < $activityNbr; $i ++) {
|
||||
|
@@ -24,7 +24,7 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
|
||||
/**
|
||||
|
@@ -24,7 +24,7 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
/**
|
||||
* Description of LoadActivityReasonCategory
|
||||
|
@@ -24,7 +24,7 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@ namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
|
||||
use Chill\MainBundle\Entity\RoleScope;
|
||||
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
|
||||
|
@@ -47,15 +47,14 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
|
||||
$container->setParameter('chill_activity.form.time_duration', $config['form']['time_duration']);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
$loader->load('services/export.yml');
|
||||
$loader->load('services/repositories.yml');
|
||||
$loader->load('services/fixtures.yml');
|
||||
$loader->load('services/menu.yml');
|
||||
$loader->load('services/controller.yml');
|
||||
$loader->load('services/form.yml');
|
||||
$loader->load('services/templating.yml');
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader->load('services.yaml');
|
||||
$loader->load('services/export.yaml');
|
||||
$loader->load('services/repositories.yaml');
|
||||
$loader->load('services/fixtures.yaml');
|
||||
$loader->load('services/controller.yaml');
|
||||
$loader->load('services/form.yaml');
|
||||
$loader->load('services/templating.yaml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
@@ -73,7 +72,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
'resources' => array(
|
||||
'@ChillActivityBundle/Resources/config/routing.yml'
|
||||
'@ChillActivityBundle/config/routes.yaml'
|
||||
)
|
||||
)
|
||||
));
|
||||
|
@@ -17,8 +17,8 @@ class Configuration implements ConfigurationInterface
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('chill_activity');
|
||||
$treeBuilder = new TreeBuilder('chill_activity');
|
||||
$rootNode = $treeBuilder->getRootNode('chill_activity');
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
|
@@ -1,101 +1,124 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
||||
|
||||
/**
|
||||
* Activity
|
||||
* @UserCircleConsistency(
|
||||
* "CHILL_ACTIVITY_SEE_DETAILS",
|
||||
* getUserFunction="getUser",
|
||||
* path="scope"
|
||||
* )
|
||||
* Class Activity
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
||||
* @ORM\Table(name="activity")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UserCircleConsistency(
|
||||
* "CHILL_ACTIVITY_SEE_DETAILS",
|
||||
* getUserFunction="getUser",
|
||||
* path="scope")
|
||||
*/
|
||||
class Activity implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $date;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(type="time")
|
||||
*/
|
||||
private $durationTime;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $remark;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $attendee;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
* @var ActivityReason
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||
*/
|
||||
private $reasons;
|
||||
|
||||
/**
|
||||
* @var ActivityType
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var Scope
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
*/
|
||||
private $scope;
|
||||
|
||||
/**
|
||||
* @var Person
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
private $person;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* Activity constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
$this->comment = new CommentEmbeddable();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@@ -110,7 +133,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set user
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
@@ -134,7 +156,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set date
|
||||
*
|
||||
* @param \DateTime $date
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDate($date)
|
||||
@@ -158,7 +179,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set durationTime
|
||||
*
|
||||
* @param \DateTime $durationTime
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDurationTime($durationTime)
|
||||
@@ -178,35 +198,10 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
return $this->durationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set remark
|
||||
*
|
||||
* @param string $remark
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setRemark($remark)
|
||||
{
|
||||
$this->remark = $remark;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remark
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRemark()
|
||||
{
|
||||
return $this->remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set attendee
|
||||
*
|
||||
* @param boolean $attendee
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setAttendee($attendee)
|
||||
@@ -230,7 +225,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Add a reason
|
||||
*
|
||||
* @param ActivityReason $reason
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function addReason(ActivityReason $reason)
|
||||
@@ -239,7 +233,10 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ActivityReason $reason
|
||||
*/
|
||||
public function removeReason(ActivityReason $reason)
|
||||
{
|
||||
$this->reasons->removeElement($reason);
|
||||
@@ -248,7 +245,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
/**
|
||||
* Get reasons
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
* @return Collection
|
||||
*/
|
||||
public function getReasons()
|
||||
{
|
||||
@@ -259,7 +256,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set type
|
||||
*
|
||||
* @param ActivityType $type
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setType(ActivityType $type)
|
||||
@@ -283,7 +279,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set scope
|
||||
*
|
||||
* @param Scope $scope
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setScope(Scope $scope)
|
||||
@@ -307,7 +302,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* Set person
|
||||
*
|
||||
* @param Person $person
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setPerson(Person $person)
|
||||
@@ -326,17 +320,32 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the center
|
||||
*
|
||||
* center is extracted from person
|
||||
*
|
||||
* @return \Chill\MainBundle\Entity\Center
|
||||
*
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenter()
|
||||
{
|
||||
return $this->person->getCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,30 +20,45 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
|
||||
/**
|
||||
* ActivityReason
|
||||
* Class ActivityReason
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="activityreason")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ActivityReason
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var ActivityReasonCategory
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
||||
* inversedBy="reasons")
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
@@ -62,7 +77,6 @@ class ActivityReason
|
||||
* Set name
|
||||
*
|
||||
* @param array $name
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setName($name)
|
||||
@@ -100,7 +114,6 @@ class ActivityReason
|
||||
* category, the reason will become inactive
|
||||
*
|
||||
* @param ActivityReasonCategory $category
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setCategory(ActivityReasonCategory $category)
|
||||
@@ -128,7 +141,6 @@ class ActivityReason
|
||||
* Set active
|
||||
*
|
||||
* @param boolean $active
|
||||
*
|
||||
* @return ActivityReason
|
||||
*/
|
||||
public function setActive($active)
|
||||
|