mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	Compare commits
	
		
			1027 Commits
		
	
	
		
			bootstrap-
			...
			features/a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7045e643a8 | |||
| ebb2479966 | |||
| 3f005aaf8f | |||
| 736b2255ab | |||
| a0ff6bbe03 | |||
| 081c1c5271 | |||
| d31175f9ef | |||
| 2744e4995c | |||
| f734210db5 | |||
| 014fe19b45 | |||
| f382131f3c | |||
| 886924a7e5 | |||
| 5ef5b65d90 | |||
| 3169da20ad | |||
| 3c7b67604c | |||
| 4e8dd3b189 | |||
| 4cca148f69 | |||
| 34f22d237e | |||
| 
						 | 
					979ea5841d | ||
| 
						 | 
					9e9a459a20 | ||
| 
						 | 
					5c2c509805 | ||
| 
						 | 
					9d478c0f01 | ||
| 
						 | 
					4646795c2c | ||
| 
						 | 
					18369a6c0a | ||
| 
						 | 
					0fd9485de5 | ||
| c8f139528a | |||
| 8030792eb6 | |||
| 
						 | 
					50a4df3d0f | ||
| 
						 | 
					0907ae1602 | ||
| 
						 | 
					673a4761e9 | ||
| 
						 | 
					282db51f06 | ||
| 
						 | 
					bdf691a063 | ||
| 
						 | 
					18ab10dd45 | ||
| 65198937c0 | |||
| 2699d48533 | |||
| 08e396195c | |||
| ab0863a275 | |||
| 82c79a17dd | |||
| d35553a1e2 | |||
| 030e71d276 | |||
| 4fc3d813c4 | |||
| 5f012165d1 | |||
| 61bd5d8ae8 | |||
| 07c464c112 | |||
| 70a4c34865 | |||
| 5a47ebed42 | |||
| 80eb5519bc | |||
| 50f3ec9064 | |||
| bdf0ec63d2 | |||
| 15f439b43d | |||
| 30af99f4f0 | |||
| c413166866 | |||
| 3c4c5e29a3 | |||
| 0224224744 | |||
| a9a59895b4 | |||
| 8a859f7885 | |||
| 2244c58ec2 | |||
| c1ede921ff | |||
| 17ff80c39c | |||
| f4f747d8d1 | |||
| a740ad29ea | |||
| ccee105efb | |||
| b10012f4da | |||
| 4937fd00fc | |||
| 0b329a9c9b | |||
| 4cfc43aaa6 | |||
| 1c45770929 | |||
| 198c815052 | |||
| a995adcf0d | |||
| bccda15307 | |||
| 75c3df50e0 | |||
| ce8207ea65 | |||
| 0f6ad3670a | |||
| 02a752f20b | |||
| 1bbce2bb81 | |||
| ca43933163 | |||
| 1392365257 | |||
| 3653d7e0b8 | |||
| 3970bb2644 | |||
| 9a1272d350 | |||
| 36419cf5f0 | |||
| c96f407e6a | |||
| 690688f5e1 | |||
| 4668f657ab | |||
| 49253abfb8 | |||
| c2122d62c6 | |||
| ca17ca4984 | |||
| a5d749b882 | |||
| 53c021b06e | |||
| b6e8c64211 | |||
| 342fd3e297 | |||
| 05a1f7d041 | |||
| 2e2eeae4f2 | |||
| 
						 | 
					842dfcc69f | ||
| 
						 | 
					67c31e781d | ||
| f32ffc572d | |||
| a44b26da6c | |||
| d016f9be86 | |||
| c36aa22ab2 | |||
| e77c886e3f | |||
| 4ca1618480 | |||
| 8e8cdfce0a | |||
| 3694eb5bf2 | |||
| e44342ab87 | |||
| a236873919 | |||
| a13766e7d7 | |||
| bc240a6754 | |||
| 50727fc4b0 | |||
| b327a3fbfa | |||
| 2916babe1c | |||
| fe2f107ddc | |||
| 3da8f89d3c | |||
| 19326ee750 | |||
| e0ae5d56f0 | |||
| 0878767c17 | |||
| f0232228a3 | |||
| fc63955205 | |||
| a78de0f96c | |||
| 270c0accc5 | |||
| fd94f27eee | |||
| f7e3be38a7 | |||
| 5861a86289 | |||
| 68c0f9b7d7 | |||
| 52288f7260 | |||
| 
						 | 
					0b5daa6c33 | ||
| 2fe1605385 | |||
| d8256b0ac5 | |||
| b5760e82ea | |||
| d3ac8d8ceb | |||
| 196f709065 | |||
| 6a8c96cdae | |||
| 3e83891744 | |||
| 662e5f967c | |||
| 802125edc6 | |||
| 028c3e0c31 | |||
| e4adafafc8 | |||
| 54316d148c | |||
| 3c5a2a65df | |||
| 741ef7b40d | |||
| e7384343b2 | |||
| 1e2a920200 | |||
| b5a78fa341 | |||
| d9c1f52894 | |||
| 
						 | 
					f05f7415bd | ||
| 
						 | 
					5553c7314c | ||
| 7dc70baf57 | |||
| 
						 | 
					34af401a98 | ||
| 5bae8dc5bf | |||
| 6e277e99ae | |||
| 2688c0f0ce | |||
| 
						 | 
					0135f5184e | ||
| fd698419e8 | |||
| 4a864a0b14 | |||
| 55dc0d3f9f | |||
| 85835c8b0d | |||
| 
						 | 
					ab1edee9fb | ||
| 6154e0912b | |||
| 0388428c6f | |||
| 7ac55275c2 | |||
| 1119e20a49 | |||
| ea2870eef8 | |||
| 
						 | 
					93a44d8303 | ||
| 
						 | 
					8109415e05 | ||
| 
						 | 
					514fe6163a | ||
| 9d9be7f831 | |||
| 
						 | 
					4cf3cc8353 | ||
| 2a974e1269 | |||
| beca41774e | |||
| dd991e3572 | |||
| 0640631821 | |||
| e845d9ba90 | |||
| 
						 | 
					6f8231f6f6 | ||
| 
						 | 
					048161e300 | ||
| b705c5910f | |||
| 6f1209eaf5 | |||
| 020759180b | |||
| 3748b4fbf4 | |||
| 
						 | 
					4f49292178 | ||
| 6eaffcae49 | |||
| 
						 | 
					f92d710a26 | ||
| 
						 | 
					bc6ba88acd | ||
| 61c2934d64 | |||
| 28b4d9562c | |||
| e06aded1ec | |||
| 3a81124e04 | |||
| 
						 | 
					b72d45d9db | ||
| 2a1f5cbad1 | |||
| e8566fd006 | |||
| cd6b5c9a39 | |||
| 9aa3974071 | |||
| a8bf478ee8 | |||
| a35f3363b2 | |||
| 0b117e5158 | |||
| 7cae9e1769 | |||
| a43e6c12a0 | |||
| abe012de60 | |||
| aaa9a1ec7b | |||
| 25f2d17097 | |||
| 4fd43310c0 | |||
| c85ca894b8 | |||
| fe22e6c7dc | |||
| cb67605bd2 | |||
| d26e08324c | |||
| e55a2691b7 | |||
| 
						 | 
					aa5c7f333e | ||
| 0afe277b04 | |||
| 981b9299ad | |||
| 
						 | 
					36eb247995 | ||
| 
						 | 
					d71c3f310e | ||
| 
						 | 
					4a2ada784a | ||
| 
						 | 
					3b5ef53b9b | ||
| 2cda6ceebf | |||
| 
						 | 
					18d0ad67d6 | ||
| 
						 | 
					ea1c12da64 | ||
| 1ceabec400 | |||
| 
						 | 
					91c5cd74f7 | ||
| 
						 | 
					b7f2e189dc | ||
| 
						 | 
					ab8deb036b | ||
| 
						 | 
					ac47a75a75 | ||
| 
						 | 
					4e6454d7de | ||
| 92a95d4186 | |||
| 
						 | 
					141aabcddc | ||
| 
						 | 
					c23ada3533 | ||
| 
						 | 
					6e37e7feac | ||
| 
						 | 
					df1f44d814 | ||
| 
						 | 
					dc26ca7e77 | ||
| 
						 | 
					2667867bd0 | ||
| 
						 | 
					5ddc0e7a53 | ||
| b72b1bd4c7 | |||
| ca9ae3874c | |||
| 7fb4616aa6 | |||
| ac4cf43753 | |||
| 5a4a0a3617 | |||
| 2cc1274ee0 | |||
| 154fa4719d | |||
| 193e7b4c7e | |||
| 80c2bd285f | |||
| 133c0ac1ac | |||
| c8d5c2c67b | |||
| 0754d20622 | |||
| 99d6e030ca | |||
| 5d38d193e2 | |||
| 86f7b116a9 | |||
| bcab5a1211 | |||
| 65a6607112 | |||
| 1cd376bf86 | |||
| 84f6f9b44d | |||
| b53f6af8d8 | |||
| 34d6452286 | |||
| c04ccef4cd | |||
| 
						 | 
					d8afbc4a40 | ||
| 95edbc673c | |||
| 07ffdfab86 | |||
| 50be29308d | |||
| d1e0d997ac | |||
| 
						 | 
					504b2efacf | ||
| 4c3c67344a | |||
| 40fcb09082 | |||
| aa4a9e874a | |||
| 3abfdbf6fd | |||
| 07cc394abd | |||
| 99337c4aa6 | |||
| 04ccca092b | |||
| 
						 | 
					b3792f6714 | ||
| e1f01a47f8 | |||
| dc79e1a02d | |||
| 7a6117a264 | |||
| 
						 | 
					1a204312f3 | ||
| 1b1a25edc4 | |||
| 5ab7f7a37b | |||
| b174397823 | |||
| 9d35e4efbb | |||
| 0e9933ca41 | |||
| 
						 | 
					3d14f00cac | ||
| 0add757230 | |||
| 2bf65dfadb | |||
| a7ecd08d78 | |||
| 
						 | 
					bccaf5ad6e | ||
| 585a19e803 | |||
| b801b75eb9 | |||
| f1120af59e | |||
| 9d58356b90 | |||
| a7131653c9 | |||
| 9f3cd943cb | |||
| 
						 | 
					970635dfad | ||
| 
						 | 
					c8297b2230 | ||
| 994cce41e5 | |||
| 86e41fb877 | |||
| f8b97b96f4 | |||
| 27907e7558 | |||
| 
						 | 
					38712de462 | ||
| fd7c7388d9 | |||
| ef55d2cf7f | |||
| 
						 | 
					8406c30c8e | ||
| 
						 | 
					901ae47ce6 | ||
| 
						 | 
					951160982d | ||
| 
						 | 
					e2633a2a79 | ||
| 
						 | 
					1cfc29caf7 | ||
| 
						 | 
					5b72eeb147 | ||
| 
						 | 
					1b9d8fab61 | ||
| 
						 | 
					801af209a1 | ||
| 
						 | 
					06daf35e96 | ||
| 38bff2e42f | |||
| e68a5405a1 | |||
| 8bd20c9c78 | |||
| 54997e5893 | |||
| 
						 | 
					35d35c9f40 | ||
| 
						 | 
					49d022ef55 | ||
| 78ca61c82e | |||
| b68de1f2e9 | |||
| 68ecff253a | |||
| 
						 | 
					db545f9fe6 | ||
| 
						 | 
					86d764c097 | ||
| 
						 | 
					cf8b9ec172 | ||
| 
						 | 
					23528e7a5c | ||
| 
						 | 
					a258905c59 | ||
| 
						 | 
					84913553e8 | ||
| 
						 | 
					916209e402 | ||
| 
						 | 
					3ec212df93 | ||
| e95d8fbc7a | |||
| 
						 | 
					ce88fe158f | ||
| efdfd10e49 | |||
| 
						 | 
					000ae6c2cb | ||
| 
						 | 
					7c26f0a56c | ||
| f827e50431 | |||
| 41617295c1 | |||
| b2c1d75fc5 | |||
| 17c3ecbabe | |||
| de024b405f | |||
| 51399b21b9 | |||
| c40019da8f | |||
| 1df759e970 | |||
| 
						 | 
					92b4adc113 | ||
| 807d3674fc | |||
| af740fd87d | |||
| 45dc8ed661 | |||
| ecc8b929ca | |||
| 
						 | 
					c378f59f5a | ||
| 4fd6d38187 | |||
| 
						 | 
					f3a7556bca | ||
| 
						 | 
					14db7265fe | ||
| 
						 | 
					f22461af1b | ||
| 
						 | 
					1b709d39a4 | ||
| 
						 | 
					81e8a4562b | ||
| 
						 | 
					1e72247546 | ||
| 
						 | 
					670ba1713a | ||
| 
						 | 
					5daf5cbe84 | ||
| 
						 | 
					331cdf13ca | ||
| f25365f651 | |||
| cbadcb4980 | |||
| b2ce5fca38 | |||
| 38c06977ca | |||
| 
						 | 
					1551ea796d | ||
| 3e39dd9a1e | |||
| 89734c680c | |||
| 
						 | 
					4c025184b4 | ||
| 6fed008ff2 | |||
| 057bdf6a6a | |||
| 
						 | 
					6f2c219e3b | ||
| 
						 | 
					550aaacaab | ||
| f9758eff5b | |||
| abc79249a2 | |||
| f7bb9ac327 | |||
| 3c727d1c65 | |||
| ac211337d6 | |||
| 30668ca67f | |||
| 5da0be24ff | |||
| 
						 | 
					dd78e9759c | ||
| 
						 | 
					1b36d9b1ab | ||
| 7fddf1d5e0 | |||
| 315fc7f63a | |||
| 3c889db41a | |||
| 71f794c4d9 | |||
| e135b98072 | |||
| e14205ae1d | |||
| 
						 | 
					e14a125bf3 | ||
| 8a5650a705 | |||
| 18217f53e8 | |||
| 79ec182ca3 | |||
| 1433af8e95 | |||
| e91596ae12 | |||
| 
						 | 
					9375c2cf86 | ||
| 
						 | 
					db77224b9f | ||
| 1c42bf6400 | |||
| c9da72fa0d | |||
| 3b3855089c | |||
| 265ace0b4c | |||
| 0e1bbbfee9 | |||
| ebf896ac74 | |||
| 31befaa339 | |||
| 780c14cfbe | |||
| 8183c028f8 | |||
| 97bba861c9 | |||
| 8d7d170f11 | |||
| c126f680ae | |||
| 
						 | 
					6a42edd460 | ||
| 0aa909f060 | |||
| f27957e91b | |||
| ed891b224f | |||
| 
						 | 
					76d945f2a7 | ||
| 
						 | 
					7d13bc7cfe | ||
| 
						 | 
					66b54bad31 | ||
| 
						 | 
					9d32ccbcad | ||
| 4dc82bc207 | |||
| 2384281532 | |||
| 7c94824c20 | |||
| a922e397f8 | |||
| be13f8f65b | |||
| 12f83abccc | |||
| 
						 | 
					63c3b5a970 | ||
| 1967d6ea4c | |||
| 5cb076495a | |||
| 
						 | 
					03a7ec389b | ||
| 604e78f35e | |||
| 
						 | 
					f39fe05dd5 | ||
| eeffa3191e | |||
| 
						 | 
					6c126b0581 | ||
| 84d5fb936e | |||
| 
						 | 
					5ee824d1c2 | ||
| 7933aaed1c | |||
| 
						 | 
					6d20476b81 | ||
| 
						 | 
					2b5ed5e5a3 | ||
| 0fe70d00ec | |||
| e5905902cc | |||
| 48e5809008 | |||
| a947634f30 | |||
| 3e3c9dc894 | |||
| 574b5dcbd0 | |||
| c1ba892811 | |||
| 
						 | 
					6f68349f57 | ||
| 
						 | 
					d513be2fce | ||
| 
						 | 
					7a33c37b51 | ||
| 
						 | 
					a6c4b4eb55 | ||
| 
						 | 
					160c7f2c31 | ||
| 
						 | 
					aff140230c | ||
| 
						 | 
					31468aeae0 | ||
| 3e57ff3ffa | |||
| 6cbbce03c4 | |||
| 
						 | 
					e52c94aabd | ||
| ef98111a2f | |||
| 55fa16ce56 | |||
| 
						 | 
					7e1b7b7e9f | ||
| 
						 | 
					39dca2a9ca | ||
| 80ccb76794 | |||
| 
						 | 
					878ee5d9c7 | ||
| 
						 | 
					541fe8f1ad | ||
| 
						 | 
					bb71b9f908 | ||
| 
						 | 
					7b67ef5db2 | ||
| 330234981c | |||
| a323e84357 | |||
| c33f577f5a | |||
| 
						 | 
					0ce814cf52 | ||
| 
						 | 
					d806a074a7 | ||
| 
						 | 
					14a9d9c739 | ||
| 502a629dc8 | |||
| 4ace2fef99 | |||
| 
						 | 
					4a1ebc1c4c | ||
| 
						 | 
					4553051271 | ||
| 
						 | 
					743d6cd0bf | ||
| 
						 | 
					0f635ca51a | ||
| 987815471c | |||
| d9a3e117b2 | |||
| 
						 | 
					f6d4d32ce4 | ||
| 937be1af3a | |||
| 32b3d74a1b | |||
| 
						 | 
					43fb020272 | ||
| 
						 | 
					f26fafb2f2 | ||
| 
						 | 
					e1e3051d00 | ||
| 
						 | 
					a659263af6 | ||
| 
						 | 
					9333b6d2df | ||
| 4d0cfbb396 | |||
| e9caa7b4b8 | |||
| 261acdfd24 | |||
| 17481798fb | |||
| edb8aa1dfe | |||
| 93a67c9ab9 | |||
| 980a305456 | |||
| 0158c6f2ed | |||
| ff5b0bc258 | |||
| a133f56dce | |||
| 
						 | 
					c4e226d0bd | ||
| fa556bbba1 | |||
| e8f3c499ee | |||
| cfd9f1bab1 | |||
| c6949490a4 | |||
| 
						 | 
					8011293b28 | ||
| 
						 | 
					7992f09aea | ||
| abede56d68 | |||
| 9ab032c943 | |||
| 4562ed46db | |||
| cd52f7e6e8 | |||
| 126ffc55bf | |||
| f49c54d51f | |||
| 1410213258 | |||
| 35e0b98687 | |||
| 8f1091b8a3 | |||
| c269bfe278 | |||
| 041b1dfc51 | |||
| 718d6c2375 | |||
| 158b572879 | |||
| 68059a9938 | |||
| 543f6b20dd | |||
| e95d756e71 | |||
| 992734bb72 | |||
| 741ed84918 | |||
| 5822736f19 | |||
| 66776eed01 | |||
| ace3b1969e | |||
| edc86af659 | |||
| e123ee5d03 | |||
| 87ba68971c | |||
| 94bcbac06a | |||
| 74520330b1 | |||
| 666c1e7ae7 | |||
| 
						 | 
					935006eae3 | ||
| 622c254cc4 | |||
| a19fd51600 | |||
| 
						 | 
					165012b302 | ||
| 
						 | 
					057db09847 | ||
| 56242f9b5a | |||
| 549f3a4c78 | |||
| 9ec2a62fb6 | |||
| 65ac9a47b4 | |||
| b1d7e543fc | |||
| b89cffce68 | |||
| 
						 | 
					063076d0cb | ||
| 
						 | 
					bcf2b9d834 | ||
| 968e6914b2 | |||
| 52ee8c5a9a | |||
| 
						 | 
					64d28106c8 | ||
| 0a5d20b16f | |||
| 85dda8b680 | |||
| 2c49afe549 | |||
| 2e1201418a | |||
| a9fb916843 | |||
| 6631e853b4 | |||
| 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 | |||
| 
						 | 
					2bae684df9 | ||
| 8bd75429c1 | |||
| 
						 | 
					8fe00b4c2b | ||
| 199e5a73d8 | |||
| 54d03275cf | |||
| 8683f8faf3 | |||
| 821b67723c | |||
| ae1146c79c | |||
| 050c325195 | |||
| 5e0d869d9b | |||
| 
						 | 
					c59cf3f0df | ||
| 
						 | 
					890b8db5dd | ||
| 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 | ||
| 
						 | 
					1f838d9c5a | ||
| 33457d3cbc | |||
| 6df8e6dec8 | |||
| f9b8f13dd6 | |||
| e919b4322e | |||
| 7503c845df | |||
| 
						 | 
					c6cd785262 | ||
| 
						 | 
					e453e24203 | ||
| 3686a294d3 | |||
| 
						 | 
					115a14fcba | ||
| 
						 | 
					fc172fdb1f | ||
| b6131379f9 | |||
| e1fcc41ace | |||
| f2a04cebe6 | |||
| c693002ddb | |||
| ee77c8540a | |||
| a536d2780e | |||
| f880598052 | |||
| e7985ea52f | |||
| f56dc65021 | |||
| 
						 | 
					4770758aee | ||
| 90fe484d81 | |||
| 2b8bbe019d | |||
| 
						 | 
					1f1b9c594f | ||
| 9e1c151402 | |||
| 088e522292 | |||
| 
						 | 
					f836114d84 | ||
| b8e6e98a74 | |||
| 
						 | 
					4fd13440c6 | ||
| 
						 | 
					4d8afd53ad | ||
| 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 | |||
| 
						 | 
					82d8556f24 | ||
| 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 | |||
| 
						 | 
					45671bda52 | ||
| 
						 | 
					934eef4db4 | ||
| c5b21f360c | |||
| 
						 | 
					31e8dea965 | ||
| 
						 | 
					05ebdefd47 | ||
| 2de8338651 | |||
| fbec64664f | |||
| 6c81fe4ef2 | |||
| 520c0e0f96 | |||
| 2647d4c6a7 | |||
| e7df62b373 | |||
| 69ea88a4d5 | |||
| 9566ea89b1 | |||
| 
						 | 
					c233c481b6 | ||
| 425d51649f | |||
| c32f730713 | |||
| a48d6d2a0a | |||
| 16b155d449 | |||
| 
						 | 
					68d9778c00 | ||
| 
						 | 
					8acd852070 | ||
| 
						 | 
					a9420f0339 | ||
| 
						 | 
					207e5bf01d | ||
| 
						 | 
					cb5cf5763e | ||
| 
						 | 
					ff450215c6 | ||
| 083f56bff0 | |||
| f526453ba3 | |||
| 
						 | 
					dad8fd5378 | ||
| 
						 | 
					37b395ee52 | ||
| 
						 | 
					03243605da | ||
| 
						 | 
					48e2d2ceab | ||
| 
						 | 
					777fb25860 | ||
| 
						 | 
					03601b9707 | ||
| 
						 | 
					580dc71218 | ||
| 
						 | 
					24a7d7b34b | ||
| 89d95a0eae | |||
| 6bcdbaf668 | |||
| 0a0895584c | |||
| d7d8f2a60a | |||
| c205bbddd3 | 
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,7 +1,8 @@
 | 
			
		||||
.composer/*
 | 
			
		||||
composer.phar
 | 
			
		||||
composer.lock
 | 
			
		||||
 | 
			
		||||
docs/build/
 | 
			
		||||
.php_cs.cache
 | 
			
		||||
 | 
			
		||||
###> symfony/framework-bundle ###
 | 
			
		||||
/.env.local
 | 
			
		||||
@@ -18,3 +19,4 @@ composer.lock
 | 
			
		||||
/phpunit.xml
 | 
			
		||||
.phpunit.result.cache
 | 
			
		||||
###< phpunit/phpunit ###
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,14 +11,15 @@ before_script:
 | 
			
		||||
  - 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 composer.phar install
 | 
			
		||||
  - php -d memory_limit=2G composer.phar install
 | 
			
		||||
  - php tests/app/bin/console doctrine:migrations:migrate -n
 | 
			
		||||
  - php tests/app/bin/console doctrine:fixtures:load -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: postgres:12
 | 
			
		||||
  - name: postgis/postgis:12-3.1-alpine
 | 
			
		||||
    alias: db
 | 
			
		||||
  - name: redis
 | 
			
		||||
    alias: redis
 | 
			
		||||
@@ -30,8 +31,12 @@ variables:
 | 
			
		||||
  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:
 | 
			
		||||
    - bin/phpunit --colors=never
 | 
			
		||||
    - php -d memory_limit=3G bin/phpunit --colors=never
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										661
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										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.
 | 
			
		||||
 | 
			
		||||
    chill-bundles
 | 
			
		||||
    Copyright (C) 2021  Chill Project
 | 
			
		||||
 | 
			
		||||
    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
									
								
							
							
						
						
									
										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
 | 
			
		||||
@@ -42,6 +42,7 @@
 | 
			
		||||
        "symfony/validator": "4.*",
 | 
			
		||||
        "sensio/framework-extra-bundle": "^5.5",
 | 
			
		||||
        "symfony/yaml": "4.*",
 | 
			
		||||
        "symfony/webpack-encore-bundle": "^1.11",
 | 
			
		||||
        "knplabs/knp-menu": "^3.1",
 | 
			
		||||
        "knplabs/knp-menu-bundle": "^3.0",
 | 
			
		||||
        "symfony/templating": "4.*",
 | 
			
		||||
@@ -51,12 +52,14 @@
 | 
			
		||||
        "knplabs/knp-time-bundle": "^1.12",
 | 
			
		||||
        "symfony/intl": "4.*",
 | 
			
		||||
        "symfony/swiftmailer-bundle": "^3.5",
 | 
			
		||||
        "league/csv": "^9.6",
 | 
			
		||||
        "league/csv": "^9.7.1",
 | 
			
		||||
        "phpoffice/phpspreadsheet": "^1.16",
 | 
			
		||||
        "symfony/browser-kit": "^5.2",
 | 
			
		||||
        "symfony/css-selector": "^5.2",
 | 
			
		||||
        "twig/markdown-extra": "^3.3",
 | 
			
		||||
        "erusev/parsedown": "^1.7"
 | 
			
		||||
        "erusev/parsedown": "^1.7",
 | 
			
		||||
        "symfony/serializer": "^5.2",
 | 
			
		||||
        "symfony/webpack-encore-bundle": "^1.11"
 | 
			
		||||
    },
 | 
			
		||||
    "conflict": {
 | 
			
		||||
        "symfony/symfony": "*"
 | 
			
		||||
@@ -71,7 +74,8 @@
 | 
			
		||||
        "symfony/web-profiler-bundle": "^5.0",
 | 
			
		||||
        "symfony/var-dumper": "4.*",
 | 
			
		||||
        "symfony/debug-bundle": "^5.1",
 | 
			
		||||
        "symfony/phpunit-bridge": "^5.2"
 | 
			
		||||
        "symfony/phpunit-bridge": "^5.2",
 | 
			
		||||
        "nelmio/alice": "^3.8"
 | 
			
		||||
    },
 | 
			
		||||
    "scripts": {
 | 
			
		||||
        "auto-scripts": {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,19 @@ Compilation into HTML
 | 
			
		||||
 | 
			
		||||
To compile this documentation :
 | 
			
		||||
 | 
			
		||||
1. Install [sphinx-doc](http://sphinx-doc.org) (eg. pip install sphinx &  pip install sphinx_rtd_theme)
 | 
			
		||||
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
 | 
			
		||||
===========
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										747
									
								
								docs/source/development/api.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -16,6 +16,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
 | 
			
		||||
 | 
			
		||||
    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>
 | 
			
		||||
@@ -29,7 +30,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
 | 
			
		||||
    Timelines <timelines.rst>
 | 
			
		||||
    Exports <exports.rst>
 | 
			
		||||
    Embeddable comments <embeddable-comments.rst>
 | 
			
		||||
    Testing <make-test-working.rst>
 | 
			
		||||
    Run tests <run-tests.rst>
 | 
			
		||||
    Useful snippets <useful-snippets.rst>
 | 
			
		||||
    manual/index.rst
 | 
			
		||||
    Assets <assets.rst>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,231 +0,0 @@
 | 
			
		||||
.. 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".
 | 
			
		||||
 | 
			
		||||
Make tests working
 | 
			
		||||
******************
 | 
			
		||||
 | 
			
		||||
Unit and functional tests are important to ensure that bundle may be deployed securely.
 | 
			
		||||
 | 
			
		||||
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. 
 | 
			
		||||
 | 
			
		||||
.. note::
 | 
			
		||||
 | 
			
		||||
    Integration tools (i.e. `travis-ci <https://travis-ci.org>`_) works like this : 
 | 
			
		||||
 | 
			
		||||
    * they clone the bundle repository in a virtual machine, using git
 | 
			
		||||
    * they optionnaly run `composer` to download and install depedencies
 | 
			
		||||
    * they optionnaly run other command to prepare a database, insert fixtures, ...
 | 
			
		||||
    * they run test
 | 
			
		||||
 | 
			
		||||
On the developer's machine test should be runnable with two or three commands **runned from the bundle directory** : 
 | 
			
		||||
 | 
			
		||||
.. code-block:: bash
 | 
			
		||||
 | 
			
		||||
   $ composer install --dev
 | 
			
		||||
   $ // command to insert fixtures, ...
 | 
			
		||||
   $ phpunit
 | 
			
		||||
 | 
			
		||||
This chapter has been inspired by `this useful blog post <http://blog.kevingomez.fr/2013/01/09/functional-testing-standalone-symfony2-bundles/>`_.
 | 
			
		||||
 | 
			
		||||
Bootstrap phpunit for a standalone bundle
 | 
			
		||||
==========================================
 | 
			
		||||
 | 
			
		||||
Unit tests should run after achieving this step.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
phpunit.xml
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
A `phpunit.xml.dist` file should be present at the bundle root.
 | 
			
		||||
 | 
			
		||||
.. code-block:: xml
 | 
			
		||||
 | 
			
		||||
   <?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
 | 
			
		||||
   <phpunit bootstrap="./Tests/bootstrap.php" colors="true">
 | 
			
		||||
        <!-- the file "./Tests/boostrap.php" will be created on the next step -->
 | 
			
		||||
       <testsuites>
 | 
			
		||||
           <testsuite name="ChillMain test suite">
 | 
			
		||||
               <directory suffix="Test.php">./Tests</directory>
 | 
			
		||||
           </testsuite>
 | 
			
		||||
       </testsuites>
 | 
			
		||||
       <filter>
 | 
			
		||||
           <whitelist>
 | 
			
		||||
               <directory>./</directory>
 | 
			
		||||
               <exclude>
 | 
			
		||||
                   <directory>./Resources</directory>
 | 
			
		||||
                   <directory>./Tests</directory>
 | 
			
		||||
                   <directory>./vendor</directory>
 | 
			
		||||
               </exclude>
 | 
			
		||||
          </whitelist>
 | 
			
		||||
      </filter>
 | 
			
		||||
   </phpunit>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bootstrap.php
 | 
			
		||||
--------------
 | 
			
		||||
 | 
			
		||||
A file `boostrap.php`, located in the `Tests` directory, will allow phpunit to resolve class autoloading :
 | 
			
		||||
 | 
			
		||||
.. code-block:: php
 | 
			
		||||
 | 
			
		||||
   <?php
 | 
			
		||||
 | 
			
		||||
   if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) {
 | 
			
		||||
       throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   require $autoloadFile;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
composer.json
 | 
			
		||||
-------------
 | 
			
		||||
 | 
			
		||||
The `composer.json` file **located at the bundle's root** should contains all depencies needed to run test (and to execute bundle functions).
 | 
			
		||||
 | 
			
		||||
Ensure that all dependencies are included in the `require` and `require-dev` sections.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Functional tests
 | 
			
		||||
================
 | 
			
		||||
 | 
			
		||||
If you want to access services, database, and run functional tests, you will have to bootstrap a symfony app, with the minimal configuration. Three files are required : 
 | 
			
		||||
 | 
			
		||||
* a `config_test.yml` file (eventually with a `config.yml`);
 | 
			
		||||
* a `routing.yml` file
 | 
			
		||||
* an `AppKernel.php` file
 | 
			
		||||
 | 
			
		||||
Adapt phpunit.xml
 | 
			
		||||
-----------------
 | 
			
		||||
 | 
			
		||||
You should add reference to the new application within `phpunit.xml.dist`. The directive `<php>` should be added like this, if your `AppKernel.php` file is located in `Tests/Fixtures/App` directory:
 | 
			
		||||
 | 
			
		||||
.. code-block:: xml
 | 
			
		||||
 | 
			
		||||
    <?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
 | 
			
		||||
    <phpunit bootstrap="./Tests/bootstrap.php" colors="true">
 | 
			
		||||
        <testsuites>
 | 
			
		||||
            <testsuite name="ChillMain test suite">
 | 
			
		||||
                <directory suffix="Test.php">./Tests</directory>
 | 
			
		||||
            </testsuite>
 | 
			
		||||
        </testsuites>
 | 
			
		||||
        <filter>
 | 
			
		||||
            <whitelist>
 | 
			
		||||
                <directory>./</directory>
 | 
			
		||||
                <exclude>
 | 
			
		||||
                    <directory>./Resources</directory>
 | 
			
		||||
                    <directory>./Tests</directory>
 | 
			
		||||
                    <directory>./vendor</directory>
 | 
			
		||||
                </exclude>
 | 
			
		||||
            </whitelist>
 | 
			
		||||
        </filter>
 | 
			
		||||
        <!-- the lines we added --> 
 | 
			
		||||
       <php>
 | 
			
		||||
            <server name="KERNEL_DIR" value="./Tests/Fixtures/App/" />
 | 
			
		||||
        </php>
 | 
			
		||||
    </phpunit>
 | 
			
		||||
 | 
			
		||||
AppKernel.php
 | 
			
		||||
-------------
 | 
			
		||||
 | 
			
		||||
This file boostrap the app. It contains three functions. This is the file used in the ChillMain bundle :
 | 
			
		||||
 | 
			
		||||
.. code-block:: php
 | 
			
		||||
                                                                                                                                                                                                                 
 | 
			
		||||
    <?php
 | 
			
		||||
 | 
			
		||||
    use Symfony\Component\HttpKernel\Kernel;
 | 
			
		||||
    use Symfony\Component\Config\Loader\LoaderInterface;
 | 
			
		||||
 | 
			
		||||
    class AppKernel extends Kernel
 | 
			
		||||
    {
 | 
			
		||||
        public function registerBundles()
 | 
			
		||||
        {   
 | 
			
		||||
            return array(
 | 
			
		||||
                new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
 | 
			
		||||
                new Chill\MainBundle\ChillMainBundle(),
 | 
			
		||||
                new Symfony\Bundle\SecurityBundle\SecurityBundle(),
 | 
			
		||||
                new Symfony\Bundle\TwigBundle\TwigBundle(),
 | 
			
		||||
                new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
 | 
			
		||||
                #add here all the required bundle (some bundle are not required)
 | 
			
		||||
            );
 | 
			
		||||
        }   
 | 
			
		||||
 | 
			
		||||
        public function registerContainerConfiguration(LoaderInterface $loader)
 | 
			
		||||
        {   
 | 
			
		||||
            $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
 | 
			
		||||
        }   
 | 
			
		||||
 | 
			
		||||
        /** 
 | 
			
		||||
         * @return string
 | 
			
		||||
         */
 | 
			
		||||
        public function getCacheDir()
 | 
			
		||||
        {   
 | 
			
		||||
            return sys_get_temp_dir().'/ChillMainBundle/cache';
 | 
			
		||||
        }   
 | 
			
		||||
 | 
			
		||||
        /** 
 | 
			
		||||
         * @return string
 | 
			
		||||
         */
 | 
			
		||||
        public function getLogDir()
 | 
			
		||||
        {   
 | 
			
		||||
            return sys_get_temp_dir().'/ChillMainBundle/logs';
 | 
			
		||||
        }   
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
config_test.yml
 | 
			
		||||
---------------
 | 
			
		||||
 | 
			
		||||
There are only few parameters required for the config file. This is a basic version for ChillMain :
 | 
			
		||||
 | 
			
		||||
.. code-block:: yaml
 | 
			
		||||
 | 
			
		||||
    # config/config_test.yml
 | 
			
		||||
    imports:
 | 
			
		||||
        - { resource: config.yml } #here we import a config.yml file, this is not required
 | 
			
		||||
 | 
			
		||||
    framework:
 | 
			
		||||
        test: ~
 | 
			
		||||
        session:
 | 
			
		||||
            storage_id: session.storage.filesystem
 | 
			
		||||
 | 
			
		||||
.. code-block:: yaml
 | 
			
		||||
 | 
			
		||||
   # config/config.yml
 | 
			
		||||
   framework: 
 | 
			
		||||
    secret:          Not very secret
 | 
			
		||||
    router:          { resource: "%kernel.root_dir%/config/routing.yml" }
 | 
			
		||||
    form:            true
 | 
			
		||||
    csrf_protection: true
 | 
			
		||||
    session:         ~
 | 
			
		||||
    default_locale:  fr  
 | 
			
		||||
    translator:      { fallback: fr }
 | 
			
		||||
    profiler:        { only_exceptions: false }
 | 
			
		||||
    templating: #required for assetic. Remove if not needed
 | 
			
		||||
        engines: ['twig']
 | 
			
		||||
 | 
			
		||||
.. note:: 
 | 
			
		||||
 | 
			
		||||
    You must adapt config.yml file according to your required bundle. Some options will be missing, other may be removed...
 | 
			
		||||
 | 
			
		||||
.. note::
 | 
			
		||||
 | 
			
		||||
    If you would like to tests different environments, with differents configuration, you could create differents config_XXX.yml files.
 | 
			
		||||
 | 
			
		||||
routing.yml
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
You should add there all routing information needed for your bundle. 
 | 
			
		||||
 | 
			
		||||
.. code-block: yaml
 | 
			
		||||
 | 
			
		||||
    chill_main_bundle:
 | 
			
		||||
      resource: "@CLChillMainBundle/Resources/config/routing.yml"
 | 
			
		||||
 | 
			
		||||
That's it. Tests should pass.
 | 
			
		||||
@@ -7,6 +7,8 @@
 | 
			
		||||
   Free Documentation License".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.. _pagination-ref:
 | 
			
		||||
 | 
			
		||||
Pagination
 | 
			
		||||
##########
 | 
			
		||||
 | 
			
		||||
@@ -15,7 +17,7 @@ The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow yo
 | 
			
		||||
A simple example
 | 
			
		||||
****************
 | 
			
		||||
 | 
			
		||||
In the controller, get the :class:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										68
									
								
								docs/source/development/run-tests.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										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
 | 
			
		||||
 | 
			
		||||
@@ -97,7 +97,7 @@ The has the following signature :
 | 
			
		||||
         * 
 | 
			
		||||
         * @param string $context
 | 
			
		||||
         * @param mixed[] $args the argument to the context.
 | 
			
		||||
         * @return string[]
 | 
			
		||||
         * @return TimelineSingleQuery
 | 
			
		||||
         * @throw  \LogicException if the context is not supported
 | 
			
		||||
         */
 | 
			
		||||
        public function fetchQuery($context, array $args);
 | 
			
		||||
@@ -163,18 +163,16 @@ The has the following signature :
 | 
			
		||||
The `fetchQuery` function
 | 
			
		||||
^^^^^^^^^^^^^^^^^^^^^^^^^
 | 
			
		||||
 | 
			
		||||
The fetchQuery function help to build the UNION query to gather events. This function should return an associative array MUST have the following key :
 | 
			
		||||
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` (in capital) : the FROM clause. May contains JOIN instructions
 | 
			
		||||
* `FROM`: the FROM clause. May contains JOIN instructions
 | 
			
		||||
* `WHERE`: the WHERE clause;
 | 
			
		||||
* `parameters`: the parameters to pass to the query
 | 
			
		||||
 | 
			
		||||
Those key are optional:
 | 
			
		||||
 | 
			
		||||
* `WHERE` (in capital) : the WHERE clause. 
 | 
			
		||||
 | 
			
		||||
 Where relevant, the data must be quoted to avoid SQL injection.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
@@ -186,6 +184,15 @@ For instance, if the context is `'person'`, the args will be this 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::
 | 
			
		||||
@@ -199,13 +206,12 @@ Example of an implementation :
 | 
			
		||||
    namespace Chill\ReportBundle\Timeline;
 | 
			
		||||
 | 
			
		||||
    use Chill\MainBundle\Timeline\TimelineProviderInterface;
 | 
			
		||||
    use Chill\MainBundle\Timeline\TimelineSingleQuery;
 | 
			
		||||
    use Doctrine\ORM\EntityManager;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Provide report for inclusion in timeline
 | 
			
		||||
     *
 | 
			
		||||
     * @author Julien Fastré <julien.fastre@champs-libres.coop>
 | 
			
		||||
     * @author Champs Libres <info@champs-libres.coop>
 | 
			
		||||
     */
 | 
			
		||||
    class TimelineReportProvider implements TimelineProviderInterface
 | 
			
		||||
    {
 | 
			
		||||
@@ -227,16 +233,17 @@ Example of an implementation :
 | 
			
		||||
                
 | 
			
		||||
                $metadata = $this->em->getClassMetadata('ChillReportBundle:Report');
 | 
			
		||||
                
 | 
			
		||||
                return array(
 | 
			
		||||
                return TimelineSingleQuery::fromArray([
 | 
			
		||||
                   'id' => $metadata->getColumnName('id'),
 | 
			
		||||
                   'type' => 'report',
 | 
			
		||||
                   'date' => $metadata->getColumnName('date'),
 | 
			
		||||
                   'FROM' => $metadata->getTableName(),
 | 
			
		||||
                   'WHERE' => sprintf('%s = %d',
 | 
			
		||||
                   'WHERE' => sprintf('%s = ?',
 | 
			
		||||
                         $metadata
 | 
			
		||||
                            ->getAssociationMapping('person')['joinColumns'][0]['name'],
 | 
			
		||||
                         $args['person']->getId())
 | 
			
		||||
                );
 | 
			
		||||
                            ->getAssociationMapping('person')['joinColumns'][0]['name'])
 | 
			
		||||
                         )
 | 
			
		||||
                   'parameters' => [ $args['person']->getId() ]
 | 
			
		||||
                ]);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        //....
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@ Chill will be available at ``http://localhost:8001.`` Currently, there isn't any
 | 
			
		||||
 | 
			
		||||
.. code-block:: bash
 | 
			
		||||
 | 
			
		||||
   docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load
 | 
			
		||||
   docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load --purge-with-truncate
 | 
			
		||||
 | 
			
		||||
There are several users available:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								package.json.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								package.json.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
add npm/yarn dependency in package.json :
 | 
			
		||||
 | 
			
		||||
"select2-bootstrap-theme": "0.1.0-beta.10",
 | 
			
		||||
@@ -18,12 +18,20 @@
 | 
			
		||||
       <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>
 | 
			
		||||
    </testsuites>
 | 
			
		||||
 | 
			
		||||
    <listeners>
 | 
			
		||||
        <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
 | 
			
		||||
 
 | 
			
		||||
@@ -23,16 +23,20 @@
 | 
			
		||||
namespace Chill\ActivityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
 | 
			
		||||
use Psr\Log\LoggerInterface;
 | 
			
		||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 | 
			
		||||
use Symfony\Component\Form\Form;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Response;
 | 
			
		||||
use Symfony\Component\Security\Core\Role\Role;
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\ActivityBundle\Form\ActivityType;
 | 
			
		||||
use Symfony\Component\Serializer\SerializerInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ActivityController
 | 
			
		||||
@@ -41,216 +45,227 @@ use Chill\ActivityBundle\Form\ActivityType;
 | 
			
		||||
 */
 | 
			
		||||
class ActivityController extends AbstractController
 | 
			
		||||
{
 | 
			
		||||
    protected EventDispatcherInterface $eventDispatcher;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var EventDispatcherInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $eventDispatcher;
 | 
			
		||||
    protected AuthorizationHelper $authorizationHelper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var AuthorizationHelper
 | 
			
		||||
     */
 | 
			
		||||
    protected $authorizationHelper;
 | 
			
		||||
    protected LoggerInterface $logger;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var LoggerInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $logger;
 | 
			
		||||
    protected SerializerInterface $serializer;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * ActivityController constructor.
 | 
			
		||||
     *
 | 
			
		||||
     * @param EventDispatcherInterface $eventDispatcher
 | 
			
		||||
     * @param AuthorizationHelper $authorizationHelper
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        EventDispatcherInterface $eventDispatcher,
 | 
			
		||||
        AuthorizationHelper $authorizationHelper,
 | 
			
		||||
        LoggerInterface $logger
 | 
			
		||||
        LoggerInterface $logger,
 | 
			
		||||
        SerializerInterface $serializer
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->eventDispatcher = $eventDispatcher;
 | 
			
		||||
        $this->authorizationHelper = $authorizationHelper;
 | 
			
		||||
        $this->logger = $logger;
 | 
			
		||||
        $this->serializer = $serializer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Lists all Activity entities.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function listAction($person_id, Request $request)
 | 
			
		||||
    public function listAction(Request $request): Response
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
        $view = null;
 | 
			
		||||
        // TODO: add pagination
 | 
			
		||||
 | 
			
		||||
        if ($person === NULL) {
 | 
			
		||||
            throw $this->createNotFoundException('Person not found');
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($person instanceof Person) {
 | 
			
		||||
            $reachableScopes = $this->authorizationHelper
 | 
			
		||||
                ->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
 | 
			
		||||
                    $person->getCenter());
 | 
			
		||||
 | 
			
		||||
            $activities = $em->getRepository(Activity::class)
 | 
			
		||||
                ->findByPersonImplied($person, $reachableScopes)
 | 
			
		||||
                ;
 | 
			
		||||
 | 
			
		||||
            $event = new PrivacyEvent($person, array(
 | 
			
		||||
                'element_class' => Activity::class,
 | 
			
		||||
                'action' => 'list'
 | 
			
		||||
            ));
 | 
			
		||||
            $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
 | 
			
		||||
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:listPerson.html.twig';
 | 
			
		||||
        } elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
 | 
			
		||||
                ['accompanyingPeriod' => $accompanyingPeriod],
 | 
			
		||||
                ['date' => 'DESC'],
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
 | 
			
		||||
        $reachableScopes = $this->authorizationHelper
 | 
			
		||||
            ->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
 | 
			
		||||
            $person->getCenter());
 | 
			
		||||
 | 
			
		||||
        $activities = $em->getRepository('ChillActivityBundle:Activity')
 | 
			
		||||
                ->findBy(
 | 
			
		||||
                      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(
 | 
			
		||||
        return $this->render($view, array(
 | 
			
		||||
            'activities' => $activities,
 | 
			
		||||
            'person'   => $person
 | 
			
		||||
            'person'   => $person,
 | 
			
		||||
            'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a new Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function createAction($person_id, Request $request)
 | 
			
		||||
 | 
			
		||||
    public function selectTypeAction(Request $request): Response
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
        $view = null;
 | 
			
		||||
 | 
			
		||||
        if ($person === NULL) {
 | 
			
		||||
            throw $this->createNotFoundException('person not found');
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:selectTypeAccompanyingCourse.html.twig';
 | 
			
		||||
        } elseif ($person instanceof Person) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:selectTypePerson.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
        $data = [];
 | 
			
		||||
 | 
			
		||||
        $activityTypeCategories = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityTypeCategory::class)
 | 
			
		||||
            ->findBy(['active' => true], ['ordering' => 'ASC']);
 | 
			
		||||
 | 
			
		||||
        foreach ($activityTypeCategories as $activityTypeCategory) {
 | 
			
		||||
            $activityTypes = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
 | 
			
		||||
                ->findBy(['active' => true, 'category' => $activityTypeCategory], ['ordering' => 'ASC']);
 | 
			
		||||
 | 
			
		||||
            $data[] = [
 | 
			
		||||
                'activityTypeCategory' => $activityTypeCategory,
 | 
			
		||||
                'activityTypes' => $activityTypes,
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($view === null) {
 | 
			
		||||
            throw $this->createNotFoundException('Template not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render($view, [
 | 
			
		||||
            'person' => $person,
 | 
			
		||||
            'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
            'data' => $data,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function newAction(Request $request): Response
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:newAccompanyingCourse.html.twig';
 | 
			
		||||
        } elseif ($person instanceof Person) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:newPerson.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $activityType_id = $request->get('activityType_id', 0);
 | 
			
		||||
        $activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
 | 
			
		||||
            ->find($activityType_id);
 | 
			
		||||
 | 
			
		||||
        if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
 | 
			
		||||
            !$activityType->isActive()) {
 | 
			
		||||
 | 
			
		||||
            $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
 | 
			
		||||
            return $this->redirectToRoute('chill_activity_activity_select_type', $params);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $entity = new Activity();
 | 
			
		||||
        $entity->setPerson($person);
 | 
			
		||||
        $form = $this->createCreateForm($entity, $person);
 | 
			
		||||
        $form->handleRequest($request);
 | 
			
		||||
        $entity->setUser($this->getUser());
 | 
			
		||||
 | 
			
		||||
        if ($form->isValid()) {
 | 
			
		||||
            $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        if ($person instanceof Person) {
 | 
			
		||||
            $entity->setPerson($person);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
            $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity,
 | 
			
		||||
                    'creation of this activity not allowed');
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $entity->setAccompanyingPeriod($accompanyingPeriod);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $entity->setType($activityType);
 | 
			
		||||
        $entity->setDate(new \DateTime('now'));
 | 
			
		||||
 | 
			
		||||
        // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
 | 
			
		||||
        // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
 | 
			
		||||
 | 
			
		||||
        $form = $this->createForm(ActivityType::class, $entity, [
 | 
			
		||||
            'center' => $entity->getCenter(),
 | 
			
		||||
            'role'   => new Role('CHILL_ACTIVITY_CREATE'),
 | 
			
		||||
            'activityType' => $entity->getType(),
 | 
			
		||||
            'accompanyingPeriod' => $accompanyingPeriod,
 | 
			
		||||
        ])->handleRequest($request);
 | 
			
		||||
 | 
			
		||||
        if ($form->isSubmitted() && $form->isValid()) {
 | 
			
		||||
            $em->persist($entity);
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            $this->get('session')
 | 
			
		||||
                ->getFlashBag()
 | 
			
		||||
                ->add('success',
 | 
			
		||||
                    $this->get('translator')
 | 
			
		||||
                        ->trans('Success : activity created!')
 | 
			
		||||
                );
 | 
			
		||||
            $this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
 | 
			
		||||
 | 
			
		||||
            return $this->redirect(
 | 
			
		||||
                $this->generateUrl('chill_activity_activity_show',
 | 
			
		||||
                array('id' => $entity->getId(), 'person_id' => $person_id)));
 | 
			
		||||
            $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
 | 
			
		||||
            $params['id'] = $entity->getId();
 | 
			
		||||
 | 
			
		||||
            return $this->redirectToRoute('chill_activity_activity_show', $params);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->get('session')
 | 
			
		||||
            ->getFlashBag()->add('danger',
 | 
			
		||||
                $this->get('translator')
 | 
			
		||||
                    ->trans('The form is not valid. The activity has not been created !')
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
 | 
			
		||||
            'entity' => $entity,
 | 
			
		||||
            'form'   => $form->createView(),
 | 
			
		||||
            'person' => $person
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a form to create a Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     * @param Activity $entity The entity
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Symfony\Component\Form\Form The form
 | 
			
		||||
     */
 | 
			
		||||
    private function createCreateForm(Activity $entity)
 | 
			
		||||
    {
 | 
			
		||||
        $form = $this->createForm(ActivityType::class, $entity,
 | 
			
		||||
              array(
 | 
			
		||||
                'action' => $this->generateUrl('chill_activity_activity_create', [
 | 
			
		||||
                    'person_id' => $entity->getPerson()->getId(),
 | 
			
		||||
                    ]),
 | 
			
		||||
                'method' => 'POST',
 | 
			
		||||
                'center' => $entity->getCenter(),
 | 
			
		||||
                'role'   => new Role('CHILL_ACTIVITY_CREATE')
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return $form;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays a form to create a new Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function newAction($person_id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
 | 
			
		||||
        if ($person === NULL){
 | 
			
		||||
            throw $this->createNotFoundException('Person not found');
 | 
			
		||||
        if ($view === null) {
 | 
			
		||||
            throw $this->createNotFoundException('Template not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
        $activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
 | 
			
		||||
 | 
			
		||||
        $entity = new Activity();
 | 
			
		||||
        $entity->setUser($this->get('security.token_storage')->getToken()->getUser());
 | 
			
		||||
        $entity->setPerson($person);
 | 
			
		||||
        $entity->setDate(new \DateTime('now'));
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
 | 
			
		||||
 | 
			
		||||
        $form   = $this->createCreateForm($entity, $person);
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
 | 
			
		||||
        return $this->render($view, [
 | 
			
		||||
            'person'   => $person,
 | 
			
		||||
            'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
            'entity' => $entity,
 | 
			
		||||
            'form'   => $form->createView(),
 | 
			
		||||
        ));
 | 
			
		||||
            'form' => $form->createView(),
 | 
			
		||||
            'activity_json' => $activity_array
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds and displays a Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function showAction($person_id, $id)
 | 
			
		||||
    public function showAction(Request $request, $id): Response
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
 | 
			
		||||
        if (!$person) {
 | 
			
		||||
            throw $this->createNotFoundException('person not found');
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
 | 
			
		||||
        } elseif ($person instanceof Person) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:showPerson.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find Activity entity.');
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if (null !== $accompanyingPeriod) {
 | 
			
		||||
           $entity->personsAssociated = $entity->getPersonsAssociated();
 | 
			
		||||
           $entity->personsNotAssociated = $entity->getPersonsNotAssociated();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
 | 
			
		||||
        // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
 | 
			
		||||
        // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
 | 
			
		||||
 | 
			
		||||
        $deleteForm = $this->createDeleteForm($id, $person);
 | 
			
		||||
        $deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
 | 
			
		||||
 | 
			
		||||
        // TODO
 | 
			
		||||
        /*
 | 
			
		||||
        $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(
 | 
			
		||||
        if ($view === null) {
 | 
			
		||||
            throw $this->createNotFoundException('Template not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render($view, array(
 | 
			
		||||
            'person'      => $person,
 | 
			
		||||
            'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
            'delete_form' => $deleteForm->createView(),
 | 
			
		||||
        ));
 | 
			
		||||
@@ -260,118 +275,70 @@ class ActivityController extends AbstractController
 | 
			
		||||
     * Displays a form to edit an existing Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function editAction($person_id, $id)
 | 
			
		||||
    public function editAction($id, Request $request): Response
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
 | 
			
		||||
        if (!$person) {
 | 
			
		||||
            throw $this->createNotFoundException('person not found');
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
 | 
			
		||||
        } elseif ($person instanceof Person) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:editPerson.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find Activity entity.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
 | 
			
		||||
        // TODO
 | 
			
		||||
        // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
 | 
			
		||||
 | 
			
		||||
        $editForm = $this->createEditForm($entity);
 | 
			
		||||
        $deleteForm = $this->createDeleteForm($id, $person);
 | 
			
		||||
        $form = $this->createForm(ActivityType::class, $entity, [
 | 
			
		||||
            'center' => $entity->getCenter(),
 | 
			
		||||
            'role'   => new Role('CHILL_ACTIVITY_UPDATE'),
 | 
			
		||||
            'activityType' => $entity->getType(),
 | 
			
		||||
            'accompanyingPeriod' => $accompanyingPeriod,
 | 
			
		||||
        ])->handleRequest($request);
 | 
			
		||||
 | 
			
		||||
        if ($form->isSubmitted() && $form->isValid()) {
 | 
			
		||||
            $em->persist($entity);
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            $this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
 | 
			
		||||
 | 
			
		||||
            $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
 | 
			
		||||
            $params['id'] = $id;
 | 
			
		||||
            return $this->redirectToRoute('chill_activity_activity_show', $params);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $deleteForm = $this->createDeleteForm($id, $person, $accompanyingPeriod);
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * TODO
 | 
			
		||||
        $event = new PrivacyEvent($person, array(
 | 
			
		||||
            'element_class' => Activity::class,
 | 
			
		||||
            'element_id' => $entity->getId(),
 | 
			
		||||
            'action' => 'edit'
 | 
			
		||||
        ));
 | 
			
		||||
        $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
            'edit_form'   => $editForm->createView(),
 | 
			
		||||
            'delete_form' => $deleteForm->createView(),
 | 
			
		||||
            'person' => $person
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * Creates a form to edit a Activity entity.
 | 
			
		||||
    *
 | 
			
		||||
    * @param Activity $entity The entity
 | 
			
		||||
    *
 | 
			
		||||
    * @return \Symfony\Component\Form\Form The form
 | 
			
		||||
    */
 | 
			
		||||
    private function createEditForm(Activity $entity)
 | 
			
		||||
    {
 | 
			
		||||
        $form = $this->createForm(ActivityType::class, $entity, array(
 | 
			
		||||
            'action' => $this->generateUrl('chill_activity_activity_update',
 | 
			
		||||
                    array(
 | 
			
		||||
                        'id' => $entity->getId(),
 | 
			
		||||
                        'person_id' => $entity->getPerson()->getId()
 | 
			
		||||
                )),
 | 
			
		||||
            'method' => 'PUT',
 | 
			
		||||
            'center' => $entity->getCenter(),
 | 
			
		||||
            'role'   => new Role('CHILL_ACTIVITY_UPDATE')
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        return $form;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Edits an existing Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function updateAction(Request $request, $person_id, $id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        $person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find Activity entity.');
 | 
			
		||||
        if ($view === null) {
 | 
			
		||||
            throw $this->createNotFoundException('Template not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
 | 
			
		||||
        $activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
 | 
			
		||||
 | 
			
		||||
        $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(),
 | 
			
		||||
            'action' => 'update'
 | 
			
		||||
        ));
 | 
			
		||||
        $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
 | 
			
		||||
 | 
			
		||||
        if ($editForm->isValid()) {
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            $this->get('session')
 | 
			
		||||
                ->getFlashBag()
 | 
			
		||||
                ->add('success',
 | 
			
		||||
                    $this->get('translator')
 | 
			
		||||
                        ->trans('Success : activity updated!')
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
            return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->get('session')
 | 
			
		||||
            ->getFlashBag()
 | 
			
		||||
            ->add('error',
 | 
			
		||||
                $this->get('translator')
 | 
			
		||||
                    ->trans('This form contains errors')
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
 | 
			
		||||
            'person'      => $entity->getPerson(),
 | 
			
		||||
        return $this->render($view, array(
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
            'edit_form'   => $editForm->createView(),
 | 
			
		||||
            'edit_form'   => $form->createView(),
 | 
			
		||||
            'delete_form' => $deleteForm->createView(),
 | 
			
		||||
            'person' => $person,
 | 
			
		||||
            'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
            'activity_json' => $activity_array
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -379,22 +346,29 @@ class ActivityController extends AbstractController
 | 
			
		||||
     * Deletes a Activity entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function deleteAction(Request $request, $id, $person_id)
 | 
			
		||||
    public function deleteAction(Request $request, $id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        [$person, $accompanyingPeriod] = $this->getEntity($request);
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod instanceof AccompanyingPeriod) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
 | 
			
		||||
        } elseif ($person instanceof Person) {
 | 
			
		||||
            $view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* @var $activity Activity */
 | 
			
		||||
        $activity = $em->getRepository('ChillActivityBundle:Activity')
 | 
			
		||||
              ->find($id);
 | 
			
		||||
        $person = $activity->getPerson();
 | 
			
		||||
        $activity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$activity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find Activity entity.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
 | 
			
		||||
        // TODO
 | 
			
		||||
        // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
 | 
			
		||||
 | 
			
		||||
        $form = $this->createDeleteForm($id, $person);
 | 
			
		||||
        $form = $this->createDeleteForm($id, $person, $accompanyingPeriod);
 | 
			
		||||
 | 
			
		||||
        if ($request->getMethod() === Request::METHOD_DELETE) {
 | 
			
		||||
            $form->handleRequest($request);
 | 
			
		||||
@@ -404,14 +378,14 @@ class ActivityController extends AbstractController
 | 
			
		||||
                $this->logger->notice("An activity has been removed", array(
 | 
			
		||||
                   'by_user' => $this->getUser()->getUsername(),
 | 
			
		||||
                   'activity_id' => $activity->getId(),
 | 
			
		||||
                   'person_id' => $activity->getPerson()->getId(),
 | 
			
		||||
                   'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null,
 | 
			
		||||
                   'comment' => $activity->getComment()->getComment(),
 | 
			
		||||
                   'scope_id' => $activity->getScope()->getId(),
 | 
			
		||||
                   'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null,
 | 
			
		||||
                   'reasons_ids' => $activity->getReasons()
 | 
			
		||||
                      ->map(function ($ar) { return $ar->getId(); })
 | 
			
		||||
                      ->toArray(),
 | 
			
		||||
                   'type_id' => $activity->getType()->getId(),
 | 
			
		||||
                   'duration' => $activity->getDurationTime()->format('U'),
 | 
			
		||||
                   'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null,
 | 
			
		||||
                   'date' => $activity->getDate()->format('Y-m-d'),
 | 
			
		||||
                   'attendee' => $activity->getAttendee()
 | 
			
		||||
                ));
 | 
			
		||||
@@ -422,37 +396,86 @@ class ActivityController extends AbstractController
 | 
			
		||||
                $this->addFlash('success', $this->get('translator')
 | 
			
		||||
                      ->trans("The activity has been successfully removed."));
 | 
			
		||||
 | 
			
		||||
                return $this->redirect($this->generateUrl(
 | 
			
		||||
                  'chill_activity_activity_list', array(
 | 
			
		||||
                     'person_id' => $person_id
 | 
			
		||||
                  )));
 | 
			
		||||
                $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
 | 
			
		||||
                return $this->redirectToRoute('chill_activity_activity_list', $params);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', array(
 | 
			
		||||
        if ($view === null) {
 | 
			
		||||
            throw $this->createNotFoundException('Template not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render($view, array(
 | 
			
		||||
           'activity' => $activity,
 | 
			
		||||
           'delete_form' => $form->createView()
 | 
			
		||||
           'delete_form' => $form->createView(),
 | 
			
		||||
           'person' => $person,
 | 
			
		||||
           'accompanyingCourse' => $accompanyingPeriod,
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a form to delete a Activity entity by id.
 | 
			
		||||
     *
 | 
			
		||||
     * @param mixed $id The entity id
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Symfony\Component\Form\Form The form
 | 
			
		||||
     */
 | 
			
		||||
    private function createDeleteForm($id, $person)
 | 
			
		||||
    private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form
 | 
			
		||||
    {
 | 
			
		||||
        $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
 | 
			
		||||
        $params['id'] = $id;
 | 
			
		||||
 | 
			
		||||
        return $this->createFormBuilder()
 | 
			
		||||
            ->setAction($this->generateUrl(
 | 
			
		||||
                'chill_activity_activity_delete',
 | 
			
		||||
                array('id' => $id, 'person_id' => $person->getId())))
 | 
			
		||||
            ->setAction($this->generateUrl('chill_activity_activity_delete', $params))
 | 
			
		||||
            ->setMethod('DELETE')
 | 
			
		||||
            ->add('submit', SubmitType::class, array('label' => 'Delete'))
 | 
			
		||||
            ->getForm()
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getEntity(Request $request): array
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
        $person = $accompanyingPeriod  = null;
 | 
			
		||||
 | 
			
		||||
        if ($request->query->has('person_id')) {
 | 
			
		||||
            $person_id = $request->get('person_id');
 | 
			
		||||
            $person = $em->getRepository(Person::class)->find($person_id);
 | 
			
		||||
 | 
			
		||||
            if ($person === null) {
 | 
			
		||||
                throw $this->createNotFoundException('Person not found');
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
        } elseif ($request->query->has('accompanying_period_id')) {
 | 
			
		||||
            $accompanying_period_id = $request->get('accompanying_period_id');
 | 
			
		||||
            $accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
 | 
			
		||||
 | 
			
		||||
            if ($accompanyingPeriod === null) {
 | 
			
		||||
                throw $this->createNotFoundException('Accompanying Period not found');
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // TODO Add permission
 | 
			
		||||
            // $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
 | 
			
		||||
        } else {
 | 
			
		||||
            throw $this->createNotFoundException("Person or Accompanying Period not found");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            $person, $accompanyingPeriod
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function buildParamsToUrl(
 | 
			
		||||
        ?Person $person,
 | 
			
		||||
        ?AccompanyingPeriod $accompanyingPeriod
 | 
			
		||||
    ): array {
 | 
			
		||||
        $params = [];
 | 
			
		||||
 | 
			
		||||
        if ($person) {
 | 
			
		||||
            $params['person_id'] = $person->getId();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($accompanyingPeriod) {
 | 
			
		||||
            $params['accompanying_period_id'] = $accompanyingPeriod->getId();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $params;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,178 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityType;
 | 
			
		||||
use Chill\ActivityBundle\Form\ActivityTypeType;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ActivityTypeController
 | 
			
		||||
 *
 | 
			
		||||
 * @package Chill\ActivityBundle\Controller
 | 
			
		||||
 */
 | 
			
		||||
class ActivityTypeController extends AbstractController
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Lists all ActivityType entities.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function indexAction()
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        $entities = $em->getRepository('ChillActivityBundle:ActivityType')->findAll();
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:index.html.twig', array(
 | 
			
		||||
            'entities' => $entities,
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a new ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function createAction(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
        $entity = new ActivityType();
 | 
			
		||||
        $form = $this->createCreateForm($entity);
 | 
			
		||||
        $form->handleRequest($request);
 | 
			
		||||
 | 
			
		||||
        if ($form->isValid()) {
 | 
			
		||||
            $em = $this->getDoctrine()->getManager();
 | 
			
		||||
            $em->persist($entity);
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            return $this->redirect($this->generateUrl('chill_activity_activitytype_show', array('id' => $entity->getId())));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array(
 | 
			
		||||
            'entity' => $entity,
 | 
			
		||||
            'form'   => $form->createView(),
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a form to create a ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     * @param ActivityType $entity The entity
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Symfony\Component\Form\Form The form
 | 
			
		||||
     */
 | 
			
		||||
    private function createCreateForm(ActivityType $entity)
 | 
			
		||||
    {
 | 
			
		||||
        $form = $this->createForm(ActivityTypeType::class, $entity, array(
 | 
			
		||||
            'action' => $this->generateUrl('chill_activity_activitytype_create'),
 | 
			
		||||
            'method' => 'POST',
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $form->add('submit', SubmitType::class, array('label' => 'Create'));
 | 
			
		||||
 | 
			
		||||
        return $form;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays a form to create a new ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function newAction()
 | 
			
		||||
    {
 | 
			
		||||
        $entity = new ActivityType();
 | 
			
		||||
        $form   = $this->createCreateForm($entity);
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array(
 | 
			
		||||
            'entity' => $entity,
 | 
			
		||||
            'form'   => $form->createView(),
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds and displays a ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function showAction($id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find ActivityType entity.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array(
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays a form to edit an existing ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function editAction($id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find ActivityType entity.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $editForm = $this->createEditForm($entity);
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
            'edit_form'   => $editForm->createView()
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * Creates a form to edit a ActivityType entity.
 | 
			
		||||
    *
 | 
			
		||||
    * @param ActivityType $entity The entity
 | 
			
		||||
    *
 | 
			
		||||
    * @return \Symfony\Component\Form\Form The form
 | 
			
		||||
    */
 | 
			
		||||
    private function createEditForm(ActivityType $entity)
 | 
			
		||||
    {
 | 
			
		||||
        $form = $this->createForm(ActivityTypeType::class, $entity, array(
 | 
			
		||||
            'action' => $this->generateUrl('chill_activity_activitytype_update', array('id' => $entity->getId())),
 | 
			
		||||
            'method' => 'PUT',
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $form->add('submit', SubmitType::class, array('label' => 'Update'));
 | 
			
		||||
 | 
			
		||||
        return $form;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Edits an existing ActivityType entity.
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    public function updateAction(Request $request, $id)
 | 
			
		||||
    {
 | 
			
		||||
        $em = $this->getDoctrine()->getManager();
 | 
			
		||||
 | 
			
		||||
        $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
 | 
			
		||||
 | 
			
		||||
        if (!$entity) {
 | 
			
		||||
            throw $this->createNotFoundException('Unable to find ActivityType entity.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $editForm = $this->createEditForm($entity);
 | 
			
		||||
        $editForm->handleRequest($request);
 | 
			
		||||
 | 
			
		||||
        if ($editForm->isValid()) {
 | 
			
		||||
            $em->flush();
 | 
			
		||||
 | 
			
		||||
            return $this->redirect($this->generateUrl('chill_activity_activitytype_edit', array('id' => $id)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
 | 
			
		||||
            'entity'      => $entity,
 | 
			
		||||
            'edit_form'   => $editForm->createView(),
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class AdminActivityPresenceController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $action
 | 
			
		||||
     * @param \Doctrine\ORM\QueryBuilder|mixed $query
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     * @param PaginatorInterface $paginator
 | 
			
		||||
     * @return \Doctrine\ORM\QueryBuilder|mixed
 | 
			
		||||
     */
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \Doctrine\ORM\QueryBuilder $query */
 | 
			
		||||
        return $query->orderBy('e.id', 'ASC');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class AdminActivityTypeCategoryController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $action
 | 
			
		||||
     * @param \Doctrine\ORM\QueryBuilder|mixed $query
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     * @param PaginatorInterface $paginator
 | 
			
		||||
     * @return \Doctrine\ORM\QueryBuilder|mixed
 | 
			
		||||
     */
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \Doctrine\ORM\QueryBuilder $query */
 | 
			
		||||
        return $query->orderBy('e.ordering', 'ASC');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class AdminActivityTypeController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $action
 | 
			
		||||
     * @param \Doctrine\ORM\QueryBuilder|mixed $query
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     * @param PaginatorInterface $paginator
 | 
			
		||||
     * @return \Doctrine\ORM\QueryBuilder|mixed
 | 
			
		||||
     */
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \Doctrine\ORM\QueryBuilder $query */
 | 
			
		||||
        return $query->orderBy('e.ordering', 'ASC');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -116,9 +116,10 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
 | 
			
		||||
            ->setDurationTime($this->faker->dateTime(36000))
 | 
			
		||||
            ->setType($this->getRandomActivityType())
 | 
			
		||||
            ->setScope($this->getRandomScope())
 | 
			
		||||
            ->setAttendee($this->faker->boolean())
 | 
			
		||||
            ;
 | 
			
		||||
 | 
			
		||||
        //      ->setAttendee($this->faker->boolean())
 | 
			
		||||
 | 
			
		||||
        $usedId = array();
 | 
			
		||||
        for ($i = 0; $i < rand(0, 4); $i++) {
 | 
			
		||||
            $reason = $this->getRandomActivityReason($usedId);
 | 
			
		||||
@@ -137,11 +138,15 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
 | 
			
		||||
 | 
			
		||||
        foreach($persons as $person) {
 | 
			
		||||
            $activityNbr = rand(0,3);
 | 
			
		||||
            $ref = 'activity_'.$person->getFullnameCanonical();
 | 
			
		||||
 | 
			
		||||
            for($i = 0; $i < $activityNbr; $i ++) {
 | 
			
		||||
                print "Creating an activity type for  : ".$person."\n";
 | 
			
		||||
                print "Creating an activity type for  : ".$person." (ref: ".$ref.")  \n";
 | 
			
		||||
                $activity = $this->newRandomActivity($person);
 | 
			
		||||
                $manager->persist($activity);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->setReference($ref, $activity);
 | 
			
		||||
        }
 | 
			
		||||
        $manager->flush();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Common\DataFixtures\AbstractFixture;
 | 
			
		||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;
 | 
			
		||||
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivity;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load notififications into database
 | 
			
		||||
 */
 | 
			
		||||
class LoadActivityNotifications extends AbstractFixture implements DependentFixtureInterface
 | 
			
		||||
{
 | 
			
		||||
    use LoadAbstractNotificationsTrait;
 | 
			
		||||
 | 
			
		||||
    public $notifs = [
 | 
			
		||||
        [
 | 
			
		||||
            'message' => 'Hello !',
 | 
			
		||||
            'entityClass' => Activity::class,
 | 
			
		||||
            'entityRef' => 'activity_gerard depardieu',
 | 
			
		||||
            'sender' => 'center a_social',
 | 
			
		||||
            'addressees' => [
 | 
			
		||||
                'center a_social',
 | 
			
		||||
                'center a_administrative',
 | 
			
		||||
                'center a_direction',
 | 
			
		||||
                'multi_center'
 | 
			
		||||
            ],
 | 
			
		||||
        ]
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    public function getDependencies()
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            LoadActivity::class,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,27 +2,27 @@
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Common\DataFixtures\AbstractFixture;
 | 
			
		||||
use Doctrine\Bundle\FixturesBundle\Fixture;
 | 
			
		||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
 | 
			
		||||
use Doctrine\Persistence\ObjectManager;
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityType;
 | 
			
		||||
@@ -32,36 +32,59 @@ use Chill\ActivityBundle\Entity\ActivityType;
 | 
			
		||||
 *
 | 
			
		||||
 * @author Champs-Libres Coop
 | 
			
		||||
 */
 | 
			
		||||
class LoadActivityType extends AbstractFixture implements OrderedFixtureInterface
 | 
			
		||||
class LoadActivityType extends Fixture implements OrderedFixtureInterface
 | 
			
		||||
{
 | 
			
		||||
    public function getOrder()
 | 
			
		||||
    {
 | 
			
		||||
        return 16100;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public static $references = array();
 | 
			
		||||
 | 
			
		||||
    public function load(ObjectManager $manager)
 | 
			
		||||
    {
 | 
			
		||||
        $types = [
 | 
			
		||||
            [ 'name' =>
 | 
			
		||||
                ['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel']],
 | 
			
		||||
            [ 'name' =>
 | 
			
		||||
                ['fr' => 'Entretien', 'en' => 'Interview', 'nl' => 'Vraaggesprek']],
 | 
			
		||||
            [ 'name' =>
 | 
			
		||||
                ['fr' => 'Inspection', 'en' => 'Inspection', 'nl' => 'Inspectie']]
 | 
			
		||||
            # Exange
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Entretien physique avec l\'usager'],
 | 
			
		||||
                'category' => 'exchange' ],
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Appel téléphonique', 'en' => 'Telephone call', 'nl' => 'Telefoon appel'],
 | 
			
		||||
                'category' => 'exchange' ],
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Courriel', 'en' => 'Email', 'nl' => 'Email'],
 | 
			
		||||
                'category' => 'exchange' ],
 | 
			
		||||
            # Meeting
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Point technique encadrant'],
 | 
			
		||||
                'category' => 'meeting' ],
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Réunion avec des partenaires'],
 | 
			
		||||
                'category' => 'meeting' ],
 | 
			
		||||
            [
 | 
			
		||||
                'name' =>
 | 
			
		||||
                    ['fr' => 'Commission pluridisciplinaire et pluri-institutionnelle'],
 | 
			
		||||
                'category' => 'meeting' ],
 | 
			
		||||
        ];
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
        foreach ($types as $t) {
 | 
			
		||||
            print "Creating activity type : " . $t['name']['en'] . "\n";
 | 
			
		||||
            print "Creating activity type : " . $t['name']['fr'] . " (cat:". $t['category']  . " \n";
 | 
			
		||||
            $activityType = (new ActivityType())
 | 
			
		||||
                ->setName(($t['name']));
 | 
			
		||||
                ->setName(($t['name']))
 | 
			
		||||
                ->setCategory($this->getReference('activity_type_cat_'.$t['category']))
 | 
			
		||||
                ->setSocialIssuesVisible(1)
 | 
			
		||||
                ->setSocialActionsVisible(1);
 | 
			
		||||
            $manager->persist($activityType);
 | 
			
		||||
            $reference = 'activity_type_'.$t['name']['en'];
 | 
			
		||||
            $reference = 'activity_type_'.$t['name']['fr'];
 | 
			
		||||
            $this->addReference($reference, $activityType);
 | 
			
		||||
            static::$references[] = $reference;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        $manager->flush();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,72 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Chill is a software for social workers
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2014-2021, 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\DataFixtures\ORM;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Bundle\FixturesBundle\Fixture;
 | 
			
		||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
 | 
			
		||||
use Doctrine\Persistence\ObjectManager;
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fixtures for ActivityTypeCategory
 | 
			
		||||
 *
 | 
			
		||||
 * @author Champs-Libres Coop
 | 
			
		||||
 */
 | 
			
		||||
class LoadActivityTypeCategory extends Fixture implements OrderedFixtureInterface
 | 
			
		||||
{
 | 
			
		||||
    public static $references = array();
 | 
			
		||||
 | 
			
		||||
    public function getOrder()
 | 
			
		||||
    {
 | 
			
		||||
        return 16050;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function load(ObjectManager $manager)
 | 
			
		||||
    {
 | 
			
		||||
        $categories = [
 | 
			
		||||
            [
 | 
			
		||||
                'name' => ['fr' => 'Échange avec usager', 'en' => 'Exchange with user'],
 | 
			
		||||
                'ref' => 'exchange',
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                'name' => ['fr' => 'Réunion', 'en' => 'Meeting'],
 | 
			
		||||
                'ref' => 'meeting',
 | 
			
		||||
            ],
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        foreach ($categories as $cat) {
 | 
			
		||||
            print "Creating activity type category : " . $cat['ref'] . "\n";
 | 
			
		||||
 | 
			
		||||
            $newCat = (new ActivityTypeCategory())
 | 
			
		||||
                ->setName(($cat['name']));
 | 
			
		||||
 | 
			
		||||
            $manager->persist($newCat);
 | 
			
		||||
            $reference = 'activity_type_cat_'.$cat['ref'];
 | 
			
		||||
 | 
			
		||||
            $this->addReference($reference, $newCat);
 | 
			
		||||
            static::$references[] = $reference;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $manager->flush();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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
 | 
			
		||||
@@ -44,7 +44,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
 | 
			
		||||
    {
 | 
			
		||||
        $configuration = new Configuration();
 | 
			
		||||
        $config = $this->processConfiguration($configuration, $configs);
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        $container->setParameter('chill_activity.form.time_duration', $config['form']['time_duration']);
 | 
			
		||||
 | 
			
		||||
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
 | 
			
		||||
@@ -52,22 +52,22 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
 | 
			
		||||
        $loader->load('services/export.yaml');
 | 
			
		||||
        $loader->load('services/repositories.yaml');
 | 
			
		||||
        $loader->load('services/fixtures.yaml');
 | 
			
		||||
        $loader->load('services/menu.yaml');
 | 
			
		||||
        $loader->load('services/controller.yaml');
 | 
			
		||||
        $loader->load('services/form.yaml');
 | 
			
		||||
        $loader->load('services/templating.yaml');
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public function prepend(ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        $this->prependRoutes($container);
 | 
			
		||||
        $this->prependAuthorization($container);
 | 
			
		||||
        $this->prependCruds($container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* (non-PHPdoc)
 | 
			
		||||
     * @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
 | 
			
		||||
     */
 | 
			
		||||
    public function prependRoutes(ContainerBuilder $container) 
 | 
			
		||||
    public function prependRoutes(ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        //add routes for custom bundle
 | 
			
		||||
         $container->prependExtensionConfig('chill_main', array(
 | 
			
		||||
@@ -78,7 +78,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
 | 
			
		||||
           )
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public function prependAuthorization(ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        $container->prependExtensionConfig('security', array(
 | 
			
		||||
@@ -90,4 +90,75 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
 | 
			
		||||
           )
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function prependCruds(ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        $container->prependExtensionConfig('chill_main', [
 | 
			
		||||
            'cruds' => [
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => \Chill\ActivityBundle\Entity\ActivityType::class,
 | 
			
		||||
                    'name' => 'activity_type',
 | 
			
		||||
                    'base_path' => '/admin/activity/type',
 | 
			
		||||
                    'form_class' => \Chill\ActivityBundle\Form\ActivityTypeType::class,
 | 
			
		||||
                    'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityType/index.html.twig',
 | 
			
		||||
                            'role' => 'ROLE_ADMIN'
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new'   => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityType/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit'  => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityType/edit.html.twig',
 | 
			
		||||
                        ]
 | 
			
		||||
                    ]
 | 
			
		||||
                ],
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => \Chill\ActivityBundle\Entity\ActivityTypeCategory::class,
 | 
			
		||||
                    'name' => 'activity_type_category',
 | 
			
		||||
                    'base_path' => '/admin/activity/type_category',
 | 
			
		||||
                    'form_class' => \Chill\ActivityBundle\Form\ActivityTypeCategoryType::class,
 | 
			
		||||
                    'controller' => \Chill\ActivityBundle\Controller\AdminActivityTypeCategoryController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityTypeCategory/index.html.twig',
 | 
			
		||||
                            'role' => 'ROLE_ADMIN'
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new'   => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityTypeCategory/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit'  => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
 | 
			
		||||
                        ]
 | 
			
		||||
                    ]
 | 
			
		||||
                ],
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
 | 
			
		||||
                    'name' => 'activity_presence',
 | 
			
		||||
                    'base_path' => '/admin/activity/presence',
 | 
			
		||||
                    'form_class' => \Chill\ActivityBundle\Form\ActivityPresenceType::class,
 | 
			
		||||
                    'controller' => \Chill\ActivityBundle\Controller\AdminActivityPresenceController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityPresence/index.html.twig',
 | 
			
		||||
                            'role' => 'ROLE_ADMIN'
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new'   => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityPresence/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit'  => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
 | 
			
		||||
                        ]
 | 
			
		||||
                    ]
 | 
			
		||||
                ],
 | 
			
		||||
            ]
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,332 +20,538 @@
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Entity;
 | 
			
		||||
 | 
			
		||||
use Chill\DocStoreBundle\Entity\Document;
 | 
			
		||||
use Chill\DocStoreBundle\Entity\StoredObject;
 | 
			
		||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
 | 
			
		||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
 | 
			
		||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
 | 
			
		||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
 | 
			
		||||
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;
 | 
			
		||||
use Symfony\Component\Serializer\Annotation\Groups;
 | 
			
		||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class Activity
 | 
			
		||||
 *
 | 
			
		||||
 * @package Chill\ActivityBundle\Entity
 | 
			
		||||
 * @ORM\Entity()
 | 
			
		||||
 * @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
 | 
			
		||||
 * @ORM\Table(name="activity")
 | 
			
		||||
 * @ORM\HasLifecycleCallbacks()
 | 
			
		||||
 * @DiscriminatorMap(typeProperty="type", mapping={
 | 
			
		||||
 *  "activity"=Activity::class
 | 
			
		||||
 *  })
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * TODO : revoir
 | 
			
		||||
 * @UserCircleConsistency(
 | 
			
		||||
 *      "CHILL_ACTIVITY_SEE_DETAILS",
 | 
			
		||||
 *      getUserFunction="getUser",
 | 
			
		||||
 *      path="scope")
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class Activity implements HasCenterInterface, HasScopeInterface
 | 
			
		||||
{
 | 
			
		||||
    const SENTRECEIVED_SENT = 'sent';
 | 
			
		||||
    const SENTRECEIVED_RECEIVED = 'received';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     *
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\Column(name="id", type="integer")
 | 
			
		||||
     * @ORM\GeneratedValue(strategy="AUTO")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private $id;
 | 
			
		||||
    private ?int $id = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var User
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
 | 
			
		||||
     */
 | 
			
		||||
    private $user;
 | 
			
		||||
    private User $user;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \DateTime
 | 
			
		||||
     * @ORM\Column(type="datetime")
 | 
			
		||||
     */
 | 
			
		||||
    private $date;
 | 
			
		||||
    private \DateTime $date;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \DateTime
 | 
			
		||||
     * @ORM\Column(type="time")
 | 
			
		||||
     * @ORM\Column(type="time", nullable=true)
 | 
			
		||||
     */
 | 
			
		||||
    private $durationTime;
 | 
			
		||||
    private ?\DateTime $durationTime = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var boolean
 | 
			
		||||
     * @ORM\Column(type="boolean")
 | 
			
		||||
     * @ORM\Column(type="time", nullable=true)
 | 
			
		||||
     */
 | 
			
		||||
    private $attendee;
 | 
			
		||||
    private ?\DateTime $travelTime = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
 | 
			
		||||
     */
 | 
			
		||||
    private ?ActivityPresence $attendee = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var ActivityReason
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
 | 
			
		||||
     */
 | 
			
		||||
    private $reasons;
 | 
			
		||||
    private Collection $reasons;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
 | 
			
		||||
     * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private Collection $socialIssues;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
 | 
			
		||||
     * @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private Collection $socialActions;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var ActivityType
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
 | 
			
		||||
     */
 | 
			
		||||
    private $type;
 | 
			
		||||
    private ActivityType $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var Scope
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
 | 
			
		||||
     */
 | 
			
		||||
    private $scope;
 | 
			
		||||
    private ?Scope $scope = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var Person
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
 | 
			
		||||
     */
 | 
			
		||||
    private $person;
 | 
			
		||||
    private ?Person $person = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private ?AccompanyingPeriod $accompanyingPeriod = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
 | 
			
		||||
     */
 | 
			
		||||
    private $comment;
 | 
			
		||||
    private CommentEmbeddable $comment;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Activity constructor.
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private ?Collection $persons = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private ?Collection $thirdParties = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject")
 | 
			
		||||
     */
 | 
			
		||||
    private Collection $documents;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     */
 | 
			
		||||
    private ?Collection $users = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean", options={"default"=false})
 | 
			
		||||
     */
 | 
			
		||||
    private bool $emergency = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $sentReceived = '';
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasons = new ArrayCollection();
 | 
			
		||||
        $this->comment = new CommentEmbeddable();
 | 
			
		||||
        $this->persons = new ArrayCollection();
 | 
			
		||||
        $this->thirdParties = new ArrayCollection();
 | 
			
		||||
        $this->documents = new ArrayCollection();
 | 
			
		||||
        $this->users = new ArrayCollection();
 | 
			
		||||
        $this->socialIssues = new ArrayCollection();
 | 
			
		||||
        $this->socialActions = new ArrayCollection();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get id
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public function getId()
 | 
			
		||||
    public function getId(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set user
 | 
			
		||||
     *
 | 
			
		||||
     * @param User $user
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setUser(User $user)
 | 
			
		||||
    public function setUser(User $user): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->user = $user;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get user
 | 
			
		||||
     *
 | 
			
		||||
     * @return User
 | 
			
		||||
     */
 | 
			
		||||
    public function getUser()
 | 
			
		||||
    public function getUser(): User
 | 
			
		||||
    {
 | 
			
		||||
        return $this->user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set date
 | 
			
		||||
     *
 | 
			
		||||
     * @param \DateTime $date
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setDate($date)
 | 
			
		||||
    public function setDate(\DateTime $date): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->date = $date;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get date
 | 
			
		||||
     *
 | 
			
		||||
     * @return \DateTime
 | 
			
		||||
     */
 | 
			
		||||
    public function getDate()
 | 
			
		||||
    public function getDate(): \DateTime
 | 
			
		||||
    {
 | 
			
		||||
        return $this->date;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set durationTime
 | 
			
		||||
     *
 | 
			
		||||
     * @param \DateTime $durationTime
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setDurationTime($durationTime)
 | 
			
		||||
    public function setDurationTime(?\DateTime $durationTime): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->durationTime = $durationTime;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get durationTime
 | 
			
		||||
     *
 | 
			
		||||
     * @return \DateTime
 | 
			
		||||
     */
 | 
			
		||||
    public function getDurationTime()
 | 
			
		||||
    public function getDurationTime(): ?\DateTime
 | 
			
		||||
    {
 | 
			
		||||
        return $this->durationTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set attendee
 | 
			
		||||
     *
 | 
			
		||||
     * @param boolean $attendee
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setAttendee($attendee)
 | 
			
		||||
    public function setTravelTime(\DateTime $travelTime): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->travelTime = $travelTime;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getTravelTime(): ?\DateTime
 | 
			
		||||
    {
 | 
			
		||||
        return $this->travelTime;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAttendee(ActivityPresence $attendee): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->attendee = $attendee;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get attendee
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function getAttendee()
 | 
			
		||||
    public function getAttendee(): ?ActivityPresence
 | 
			
		||||
    {
 | 
			
		||||
        return $this->attendee;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Add a reason
 | 
			
		||||
     *
 | 
			
		||||
     * @param ActivityReason $reason
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function addReason(ActivityReason $reason)
 | 
			
		||||
    public function addReason(ActivityReason $reason): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasons[] = $reason;
 | 
			
		||||
        $this->reasons->add($reason);
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param ActivityReason $reason
 | 
			
		||||
     */
 | 
			
		||||
    public function removeReason(ActivityReason $reason)
 | 
			
		||||
    public function removeReason(ActivityReason $reason): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasons->removeElement($reason);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get reasons
 | 
			
		||||
     *
 | 
			
		||||
     * @return Collection
 | 
			
		||||
     */
 | 
			
		||||
    public function getReasons()
 | 
			
		||||
    public function getReasons(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->reasons;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set type
 | 
			
		||||
     *
 | 
			
		||||
     * @param ActivityType $type
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setType(ActivityType $type)
 | 
			
		||||
    public function setReasons(?ArrayCollection $reasons): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasons = $reasons;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialIssues(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialIssues;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addSocialIssue(SocialIssue $socialIssue): self
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->socialIssues->contains($socialIssue)) {
 | 
			
		||||
            $this->socialIssues[] = $socialIssue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removeSocialIssue(SocialIssue $socialIssue): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialIssues->removeElement($socialIssue);
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialActions(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialActions;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addSocialAction(SocialAction $socialAction): self
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->socialActions->contains($socialAction)) {
 | 
			
		||||
            $this->socialActions[] = $socialAction;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removeSocialAction(SocialAction $socialAction): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialActions->removeElement($socialAction);
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function setType(ActivityType $type): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->type = $type;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get type
 | 
			
		||||
     *
 | 
			
		||||
     * @return ActivityType
 | 
			
		||||
     */
 | 
			
		||||
    public function getType()
 | 
			
		||||
    public function getType(): ActivityType
 | 
			
		||||
    {
 | 
			
		||||
        return $this->type;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set scope
 | 
			
		||||
     *
 | 
			
		||||
     * @param Scope $scope
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setScope(Scope $scope)
 | 
			
		||||
    public function setScope(Scope $scope): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->scope = $scope;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get scope
 | 
			
		||||
     *
 | 
			
		||||
     * @return Scope
 | 
			
		||||
     */
 | 
			
		||||
    public function getScope()
 | 
			
		||||
    public function getScope(): ?Scope
 | 
			
		||||
    {
 | 
			
		||||
        return $this->scope;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set person
 | 
			
		||||
     *
 | 
			
		||||
     * @param Person $person
 | 
			
		||||
     * @return Activity
 | 
			
		||||
     */
 | 
			
		||||
    public function setPerson(Person $person)
 | 
			
		||||
    public function setPerson(?Person $person): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->person = $person;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get person
 | 
			
		||||
     *
 | 
			
		||||
     * @return Person
 | 
			
		||||
     */
 | 
			
		||||
    public function getPerson()
 | 
			
		||||
    public function getPerson(): ?Person
 | 
			
		||||
    {
 | 
			
		||||
        return $this->person;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAccompanyingPeriod(): ?AccompanyingPeriod
 | 
			
		||||
    {
 | 
			
		||||
        return $this->accompanyingPeriod;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->accompanyingPeriod = $accompanyingPeriod;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * get the center
 | 
			
		||||
     * center is extracted from person
 | 
			
		||||
     *
 | 
			
		||||
     * @return Center
 | 
			
		||||
     */
 | 
			
		||||
    public function getCenter()
 | 
			
		||||
    public function getCenter(): ?Center
 | 
			
		||||
    {
 | 
			
		||||
        return $this->person->getCenter();
 | 
			
		||||
        if ($this->person instanceof Person) {
 | 
			
		||||
            return $this->person->getCenter();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
 | 
			
		||||
     */
 | 
			
		||||
    public function getComment()
 | 
			
		||||
    public function getComment(): CommentEmbeddable
 | 
			
		||||
    {
 | 
			
		||||
        return $this->comment;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
 | 
			
		||||
     */
 | 
			
		||||
    public function setComment($comment)
 | 
			
		||||
    public function setComment(CommentEmbeddable $comment): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->comment = $comment;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Add a person to the person list
 | 
			
		||||
     */
 | 
			
		||||
    public function addPerson(?Person $person): self
 | 
			
		||||
    {
 | 
			
		||||
        if (null !== $person) {
 | 
			
		||||
            $this->persons[] = $person;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removePerson(Person $person): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->persons->removeElement($person);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersons(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->persons;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersonsAssociated(): array 
 | 
			
		||||
    {
 | 
			
		||||
        if (null !== $this->accompanyingPeriod) {
 | 
			
		||||
            $personsAssociated = [];
 | 
			
		||||
            foreach ($this->accompanyingPeriod->getParticipations() as $participation) {
 | 
			
		||||
                if ($this->persons->contains($participation->getPerson())) {
 | 
			
		||||
                    $personsAssociated[] = $participation->getPerson();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return $personsAssociated; 
 | 
			
		||||
        }
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public function getPersonsNotAssociated(): array
 | 
			
		||||
    {
 | 
			
		||||
        if (null !== $this->accompanyingPeriod) {
 | 
			
		||||
            $personsNotAssociated = [];
 | 
			
		||||
            foreach ($this->persons as $person) {
 | 
			
		||||
                if (!in_array($person, $this->getPersonsAssociated())) {
 | 
			
		||||
                     $personsNotAssociated[] = $person;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return $personsNotAssociated;
 | 
			
		||||
        }
 | 
			
		||||
        return [];
 | 
			
		||||
    }    
 | 
			
		||||
 | 
			
		||||
    public function setPersons(?Collection $persons): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->persons = $persons;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addThirdParty(?ThirdParty $thirdParty): self
 | 
			
		||||
    {
 | 
			
		||||
        if (null !== $thirdParty) {
 | 
			
		||||
           $this->thirdParties[] = $thirdParty;
 | 
			
		||||
        }
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removeThirdParty(ThirdParty $thirdParty): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->thirdParties->removeElement($thirdParty);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getThirdParties(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->thirdParties;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setThirdParties(?Collection $thirdParties): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->thirdParties = $thirdParties;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addDocument(Document $document): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->documents[] = $document;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removeDocument(Document $document): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->documents->removeElement($document);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDocuments(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->documents;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDocuments(Collection $documents): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->documents = $documents;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addUser(?User $user): self
 | 
			
		||||
    {
 | 
			
		||||
        if (null !== $user) {
 | 
			
		||||
            $this->users[] = $user;
 | 
			
		||||
        }
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function removeUser(User $user): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->users->removeElement($user);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getUsers(): Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->users;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUsers(?Collection $users): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->users = $users;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function isEmergency(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getEmergency();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getEmergency(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->emergency;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setEmergency(bool $emergency): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->emergency = $emergency;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSentReceived(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sentReceived;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSentReceived(?string $sentReceived): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->sentReceived = (string) $sentReceived;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										97
									
								
								src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,97 @@
 | 
			
		||||
<?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 Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ActivityPresence
 | 
			
		||||
 *
 | 
			
		||||
 * @package Chill\ActivityBundle\Entity
 | 
			
		||||
 * @ORM\Entity()
 | 
			
		||||
 * @ORM\Table(name="activitytpresence")
 | 
			
		||||
 * @ORM\HasLifecycleCallbacks()
 | 
			
		||||
 */
 | 
			
		||||
class ActivityPresence
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\Column(name="id", type="integer")
 | 
			
		||||
     * @ORM\GeneratedValue(strategy="AUTO")
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json")
 | 
			
		||||
     */
 | 
			
		||||
    private array $name = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean")
 | 
			
		||||
     */
 | 
			
		||||
    private bool $active = true;
 | 
			
		||||
 | 
			
		||||
    public function getId(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setName(array $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getName(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get active
 | 
			
		||||
     * return true if the category type is active.
 | 
			
		||||
     */
 | 
			
		||||
    public function getActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->active;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Is active
 | 
			
		||||
     * return true if the category type is active
 | 
			
		||||
     */
 | 
			
		||||
    public function isActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getActive();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set active
 | 
			
		||||
     * set to true if the category type is active
 | 
			
		||||
     */
 | 
			
		||||
    public function setActive(bool $active): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->active = $active;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +1,19 @@
 | 
			
		||||
<?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/>.
 | 
			
		||||
 */
 | 
			
		||||
@@ -32,45 +32,239 @@ use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 */
 | 
			
		||||
class ActivityType
 | 
			
		||||
{
 | 
			
		||||
    const FIELD_INVISIBLE = 0;
 | 
			
		||||
    const FIELD_OPTIONAL = 1;
 | 
			
		||||
    const FIELD_REQUIRED = 2;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     *
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\Column(name="id", type="integer")
 | 
			
		||||
     * @ORM\GeneratedValue(strategy="AUTO")
 | 
			
		||||
     */
 | 
			
		||||
    private $id;
 | 
			
		||||
    private ?int $id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @ORM\Column(type="json_array")
 | 
			
		||||
     */
 | 
			
		||||
    private $name;
 | 
			
		||||
    
 | 
			
		||||
    private array $name = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var bool
 | 
			
		||||
     * @ORM\Column(type="boolean")
 | 
			
		||||
     */
 | 
			
		||||
    private $active = true;
 | 
			
		||||
    private bool $active = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityTypeCategory")
 | 
			
		||||
     */
 | 
			
		||||
    private ?ActivityTypeCategory $category = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=2})
 | 
			
		||||
     */
 | 
			
		||||
    private int $personVisible = self::FIELD_REQUIRED;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $personLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=2})
 | 
			
		||||
     */
 | 
			
		||||
    private int $userVisible = self::FIELD_REQUIRED;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $userLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=2})
 | 
			
		||||
     */
 | 
			
		||||
    private int $dateVisible = self::FIELD_REQUIRED;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $dateLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $placeVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $placeLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $personsVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $personsLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $thirdPartiesLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $durationTimeVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $durationTimeLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $travelTimeVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $travelTimeLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $attendeeVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $attendeeLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $reasonsVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $reasonsLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $commentVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $commentLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $sentReceivedVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $sentReceivedLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $documentsVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $documentsLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $usersVisible = self::FIELD_OPTIONAL;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $usersLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $emergencyVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $emergencyLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $accompanyingPeriodLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $socialDataVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $socialDataLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $socialIssuesVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $socialIssuesLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="smallint", nullable=false, options={"default"=1})
 | 
			
		||||
     */
 | 
			
		||||
    private int $socialActionsVisible = self::FIELD_INVISIBLE;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", nullable=false, options={"default"=""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $socialActionsLabel = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="float", options={"default"="0.0"})
 | 
			
		||||
     */
 | 
			
		||||
    private float $ordering = 0.0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get id
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public function getId()
 | 
			
		||||
    public function getId(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set name
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $name
 | 
			
		||||
     * @return ActivityType
 | 
			
		||||
     */
 | 
			
		||||
    public function setName($name)
 | 
			
		||||
    public function setName(array $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
@@ -79,58 +273,551 @@ class ActivityType
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get name
 | 
			
		||||
     *
 | 
			
		||||
     * @return array | string
 | 
			
		||||
     */
 | 
			
		||||
    public function getName($locale = null)
 | 
			
		||||
    public function getName(): array
 | 
			
		||||
    {
 | 
			
		||||
        if ($locale) {
 | 
			
		||||
            if (isset($this->name[$locale])) {
 | 
			
		||||
                return $this->name[$locale];
 | 
			
		||||
            } else {
 | 
			
		||||
                foreach ($this->name as $name) {
 | 
			
		||||
                    if (!empty($name)) {
 | 
			
		||||
                        return $name;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return '';
 | 
			
		||||
        } else {
 | 
			
		||||
            return $this->name;
 | 
			
		||||
        }
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get active
 | 
			
		||||
     * return true if the type is active.
 | 
			
		||||
     * 
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function getActive() {
 | 
			
		||||
    public function getActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->active;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Is active
 | 
			
		||||
     * return true if the type is active
 | 
			
		||||
     * 
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function isActive() {
 | 
			
		||||
    public function isActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getActive();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set active
 | 
			
		||||
     * set to true if the type is active
 | 
			
		||||
     * 
 | 
			
		||||
     * @param boolean $active
 | 
			
		||||
     * @return ActivityType
 | 
			
		||||
     */
 | 
			
		||||
    public function setActive($active) {
 | 
			
		||||
    public function setActive(bool $active): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->active = $active;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
    public function getCategory(): ?ActivityTypeCategory
 | 
			
		||||
    {
 | 
			
		||||
        return $this->category;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setCategory(?ActivityTypeCategory $category): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->category = $category;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersonVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->personVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPersonVisible(int $personVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->personVisible = $personVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersonLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->personLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPersonLabel(string $personLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->personLabel = $personLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getUserVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->userVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUserVisible(int $userVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->userVisible = $userVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getUserLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->userLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUserLabel(string $userLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->userLabel = $userLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDateVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->dateVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDateVisible(int $dateVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->dateVisible = $dateVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDateLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->dateLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDateLabel(string $dateLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->dateLabel = $dateLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPlaceVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->placeVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPlaceVisible(int $placeVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->placeVisible = $placeVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPlaceLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->placeLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPlaceLabel(string $placeLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->placeLabel = $placeLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersonsVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->personsVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPersonsVisible(int $personsVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->personsVisible = $personsVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPersonsLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->personsLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setPersonsLabel(string $personsLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->personsLabel = $personsLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getThirdPartiesVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->thirdPartiesVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setThirdPartiesVisible(int $thirdPartiesVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->thirdPartiesVisible = $thirdPartiesVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getThirdPartiesLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->thirdPartiesLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setThirdPartiesLabel(string $thirdPartiesLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->thirdPartiesLabel = $thirdPartiesLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDurationTimeVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->durationTimeVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDurationTimeVisible(int $durationTimeVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->durationTimeVisible = $durationTimeVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDurationTimeLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->durationTimeLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDurationTimeLabel(string $durationTimeLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->durationTimeLabel = $durationTimeLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getTravelTimeVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->travelTimeVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setTravelTimeVisible(int $TravelTimeVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->travelTimeVisible = $TravelTimeVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getTravelTimeLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->travelTimeLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setTravelTimeLabel(string $TravelTimeLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->travelTimeLabel = $TravelTimeLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAttendeeVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->attendeeVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAttendeeVisible(int $attendeeVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->attendeeVisible = $attendeeVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAttendeeLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->attendeeLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAttendeeLabel(string $attendeeLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->attendeeLabel = $attendeeLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getReasonsVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->reasonsVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setReasonsVisible(int $reasonsVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasonsVisible = $reasonsVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getReasonsLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->reasonsLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setReasonsLabel(string $reasonsLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->reasonsLabel = $reasonsLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCommentVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->commentVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setCommentVisible(int $commentVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->commentVisible = $commentVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCommentLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->commentLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setCommentLabel(string $commentLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->commentLabel = $commentLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSentReceivedVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sentReceivedVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSentReceivedVisible(int $sentReceivedVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->sentReceivedVisible = $sentReceivedVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSentReceivedLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sentReceivedLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSentReceivedLabel(string $sentReceivedLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->sentReceivedLabel = $sentReceivedLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDocumentsVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->documentsVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDocumentsVisible(int $documentsVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->documentsVisible = $documentsVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDocumentsLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->documentsLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setDocumentsLabel(string $documentsLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->documentsLabel = $documentsLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getUsersVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->usersVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUsersVisible(int $usersVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->usersVisible = $usersVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getUsersLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->usersLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setUsersLabel(string $usersLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->usersLabel = $usersLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getEmergencyVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->emergencyVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setEmergencyVisible(int $emergencyVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->emergencyVisible = $emergencyVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getEmergencyLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->emergencyLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setEmergencyLabel(string $emergencyLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->emergencyLabel = $emergencyLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAccompanyingPeriodVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->accompanyingPeriodVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAccompanyingPeriodVisible(int $accompanyingPeriodVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->accompanyingPeriodVisible = $accompanyingPeriodVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getAccompanyingPeriodLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->accompanyingPeriodLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setAccompanyingPeriodLabel(string $accompanyingPeriodLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->accompanyingPeriodLabel = $accompanyingPeriodLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialDataVisible(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialDataVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialDataVisible(int $socialDataVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialDataVisible = $socialDataVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialDataLabel(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialDataLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialDataLabel(string $socialDataLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialDataLabel = $socialDataLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function isVisible(string $field): bool
 | 
			
		||||
    {
 | 
			
		||||
        $property = $field.'Visible';
 | 
			
		||||
 | 
			
		||||
        if (!property_exists($this, $property)) {
 | 
			
		||||
            throw new \InvalidArgumentException('Field "'.$field.'" not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return self::FIELD_INVISIBLE !== $this->$property;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function isRequired(string $field): bool
 | 
			
		||||
    {
 | 
			
		||||
        $property = $field.'Visible';
 | 
			
		||||
 | 
			
		||||
        if (!property_exists($this, $property)) {
 | 
			
		||||
            throw new \InvalidArgumentException('Field "'.$field.'" not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return self::FIELD_REQUIRED === $this->$property;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getLabel(string $field): ?string
 | 
			
		||||
    {
 | 
			
		||||
        $property = $field.'Label';
 | 
			
		||||
 | 
			
		||||
        if (!property_exists($this, $property)) {
 | 
			
		||||
            throw new \InvalidArgumentException('Field "'.$field.'" not found');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->$property;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOrdering(): float
 | 
			
		||||
    {
 | 
			
		||||
        return $this->ordering;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setOrdering(float $ordering): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->ordering = $ordering;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialIssuesVisible(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialIssuesVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialIssuesVisible(int $socialIssuesVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialIssuesVisible = $socialIssuesVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialIssuesLabel(): ?string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialIssuesLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialIssuesLabel(string $socialIssuesLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialIssuesLabel = $socialIssuesLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialActionsVisible(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialActionsVisible;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialActionsVisible(int $socialActionsVisible): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialActionsVisible = $socialActionsVisible;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSocialActionsLabel(): ?string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->socialActionsLabel;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setSocialActionsLabel(string $socialActionsLabel): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->socialActionsLabel = $socialActionsLabel;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										123
									
								
								src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/Bundle/ChillActivityBundle/Entity/ActivityTypeCategory.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,123 @@
 | 
			
		||||
<?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 Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ActivityTypeCateogry
 | 
			
		||||
 *
 | 
			
		||||
 * @package Chill\ActivityBundle\Entity
 | 
			
		||||
 * @ORM\Entity()
 | 
			
		||||
 * @ORM\Table(name="activitytypecategory")
 | 
			
		||||
 * @ORM\HasLifecycleCallbacks()
 | 
			
		||||
 */
 | 
			
		||||
class ActivityTypeCategory
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\Column(name="id", type="integer")
 | 
			
		||||
     * @ORM\GeneratedValue(strategy="AUTO")
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json_array")
 | 
			
		||||
     */
 | 
			
		||||
    private array $name = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean")
 | 
			
		||||
     */
 | 
			
		||||
    private bool $active = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="float", options={"default"="0.0"})
 | 
			
		||||
     */
 | 
			
		||||
    private float $ordering = 0.0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get id
 | 
			
		||||
     */
 | 
			
		||||
    public function getId(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set name
 | 
			
		||||
     */
 | 
			
		||||
    public function setName(array $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get name
 | 
			
		||||
     */
 | 
			
		||||
    public function getName(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get active
 | 
			
		||||
     * return true if the category type is active.
 | 
			
		||||
     */
 | 
			
		||||
    public function getActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->active;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Is active
 | 
			
		||||
     * return true if the category type is active
 | 
			
		||||
     */
 | 
			
		||||
    public function isActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getActive();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set active
 | 
			
		||||
     * set to true if the category type is active
 | 
			
		||||
     */
 | 
			
		||||
    public function setActive(bool $active): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->active = $active;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOrdering(): float
 | 
			
		||||
    {
 | 
			
		||||
        return $this->ordering;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setOrdering(float $ordering): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->ordering = $ordering;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityPresence;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
 | 
			
		||||
 | 
			
		||||
class ActivityPresenceType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options): void
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class)
 | 
			
		||||
            ->add('active', ChoiceType::class, array(
 | 
			
		||||
                'choices' => array(
 | 
			
		||||
                    'Yes' => true,
 | 
			
		||||
                    'No'  => false
 | 
			
		||||
                ),
 | 
			
		||||
                'expanded' => true
 | 
			
		||||
            ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver): void
 | 
			
		||||
    {
 | 
			
		||||
        $resolver->setDefaults(array(
 | 
			
		||||
            'data_class' => ActivityPresence::class
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,8 +2,21 @@
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityPresence;
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityReason;
 | 
			
		||||
use Chill\DocStoreBundle\Form\StoredObjectType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillCollectionType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\CommentType;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
 | 
			
		||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
 | 
			
		||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
@@ -15,178 +28,363 @@ use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTra
 | 
			
		||||
use Symfony\Component\Form\FormEvent;
 | 
			
		||||
use Symfony\Component\Form\FormEvents;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityType;
 | 
			
		||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
 | 
			
		||||
use Chill\MainBundle\Form\Type\UserPickerType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ScopePickerType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillDateType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
 | 
			
		||||
use Symfony\Component\Form\CallbackTransformer;
 | 
			
		||||
use Chill\PersonBundle\Form\DataTransformer\PersonToIdTransformer;
 | 
			
		||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
 | 
			
		||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
 | 
			
		||||
 | 
			
		||||
class ActivityType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    protected User $user;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * the user running this form
 | 
			
		||||
     *
 | 
			
		||||
     * @var User
 | 
			
		||||
     */
 | 
			
		||||
    protected $user;
 | 
			
		||||
    protected AuthorizationHelper $authorizationHelper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var AuthorizationHelper
 | 
			
		||||
     */
 | 
			
		||||
    protected $authorizationHelper;
 | 
			
		||||
    protected ObjectManager $om;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var ObjectManager
 | 
			
		||||
     */
 | 
			
		||||
    protected $om;
 | 
			
		||||
    protected TranslatableStringHelper $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var TranslatableStringHelper
 | 
			
		||||
     */
 | 
			
		||||
    protected $translatableStringHelper;
 | 
			
		||||
    protected SocialIssueRender $socialIssueRender;
 | 
			
		||||
 | 
			
		||||
    protected $timeChoices;
 | 
			
		||||
    protected SocialActionRender $socialActionRender;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
            TokenStorageInterface $tokenStorage,
 | 
			
		||||
            AuthorizationHelper $authorizationHelper, ObjectManager $om,
 | 
			
		||||
            TranslatableStringHelper $translatableStringHelper,
 | 
			
		||||
            array $timeChoices
 | 
			
		||||
            )
 | 
			
		||||
    {
 | 
			
		||||
    protected array $timeChoices;
 | 
			
		||||
 | 
			
		||||
    public function __construct (
 | 
			
		||||
        TokenStorageInterface $tokenStorage,
 | 
			
		||||
        AuthorizationHelper $authorizationHelper,
 | 
			
		||||
        ObjectManager $om,
 | 
			
		||||
        TranslatableStringHelper $translatableStringHelper,
 | 
			
		||||
        array $timeChoices,
 | 
			
		||||
        SocialIssueRender $socialIssueRender,
 | 
			
		||||
        SocialActionRender $socialActionRender
 | 
			
		||||
    ) {
 | 
			
		||||
        if (!$tokenStorage->getToken()->getUser() instanceof User) {
 | 
			
		||||
            throw new \RuntimeException("you should have a valid user");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->user = $tokenStorage->getToken()->getUser();
 | 
			
		||||
        $this->authorizationHelper = $authorizationHelper;
 | 
			
		||||
        $this->om = $om;
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
        $this->timeChoices = $timeChoices;
 | 
			
		||||
        $this->socialIssueRender = $socialIssueRender;
 | 
			
		||||
        $this->socialActionRender = $socialActionRender;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param FormBuilderInterface $builder
 | 
			
		||||
     * @param array $options
 | 
			
		||||
     */
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options): void
 | 
			
		||||
    {
 | 
			
		||||
        // handle times choices
 | 
			
		||||
        $timeChoices = array();
 | 
			
		||||
        $timeChoices = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->timeChoices as $e) {
 | 
			
		||||
            $timeChoices[$e['label']] = $e['seconds'];
 | 
			
		||||
        };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $durationTimeTransformer = new DateTimeToTimestampTransformer('GMT', 'GMT');
 | 
			
		||||
        $durationTimeOptions = array(
 | 
			
		||||
                'choices' => $timeChoices,
 | 
			
		||||
                'placeholder' => 'Choose the duration',
 | 
			
		||||
        );
 | 
			
		||||
        $durationTimeOptions = [
 | 
			
		||||
            'choices' => $timeChoices,
 | 
			
		||||
            'placeholder' => 'Choose the duration',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('date', ChillDateType::class, array(
 | 
			
		||||
               'required' => true
 | 
			
		||||
            ))
 | 
			
		||||
            ->add('durationTime', ChoiceType::class, $durationTimeOptions)
 | 
			
		||||
            ->add('attendee', ChoiceType::class, array(
 | 
			
		||||
               'expanded' => true,
 | 
			
		||||
               'required' => false,
 | 
			
		||||
               'choices' => array(
 | 
			
		||||
                  'present' => true,
 | 
			
		||||
                  'not present' => false
 | 
			
		||||
               )
 | 
			
		||||
            ))
 | 
			
		||||
            ->add('user', UserPickerType::class, [
 | 
			
		||||
        /** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */
 | 
			
		||||
        $activityType = $options['activityType'];
 | 
			
		||||
 | 
			
		||||
        if (!$activityType->isActive()) {
 | 
			
		||||
            throw new \InvalidArgumentException('Activity type must be active');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // TODO revoir la gestion des center au niveau du form des activité.
 | 
			
		||||
        if ($options['center']) {
 | 
			
		||||
            $builder->add('scope', ScopePickerType::class, [
 | 
			
		||||
                'center' => $options['center'],
 | 
			
		||||
                'role' => $options['role']
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /** @var ? \Chill\PersonBundle\Entity\AccompanyingPeriod  $accompanyingPeriod */
 | 
			
		||||
        $accompanyingPeriod = NULL;
 | 
			
		||||
        if ($options['accompanyingPeriod']) {
 | 
			
		||||
            $accompanyingPeriod = $options['accompanyingPeriod'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
 | 
			
		||||
            $builder->add('socialIssues', HiddenType::class);
 | 
			
		||||
            $builder->get('socialIssues')
 | 
			
		||||
               ->addModelTransformer(new CallbackTransformer(
 | 
			
		||||
                   function (iterable $socialIssuesAsIterable): string {
 | 
			
		||||
                       $socialIssueIds = [];
 | 
			
		||||
                       foreach ($socialIssuesAsIterable as $value) {
 | 
			
		||||
                          $socialIssueIds[] = $value->getId();
 | 
			
		||||
                       }
 | 
			
		||||
                       return implode(',', $socialIssueIds);
 | 
			
		||||
                   },
 | 
			
		||||
                   function (?string $socialIssuesAsString): array {
 | 
			
		||||
                       if (null === $socialIssuesAsString) {
 | 
			
		||||
                          return [];
 | 
			
		||||
                       }
 | 
			
		||||
                       return array_map(
 | 
			
		||||
                          fn(string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
 | 
			
		||||
                          explode(',', $socialIssuesAsString)
 | 
			
		||||
                       );
 | 
			
		||||
                   }
 | 
			
		||||
               ))
 | 
			
		||||
            ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
 | 
			
		||||
            $builder->add('socialActions', HiddenType::class);
 | 
			
		||||
            $builder->get('socialActions')
 | 
			
		||||
               ->addModelTransformer(new CallbackTransformer(
 | 
			
		||||
                   function (iterable $socialActionsAsIterable): string {
 | 
			
		||||
                       $socialActionIds = [];
 | 
			
		||||
                       foreach ($socialActionsAsIterable as $value) {
 | 
			
		||||
                          $socialActionIds[] = $value->getId();
 | 
			
		||||
                       }
 | 
			
		||||
                       return implode(',', $socialActionIds);
 | 
			
		||||
                   },
 | 
			
		||||
                   function (?string $socialActionsAsString): array {
 | 
			
		||||
                       if (null === $socialActionsAsString) {
 | 
			
		||||
                          return [];
 | 
			
		||||
                       }
 | 
			
		||||
                       return array_map(
 | 
			
		||||
                          fn(string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
 | 
			
		||||
                          explode(',', $socialActionsAsString)
 | 
			
		||||
                       );
 | 
			
		||||
                   }
 | 
			
		||||
               ))
 | 
			
		||||
            ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('date')) {
 | 
			
		||||
            $builder->add('date', ChillDateType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('date'),
 | 
			
		||||
                'required' => $activityType->isRequired('date'),
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('durationTime')) {
 | 
			
		||||
            $durationTimeOptions['label'] = $activityType->getLabel('durationTime');
 | 
			
		||||
            $durationTimeOptions['required'] = $activityType->isRequired('durationTime');
 | 
			
		||||
 | 
			
		||||
            $builder->add('durationTime', ChoiceType::class, $durationTimeOptions);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('travelTime')) {
 | 
			
		||||
            $durationTimeOptions['label'] = $activityType->getLabel('travelTime');
 | 
			
		||||
            $durationTimeOptions['required'] = $activityType->isRequired('travelTime');
 | 
			
		||||
 | 
			
		||||
            $builder->add('travelTime', ChoiceType::class, $durationTimeOptions);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('attendee')) {
 | 
			
		||||
            $builder->add('attendee', EntityType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('attendee'),
 | 
			
		||||
                'required' => $activityType->isRequired('attendee'),
 | 
			
		||||
                'expanded' => true,
 | 
			
		||||
                'class' => ActivityPresence::class,
 | 
			
		||||
                'choice_label' => function (ActivityPresence $activityPresence) {
 | 
			
		||||
                    return $this->translatableStringHelper->localize($activityPresence->getName());
 | 
			
		||||
                },
 | 
			
		||||
                'query_builder' => function (EntityRepository $er) {
 | 
			
		||||
                    return $er->createQueryBuilder('a')
 | 
			
		||||
                        ->where('a.active = true');
 | 
			
		||||
                },
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('user') && $options['center']) {
 | 
			
		||||
            $builder->add('user', UserPickerType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('user'),
 | 
			
		||||
                'required' => $activityType->isRequired('user'),
 | 
			
		||||
                'center' => $options['center'],
 | 
			
		||||
                'role'   => $options['role']
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('scope', ScopePickerType::class, [
 | 
			
		||||
                'center' => $options['center'],
 | 
			
		||||
                'role'   => $options['role']
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('reasons', TranslatableActivityReason::class, array(
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('reasons')) {
 | 
			
		||||
            $builder->add('reasons', EntityType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('reasons'),
 | 
			
		||||
                'required' => $activityType->isRequired('reasons'),
 | 
			
		||||
                'class' => ActivityReason::class,
 | 
			
		||||
                'multiple' => true,
 | 
			
		||||
                'required' => false,
 | 
			
		||||
            ))
 | 
			
		||||
            ->add('type', TranslatableActivityType::class, array(
 | 
			
		||||
                'placeholder' => 'Choose a type',
 | 
			
		||||
                'active_only' => true
 | 
			
		||||
            ))
 | 
			
		||||
            ->add('comment', CommentType::class, [
 | 
			
		||||
                'required' => false,
 | 
			
		||||
            ])
 | 
			
		||||
        ;
 | 
			
		||||
                'choice_label' => function (ActivityReason $activityReason) {
 | 
			
		||||
                    return $this->translatableStringHelper->localize($activityReason->getName());
 | 
			
		||||
                },
 | 
			
		||||
                'attr' => array('class' => 'select2 '),
 | 
			
		||||
                'query_builder' => function (EntityRepository $er) {
 | 
			
		||||
                    return $er->createQueryBuilder('a')
 | 
			
		||||
                        ->where('a.active = true');
 | 
			
		||||
                },
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $builder->get('durationTime')
 | 
			
		||||
        if ($activityType->isVisible('comment')) {
 | 
			
		||||
            $builder->add('comment', CommentType::class, [
 | 
			
		||||
                'label' => empty($activityType->getLabel('comment')) 
 | 
			
		||||
                    ? 'activity.comment' : $activityType->getLabel('comment'),
 | 
			
		||||
                'required' => $activityType->isRequired('comment'),
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('persons')) {
 | 
			
		||||
            $builder->add('persons', HiddenType::class);
 | 
			
		||||
            $builder->get('persons')
 | 
			
		||||
               ->addModelTransformer(new CallbackTransformer(
 | 
			
		||||
                   function (iterable $personsAsIterable): string {
 | 
			
		||||
                       $personIds = [];
 | 
			
		||||
                       foreach ($personsAsIterable as $value) {
 | 
			
		||||
                          $personIds[] = $value->getId();
 | 
			
		||||
                       }
 | 
			
		||||
                       return implode(',', $personIds);
 | 
			
		||||
                   },
 | 
			
		||||
                   function (?string $personsAsString): array {
 | 
			
		||||
                       return array_map(
 | 
			
		||||
                          fn(string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
 | 
			
		||||
                          explode(',', $personsAsString)
 | 
			
		||||
                       );
 | 
			
		||||
                   }
 | 
			
		||||
               ))
 | 
			
		||||
           ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('thirdParties')) {
 | 
			
		||||
            $builder->add('thirdParties', HiddenType::class);
 | 
			
		||||
            $builder->get('thirdParties')
 | 
			
		||||
               ->addModelTransformer(new CallbackTransformer(
 | 
			
		||||
                   function (iterable $thirdpartyAsIterable): string {
 | 
			
		||||
                       $thirdpartyIds = [];
 | 
			
		||||
                       foreach ($thirdpartyAsIterable as $value) {
 | 
			
		||||
                          $thirdpartyIds[] = $value->getId();
 | 
			
		||||
                       }
 | 
			
		||||
                       return implode(',', $thirdpartyIds);
 | 
			
		||||
                   },
 | 
			
		||||
                   function (?string $thirdpartyAsString): array {
 | 
			
		||||
                       return array_map(
 | 
			
		||||
                           fn(string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
 | 
			
		||||
                           explode(',', $thirdpartyAsString)
 | 
			
		||||
                       );
 | 
			
		||||
                   }
 | 
			
		||||
               ))
 | 
			
		||||
           ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('documents')) {
 | 
			
		||||
            $builder->add('documents', ChillCollectionType::class, [
 | 
			
		||||
                'entry_type' => StoredObjectType::class,
 | 
			
		||||
                'label' => $activityType->getLabel('documents'),
 | 
			
		||||
                'required' => $activityType->isRequired('documents'),
 | 
			
		||||
                'allow_add' => true,
 | 
			
		||||
                'button_add_label' => 'activity.Insert a document',
 | 
			
		||||
                'button_remove_label' => 'activity.Remove a document'
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('users')) {
 | 
			
		||||
            $builder->add('users', HiddenType::class);
 | 
			
		||||
            $builder->get('users')
 | 
			
		||||
               ->addModelTransformer(new CallbackTransformer(
 | 
			
		||||
                   function (iterable $usersAsIterable): string {
 | 
			
		||||
                       $userIds = [];
 | 
			
		||||
                       foreach ($usersAsIterable as $value) {
 | 
			
		||||
                           $userIds[] = $value->getId();
 | 
			
		||||
                       }
 | 
			
		||||
                       return implode(',', $userIds);
 | 
			
		||||
                   },
 | 
			
		||||
                   function (?string $usersAsString): array {
 | 
			
		||||
                       return array_map(
 | 
			
		||||
                           fn(string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
 | 
			
		||||
                           explode(',', $usersAsString)
 | 
			
		||||
                       );
 | 
			
		||||
                   }
 | 
			
		||||
               ))
 | 
			
		||||
           ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('emergency')) {
 | 
			
		||||
            $builder->add('emergency', CheckboxType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('emergency'),
 | 
			
		||||
                'required' => $activityType->isRequired('emergency'),
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($activityType->isVisible('sentReceived')) {
 | 
			
		||||
            $builder->add('sentReceived', ChoiceType::class, [
 | 
			
		||||
                'label' => $activityType->getLabel('sentReceived'),
 | 
			
		||||
                'required' => $activityType->isRequired('sentReceived'),
 | 
			
		||||
                'choices' => [
 | 
			
		||||
                    'Sent' => Activity::SENTRECEIVED_SENT,
 | 
			
		||||
                    'Received' => Activity::SENTRECEIVED_RECEIVED,
 | 
			
		||||
                ],
 | 
			
		||||
            ]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (['durationTime', 'travelTime'] as $fieldName) {
 | 
			
		||||
            if (!$activityType->isVisible($fieldName)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $builder->get($fieldName)
 | 
			
		||||
                ->addModelTransformer($durationTimeTransformer);
 | 
			
		||||
 | 
			
		||||
            $builder->get($fieldName)
 | 
			
		||||
                ->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $formEvent) use (
 | 
			
		||||
                    $timeChoices,
 | 
			
		||||
                    $builder,
 | 
			
		||||
                    $durationTimeTransformer,
 | 
			
		||||
                    $durationTimeOptions,
 | 
			
		||||
                    $fieldName
 | 
			
		||||
                ) {
 | 
			
		||||
                    // set the timezone to GMT, and fix the difference between current and GMT
 | 
			
		||||
                    // the datetimetransformer will then handle timezone as GMT
 | 
			
		||||
                    $timezoneUTC = new \DateTimeZone('GMT');
 | 
			
		||||
                    /* @var $data \DateTime */
 | 
			
		||||
                    $data = $formEvent->getData() === NULL ?
 | 
			
		||||
                        \DateTime::createFromFormat('U', 300) :
 | 
			
		||||
                        $formEvent->getData();
 | 
			
		||||
                    $seconds = $data->getTimezone()->getOffset($data);
 | 
			
		||||
                    $data->setTimeZone($timezoneUTC);
 | 
			
		||||
                    $data->add(new \DateInterval('PT'.$seconds.'S'));
 | 
			
		||||
 | 
			
		||||
        $builder->get('durationTime')
 | 
			
		||||
                ->addEventListener(
 | 
			
		||||
                        FormEvents::PRE_SET_DATA,
 | 
			
		||||
                        function(FormEvent $formEvent) use (
 | 
			
		||||
                                $timeChoices,
 | 
			
		||||
                                $builder,
 | 
			
		||||
                                $durationTimeTransformer,
 | 
			
		||||
                                $durationTimeOptions
 | 
			
		||||
                                )
 | 
			
		||||
                        {
 | 
			
		||||
                            // set the timezone to GMT, and fix the difference between current and GMT
 | 
			
		||||
                            // the datetimetransformer will then handle timezone as GMT
 | 
			
		||||
                            $timezoneUTC = new \DateTimeZone('GMT');
 | 
			
		||||
                            /* @var $data \DateTime */
 | 
			
		||||
                            $data = $formEvent->getData() === NULL ?
 | 
			
		||||
                                    \DateTime::createFromFormat('U', 300) :
 | 
			
		||||
                                    $formEvent->getData();
 | 
			
		||||
                            $seconds = $data->getTimezone()->getOffset($data);
 | 
			
		||||
                            $data->setTimeZone($timezoneUTC);
 | 
			
		||||
                            $data->add(new \DateInterval('PT'.$seconds.'S'));
 | 
			
		||||
 | 
			
		||||
                            // test if the timestamp is in the choices.
 | 
			
		||||
                            // If not, recreate the field with the new timestamp
 | 
			
		||||
                            if (!in_array($data->getTimestamp(), $timeChoices)) {
 | 
			
		||||
                                // the data are not in the possible values. add them
 | 
			
		||||
                                $timeChoices[$data->format('H:i')] = $data->getTimestamp();
 | 
			
		||||
                                $form = $builder->create(
 | 
			
		||||
                                        'durationTime',
 | 
			
		||||
                                        ChoiceType::class,
 | 
			
		||||
                                        array_merge(
 | 
			
		||||
                                                $durationTimeOptions,
 | 
			
		||||
                                                array(
 | 
			
		||||
                                                    'choices' => $timeChoices,
 | 
			
		||||
                                                    'auto_initialize' => false
 | 
			
		||||
                                                )
 | 
			
		||||
                                                ));
 | 
			
		||||
                                $form->addModelTransformer($durationTimeTransformer);
 | 
			
		||||
                                $formEvent->getForm()->getParent()->add($form->getForm());
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
                    // test if the timestamp is in the choices.
 | 
			
		||||
                    // If not, recreate the field with the new timestamp
 | 
			
		||||
                    if (!in_array($data->getTimestamp(), $timeChoices)) {
 | 
			
		||||
                        // the data are not in the possible values. add them
 | 
			
		||||
                        $timeChoices[$data->format('H:i')] = $data->getTimestamp();
 | 
			
		||||
                        $form = $builder->create($fieldName, ChoiceType::class, array_merge(
 | 
			
		||||
                            $durationTimeOptions, [
 | 
			
		||||
                                'choices' => $timeChoices,
 | 
			
		||||
                                'auto_initialize' => false
 | 
			
		||||
                            ]
 | 
			
		||||
                        ));
 | 
			
		||||
                        $form->addModelTransformer($durationTimeTransformer);
 | 
			
		||||
                        $formEvent->getForm()->getParent()->add($form->getForm());
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param OptionsResolverInterface $resolver
 | 
			
		||||
     */
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver): void
 | 
			
		||||
    {
 | 
			
		||||
        $resolver->setDefaults(array(
 | 
			
		||||
            'data_class' => 'Chill\ActivityBundle\Entity\Activity'
 | 
			
		||||
        ));
 | 
			
		||||
        $resolver->setDefaults([
 | 
			
		||||
            'data_class' => Activity::class
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $resolver
 | 
			
		||||
              ->setRequired(array('center', 'role'))
 | 
			
		||||
              ->setAllowedTypes('center', 'Chill\MainBundle\Entity\Center')
 | 
			
		||||
              ->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
 | 
			
		||||
              ;
 | 
			
		||||
            ->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod'])
 | 
			
		||||
            ->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
 | 
			
		||||
            ->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
 | 
			
		||||
            ->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
 | 
			
		||||
            ->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null'])
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getBlockPrefix()
 | 
			
		||||
    public function getBlockPrefix(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'chill_activitybundle_activity';
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
 | 
			
		||||
 | 
			
		||||
class ActivityTypeCategoryType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options): void
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class)
 | 
			
		||||
            ->add('active', ChoiceType::class, array(
 | 
			
		||||
                'choices' => array(
 | 
			
		||||
                    'Yes' => true,
 | 
			
		||||
                    'No'  => false
 | 
			
		||||
                ),
 | 
			
		||||
                'expanded' => true
 | 
			
		||||
            ))
 | 
			
		||||
            ->add('ordering', NumberType::class, [
 | 
			
		||||
                'required' => true,
 | 
			
		||||
                'scale' => 5
 | 
			
		||||
            ])
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver): void
 | 
			
		||||
    {
 | 
			
		||||
        $resolver->setDefaults(array(
 | 
			
		||||
            'data_class' => ActivityTypeCategory::class
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,7 +2,13 @@
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
 | 
			
		||||
use Chill\ActivityBundle\Form\Type\ActivityFieldPresence;
 | 
			
		||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
@@ -10,38 +16,56 @@ use Chill\MainBundle\Form\Type\TranslatableStringFormType;
 | 
			
		||||
 | 
			
		||||
class ActivityTypeType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param FormBuilderInterface $builder
 | 
			
		||||
     * @param array $options
 | 
			
		||||
     */
 | 
			
		||||
    private TranslatableStringHelper $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    public function __construct(TranslatableStringHelper $translatableStringHelper)
 | 
			
		||||
    {
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class)
 | 
			
		||||
            ->add('active', ChoiceType::class, array(
 | 
			
		||||
                'choices' => array(
 | 
			
		||||
            ->add('active', ChoiceType::class, [
 | 
			
		||||
                'choices' => [
 | 
			
		||||
                    'Yes' => true,
 | 
			
		||||
                    'No'  => false
 | 
			
		||||
                ),
 | 
			
		||||
                ],
 | 
			
		||||
                'expanded' => true
 | 
			
		||||
            ));
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('category', EntityType::class, [
 | 
			
		||||
                'class' => ActivityTypeCategory::class,
 | 
			
		||||
                'choice_label' => function (ActivityTypeCategory $activityTypeCategory) {
 | 
			
		||||
                    return $this->translatableStringHelper->localize($activityTypeCategory->getName());
 | 
			
		||||
                },
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('ordering', NumberType::class, [
 | 
			
		||||
                'required' => true,
 | 
			
		||||
                'scale' => 5
 | 
			
		||||
            ])
 | 
			
		||||
        ;
 | 
			
		||||
 | 
			
		||||
        $fields = [
 | 
			
		||||
            'persons', 'user', 'date', 'place', 'persons',
 | 
			
		||||
            'thirdParties', 'durationTime', 'travelTime', 'attendee',
 | 
			
		||||
            'reasons', 'comment', 'sentReceived', 'documents',
 | 
			
		||||
            'emergency', 'accompanyingPeriod', 'socialData', 'users'
 | 
			
		||||
        ];
 | 
			
		||||
        foreach ($fields as $field) {
 | 
			
		||||
            $builder
 | 
			
		||||
                ->add($field.'Visible', ActivityFieldPresence::class)
 | 
			
		||||
                ->add($field.'Label', TextType::class, [
 | 
			
		||||
                    'required' => false,
 | 
			
		||||
                    'empty_data' => '',
 | 
			
		||||
                ]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param OptionsResolverInterface $resolver
 | 
			
		||||
     */
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver->setDefaults(array(
 | 
			
		||||
            'data_class' => 'Chill\ActivityBundle\Entity\ActivityType'
 | 
			
		||||
            'data_class' => \Chill\ActivityBundle\Entity\ActivityType::class
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getBlockPrefix()
 | 
			
		||||
    {
 | 
			
		||||
        return 'chill_activitybundle_activitytype';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,29 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Form\Type;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\ActivityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
class ActivityFieldPresence extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function getParent()
 | 
			
		||||
    {
 | 
			
		||||
        return ChoiceType::class;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver->setDefaults(
 | 
			
		||||
            array(
 | 
			
		||||
                'choices' => [
 | 
			
		||||
                    'Invisible' => ActivityType::FIELD_INVISIBLE,
 | 
			
		||||
                    'Optional' => ActivityType::FIELD_OPTIONAL,
 | 
			
		||||
                    'Required' => ActivityType::FIELD_REQUIRED,
 | 
			
		||||
                ],
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Menu;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
 | 
			
		||||
use Knp\Menu\MenuItem;
 | 
			
		||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
 | 
			
		||||
use Symfony\Contracts\Translation\TranslatorInterface;
 | 
			
		||||
 | 
			
		||||
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
{
 | 
			
		||||
    protected TokenStorageInterface $tokenStorage;
 | 
			
		||||
 | 
			
		||||
    protected AuthorizationHelper $authorizationHelper;
 | 
			
		||||
 | 
			
		||||
    protected TranslatorInterface $translator;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        TokenStorageInterface $tokenStorage,
 | 
			
		||||
        AuthorizationHelper $authorizationHelper,
 | 
			
		||||
        TranslatorInterface $translator
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
        $this->authorizationHelper = $authorizationHelper;
 | 
			
		||||
        $this->tokenStorage = $tokenStorage;
 | 
			
		||||
    }
 | 
			
		||||
    public static function getMenuIds(): array
 | 
			
		||||
    {
 | 
			
		||||
        return ['accompanyingCourse'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildMenu($menuId, MenuItem $menu, array $parameters)
 | 
			
		||||
    {
 | 
			
		||||
        $period = $parameters['accompanyingCourse'];
 | 
			
		||||
 | 
			
		||||
        if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
 | 
			
		||||
            $menu->addChild($this->translator->trans('Activity list'), [
 | 
			
		||||
                'route' => 'chill_activity_activity_list',
 | 
			
		||||
                'routeParameters' => [
 | 
			
		||||
                    'accompanying_period_id' => $period->getId(),
 | 
			
		||||
                ]])
 | 
			
		||||
                ->setExtras(['order' => 40]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,88 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
namespace Chill\ActivityBundle\Menu;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
 | 
			
		||||
use Symfony\Component\Translation\TranslatorInterface;
 | 
			
		||||
use Knp\Menu\MenuItem;
 | 
			
		||||
use Symfony\Component\Security\Core\Role\Role;
 | 
			
		||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @author Julien Fastré <julien.fastre@champs-libres.coop>
 | 
			
		||||
 */
 | 
			
		||||
class MenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var TokenStorageInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $tokenStorage;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var TranslatorInterface
 | 
			
		||||
     */
 | 
			
		||||
    protected $translator;
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @var AuthorizationHelper
 | 
			
		||||
     */
 | 
			
		||||
    protected $authorizationHelper;
 | 
			
		||||
    
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        TokenStorageInterface $tokenStorage, 
 | 
			
		||||
        TranslatorInterface $translator, 
 | 
			
		||||
        AuthorizationHelper $authorizationHelper
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->tokenStorage = $tokenStorage;
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
        $this->authorizationHelper = $authorizationHelper;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    public function buildMenu($menuId, MenuItem $menu, array $parameters)
 | 
			
		||||
    {
 | 
			
		||||
        /* @var $person \Chill\PersonBundle\Entity\Person */
 | 
			
		||||
        $person  = $parameters['person'];
 | 
			
		||||
        $user    = $this->tokenStorage->getToken()->getUser();
 | 
			
		||||
        $roleSee = new Role(ActivityVoter::SEE);
 | 
			
		||||
        $roleAdd = new Role(ActivityVoter::CREATE);
 | 
			
		||||
        
 | 
			
		||||
        if ($this->authorizationHelper->userHasAccess($user, $person, $roleSee)) {
 | 
			
		||||
            $menu->addChild($this->translator->trans('Activity list'), [
 | 
			
		||||
                    'route' => 'chill_activity_activity_list',
 | 
			
		||||
                    'routeParameters' => [
 | 
			
		||||
                        'person_id' => $person->getId()
 | 
			
		||||
                    ]
 | 
			
		||||
                ])
 | 
			
		||||
                ->setExtras([
 | 
			
		||||
                    'order' => 201
 | 
			
		||||
                ]);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if ($this->authorizationHelper->userHasAccess($user, $person, $roleAdd)) {
 | 
			
		||||
            $menu->addChild($this->translator->trans('Add a new activity'), [
 | 
			
		||||
                    'route' => 'chill_activity_activity_new',
 | 
			
		||||
                    'routeParameters' => [
 | 
			
		||||
                        'person_id' => $person->getId()
 | 
			
		||||
                    ]
 | 
			
		||||
                ])
 | 
			
		||||
                ->setExtras([
 | 
			
		||||
                    'order' => 200
 | 
			
		||||
                ]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function getMenuIds(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [ 'person' ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -15,8 +15,7 @@
 | 
			
		||||
 * 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\Menu;
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Menu; 
 | 
			
		||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
 | 
			
		||||
use Knp\Menu\MenuItem;
 | 
			
		||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
 | 
			
		||||
@@ -65,15 +64,6 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
                ->setExtra('order', 201)
 | 
			
		||||
                ;
 | 
			
		||||
        }
 | 
			
		||||
        if ($this->authorizationChecker->isGranted(ActivityVoter::CREATE, $person)) {
 | 
			
		||||
            $menu->addChild(
 | 
			
		||||
                $this->translator->trans('Add a new activity'), [
 | 
			
		||||
                    'route' => 'chill_activity_activity_new',
 | 
			
		||||
                    'routeParameters' => [ 'person_id' => $person->getId() ],
 | 
			
		||||
                ])
 | 
			
		||||
                ->setExtra('order', 200)
 | 
			
		||||
                ;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function getMenuIds(): array
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Notification;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Entity\Notification;
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
 | 
			
		||||
final class ActivityNotificationRenderer
 | 
			
		||||
{
 | 
			
		||||
    public function supports(Notification $notification, array $options = []): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $notification->getRelatedEntityClass() == Activity::class;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getTemplate()
 | 
			
		||||
    {
 | 
			
		||||
        return '@ChillActivity/Activity/showInNotification.html.twig';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getTemplateData(Notification $notification)
 | 
			
		||||
    {
 | 
			
		||||
        return ['notification' => $notification];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,169 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Chill is a software for social workers
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2021, 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Repository;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\ActivityBundle\Repository\ActivityRepository;
 | 
			
		||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
 | 
			
		||||
use Chill\MainBundle\Entity\Scope;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
use Doctrine\ORM\Query\Expr\Orx;
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
 | 
			
		||||
use Symfony\Component\Security\Core\Role\Role;
 | 
			
		||||
use Doctrine\ORM\EntityManagerInterface;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
final class ActivityACLAwareRepository 
 | 
			
		||||
{
 | 
			
		||||
    private AuthorizationHelper $authorizationHelper;
 | 
			
		||||
 | 
			
		||||
    private TokenStorageInterface $tokenStorage;
 | 
			
		||||
 | 
			
		||||
    private ActivityRepository $repository;
 | 
			
		||||
 | 
			
		||||
    private EntityManagerInterface $em;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        AuthorizationHelper $authorizationHelper,
 | 
			
		||||
        TokenStorageInterface $tokenStorage,
 | 
			
		||||
        ActivityRepository $repository,
 | 
			
		||||
        EntityManagerInterface $em
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->authorizationHelper = $authorizationHelper;
 | 
			
		||||
        $this->tokenStorage = $tokenStorage;
 | 
			
		||||
        $this->repository = $repository;
 | 
			
		||||
        $this->em = $em;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function queryTimelineIndexer(string $context, array $args = []): array
 | 
			
		||||
    {
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
 | 
			
		||||
        $from = $this->getFromClauseCenter($args);
 | 
			
		||||
        [$where, $parameters] = $this->getWhereClause($context, $args);
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
           'id' => $metadataActivity->getTableName()
 | 
			
		||||
                .'.'.$metadataActivity->getColumnName('id'),
 | 
			
		||||
           'type' => 'activity',
 | 
			
		||||
           'date' => $metadataActivity->getTableName()
 | 
			
		||||
                .'.'.$metadataActivity->getColumnName('date'),
 | 
			
		||||
           'FROM' => $from,
 | 
			
		||||
           'WHERE' => $where,
 | 
			
		||||
           'parameters' => $parameters
 | 
			
		||||
       ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getFromClauseCenter(array $args): string
 | 
			
		||||
    {
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
        $metadataPerson = $this->em->getClassMetadata(Person::class);
 | 
			
		||||
        $associationMapping = $metadataActivity->getAssociationMapping('person');
 | 
			
		||||
        
 | 
			
		||||
        return $metadataActivity->getTableName().' JOIN '
 | 
			
		||||
            .$metadataPerson->getTableName().' ON '
 | 
			
		||||
            .$metadataPerson->getTableName().'.'.
 | 
			
		||||
                $associationMapping['joinColumns'][0]['referencedColumnName']
 | 
			
		||||
            .' = '
 | 
			
		||||
            .$associationMapping['joinColumns'][0]['name']
 | 
			
		||||
            ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getWhereClause(string $context, array $args): array
 | 
			
		||||
    {
 | 
			
		||||
        $where = '';
 | 
			
		||||
        $parameters = [];
 | 
			
		||||
        
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
        $metadataPerson = $this->em->getClassMetadata(Person::class);
 | 
			
		||||
        $activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
 | 
			
		||||
        $activityToScope  = $metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'];
 | 
			
		||||
        $personToCenter = $metadataPerson->getAssociationMapping('center')['joinColumns'][0]['name'];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // acls:
 | 
			
		||||
        $role = new Role(ActivityVoter::SEE);
 | 
			
		||||
        $reachableCenters = $this->authorizationHelper->getReachableCenters($this->tokenStorage->getToken()->getUser(), 
 | 
			
		||||
                $role);
 | 
			
		||||
        
 | 
			
		||||
        if (count($reachableCenters) === 0) {
 | 
			
		||||
            // insert a dummy condition
 | 
			
		||||
            return 'FALSE = TRUE';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($context === 'person') { 
 | 
			
		||||
            // we start with activities having the person_id linked to person 
 | 
			
		||||
            $where .= sprintf('%s = ? AND ', $activityToPerson);
 | 
			
		||||
            $parameters[] = $person->getId();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // we add acl (reachable center and scopes)
 | 
			
		||||
        $where .= '('; // first loop for the for centers
 | 
			
		||||
        $centersI = 0; // like centers#i
 | 
			
		||||
        foreach ($reachableCenters as $center) {
 | 
			
		||||
            // we pass if not in centers
 | 
			
		||||
            if (!\in_array($center, $args['centers'])) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            // we get all the reachable scopes for this center
 | 
			
		||||
            $reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
 | 
			
		||||
            // we get the ids for those scopes
 | 
			
		||||
            $reachablesScopesId = array_map(
 | 
			
		||||
                function(Scope $scope) { return $scope->getId(); }, 
 | 
			
		||||
                $reachableScopes
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            // if not the first center
 | 
			
		||||
            if ($centersI > 0) {
 | 
			
		||||
                $where .= ') OR (';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // condition for the center
 | 
			
		||||
            $where .= sprintf(' %s.%s = ? ', $metadataPerson->getTableName(), $personToCenter);
 | 
			
		||||
            $parameters[] = $center->getId();
 | 
			
		||||
 | 
			
		||||
            // begin loop for scopes
 | 
			
		||||
            $where .= ' AND (';
 | 
			
		||||
            $scopesI = 0; //like scope#i
 | 
			
		||||
 | 
			
		||||
            foreach ($reachablesScopesId as $scopeId) {
 | 
			
		||||
                if ($scopesI > 0) {
 | 
			
		||||
                    $where .= ' OR ';
 | 
			
		||||
                }
 | 
			
		||||
                $where .= sprintf(' %s.%s = ? ', $metadataActivity->getTableName(), $activityToScope);
 | 
			
		||||
                $parameters[] = $scopeId;
 | 
			
		||||
                $scopesI ++;
 | 
			
		||||
            }
 | 
			
		||||
            // close loop for scopes
 | 
			
		||||
            $where .= ') ';
 | 
			
		||||
            $centersI++;
 | 
			
		||||
        }
 | 
			
		||||
        // close loop for centers
 | 
			
		||||
        $where .= ')';
 | 
			
		||||
        
 | 
			
		||||
        return [$where, $parameters];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,67 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Chill is a software for social workers
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright (C) 2021, 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\ActivityBundle\Repository;
 | 
			
		||||
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
 | 
			
		||||
use Doctrine\Persistence\ManagerRegistry;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @method AccompanyingPeriodParticipation|null find($id, $lockMode = null, $lockVersion = null)
 | 
			
		||||
 * @method AccompanyingPeriodParticipation|null findOneBy(array $criteria, array $orderBy = null)
 | 
			
		||||
 * @method AccompanyingPeriodParticipation[]    findAll()
 | 
			
		||||
 * @method AccompanyingPeriodParticipation[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 | 
			
		||||
 */
 | 
			
		||||
class ActivityRepository extends ServiceEntityRepository
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(ManagerRegistry $registry)
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct($registry, Activity::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function findByPersonImplied($person, array $scopes, $orderBy = [ 'date' => 'DESC'], $limit = 100, $offset = 0)
 | 
			
		||||
    {
 | 
			
		||||
        $qb = $this->createQueryBuilder('a');
 | 
			
		||||
        $qb->select('a');
 | 
			
		||||
 | 
			
		||||
        $qb
 | 
			
		||||
            // TODO add acl
 | 
			
		||||
            //->where($qb->expr()->in('a.scope', ':scopes'))
 | 
			
		||||
            //->setParameter('scopes', $scopes)
 | 
			
		||||
            ->andWhere(
 | 
			
		||||
                $qb->expr()->orX(
 | 
			
		||||
                    $qb->expr()->eq('a.person', ':person'),
 | 
			
		||||
                    ':person MEMBER OF a.persons'
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
            ->setParameter('person', $person)
 | 
			
		||||
            ;
 | 
			
		||||
 | 
			
		||||
        foreach ($orderBy as $k => $dir) {
 | 
			
		||||
            $qb->addOrderBy('a.'.$k, $dir);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $qb->getQuery()
 | 
			
		||||
            ->getResult();
 | 
			
		||||
    }    
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
@import '~ChillMainSass/custom/config/colors';
 | 
			
		||||
@import '~ChillMainSass/custom/mixins/entity';
 | 
			
		||||
 | 
			
		||||
.chill-entity.chill-entity__activity-reason {
 | 
			
		||||
    @include entity($chill-pink, white);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.activity {
 | 
			
		||||
    color: $chill-green;
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
require('./activity/activity.scss');
 | 
			
		||||
require('./scss/chillactivity.scss');
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,130 @@
 | 
			
		||||
@import '~ChillMainAssets/modules/bootstrap/bootstrap';
 | 
			
		||||
//@import '~ChillMainSass/custom/mixins/entity';
 | 
			
		||||
 | 
			
		||||
//.chill-entity.chill-entity__activity-reason {
 | 
			
		||||
//    @include entity($chill-pink, white);
 | 
			
		||||
//}
 | 
			
		||||
 | 
			
		||||
.activity {
 | 
			
		||||
    color: $chill-green;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// exceptions for flex-bloc in concerned-groups
 | 
			
		||||
div.flex-bloc.concerned-groups {
 | 
			
		||||
   margin-top: 1em;
 | 
			
		||||
   div.item-bloc {
 | 
			
		||||
      flex-grow: 0; flex-shrink: 0; flex-basis: 25%; //4 blocs
 | 
			
		||||
      ul.list-content {
 | 
			
		||||
         list-style-type: none;
 | 
			
		||||
         padding-left: 0;
 | 
			
		||||
         li {
 | 
			
		||||
            margin-bottom: 0.2em;
 | 
			
		||||
            a {
 | 
			
		||||
               color: white;
 | 
			
		||||
               cursor: pointer;
 | 
			
		||||
               &:hover {
 | 
			
		||||
                  color: #ffffffab;
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
   &.person div.item-bloc {
 | 
			
		||||
      flex-basis: 33%; //3 blocs
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// exceptions for flex-table in list-records
 | 
			
		||||
div.flex-table.list-records {
 | 
			
		||||
   div.item-bloc {
 | 
			
		||||
      div.item-row.main {
 | 
			
		||||
         div.item-col {
 | 
			
		||||
            &:first-child {
 | 
			
		||||
               flex-basis: 27%;
 | 
			
		||||
            }
 | 
			
		||||
            ul.list-content {
 | 
			
		||||
               li.social-issues, li.social-actions {
 | 
			
		||||
                  .badge-primary {
 | 
			
		||||
                     font-variant: small-caps;
 | 
			
		||||
                     font-weight: bold;
 | 
			
		||||
                     font-size: 88%;
 | 
			
		||||
                     margin-bottom: 0.2em;
 | 
			
		||||
                  }
 | 
			
		||||
               }
 | 
			
		||||
               li.social-issues .badge-primary {
 | 
			
		||||
                  background-color: var(--chill-orange);
 | 
			
		||||
               }
 | 
			
		||||
               li.social-actions .badge-primary {
 | 
			
		||||
                  background-color: var(--chill-green);
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      div.item-row.details {
 | 
			
		||||
         flex-direction: row;
 | 
			
		||||
         & > div.item-col {
 | 
			
		||||
            justify-content: flex-start;
 | 
			
		||||
            align-self: center;
 | 
			
		||||
            &:nth-child(1) {
 | 
			
		||||
               flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
 | 
			
		||||
            }
 | 
			
		||||
            &:nth-child(2) {
 | 
			
		||||
               flex-grow: 0; flex-shrink: 1; flex-basis: 70%;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            &:only-child {
 | 
			
		||||
               flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
 | 
			
		||||
               & > div.concerned-groups {
 | 
			
		||||
                  flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
 | 
			
		||||
                  display: flex;
 | 
			
		||||
                  flex-direction: column; // TODO pas fini
 | 
			
		||||
                  div.group {
 | 
			
		||||
                     flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
 | 
			
		||||
                     h4 {} 
 | 
			
		||||
                     ul.list-content {
 | 
			
		||||
                        li { 
 | 
			
		||||
                           display: inline;
 | 
			
		||||
                        } 
 | 
			
		||||
                     }
 | 
			
		||||
                  }
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
         div.concerned-groups {
 | 
			
		||||
            font-size: 85%;
 | 
			
		||||
            h4 {
 | 
			
		||||
               text-transform: uppercase;
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
      ul.list-content {
 | 
			
		||||
         list-style-type: none;
 | 
			
		||||
         padding-left: 1em;
 | 
			
		||||
         margin: 0 0;
 | 
			
		||||
         li {
 | 
			
		||||
            margin-bottom: 0.2em;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
   div.duration {
 | 
			
		||||
      font-size: smaller;
 | 
			
		||||
      padding-left: 1em;
 | 
			
		||||
      margin-top: 1em;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div.activity-row {
 | 
			
		||||
   display: flex;
 | 
			
		||||
   flex-direction: row;
 | 
			
		||||
   flex-wrap: wrap;
 | 
			
		||||
   justify-content: center;
 | 
			
		||||
   gap: 12px;
 | 
			
		||||
   div.bloc {
 | 
			
		||||
      width: 200px;
 | 
			
		||||
      align-self: flex-end;
 | 
			
		||||
      height: 140px;
 | 
			
		||||
      display: flex;
 | 
			
		||||
      justify-content: center;
 | 
			
		||||
      align-items: center;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,17 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <concerned-groups></concerned-groups>
 | 
			
		||||
   <social-issues-acc></social-issues-acc>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import ConcernedGroups from './components/ConcernedGroups.vue';
 | 
			
		||||
import SocialIssuesAcc from './components/SocialIssuesAcc.vue';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
   name: "App",
 | 
			
		||||
   components: {
 | 
			
		||||
      ConcernedGroups,
 | 
			
		||||
      SocialIssuesAcc
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
import { getSocialIssues } from 'ChillPersonAssets/vuejs/AccompanyingCourse/api.js';
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
*  Load socialActions by socialIssue (id)
 | 
			
		||||
*/
 | 
			
		||||
const getSocialActionByIssue = (id) => { 
 | 
			
		||||
   const url = `/api/1.0/person/social/social-action/by-social-issue/${id}.json`;
 | 
			
		||||
   return fetch(url)
 | 
			
		||||
      .then(response => {
 | 
			
		||||
         if (response.ok) { return response.json(); }
 | 
			
		||||
         throw Error('Error with request resource response'); 
 | 
			
		||||
      });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
   getSocialIssues,
 | 
			
		||||
   getSocialActionByIssue
 | 
			
		||||
};
 | 
			
		||||
@@ -0,0 +1,170 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <teleport to="#add-persons">
 | 
			
		||||
 | 
			
		||||
      <div class="flex-bloc concerned-groups" :class="getContext">
 | 
			
		||||
         <persons-bloc 
 | 
			
		||||
            v-for="bloc in contextPersonsBlocs"
 | 
			
		||||
            v-bind:key="bloc.key"
 | 
			
		||||
            v-bind:bloc="bloc"
 | 
			
		||||
            v-bind:setPersonsInBloc="setPersonsInBloc">
 | 
			
		||||
         </persons-bloc>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <add-persons 
 | 
			
		||||
         buttonTitle="activity.add_persons"
 | 
			
		||||
         modalTitle="activity.add_persons"
 | 
			
		||||
         v-bind:key="addPersons.key"
 | 
			
		||||
         v-bind:options="addPersons.options"
 | 
			
		||||
         @addNewPersons="addNewPersons"
 | 
			
		||||
         ref="addPersons">
 | 
			
		||||
      </add-persons>
 | 
			
		||||
 
 | 
			
		||||
  </teleport>  
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { mapState } from 'vuex';
 | 
			
		||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
 | 
			
		||||
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
   name: "ConcernedGroups",
 | 
			
		||||
   components: {
 | 
			
		||||
      AddPersons,
 | 
			
		||||
      PersonsBloc
 | 
			
		||||
   },
 | 
			
		||||
   data() {
 | 
			
		||||
      return {
 | 
			
		||||
         personsBlocs: [
 | 
			
		||||
            {  key: 'persons', 
 | 
			
		||||
               title: 'activity.bloc_persons', 
 | 
			
		||||
               persons: [], 
 | 
			
		||||
               included: false 
 | 
			
		||||
            },
 | 
			
		||||
            {  key: 'personsAssociated', 
 | 
			
		||||
               title: 'activity.bloc_persons_associated', 
 | 
			
		||||
               persons: [], 
 | 
			
		||||
               included: false 
 | 
			
		||||
            },
 | 
			
		||||
            {  key: 'personsNotAssociated', 
 | 
			
		||||
               title: 'activity.bloc_persons_not_associated', 
 | 
			
		||||
               persons: [], 
 | 
			
		||||
               included: false 
 | 
			
		||||
            },
 | 
			
		||||
            {  key: 'thirdparty', 
 | 
			
		||||
               title: 'activity.bloc_thirdparty', 
 | 
			
		||||
               persons: [], 
 | 
			
		||||
               included: true
 | 
			
		||||
            },
 | 
			
		||||
            {  key: 'users', 
 | 
			
		||||
               title: 'activity.bloc_users', 
 | 
			
		||||
               persons: [], 
 | 
			
		||||
               included: true
 | 
			
		||||
            },
 | 
			
		||||
         ],
 | 
			
		||||
         addPersons: {
 | 
			
		||||
            key: 'activity',
 | 
			
		||||
            options: {
 | 
			
		||||
               type: ['person', 'thirdparty', 'user'], // TODO add 'user'
 | 
			
		||||
               priority: null,
 | 
			
		||||
               uniq: false,
 | 
			
		||||
            }
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   computed: {
 | 
			
		||||
      ...mapState({
 | 
			
		||||
         persons: state => state.activity.persons,
 | 
			
		||||
         thirdParties: state => state.activity.thirdParties,
 | 
			
		||||
         users: state => state.activity.users,
 | 
			
		||||
         accompanyingCourse: state => state.activity.accompanyingPeriod
 | 
			
		||||
      }),
 | 
			
		||||
      getContext() {
 | 
			
		||||
         return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
 | 
			
		||||
      },
 | 
			
		||||
      contextPersonsBlocs() {
 | 
			
		||||
         return this.personsBlocs.filter(bloc => bloc.included !== false);
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   mounted() {
 | 
			
		||||
      this.setPersonsInBloc();
 | 
			
		||||
   },
 | 
			
		||||
   methods: {
 | 
			
		||||
      setPersonsInBloc() {
 | 
			
		||||
         let groups; 
 | 
			
		||||
         if (this.accompanyingCourse) {
 | 
			
		||||
            groups = this.splitPersonsInGroups();
 | 
			
		||||
         }     
 | 
			
		||||
         this.personsBlocs.forEach(bloc => {
 | 
			
		||||
            if (this.accompanyingCourse) {
 | 
			
		||||
               switch (bloc.key) {
 | 
			
		||||
                  case 'personsAssociated':
 | 
			
		||||
                     bloc.persons = groups.personsAssociated;
 | 
			
		||||
                     bloc.included = true;
 | 
			
		||||
                     break;
 | 
			
		||||
                  case 'personsNotAssociated':
 | 
			
		||||
                     bloc.persons = groups.personsNotAssociated;
 | 
			
		||||
                     bloc.included = true;
 | 
			
		||||
                     break;
 | 
			
		||||
               }
 | 
			
		||||
            } else {
 | 
			
		||||
               switch (bloc.key) {
 | 
			
		||||
                  case 'persons': 
 | 
			
		||||
                     bloc.persons = this.persons;
 | 
			
		||||
                     bloc.included = true;
 | 
			
		||||
                     break;
 | 
			
		||||
               }
 | 
			
		||||
            }
 | 
			
		||||
            switch (bloc.key) {
 | 
			
		||||
               case 'thirdparty':
 | 
			
		||||
                  bloc.persons = this.thirdParties;
 | 
			
		||||
                  break;
 | 
			
		||||
               case 'users':
 | 
			
		||||
                  bloc.persons = this.users;
 | 
			
		||||
                  break;
 | 
			
		||||
            }
 | 
			
		||||
         }, groups);
 | 
			
		||||
      },
 | 
			
		||||
      splitPersonsInGroups() {
 | 
			
		||||
         let personsAssociated = [];
 | 
			
		||||
         let personsNotAssociated = this.persons;
 | 
			
		||||
         let participations = this.getCourseParticipations();         
 | 
			
		||||
         this.persons.forEach(person => {
 | 
			
		||||
            participations.forEach(participation => {
 | 
			
		||||
               if (person.id === participation.id) {
 | 
			
		||||
                  //console.log(person.id);
 | 
			
		||||
                  personsAssociated.push(person);
 | 
			
		||||
                  personsNotAssociated = personsNotAssociated.filter(p => p !== person);
 | 
			
		||||
               }
 | 
			
		||||
            });
 | 
			
		||||
         });
 | 
			
		||||
         return { 
 | 
			
		||||
            'personsAssociated': personsAssociated, 
 | 
			
		||||
            'personsNotAssociated': personsNotAssociated 
 | 
			
		||||
         };
 | 
			
		||||
      },
 | 
			
		||||
      getCourseParticipations() {
 | 
			
		||||
         let participations = [];
 | 
			
		||||
         this.accompanyingCourse.participations.forEach(participation => {
 | 
			
		||||
            if (!participation.endDate) {
 | 
			
		||||
               participations.push(participation.person);
 | 
			
		||||
            }
 | 
			
		||||
         });
 | 
			
		||||
         return participations;
 | 
			
		||||
      },
 | 
			
		||||
      addNewPersons({ selected, modal }) {
 | 
			
		||||
         console.log('@@@ CLICK button addNewPersons', selected);
 | 
			
		||||
         selected.forEach(function(item) {
 | 
			
		||||
               this.$store.dispatch('addPersonsInvolved', item);
 | 
			
		||||
            }, this
 | 
			
		||||
         );
 | 
			
		||||
         this.$refs.addPersons.resetSearch(); // to cast child method
 | 
			
		||||
         modal.showModal = false;
 | 
			
		||||
         this.setPersonsInBloc();
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
@@ -0,0 +1,29 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <li>
 | 
			
		||||
      <span class="badge bg-primary" :title="person.text">
 | 
			
		||||
         <span class="chill_denomination">
 | 
			
		||||
            {{ textCutted }}
 | 
			
		||||
         </span>
 | 
			
		||||
         <a class="fa fa-fw fa-times"
 | 
			
		||||
            @click.prevent="$emit('remove', person)">
 | 
			
		||||
         </a>
 | 
			
		||||
      </span>
 | 
			
		||||
   </li>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
   name: "PersonBadge",
 | 
			
		||||
   props: ['person'],
 | 
			
		||||
   computed: {
 | 
			
		||||
      textCutted() {
 | 
			
		||||
         let more = (this.person.text.length > 15) ?'…' : '';
 | 
			
		||||
         return this.person.text.slice(0,15) + more;
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   emits: ['remove'],
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="css" scoped>
 | 
			
		||||
</style>
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <div class="item-bloc">
 | 
			
		||||
      <div class="item-row">
 | 
			
		||||
         <div class="item-col">
 | 
			
		||||
            <h4>{{ $t(bloc.title) }}</h4>
 | 
			
		||||
         </div>
 | 
			
		||||
         <div class="item-col">
 | 
			
		||||
            <ul class="list-content">
 | 
			
		||||
               <person-badge
 | 
			
		||||
                  v-for="person in bloc.persons"
 | 
			
		||||
                  v-bind:key="person.id"
 | 
			
		||||
                  v-bind:person="person"
 | 
			
		||||
                  @remove="removePerson">
 | 
			
		||||
               </person-badge>
 | 
			
		||||
            </ul>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
   </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import PersonBadge from './PersonBadge.vue';
 | 
			
		||||
export default {
 | 
			
		||||
   name:"PersonsBloc",
 | 
			
		||||
   components: {
 | 
			
		||||
      PersonBadge
 | 
			
		||||
   },
 | 
			
		||||
   props: ['bloc', 'setPersonsInBloc'],
 | 
			
		||||
   methods: {
 | 
			
		||||
      removePerson(item) {
 | 
			
		||||
         console.log('@@ CLICK remove person: item', item);
 | 
			
		||||
         this.$store.dispatch('removePersonInvolved', item);
 | 
			
		||||
         this.setPersonsInBloc();
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss">
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
@@ -0,0 +1,214 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <teleport to="#social-issues-acc">
 | 
			
		||||
      
 | 
			
		||||
      <div class="mb-3 row">
 | 
			
		||||
         <div class="col-4">
 | 
			
		||||
            <label class="col-form-label">{{ $t('activity.social_issues') }}</label>
 | 
			
		||||
         </div>
 | 
			
		||||
         <div class="col-8">
 | 
			
		||||
            
 | 
			
		||||
            <check-social-issue
 | 
			
		||||
               v-for="issue in socialIssuesList"
 | 
			
		||||
               v-bind:key="issue.id"
 | 
			
		||||
               v-bind:issue="issue"
 | 
			
		||||
               v-bind:selection="socialIssuesSelected"
 | 
			
		||||
               @updateSelected="updateIssuesSelected">
 | 
			
		||||
            </check-social-issue>
 | 
			
		||||
            
 | 
			
		||||
            <div class="my-3">
 | 
			
		||||
            <VueMultiselect
 | 
			
		||||
               name="otherIssues"
 | 
			
		||||
               label="text"
 | 
			
		||||
               track-by="id"
 | 
			
		||||
               open-direction="bottom"
 | 
			
		||||
               v-bind:close-on-select="true"
 | 
			
		||||
               v-bind:preserve-search="false"
 | 
			
		||||
               v-bind:reset-after="true"
 | 
			
		||||
               v-bind:hide-selected="true"
 | 
			
		||||
               v-bind:taggable="false"
 | 
			
		||||
               v-bind:multiple="false"
 | 
			
		||||
               v-bind:searchable="true"
 | 
			
		||||
               v-bind:allow-empty="true" 
 | 
			
		||||
               v-bind:show-labels="false"
 | 
			
		||||
               v-bind:loading="issueIsLoading"
 | 
			
		||||
               v-bind:placeholder="$t('activity.choose_other_social_issue')"
 | 
			
		||||
               v-bind:options="socialIssuesOther"
 | 
			
		||||
               v-model="value"
 | 
			
		||||
               @select="addIssueInList">
 | 
			
		||||
            </VueMultiselect>
 | 
			
		||||
            </div>
 | 
			
		||||
            
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div class="mb-3 row">
 | 
			
		||||
         <div class="col-4">
 | 
			
		||||
            <label class="col-form-label">{{ $t('activity.social_actions') }}</label>
 | 
			
		||||
         </div>
 | 
			
		||||
         <div class="col-8">
 | 
			
		||||
            
 | 
			
		||||
            <div v-if="actionIsLoading === true">
 | 
			
		||||
               <i class="chill-green fa fa-circle-o-notch fa-spin fa-lg"></i>
 | 
			
		||||
            </div>
 | 
			
		||||
            
 | 
			
		||||
            <check-social-action
 | 
			
		||||
               v-if="socialIssuesSelected.length || socialActionsSelected.length"
 | 
			
		||||
               v-for="action in socialActionsList"
 | 
			
		||||
               v-bind:key="action.id"
 | 
			
		||||
               v-bind:action="action"
 | 
			
		||||
               v-bind:selection="socialActionsSelected"
 | 
			
		||||
               @updateSelected="updateActionsSelected">
 | 
			
		||||
            </check-social-action>
 | 
			
		||||
            
 | 
			
		||||
            <span v-else class="inline-choice chill-no-data-statement mt-3">
 | 
			
		||||
               {{ $t('activity.select_first_a_social_issue') }}
 | 
			
		||||
            </span>
 | 
			
		||||
            
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      
 | 
			
		||||
   </teleport>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { readonly } from 'vue';
 | 
			
		||||
import VueMultiselect from 'vue-multiselect';
 | 
			
		||||
import CheckSocialIssue from './SocialIssuesAcc/CheckSocialIssue.vue';
 | 
			
		||||
import CheckSocialAction from './SocialIssuesAcc/CheckSocialAction.vue';
 | 
			
		||||
import { getSocialIssues, getSocialActionByIssue } from '../api.js';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
   name: "SocialIssuesAcc",
 | 
			
		||||
   components: {
 | 
			
		||||
      CheckSocialIssue,
 | 
			
		||||
      CheckSocialAction,
 | 
			
		||||
      VueMultiselect
 | 
			
		||||
   },
 | 
			
		||||
   data() {
 | 
			
		||||
      return {
 | 
			
		||||
         issueIsLoading: false,
 | 
			
		||||
         actionIsLoading: false
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   computed: {
 | 
			
		||||
      socialIssuesList() {
 | 
			
		||||
         return this.$store.state.activity.accompanyingPeriod.socialIssues;
 | 
			
		||||
      },
 | 
			
		||||
      socialIssuesSelected() {
 | 
			
		||||
         return this.$store.state.activity.socialIssues;
 | 
			
		||||
      },
 | 
			
		||||
      socialIssuesOther() {
 | 
			
		||||
         return this.$store.state.socialIssuesOther;
 | 
			
		||||
      },
 | 
			
		||||
      socialActionsList() {
 | 
			
		||||
         return this.$store.state.socialActionsList;
 | 
			
		||||
      },
 | 
			
		||||
      socialActionsSelected() {
 | 
			
		||||
         return this.$store.state.activity.socialActions;
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   mounted() {
 | 
			
		||||
      /* Load others issues in multiselect
 | 
			
		||||
      */
 | 
			
		||||
      this.issueIsLoading = true;
 | 
			
		||||
      getSocialIssues().then(response => new Promise((resolve, reject) => {
 | 
			
		||||
         this.$store.commit('updateIssuesOther', response.results);
 | 
			
		||||
         
 | 
			
		||||
         /* Add in list the issues already associated (if not yet listed)
 | 
			
		||||
         */
 | 
			
		||||
         this.socialIssuesSelected.forEach(issue => {
 | 
			
		||||
            if (this.socialIssuesList.filter(i => i.id === issue.id).length !== 1) {
 | 
			
		||||
               this.$store.commit('addIssueInList', issue);
 | 
			
		||||
            }
 | 
			
		||||
         }, this);
 | 
			
		||||
         
 | 
			
		||||
         /* Remove from multiselect the issues that are not yet in checkbox list
 | 
			
		||||
         */
 | 
			
		||||
         this.socialIssuesList.forEach(issue => {
 | 
			
		||||
            this.$store.commit('removeIssueInOther', issue);
 | 
			
		||||
         }, this);
 | 
			
		||||
         
 | 
			
		||||
         /* Filter issues
 | 
			
		||||
         */
 | 
			
		||||
         this.$store.commit('filterList', 'issues');
 | 
			
		||||
         
 | 
			
		||||
         /* Add in list the actions already associated (if not yet listed)
 | 
			
		||||
         */
 | 
			
		||||
         this.socialActionsSelected.forEach(action => {
 | 
			
		||||
            this.$store.commit('addActionInList', action);
 | 
			
		||||
         }, this);
 | 
			
		||||
         
 | 
			
		||||
         /* Filter issues
 | 
			
		||||
         */
 | 
			
		||||
         this.$store.commit('filterList', 'actions');
 | 
			
		||||
         
 | 
			
		||||
         this.issueIsLoading = false;
 | 
			
		||||
         resolve();
 | 
			
		||||
      }));   
 | 
			
		||||
   },
 | 
			
		||||
   methods: {
 | 
			
		||||
   
 | 
			
		||||
      /* When choosing an issue in multiselect, add it in checkboxes (as selected), 
 | 
			
		||||
         remove it from multiselect, and add socialActions concerned
 | 
			
		||||
      */
 | 
			
		||||
      addIssueInList(value) {
 | 
			
		||||
         //console.log('addIssueInList', value);
 | 
			
		||||
         this.$store.commit('addIssueInList', value);
 | 
			
		||||
         this.$store.commit('removeIssueInOther', value);
 | 
			
		||||
         this.$store.dispatch('addIssueSelected', value);
 | 
			
		||||
         this.updateActionsList();
 | 
			
		||||
      },
 | 
			
		||||
      /* Update value for selected issues checkboxes
 | 
			
		||||
      */
 | 
			
		||||
      updateIssuesSelected(issues) {
 | 
			
		||||
         //console.log('updateIssuesSelected', issues);
 | 
			
		||||
         this.$store.dispatch('updateIssuesSelected', issues);
 | 
			
		||||
         this.updateActionsList();
 | 
			
		||||
      },
 | 
			
		||||
      /* Update value for selected actions checkboxes
 | 
			
		||||
      */
 | 
			
		||||
      updateActionsSelected(actions) {
 | 
			
		||||
         //console.log('updateActionsSelected', actions);
 | 
			
		||||
         this.$store.dispatch('updateActionsSelected', actions);
 | 
			
		||||
      },
 | 
			
		||||
      /* Add socialActions concerned: after reset, loop on each issue selected 
 | 
			
		||||
         to get social actions concerned
 | 
			
		||||
      */
 | 
			
		||||
      updateActionsList() {
 | 
			
		||||
         //console.log('updateActionsList');
 | 
			
		||||
         this.resetActionsList();
 | 
			
		||||
         this.socialIssuesSelected.forEach(item => {
 | 
			
		||||
            
 | 
			
		||||
            this.actionIsLoading = true;
 | 
			
		||||
            getSocialActionByIssue(item.id)
 | 
			
		||||
               .then(actions => new Promise((resolve, reject) => {
 | 
			
		||||
                  
 | 
			
		||||
                  actions.results.forEach(action => {
 | 
			
		||||
                     this.$store.commit('addActionInList', action);
 | 
			
		||||
                  }, this);
 | 
			
		||||
                  
 | 
			
		||||
                  this.$store.commit('filterList', 'actions');
 | 
			
		||||
                  
 | 
			
		||||
                  this.actionIsLoading = false;
 | 
			
		||||
                  resolve();
 | 
			
		||||
            }));
 | 
			
		||||
         }, this);
 | 
			
		||||
      },
 | 
			
		||||
      /* Reset socialActions List: flush list and restore selected actions 
 | 
			
		||||
      */
 | 
			
		||||
      resetActionsList() {
 | 
			
		||||
         this.$store.commit('resetActionsList');
 | 
			
		||||
         this.socialActionsSelected.forEach(item => {
 | 
			
		||||
            this.$store.commit('addActionInList', item);
 | 
			
		||||
         }, this);
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
 | 
			
		||||
<style lang="scss">
 | 
			
		||||
   span.multiselect__single {
 | 
			
		||||
      display: none !important;
 | 
			
		||||
   }
 | 
			
		||||
</style>
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <span class="inline-choice">
 | 
			
		||||
      <div class="form-check">
 | 
			
		||||
   
 | 
			
		||||
         <input class="form-check-input"
 | 
			
		||||
            type="checkbox" 
 | 
			
		||||
            v-model="selected"
 | 
			
		||||
            name="action"
 | 
			
		||||
            v-bind:id="action.id" 
 | 
			
		||||
            v-bind:value="action"
 | 
			
		||||
            />
 | 
			
		||||
         <label class="form-check-label" v-bind:for="action.id">
 | 
			
		||||
            {{ action.text }}
 | 
			
		||||
         </label>
 | 
			
		||||
         
 | 
			
		||||
      </div>
 | 
			
		||||
   </span>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
   name: "CheckSocialAction",
 | 
			
		||||
   props: [ 'action', 'selection' ],
 | 
			
		||||
   emits: [ 'updateSelected' ],
 | 
			
		||||
   computed: {
 | 
			
		||||
      selected: {
 | 
			
		||||
         set(value) {
 | 
			
		||||
            this.$emit('updateSelected', value);
 | 
			
		||||
         },
 | 
			
		||||
         get() {
 | 
			
		||||
            return this.selection;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <span class="inline-choice">
 | 
			
		||||
      <div class="form-check">
 | 
			
		||||
      
 | 
			
		||||
         <input class="form-check-input"
 | 
			
		||||
            type="checkbox" 
 | 
			
		||||
            v-model="selected"
 | 
			
		||||
            name="issue"
 | 
			
		||||
            v-bind:id="issue.id" 
 | 
			
		||||
            v-bind:value="issue"
 | 
			
		||||
            />
 | 
			
		||||
         <label class="form-check-label" v-bind:for="issue.id">
 | 
			
		||||
            {{ issue.text }}
 | 
			
		||||
         </label>
 | 
			
		||||
         
 | 
			
		||||
      </div>
 | 
			
		||||
   </span>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
   name: "CheckSocialIssue",
 | 
			
		||||
   props: [ 'issue', 'selection' ],
 | 
			
		||||
   emits: [ 'updateSelected' ],
 | 
			
		||||
   computed: {
 | 
			
		||||
      selected: {
 | 
			
		||||
         set(value) {
 | 
			
		||||
            this.$emit('updateSelected', value);
 | 
			
		||||
         },
 | 
			
		||||
         get() {
 | 
			
		||||
            return this.selection;
 | 
			
		||||
         }
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,27 @@
 | 
			
		||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
 | 
			
		||||
 | 
			
		||||
const appMessages = {
 | 
			
		||||
   fr: {
 | 
			
		||||
      activity: {
 | 
			
		||||
         //
 | 
			
		||||
         social_issues: "Problématiques sociales",
 | 
			
		||||
         choose_other_social_issue: "Ajouter une autre problématique sociale...",
 | 
			
		||||
         social_actions: "Actions d'accompagnement",
 | 
			
		||||
         select_first_a_social_issue: "Sélectionnez d'abord une problématique sociale",
 | 
			
		||||
         
 | 
			
		||||
         //
 | 
			
		||||
         add_persons: "Ajouter des personnes concernées",
 | 
			
		||||
         bloc_persons: "Usagers",
 | 
			
		||||
         bloc_persons_associated: "Usagers du parcours",
 | 
			
		||||
         bloc_persons_not_associated: "Tiers non-pro.",
 | 
			
		||||
         bloc_thirdparty: "Tiers professionnels",
 | 
			
		||||
         bloc_users: "T(M)S",
 | 
			
		||||
      }
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Object.assign(appMessages.fr, personMessages.fr);
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
   appMessages
 | 
			
		||||
};
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
import { createApp } from 'vue';
 | 
			
		||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
 | 
			
		||||
import { appMessages } from './i18n'
 | 
			
		||||
import store from './store'
 | 
			
		||||
 | 
			
		||||
import App from './App.vue';
 | 
			
		||||
 | 
			
		||||
const i18n = _createI18n(appMessages);
 | 
			
		||||
 | 
			
		||||
const app = createApp({
 | 
			
		||||
   template: `<app></app>`,
 | 
			
		||||
})
 | 
			
		||||
.use(store)
 | 
			
		||||
.use(i18n)
 | 
			
		||||
.component('app', App)
 | 
			
		||||
.mount('#activity');
 | 
			
		||||
@@ -0,0 +1,170 @@
 | 
			
		||||
import 'es6-promise/auto';
 | 
			
		||||
import { createStore } from 'vuex';
 | 
			
		||||
 | 
			
		||||
const debug = process.env.NODE_ENV !== 'production';
 | 
			
		||||
//console.log('window.activity', window.activity);
 | 
			
		||||
 | 
			
		||||
const addIdToValue = (string, id) => {
 | 
			
		||||
   let array = string ? string.split(',') : [];
 | 
			
		||||
   array.push(id.toString());
 | 
			
		||||
   let str = array.join();
 | 
			
		||||
   return str;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const removeIdFromValue = (string, id) => {
 | 
			
		||||
   let array = string.split(',');
 | 
			
		||||
   array = array.filter(el => el !== id.toString());
 | 
			
		||||
   let str = array.join();
 | 
			
		||||
   return str;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const store = createStore({
 | 
			
		||||
   strict: debug,
 | 
			
		||||
   state: {
 | 
			
		||||
     activity: window.activity,
 | 
			
		||||
     socialIssuesOther: [],
 | 
			
		||||
     socialActionsList: [],
 | 
			
		||||
   },
 | 
			
		||||
   mutations: {
 | 
			
		||||
      
 | 
			
		||||
      // SocialIssueAcc
 | 
			
		||||
      addIssueInList(state, issue) {
 | 
			
		||||
         //console.log('add issue list', issue.id);
 | 
			
		||||
         state.activity.accompanyingPeriod.socialIssues.push(issue);         
 | 
			
		||||
      },
 | 
			
		||||
      addIssueSelected(state, issue) {
 | 
			
		||||
         //console.log('add issue selected', issue.id);
 | 
			
		||||
         state.activity.socialIssues.push(issue);
 | 
			
		||||
      },
 | 
			
		||||
      updateIssuesSelected(state, issues) {
 | 
			
		||||
         //console.log('update issues selected', issues);
 | 
			
		||||
         state.activity.socialIssues = issues;
 | 
			
		||||
      },
 | 
			
		||||
      updateIssuesOther(state, payload) {
 | 
			
		||||
         //console.log('update issues other');
 | 
			
		||||
         state.socialIssuesOther = payload;
 | 
			
		||||
      },
 | 
			
		||||
      removeIssueInOther(state, issue) {
 | 
			
		||||
         //console.log('remove issue other', issue.id);
 | 
			
		||||
         state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
 | 
			
		||||
      },
 | 
			
		||||
      resetActionsList(state) {
 | 
			
		||||
         //console.log('reset list actions');
 | 
			
		||||
         state.socialActionsList = [];
 | 
			
		||||
      },
 | 
			
		||||
      addActionInList(state, action) {
 | 
			
		||||
         //console.log('add action list', action.id);
 | 
			
		||||
         state.socialActionsList.push(action);         
 | 
			
		||||
      },
 | 
			
		||||
      updateActionsSelected(state, actions) {
 | 
			
		||||
         //console.log('update actions selected', actions);
 | 
			
		||||
         state.activity.socialActions = actions;
 | 
			
		||||
      },
 | 
			
		||||
      filterList(state, list) {
 | 
			
		||||
         const filterList = (list) => {
 | 
			
		||||
            // remove duplicates entries
 | 
			
		||||
            list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
 | 
			
		||||
            // alpha sort
 | 
			
		||||
            list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
 | 
			
		||||
            return list;
 | 
			
		||||
         };
 | 
			
		||||
         if (list === 'issues') {
 | 
			
		||||
            state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
 | 
			
		||||
         }
 | 
			
		||||
         if (list === 'actions') {
 | 
			
		||||
            state.socialActionsList = filterList(state.socialActionsList);
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      
 | 
			
		||||
      // ConcernedGroups
 | 
			
		||||
      addPersonsInvolved(state, payload) {
 | 
			
		||||
         //console.log('### mutation addPersonsInvolved', payload.result.type);
 | 
			
		||||
         switch (payload.result.type) {
 | 
			
		||||
            case 'person':
 | 
			
		||||
               state.activity.persons.push(payload.result);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'thirdparty':
 | 
			
		||||
               state.activity.thirdParties.push(payload.result);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'user':
 | 
			
		||||
               state.activity.users.push(payload.result); 
 | 
			
		||||
               break;
 | 
			
		||||
         };
 | 
			
		||||
      },
 | 
			
		||||
      removePersonInvolved(state, payload) {
 | 
			
		||||
         //console.log('### mutation removePersonInvolved', payload.type);
 | 
			
		||||
         switch (payload.type) {
 | 
			
		||||
            case 'person':
 | 
			
		||||
               state.activity.persons = state.activity.persons.filter(person => person !== payload);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'thirdparty':
 | 
			
		||||
               state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'user':
 | 
			
		||||
               state.activity.users = state.activity.users.filter(user => user !== payload); 
 | 
			
		||||
               break;
 | 
			
		||||
         };
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   actions: {
 | 
			
		||||
      addIssueSelected({ commit }, issue) {
 | 
			
		||||
         let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
 | 
			
		||||
         aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
 | 
			
		||||
         commit('addIssueSelected', issue);
 | 
			
		||||
      },
 | 
			
		||||
      updateIssuesSelected({ commit }, payload) {
 | 
			
		||||
         let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
 | 
			
		||||
         aSocialIssues.value = '';
 | 
			
		||||
         payload.forEach(item => {
 | 
			
		||||
            aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
 | 
			
		||||
         });
 | 
			
		||||
         commit('updateIssuesSelected', payload);
 | 
			
		||||
      },
 | 
			
		||||
      updateActionsSelected({ commit }, payload) {
 | 
			
		||||
         let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
 | 
			
		||||
         aSocialActions.value = '';
 | 
			
		||||
         payload.forEach(item => {
 | 
			
		||||
            aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
 | 
			
		||||
         });
 | 
			
		||||
         commit('updateActionsSelected', payload);
 | 
			
		||||
      },
 | 
			
		||||
      addPersonsInvolved({ commit }, payload) {
 | 
			
		||||
         //console.log('### action addPersonsInvolved', payload.result.type);
 | 
			
		||||
         switch (payload.result.type) {
 | 
			
		||||
            case 'person':
 | 
			
		||||
               let aPersons = document.getElementById("chill_activitybundle_activity_persons");
 | 
			
		||||
               aPersons.value = addIdToValue(aPersons.value, payload.result.id);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'thirdparty':
 | 
			
		||||
               let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
 | 
			
		||||
               aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'user':
 | 
			
		||||
               let aUsers = document.getElementById("chill_activitybundle_activity_users");
 | 
			
		||||
               aUsers.value = addIdToValue(aUsers.value, payload.result.id);
 | 
			
		||||
               break;
 | 
			
		||||
         };
 | 
			
		||||
         commit('addPersonsInvolved', payload);
 | 
			
		||||
      },
 | 
			
		||||
      removePersonInvolved({ commit }, payload) {
 | 
			
		||||
         //console.log('### action removePersonInvolved', payload);
 | 
			
		||||
         switch (payload.type) {
 | 
			
		||||
            case 'person':
 | 
			
		||||
               let aPersons = document.getElementById("chill_activitybundle_activity_persons");
 | 
			
		||||
               aPersons.value = removeIdFromValue(aPersons.value, payload.id);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'thirdparty':
 | 
			
		||||
               let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
 | 
			
		||||
               aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
 | 
			
		||||
               break;
 | 
			
		||||
            case 'user':
 | 
			
		||||
               let aUsers = document.getElementById("chill_activitybundle_activity_users");
 | 
			
		||||
               aUsers.value = removeIdFromValue(aUsers.value, payload.id);
 | 
			
		||||
               break;
 | 
			
		||||
         };
 | 
			
		||||
         commit('removePersonInvolved', payload);
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default store;
 | 
			
		||||
@@ -0,0 +1,97 @@
 | 
			
		||||
{% macro href(pathname, key, value) %}
 | 
			
		||||
    {% set parms = { (key): value } %}
 | 
			
		||||
    {{ path(pathname, parms) }}
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
 | 
			
		||||
{% if context == 'person' %}
 | 
			
		||||
    {% set blocs = [
 | 
			
		||||
        {   'title': 'Others persons'|trans, 
 | 
			
		||||
            'items': entity.persons,
 | 
			
		||||
            'path' : 'chill_person_view',
 | 
			
		||||
            'key'  : 'person_id'
 | 
			
		||||
        },
 | 
			
		||||
        {   'title': 'Third parties'|trans, 
 | 
			
		||||
            'items': entity.thirdParties,
 | 
			
		||||
            'path' : 'chill_3party_3party_show',
 | 
			
		||||
            'key'  : 'thirdparty_id'
 | 
			
		||||
        },
 | 
			
		||||
        {   'title': 'Users concerned'|trans, 
 | 
			
		||||
            'items': entity.users,
 | 
			
		||||
            'path' : 'admin_user_show',
 | 
			
		||||
            'key'  : 'id'
 | 
			
		||||
        },
 | 
			
		||||
    ] %}
 | 
			
		||||
{% else %}
 | 
			
		||||
    {% set blocs = [
 | 
			
		||||
        {   'title': 'Persons in accompanying course'|trans, 
 | 
			
		||||
            'items': entity.personsAssociated,
 | 
			
		||||
            'path' : 'chill_person_view',
 | 
			
		||||
            'key'  : 'person_id'
 | 
			
		||||
        },
 | 
			
		||||
        {   'title': 'Third persons'|trans, 
 | 
			
		||||
            'items': entity.personsNotAssociated,
 | 
			
		||||
            'path' : 'chill_person_view',
 | 
			
		||||
            'key'  : 'person_id'
 | 
			
		||||
        },
 | 
			
		||||
        {   'title': 'Third parties'|trans, 
 | 
			
		||||
            'items': entity.thirdParties,
 | 
			
		||||
            'path' : 'chill_3party_3party_show',
 | 
			
		||||
            'key'  : 'thirdparty_id'
 | 
			
		||||
        },
 | 
			
		||||
        {   'title': 'Users concerned'|trans, 
 | 
			
		||||
            'items': entity.users,
 | 
			
		||||
            'path' : 'admin_user_show',
 | 
			
		||||
            'key'  : 'id'
 | 
			
		||||
        },
 | 
			
		||||
    ] %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if (with_display == 'bloc') %}
 | 
			
		||||
<div class="{{ context }} flex-bloc concerned-groups">
 | 
			
		||||
    {% for bloc in blocs %}
 | 
			
		||||
    <div class="item-bloc">
 | 
			
		||||
        <div class="item-row">
 | 
			
		||||
            <div class="item-col">
 | 
			
		||||
                <h4>{{ bloc.title }}</h4>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-col">
 | 
			
		||||
                <ul class="list-content">
 | 
			
		||||
                    {% for item in bloc.items %}
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
 | 
			
		||||
                            <span class="badge bg-primary">
 | 
			
		||||
                                {{ item|chill_entity_render_box({'only_denomination': true}) }}
 | 
			
		||||
                            </span>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    {% endfor %}
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
    
 | 
			
		||||
{% if (with_display == 'row') %}
 | 
			
		||||
<div class="concerned-groups">
 | 
			
		||||
    {% for bloc in blocs %}
 | 
			
		||||
    <div class="group">
 | 
			
		||||
        {% if bloc.items|length > 0 %}
 | 
			
		||||
            <h4>{{ bloc.title }}</h4>
 | 
			
		||||
            <ul class="list-content">
 | 
			
		||||
                {% for item in bloc.items %}
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
 | 
			
		||||
                        <span class="badge bg-primary">
 | 
			
		||||
                            {{ item|chill_entity_render_box({'only_denomination': true}) }}
 | 
			
		||||
                        </span>
 | 
			
		||||
                    </a>
 | 
			
		||||
                </li>
 | 
			
		||||
                {% endfor %}
 | 
			
		||||
            </ul>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </div>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title  'Remove activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    {{ include('@ChillMain/Util/confirmation_template.html.twig',
 | 
			
		||||
        {
 | 
			
		||||
            'title'             : 'Remove activity'|trans,
 | 
			
		||||
            'confirm_question'  : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : accompanyingCourse.id } ),
 | 
			
		||||
            'cancel_route'      : 'chill_activity_activity_list',
 | 
			
		||||
            'cancel_parameters' : { 'accompanying_course_id' : accompanyingCourse.id, 'id' : activity.id },
 | 
			
		||||
            'form'              : delete_form
 | 
			
		||||
        } ) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
{% extends "@ChillPerson/layout.html.twig"  %}
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
{% set person = activity.person %}
 | 
			
		||||
@@ -6,7 +6,6 @@
 | 
			
		||||
{% block title  'Remove activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
 | 
			
		||||
{{ include('@ChillMain/Util/confirmation_template.html.twig',
 | 
			
		||||
    {
 | 
			
		||||
        'title'             : 'Remove activity'|trans,
 | 
			
		||||
@@ -15,5 +14,4 @@
 | 
			
		||||
        'cancel_parameters' : { 'person_id' : activity.person.id, 'id' : activity.id },
 | 
			
		||||
        'form'              : delete_form
 | 
			
		||||
    } ) }}
 | 
			
		||||
    
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,59 +1,104 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillPerson/layout.html.twig"  %}
 | 
			
		||||
<h1>{{ "Update activity"|trans }}</h1>
 | 
			
		||||
<h2 class="chill-green mb-4">{{ entity.type.name|localize_translatable_string }}</h2>
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
{{ form_start(edit_form) }}
 | 
			
		||||
{{ form_errors(edit_form) }}
 | 
			
		||||
 | 
			
		||||
{% block title  'Update activity'|trans %}
 | 
			
		||||
{%- if edit_form.emergency is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.emergency) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
    <h1>{{ "Update activity"|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    {{ form_start(edit_form) }}
 | 
			
		||||
{%- if edit_form.sentReceived is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.sentReceived) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.user is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.user) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.scope is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.scope) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    <h2>{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
    {{ form_row(edit_form.date) }}
 | 
			
		||||
    {{ form_row(edit_form.durationTime) }}
 | 
			
		||||
    {{ form_row(edit_form.type) }}
 | 
			
		||||
    {{ form_row(edit_form.attendee) }}
 | 
			
		||||
{%- if edit_form.socialIssues is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.socialIssues) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.socialActions is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.socialActions) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<div id="social-issues-acc"></div>
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.reasons is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.reasons) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.persons is defined -%}
 | 
			
		||||
    {{ form_widget(edit_form.persons) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{%- if edit_form.thirdParties is defined -%}
 | 
			
		||||
    {{ form_widget(edit_form.thirdParties) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{%- if edit_form.users is defined -%}
 | 
			
		||||
    {{ form_widget(edit_form.users) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<div id="add-persons"></div>
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.date is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.date) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
.. location
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.durationTime is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.durationTime) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.travelTime is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.travelTime) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if edit_form.comment is defined -%}
 | 
			
		||||
    .. public and private
 | 
			
		||||
    {{ form_row(edit_form.comment) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    {{ form_widget(edit_form) }}
 | 
			
		||||
        <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
            <li class="cancel">
 | 
			
		||||
                <a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': entity.person.id } ) }}" class="sc-button bt-cancel">
 | 
			
		||||
                    {{ 'Cancel'|trans }}
 | 
			
		||||
                </a>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li>
 | 
			
		||||
                <button class="sc-button bt-update" type="submit">{{ 'Save activity'|trans }}</button>
 | 
			
		||||
            </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
{%- if edit_form.documents is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.documents) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    {# {{ form(delete_form) }} #}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
{%- if edit_form.attendee is defined -%}
 | 
			
		||||
    {{ form_row(edit_form.attendee) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
.. status
 | 
			
		||||
 | 
			
		||||
{% set person_id = null %}
 | 
			
		||||
{% if entity.person %}
 | 
			
		||||
    {% set person_id = entity.person.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% set accompanying_course_id = null %}
 | 
			
		||||
{% if accompanyingCourse %}
 | 
			
		||||
    {% set accompanying_course_id = accompanyingCourse.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id  } ) }}" class="btn btn-cancel">
 | 
			
		||||
                {{ 'Cancel'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
{{ form_end(edit_form) }}
 | 
			
		||||
 | 
			
		||||
{# {{ form(delete_form) }} #}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title  'Update activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
<div class="activity-edit">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            <div id="activity"></div> {# <=== vue component #}
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:edit.html.twig' %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
    {{ parent() }}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        window.addEventListener('DOMContentLoaded', function (e) {
 | 
			
		||||
            chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', 
 | 
			
		||||
            '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
        });
 | 
			
		||||
        window.activity = {{ activity_json|json_encode|raw }}; 
 | 
			
		||||
    </script>
 | 
			
		||||
    {{ encore_entry_script_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block css %}
 | 
			
		||||
    {{ parent() }}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    {{ encore_entry_link_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,51 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title  'Update activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
<div class="activity-edit">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            <div id="activity"></div> {# <=== vue component #}
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:edit.html.twig' %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        window.addEventListener('DOMContentLoaded', function (e) {
 | 
			
		||||
            chill.displayAlertWhenLeavingModifiedForm('form[name="{{ edit_form.vars.form.vars.name }}"]', 
 | 
			
		||||
            '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
        });
 | 
			
		||||
        window.activity = {{ activity_json|json_encode|raw }};
 | 
			
		||||
    </script>
 | 
			
		||||
    {{ encore_entry_script_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block css %}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    {{ encore_entry_link_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,87 +1,197 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillPerson/layout.html.twig"  %}
 | 
			
		||||
{% set person_id = null %}
 | 
			
		||||
{% if person %}
 | 
			
		||||
    {% set person_id = person.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
{% set accompanying_course_id = null %}
 | 
			
		||||
{% if accompanyingCourse %}
 | 
			
		||||
    {% set accompanying_course_id = accompanyingCourse.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
 | 
			
		||||
<h2>{{ 'Activity list' |trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
    <h2>{{ 'Activity list' |trans }}</h2>
 | 
			
		||||
{% if activities|length == 0 %}
 | 
			
		||||
    <p class="chill-no-data-statement">
 | 
			
		||||
        {{ "There isn't any activities."|trans }}
 | 
			
		||||
        <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create button-small"></a>
 | 
			
		||||
    </p>
 | 
			
		||||
{% else %}
 | 
			
		||||
 | 
			
		||||
    {% if activities|length == 0 %}
 | 
			
		||||
        <p class="chill-no-data-statement">
 | 
			
		||||
            {{ "There isn't any activities."|trans }}
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_new', {'person_id': person.id}) }}" class="sc-button bt-create button-small"></a>
 | 
			
		||||
        </p>
 | 
			
		||||
    {% else %}
 | 
			
		||||
    <table class="records_list">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th class="chill-red">{{'Date' | trans }}</th>
 | 
			
		||||
                <th class="chill-green">{{'Duration Time' | trans }}</th>
 | 
			
		||||
                <th class="chill-orange">{{'Reasons' | trans}}</th>
 | 
			
		||||
                <th>{{'Type' | trans}}</th>
 | 
			
		||||
                <th> </th>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for activity in activities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>{% if activity.date %}{{ activity.date|format_date('long') }}{% endif %}</td>
 | 
			
		||||
                <td>{{ activity.durationTime|date('H:i') }}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    {% if activity.comment.comment is not empty %}
 | 
			
		||||
                            {{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
 | 
			
		||||
<div class="flex-table list-records context-{{ context }}">
 | 
			
		||||
    <!--
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th class="chill-red">{{'Date' | trans }}</th>
 | 
			
		||||
            <th class="chill-green">{{'Duration Time' | trans }}</th>
 | 
			
		||||
            <th class="chill-orange">{{'Reasons' | trans}}</th>
 | 
			
		||||
            <th>{{'Type' | trans}}</th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </thead>
 | 
			
		||||
-->
 | 
			
		||||
    {% for activity in activities %}
 | 
			
		||||
        {% set t = activity.type %}
 | 
			
		||||
        <div class="item-bloc">
 | 
			
		||||
            <div class="item-row main">
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                                        
 | 
			
		||||
                    {% if activity.date %}
 | 
			
		||||
                        <h3>{{ activity.date|format_date('long') }}</h3>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                    {%- if activity.reasons is empty -%}
 | 
			
		||||
                        {{ 'No reason associated'|trans }}
 | 
			
		||||
                    {%- else -%}
 | 
			
		||||
                        {% for r in activity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}
 | 
			
		||||
                    {%- endif -%}
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>{{ activity.type.name | localize_translatable_string }}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                   
 | 
			
		||||
                    <div class="duration">
 | 
			
		||||
                      {% if t.durationTimeVisible > 0 %}
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <i class="fa fa-fw fa-hourglass-end"></i>
 | 
			
		||||
                            {{ activity.durationTime|date('H:i') }}
 | 
			
		||||
                        </p>
 | 
			
		||||
                      {% endif %}
 | 
			
		||||
                        
 | 
			
		||||
                        {% if activity.travelTime and t.travelTimeVisible %}
 | 
			
		||||
                        <p>
 | 
			
		||||
                            <i class="fa fa-fw fa-car"></i>
 | 
			
		||||
                            {{ activity.travelTime|date('H:i') }}
 | 
			
		||||
                        </p>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    {% if context == 'person' and activity.accompanyingPeriod is not empty %}
 | 
			
		||||
                      <div class="accompanyingPeriodLink" style="margin-top: 1rem">
 | 
			
		||||
                        <a 
 | 
			
		||||
                           href="{{ chill_path_add_return_path(
 | 
			
		||||
                            "chill_person_accompanying_course_index",
 | 
			
		||||
                            { 'accompanying_period_id': activity.accompanyingPeriod.id }
 | 
			
		||||
                            ) }}"
 | 
			
		||||
                           >
 | 
			
		||||
                          <i class="fa fa-random"></i>
 | 
			
		||||
                          {{ activity.accompanyingPeriod.id }}
 | 
			
		||||
                        </a>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                    
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                    <ul class="list-content">
 | 
			
		||||
                        {% if activity.user and t.userVisible %}
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                        
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <b>{{ activity.type.name | localize_translatable_string }}</b>
 | 
			
		||||
                            
 | 
			
		||||
                            {% if activity.attendee is not null and t.attendeeVisible %}
 | 
			
		||||
                                {% if activity.attendee %}
 | 
			
		||||
                                    {{ '→ ' ~ 'present'|trans|capitalize }} 
 | 
			
		||||
                                {% else %} 
 | 
			
		||||
                                    {{ '→ ' ~ 'not present'|trans|capitalize }}
 | 
			
		||||
                                {% endif %}
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
                        </li>
 | 
			
		||||
                        
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <b>{{ 'location'|trans ~ ': ' }}</b>
 | 
			
		||||
                            Domicile de l'usager
 | 
			
		||||
                            {#
 | 
			
		||||
                                {% if activity.location %}{{ activity.location }}{% endif %}
 | 
			
		||||
                            #}
 | 
			
		||||
                        </li>
 | 
			
		||||
                        
 | 
			
		||||
                        {%- if t.reasonsVisible -%}
 | 
			
		||||
                        <li>
 | 
			
		||||
                            {%- if activity.reasons is empty -%}
 | 
			
		||||
                                <span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
 | 
			
		||||
                            {%- else -%}
 | 
			
		||||
                                {% for r in activity.reasons %}
 | 
			
		||||
                                    {{ r|chill_entity_render_box }}
 | 
			
		||||
                                {% endfor %}
 | 
			
		||||
                            {%- endif -%}
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
 | 
			
		||||
                        {%- if t.socialIssuesVisible %}
 | 
			
		||||
                            <li class="social-issues">
 | 
			
		||||
                                {%- if activity.socialIssues is empty -%}
 | 
			
		||||
                                    <span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span>
 | 
			
		||||
                                {%- else -%}
 | 
			
		||||
                                    {% for r in activity.socialIssues %}
 | 
			
		||||
                                      {{ r|chill_entity_render_box }}
 | 
			
		||||
                                    {% endfor %}
 | 
			
		||||
                                {%- endif -%}
 | 
			
		||||
                            </li>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                        
 | 
			
		||||
                        {%- if t.socialActionsVisible -%}
 | 
			
		||||
                            <li class="social-actions">
 | 
			
		||||
                                {%- if activity.socialActions is empty -%}
 | 
			
		||||
                                    <span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
 | 
			
		||||
                                {%- else -%}
 | 
			
		||||
                                    {% for r in activity.socialActions %}
 | 
			
		||||
                                        <span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
 | 
			
		||||
                                    {% endfor %}
 | 
			
		||||
                                {%- endif -%}
 | 
			
		||||
                            </li>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
 | 
			
		||||
                        
 | 
			
		||||
                    </ul>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-show "></a>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-show "></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {# TOOD
 | 
			
		||||
                        {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
 | 
			
		||||
                        #}
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update "></a>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-update "></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {# TOOD
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                        {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
 | 
			
		||||
                        #}
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person.id } ) }}" class="sc-button bt-delete "></a>
 | 
			
		||||
                            <a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete "></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {#
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
                        #}
 | 
			
		||||
                    </ul>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            
 | 
			
		||||
            {%  
 | 
			
		||||
                if activity.comment.comment is not empty
 | 
			
		||||
                or activity.persons|length > 0
 | 
			
		||||
                or activity.thirdParties|length > 0
 | 
			
		||||
                or activity.users|length > 0 
 | 
			
		||||
            %}
 | 
			
		||||
            <div class="item-row details">
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_new', {'person_id': person.id}) }}" class="sc-button bt-create">
 | 
			
		||||
                {{ 'Add a new activity' | trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
                    {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
 | 
			
		||||
                </div>
 | 
			
		||||
                
 | 
			
		||||
                {% if activity.comment.comment is not empty %}
 | 
			
		||||
                <div class="item-col comment">
 | 
			
		||||
                    {{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
 | 
			
		||||
                </div>
 | 
			
		||||
                {% endif %}
 | 
			
		||||
            </div>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
</div>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if context != 'person' %}
 | 
			
		||||
{# TODO set this condition in configuration #}
 | 
			
		||||
  <ul class="record_actions">
 | 
			
		||||
      <li>
 | 
			
		||||
          <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
 | 
			
		||||
              {{ 'Add a new activity' | trans }}
 | 
			
		||||
          </a>
 | 
			
		||||
      </li>
 | 
			
		||||
  </ul>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
    {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,50 +1,102 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillPerson/layout.html.twig"  %}
 | 
			
		||||
<h1>{{ "Activity creation"|trans ~ ' :' }}</h1>
 | 
			
		||||
<h2 class="chill-green mb-4">{{ entity.type.name|localize_translatable_string }}</h2>
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
 | 
			
		||||
{{ form_start(form) }}
 | 
			
		||||
{{ form_errors(form) }}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity creation' |trans %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
    <h2 class="chill-red">{{ "Activity creation"|trans }}</h1>
 | 
			
		||||
{%- if form.emergency is defined -%}
 | 
			
		||||
    {{ form_row(form.emergency) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    {{ form_start(form) }}
 | 
			
		||||
{%- if form.sentReceived is defined -%}
 | 
			
		||||
    {{ form_row(form.sentReceived) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if form.user is defined -%}
 | 
			
		||||
    {{ form_row(form.user) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if form.scope is defined -%}
 | 
			
		||||
    {{ form_row(form.scope) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    <h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
{%- if form.socialIssues is defined -%}
 | 
			
		||||
    {{ form_row(form.socialIssues) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
    {{ form_row(form.date) }}
 | 
			
		||||
    {{ form_row(form.durationTime) }}
 | 
			
		||||
    {{ form_row(form.type) }}
 | 
			
		||||
    {{ form_row(form.attendee) }}
 | 
			
		||||
{%- if form.socialActions is defined -%}
 | 
			
		||||
    {{ form_row(form.socialActions) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<div id="social-issues-acc"></div>
 | 
			
		||||
 | 
			
		||||
{%- if form.reasons is defined -%}
 | 
			
		||||
    {{ form_row(form.reasons) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{%- if form.persons is defined -%}
 | 
			
		||||
    {{ form_widget(form.persons) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{%- if form.thirdParties is defined -%}
 | 
			
		||||
    {{ form_widget(form.thirdParties) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
{%- if form.users is defined -%}
 | 
			
		||||
    {{ form_widget(form.users) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<div id="add-persons"></div>
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{%- if form.date is defined -%}
 | 
			
		||||
    {{ form_row(form.date) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
.. location
 | 
			
		||||
 | 
			
		||||
{%- if form.durationTime is defined -%}
 | 
			
		||||
    {{ form_row(form.durationTime) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if form.travelTime is defined -%}
 | 
			
		||||
    {{ form_row(form.travelTime) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{%- if form.comment is defined -%}
 | 
			
		||||
    .. public and private
 | 
			
		||||
    {{ form_row(form.comment) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
        <div class="grid-12 centered sticky-form-buttons">
 | 
			
		||||
            <button class="sc-button green margin-10" type="submit"><i class="fa fa-save"></i> {{ 'Add a new activity'|trans }}</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
{%- if form.documents is defined -%}
 | 
			
		||||
    {{ form_row(form.documents) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
    chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
</script>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
{%- if form.attendee is defined -%}
 | 
			
		||||
    {{ form_row(form.attendee) }}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
.. status
 | 
			
		||||
 | 
			
		||||
<ul class="record_actions sticky-form-buttons">
 | 
			
		||||
  <li class="cancel">
 | 
			
		||||
    <a 
 | 
			
		||||
      class="btn btn-cancel"
 | 
			
		||||
      {%- if context == 'person' -%} 
 | 
			
		||||
      href="{{ chill_return_path_or('chill_activity_activity_list', { 'person_id': person.id } )}}"
 | 
			
		||||
      {%- else -%}
 | 
			
		||||
      href="{{ chill_return_path_or('chill_activity_activity_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
 | 
			
		||||
      {%- endif -%}
 | 
			
		||||
      >
 | 
			
		||||
      {{ 'Cancel'|trans|chill_return_path_label }}
 | 
			
		||||
    </a>
 | 
			
		||||
  </li>
 | 
			
		||||
  <li>
 | 
			
		||||
    <button class="btn btn-create" type="submit">
 | 
			
		||||
      {{ 'Create'|trans }}
 | 
			
		||||
    </button>
 | 
			
		||||
  </li>
 | 
			
		||||
</ul>
 | 
			
		||||
{{ form_end(form) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity creation' |trans %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
<div class="activity-new">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            <div id="activity"></div> {# <=== vue component #}
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'accompanyingCourse'} %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>            
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
    {{ parent() }}
 | 
			
		||||
    {{ encore_entry_script_tags('async_upload') }}
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        window.addEventListener('DOMContentLoaded', function (e) {
 | 
			
		||||
            chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', 
 | 
			
		||||
            '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
        });
 | 
			
		||||
        window.activity = {{ activity_json|json_encode|raw }}; 
 | 
			
		||||
    </script>
 | 
			
		||||
    {{ encore_entry_script_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block css %}
 | 
			
		||||
    {{ parent() }}
 | 
			
		||||
    <link rel="stylesheet" href="{{ asset('build/async_upload.css') }}"/>
 | 
			
		||||
    {{ encore_entry_link_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,35 @@
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity creation' |trans %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
<div class="activity-new">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            <div id="activity"></div> {# <=== vue component #}
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:new.html.twig' with {'context': 'person'} %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    <script type="text/javascript">
 | 
			
		||||
        window.addEventListener('DOMContentLoaded', function (e) {
 | 
			
		||||
            chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]', 
 | 
			
		||||
            '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
 | 
			
		||||
        });
 | 
			
		||||
        window.activity = {{ activity_json|json_encode|raw }};
 | 
			
		||||
    </script>
 | 
			
		||||
    {{ encore_entry_script_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block css %}
 | 
			
		||||
    {{ encore_entry_link_tags('async_upload') }}
 | 
			
		||||
    {{ encore_entry_link_tags('vue_activity') }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
<h2 class="chill-red">{{ "Activity creation"|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
{# TODO: refaire l'html css des tuilles #}
 | 
			
		||||
 | 
			
		||||
{% for row in data %}
 | 
			
		||||
    <h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
 | 
			
		||||
    <div class="activity-row">
 | 
			
		||||
        {% for activityType in row.activityTypes %}
 | 
			
		||||
 | 
			
		||||
            {% set person_id = null %}
 | 
			
		||||
            {% if person %}
 | 
			
		||||
                {% set person_id = person.id %}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
 | 
			
		||||
            {% set accompanying_course_id = null %}
 | 
			
		||||
            {% if accompanyingCourse %}
 | 
			
		||||
                {% set accompanying_course_id = accompanyingCourse.id %}
 | 
			
		||||
            {% endif %}
 | 
			
		||||
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
 | 
			
		||||
 | 
			
		||||
                <div class="bloc btn btn-primary btn-lg btn-block">
 | 
			
		||||
                    {{ activityType.name|localize_translatable_string }}
 | 
			
		||||
                </div>
 | 
			
		||||
            </a>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
    </div>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity creation'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    {% include 'ChillActivityBundle:Activity:selectType.html.twig' %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity creation'|trans %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent %}
 | 
			
		||||
    {% include 'ChillActivityBundle:Activity:selectType.html.twig' %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,68 +1,137 @@
 | 
			
		||||
{% extends "@ChillPerson/layout.html.twig"  %}
 | 
			
		||||
{%- set t = entity.type -%}
 | 
			
		||||
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
<h1>
 | 
			
		||||
  {{ "Activity"|trans }}
 | 
			
		||||
  {%- if t.emergencyVisible and entity.emergency -%}
 | 
			
		||||
  <span class="badge bg-secondary">
 | 
			
		||||
    {{- 'Emergency'|trans -}}
 | 
			
		||||
  </span>
 | 
			
		||||
{%- endif -%}
 | 
			
		||||
</h1>
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity'|trans %}
 | 
			
		||||
<dl class="chill_view_data">
 | 
			
		||||
 | 
			
		||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
 | 
			
		||||
    <dt class="inline">{{ 'by'|trans|capitalize }}</dt>
 | 
			
		||||
    <dd>{{ entity.user }}</dd>
 | 
			
		||||
 | 
			
		||||
{% block personcontent -%}
 | 
			
		||||
    <h1 >{{ "Activity"|trans }}</h1>
 | 
			
		||||
    <dt class="inline">{{ 'Type'|trans }}</dt>
 | 
			
		||||
    <dd>{{ entity.type.name | localize_translatable_string }}</dd>
 | 
			
		||||
 | 
			
		||||
    <dl class="chill_view_data">
 | 
			
		||||
        <dt class="inline">{{ 'User'|trans }}</dt>
 | 
			
		||||
        <dd>{{ entity.user }}</dd>
 | 
			
		||||
    {%- if entity.scope -%}
 | 
			
		||||
        <dt class="inline">{{ 'Scope'|trans }}</dt>
 | 
			
		||||
        <dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
        <h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
        <dt class="inline">{{ 'Person'|trans }}</dt>
 | 
			
		||||
        <dd>{{ entity.person }}</dd>
 | 
			
		||||
 | 
			
		||||
        <dt class="inline">{{ 'Date'|trans }}</dt>
 | 
			
		||||
        <dd>{{ entity.date|format_date('long') }}</dd>
 | 
			
		||||
        <dt class="inline">{{ 'Duration Time'|trans }}</dt>
 | 
			
		||||
        <dd>{{ entity.durationTime|date('H:i') }}</dd>
 | 
			
		||||
        <dt class="inline">{{ 'Type'|trans }}</dt>
 | 
			
		||||
        <dd>{{ entity.type.name | localize_translatable_string }}</dd>
 | 
			
		||||
 | 
			
		||||
        <dt class="inline">{{ 'Attendee'|trans }}</dt>
 | 
			
		||||
        <dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
 | 
			
		||||
 | 
			
		||||
        <dt class="inline">{{ 'Reasons'|trans }}</dt>
 | 
			
		||||
        {%- if entity.reasons is empty -%}
 | 
			
		||||
        <dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
 | 
			
		||||
        {%- else -%}
 | 
			
		||||
        <dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
 | 
			
		||||
        {%- endif -%}
 | 
			
		||||
 | 
			
		||||
        <dt class="inline">{{ 'Comment'|trans }}</dt>
 | 
			
		||||
        {%- if entity.comment is empty -%}
 | 
			
		||||
            <dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
 | 
			
		||||
        {%- else -%}
 | 
			
		||||
            <dd>{{ entity.comment|chill_entity_render_box }}</dd>
 | 
			
		||||
        {%- endif -%}
 | 
			
		||||
 | 
			
		||||
    </dl>
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a class="sc-button bt-cancel" href="{{ path('chill_activity_activity_list', { 'person_id': person.id } ) }}">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
        <a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person.id }) }}">
 | 
			
		||||
            {{ 'Edit the activity'|trans }}
 | 
			
		||||
        </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        {% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person.id } ) }}" class="sc-button bt-delete">
 | 
			
		||||
                {{ 'Delete'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
    {% if t.socialIssuesVisible %}
 | 
			
		||||
      <dt class="inline">{{ 'Social issues'|trans }}</dt>
 | 
			
		||||
      <dd>
 | 
			
		||||
        {% if entity.socialIssues|length == 0 %}
 | 
			
		||||
          <p class="chill-no-data-statement">{{ 'Any social issues'|trans }}</p>
 | 
			
		||||
        {% else %}
 | 
			
		||||
          {% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </ul>
 | 
			
		||||
      </dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
{% endblock personcontent %}
 | 
			
		||||
    {% if t.socialActionsVisible %}
 | 
			
		||||
      <dt class="inline">{{ 'Social actions'|trans }}</dt>
 | 
			
		||||
      <dd>
 | 
			
		||||
        {% if entity.socialActions|length == 0 %}
 | 
			
		||||
          <p class="chill-no-data-statement">{{ 'Any social actions'|trans }}</p>
 | 
			
		||||
        {% else %}
 | 
			
		||||
          {% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
 | 
			
		||||
        {% endif %}
 | 
			
		||||
      </dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if t.reasonsVisible %}
 | 
			
		||||
    <dt class="inline">{{ 'Reasons'|trans }}</dt>
 | 
			
		||||
    {%- if entity.reasons is empty -%}
 | 
			
		||||
    <dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
 | 
			
		||||
    {%- else -%}
 | 
			
		||||
    <dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
 | 
			
		||||
    {%- endif -%}
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
 | 
			
		||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
 | 
			
		||||
 | 
			
		||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
    <dt class="inline">{{ 'Date'|trans }}</dt>
 | 
			
		||||
    <dd>{{ entity.date|format_date('long') }}</dd>
 | 
			
		||||
 | 
			
		||||
    {% if t.durationTimeVisible %}
 | 
			
		||||
    <dt class="inline">{{ 'Duration Time'|trans }}</dt>
 | 
			
		||||
    <dd>{{ entity.durationTime|date('H:i') }}</dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if t.travelTimeVisible %}
 | 
			
		||||
    <dt class="inline">{{ 'Travel Time'|trans }}</dt>
 | 
			
		||||
    <dd>{{ entity.travelTime|date('H:i') }}</dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if t.commentVisible %}
 | 
			
		||||
    <dt class="inline">{{ 'Comment'|trans }}</dt>
 | 
			
		||||
      {%- if entity.comment.empty -%}
 | 
			
		||||
          <dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
 | 
			
		||||
      {%- else -%}
 | 
			
		||||
          <dd>{{ entity.comment|chill_entity_render_box }}</dd>
 | 
			
		||||
      {%- endif -%}
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if t.documentsVisible and entity.documents|length > 0 %}
 | 
			
		||||
      <dt>{{ 'Documents'|trans }}</dt>
 | 
			
		||||
      <dd>
 | 
			
		||||
        <ul>
 | 
			
		||||
        {% for d in entity.documents %}
 | 
			
		||||
          <li>{{ m.download_button(d) }}</li>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </ul>
 | 
			
		||||
      </dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if t.attendeeVisible %}
 | 
			
		||||
    <dt class="inline">{{ 'Attendee'|trans }}</dt>
 | 
			
		||||
    <dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
</dl>
 | 
			
		||||
 | 
			
		||||
{% set person_id = null %}
 | 
			
		||||
{% if person %}
 | 
			
		||||
    {% set person_id = person.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% set accompanying_course_id = null %}
 | 
			
		||||
{% if accompanyingCourse %}
 | 
			
		||||
    {% set accompanying_course_id = accompanyingCourse.id %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
<ul class="record_actions sticky-form-buttons">
 | 
			
		||||
    <li class="cancel">
 | 
			
		||||
        <a class="btn btn-cancel" href="{{ path('chill_activity_activity_list', { 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}">
 | 
			
		||||
            {{ 'Back to the list'|trans }}
 | 
			
		||||
        </a>
 | 
			
		||||
    </li>
 | 
			
		||||
    <li>
 | 
			
		||||
        <a class="btn btn-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
 | 
			
		||||
            {{ 'Edit'|trans }}
 | 
			
		||||
        </a>
 | 
			
		||||
    </li>
 | 
			
		||||
    
 | 
			
		||||
    {# TODO
 | 
			
		||||
    {% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
 | 
			
		||||
    #}
 | 
			
		||||
    
 | 
			
		||||
    <li>
 | 
			
		||||
        <a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
 | 
			
		||||
            {{ 'Delete'|trans }}
 | 
			
		||||
        </a>
 | 
			
		||||
    </li>
 | 
			
		||||
    
 | 
			
		||||
    {#
 | 
			
		||||
    {% endif %}
 | 
			
		||||
    #}
 | 
			
		||||
</ul>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
 | 
			
		||||
 | 
			
		||||
{% block content -%}
 | 
			
		||||
<div class="activity-show">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div> 
 | 
			
		||||
{% endblock content %}
 | 
			
		||||
@@ -0,0 +1,4 @@
 | 
			
		||||
 | 
			
		||||
{{ dump(notification) }}
 | 
			
		||||
 | 
			
		||||
<a href="{{ path('chill_activity_activity_show', {'id': notification.relatedEntityId })  }}">Go to Activity</a>
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
{% extends "@ChillPerson/Person/layout.html.twig"  %}
 | 
			
		||||
 | 
			
		||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
 | 
			
		||||
 | 
			
		||||
{% block title 'Activity'|trans %}
 | 
			
		||||
 | 
			
		||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
 | 
			
		||||
 | 
			
		||||
{% block personcontent -%}
 | 
			
		||||
<div class="activity-show">
 | 
			
		||||
    <div class="row justify-content-center">
 | 
			
		||||
        <div class="col-md-10 col-xxl">
 | 
			
		||||
            
 | 
			
		||||
            {% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>                
 | 
			
		||||
{% endblock personcontent %}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block title %}
 | 
			
		||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
 | 
			
		||||
    {% block content_form_actions_view %}{% endblock %}
 | 
			
		||||
    {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
{% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,44 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    <h1>{{ 'ActivityPresence list'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    <table class="records_list">
 | 
			
		||||
        <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for entity in entities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
                <td style="text-align:center;">
 | 
			
		||||
                    {%- if entity.active -%}
 | 
			
		||||
                        <i class="fa fa-check-square-o"></i>
 | 
			
		||||
                    {%- else -%}
 | 
			
		||||
                        <i class="fa fa-square-o"></i>
 | 
			
		||||
                    {%- endif -%}
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('chill_crud_activity_presence_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                    </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_crud_activity_presence_new') }}" class="btn btn-create">
 | 
			
		||||
                {{ 'Create a new activity presence'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block title %}
 | 
			
		||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
 | 
			
		||||
    {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
{% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -26,10 +26,10 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_row(edit_form.submit, { 'attr': { 'class' : 'sc-button orange' } } ) }}
 | 
			
		||||
            {{ form_row(edit_form.submit, { 'attr': { 'class' : 'btn btn-chill-orange' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,10 +33,10 @@
 | 
			
		||||
                <td>
 | 
			
		||||
                <ul class="record_actions">
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreason_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreason_show', { 'id': entity.id }) }}" class="btn btn-show" title="{{ 'show'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreason_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreason_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
@@ -47,7 +47,7 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason_new') }}" class="sc-button bt-new">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason_new') }}" class="btn btn-new">
 | 
			
		||||
                {{ 'Create a new activity reason'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -26,10 +26,10 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_row(form.submit, { 'attr': { 'class' : 'sc-button bt-new' } } ) }}
 | 
			
		||||
            {{ form_row(form.submit, { 'attr': { 'class' : 'btn btn-new' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,12 +40,12 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="sc-button bt-cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason') }}" class="btn btn-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreason_edit', { 'id': entity.id }) }}" class="btn btn-edit">
 | 
			
		||||
                {{ 'Edit'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,12 +25,12 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="sc-button bt-cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_row(edit_form.submit, { 'attr': { 'class': 'sc-button bt-edit' } } ) }}
 | 
			
		||||
            {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-edit' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,10 +34,10 @@
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}" class="btn btn-show" title="{{ 'show'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
@@ -48,7 +48,7 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory_new') }}" class="sc-button bt-new">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory_new') }}" class="btn btn-new">
 | 
			
		||||
                {{ 'Create a new activity category reason'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,10 +25,10 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(form.submit, { 'attr': { 'class' : 'sc-button bt-new' } } ) }}
 | 
			
		||||
            {{ form_widget(form.submit, { 'attr': { 'class' : 'btn btn-new' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -39,12 +39,12 @@
 | 
			
		||||
    </table>
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="sc-button bt-cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory') }}" class="btn btn-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
 | 
			
		||||
            <a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}" class="btn btn-edit">
 | 
			
		||||
                {{ 'Edit'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,40 +1,12 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    <h1>{{ 'ActivityType edit'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    {{ form_start(edit_form) }}
 | 
			
		||||
    {{ form_row(edit_form.active) }}
 | 
			
		||||
    {{ form_row(edit_form.name) }}
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'sc-button bt-update' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
{% block title %}
 | 
			
		||||
    {% include('@ChillMain/CRUD/_edit_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
 | 
			
		||||
        {% block content_form_actions_view %}{% endblock %}
 | 
			
		||||
        {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for entity in entities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
 | 
			
		||||
                <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
                <td style="text-align:center;">
 | 
			
		||||
                {%- if entity.active -%}
 | 
			
		||||
                    <i class="fa fa-check-square-o"></i>
 | 
			
		||||
@@ -41,10 +41,7 @@
 | 
			
		||||
                <td>
 | 
			
		||||
                <ul class="record_actions">
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                        <a href="{{ path('chill_crud_activity_type_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
@@ -55,7 +52,7 @@
 | 
			
		||||
 | 
			
		||||
        <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activitytype_new') }}" class="sc-button bt-create">
 | 
			
		||||
            <a href="{{ path('chill_crud_activity_type_new') }}" class="btn btn-create">
 | 
			
		||||
                {{ 'Create a new activity type'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,38 +1,11 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    <h1>{{ 'ActivityType creation'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    {{ form_start(form) }}
 | 
			
		||||
        {{ form_row(form.active) }}
 | 
			
		||||
    {{ form_row(form.name) }}
 | 
			
		||||
    
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(form.submit, { 'attr' : { 'class' : 'sc-button bt-new' } } ) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
    
 | 
			
		||||
{% block title %}
 | 
			
		||||
    {% include('@ChillMain/CRUD/_new_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_new_content.html.twig' %}
 | 
			
		||||
        {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,42 +0,0 @@
 | 
			
		||||
{#
 | 
			
		||||
 * Copyright (C) 2014, 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/>.
 | 
			
		||||
#}
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    <h1>{{ 'ActivityType'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    <table class="record_properties">
 | 
			
		||||
        <tbody>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
                <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li class="cancel">
 | 
			
		||||
            <a href="{{ path('chill_activity_activitytype') }}" class="sc-button bt-cancel">
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
 | 
			
		||||
                {{ 'Edit'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block title %}
 | 
			
		||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
 | 
			
		||||
    {% block content_form_actions_view %}{% endblock %}
 | 
			
		||||
    {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
{% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,44 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    <h1>{{ 'ActivityTypeCategory list'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    <table class="records_list">
 | 
			
		||||
        <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for entity in entities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
                <td style="text-align:center;">
 | 
			
		||||
                    {%- if entity.active -%}
 | 
			
		||||
                        <i class="fa fa-check-square-o"></i>
 | 
			
		||||
                    {%- else -%}
 | 
			
		||||
                        <i class="fa fa-square-o"></i>
 | 
			
		||||
                    {%- endif -%}
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('chill_crud_activity_type_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                    </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_crud_activity_type_category_new') }}" class="btn btn-create">
 | 
			
		||||
                {{ 'Create a new activity type category'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block title %}
 | 
			
		||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
 | 
			
		||||
    {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
{% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
 | 
			
		||||
 | 
			
		||||
<div>
 | 
			
		||||
    <h3>{{ activity.date|format_date('long') }}<span class="activity"> / {{ 'Activity'|trans }}</span></h3>
 | 
			
		||||
  <h3>{{ activity.date|format_date('long') }}<span class="activity"> / {{ 'Activity'|trans }}</span>{% if 'person' != context %} / {{ activity.person|chill_entity_render_box({'addLink': true}) }}{% endif %}</h3>
 | 
			
		||||
    <div class="statement">
 | 
			
		||||
        <span class="statement">{{ '%user% has done an %activity_type%'|trans(
 | 
			
		||||
           {
 | 
			
		||||
             '%user%' : user,
 | 
			
		||||
             '%user%' : activity.user,
 | 
			
		||||
             '%activity_type%': activity.type.name|localize_translatable_string,
 | 
			
		||||
             '%date%' : activity.date|format_date('long') }
 | 
			
		||||
        ) }}</span>
 | 
			
		||||
@@ -29,13 +29,13 @@
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions">
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_show', { 'person_id': person.id, 'id': activity.id} ) }}" class="sc-button bt-view">
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_show', { 'person_id': activity.person.id, 'id': activity.id} ) }}" class="btn btn-view">
 | 
			
		||||
                {{ 'Show the activity'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_edit', { 'person_id': person.id, 'id': activity.id} ) }}" class="sc-button bt-edit">
 | 
			
		||||
            <a href="{{ path('chill_activity_activity_edit', { 'person_id': activity.person.id, 'id': activity.id} ) }}" class="btn btn-edit">
 | 
			
		||||
                {{ 'Edit the activity'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@
 | 
			
		||||
namespace Chill\ActivityBundle\Timeline;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
 | 
			
		||||
use Chill\ActivityBundle\Repository\ActivityACLAwareRepository;
 | 
			
		||||
use Doctrine\ORM\EntityManager;
 | 
			
		||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
 | 
			
		||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
 | 
			
		||||
@@ -28,13 +29,13 @@ use Symfony\Component\Security\Core\Role\Role;
 | 
			
		||||
use Doctrine\ORM\Mapping\ClassMetadata;
 | 
			
		||||
use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\MainBundle\Entity\Scope;
 | 
			
		||||
use Chill\ActivityBundle\Entity\Activity;
 | 
			
		||||
use Chill\MainBundle\Timeline\TimelineSingleQuery;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Provide activity for inclusion in timeline
 | 
			
		||||
 *
 | 
			
		||||
 * @author Julien Fastré <julien.fastre@champs-libres.coop>
 | 
			
		||||
 * @author Champs Libres <info@champs-libres.coop>
 | 
			
		||||
 */
 | 
			
		||||
*/
 | 
			
		||||
class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
@@ -55,6 +56,10 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
     * @var \Chill\MainBundle\Entity\User 
 | 
			
		||||
     */
 | 
			
		||||
    protected $user;
 | 
			
		||||
 | 
			
		||||
    protected ActivityACLAwareRepository $aclAwareRepository;
 | 
			
		||||
 | 
			
		||||
    private const SUPPORTED_CONTEXTS = [ 'center', 'person'];
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * TimelineActivityProvider constructor.
 | 
			
		||||
@@ -66,11 +71,13 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        EntityManager $em,
 | 
			
		||||
        AuthorizationHelper $helper,
 | 
			
		||||
        TokenStorageInterface $storage
 | 
			
		||||
        TokenStorageInterface $storage,
 | 
			
		||||
        ActivityACLAwareRepository $aclAwareRepository
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        $this->em = $em;
 | 
			
		||||
        $this->helper = $helper;
 | 
			
		||||
        $this->aclAwareRepository = $aclAwareRepository;
 | 
			
		||||
        
 | 
			
		||||
        if (!$storage->getToken()->getUser() instanceof \Chill\MainBundle\Entity\User)
 | 
			
		||||
        {
 | 
			
		||||
@@ -86,67 +93,69 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
     */
 | 
			
		||||
    public function fetchQuery($context, array $args)
 | 
			
		||||
    {
 | 
			
		||||
        $this->checkContext($context);
 | 
			
		||||
        if ('center' === $context) {
 | 
			
		||||
            return TimelineSingleQuery::fromArray($this->aclAwareRepository
 | 
			
		||||
                ->queryTimelineIndexer($context, $args));
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata('ChillActivityBundle:Activity');
 | 
			
		||||
        $metadataPerson = $this->em->getClassMetadata('ChillPersonBundle:Person');
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
 | 
			
		||||
        [$where, $parameters] =  $this->getWhereClauseForPerson($args['person']);
 | 
			
		||||
        
 | 
			
		||||
        return array(
 | 
			
		||||
        return TimelineSingleQuery::fromArray([
 | 
			
		||||
           'id' => $metadataActivity->getTableName()
 | 
			
		||||
                .'.'.$metadataActivity->getColumnName('id'),
 | 
			
		||||
           'type' => 'activity',
 | 
			
		||||
           'date' => $metadataActivity->getTableName()
 | 
			
		||||
                .'.'.$metadataActivity->getColumnName('date'),
 | 
			
		||||
           'FROM' => $this->getFromClause($metadataActivity, $metadataPerson),
 | 
			
		||||
           'WHERE' => $this->getWhereClause($metadataActivity, $metadataPerson,
 | 
			
		||||
                   $args['person'])
 | 
			
		||||
        );
 | 
			
		||||
           'FROM' => $this->getFromClausePerson($args['person']),
 | 
			
		||||
           'WHERE' => $where,
 | 
			
		||||
           'parameters' => $parameters
 | 
			
		||||
       ]);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private function getWhereClause(ClassMetadata $metadataActivity, 
 | 
			
		||||
            ClassMetadata $metadataPerson, Person $person)
 | 
			
		||||
    private function getWhereClauseForPerson(Person $person)
 | 
			
		||||
    {
 | 
			
		||||
        $role = new Role('CHILL_ACTIVITY_SEE');
 | 
			
		||||
        $reachableCenters = $this->helper->getReachableCenters($this->user, 
 | 
			
		||||
                $role);
 | 
			
		||||
        $parameters = [];
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
        $associationMapping = $metadataActivity->getAssociationMapping('person');
 | 
			
		||||
        
 | 
			
		||||
        if (count($reachableCenters) === 0) {
 | 
			
		||||
            return 'FALSE = TRUE';
 | 
			
		||||
        $role = new Role('CHILL_ACTIVITY_SEE');
 | 
			
		||||
        $reachableScopes =  $this->helper->getReachableScopes($this->user,
 | 
			
		||||
            $role, $person->getCenter());
 | 
			
		||||
        $whereClause = sprintf(' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ');
 | 
			
		||||
        $scopes_ids = [];
 | 
			
		||||
 | 
			
		||||
        // first parameter: activity.person_id 
 | 
			
		||||
        $parameters[] = $person->getId();
 | 
			
		||||
 | 
			
		||||
        // loop on reachable scopes 
 | 
			
		||||
        foreach ($reachableScopes as $scope) {
 | 
			
		||||
            if (\in_array($scope->getId(), $scopes_ids)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            $scopes_ids[] = '?'; 
 | 
			
		||||
            $parameters[] = $scope->getId();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // we start with activities having the person_id linked to person 
 | 
			
		||||
        // (currently only context "person" is supported)
 | 
			
		||||
        $whereClause = sprintf('%s = %d',
 | 
			
		||||
                 $associationMapping['joinColumns'][0]['name'],
 | 
			
		||||
                 $person->getId());
 | 
			
		||||
        
 | 
			
		||||
        // we add acl (reachable center and scopes)
 | 
			
		||||
        $centerAndScopeLines = array();
 | 
			
		||||
        foreach ($reachableCenters as $center) {
 | 
			
		||||
            $reachablesScopesId = array_map(
 | 
			
		||||
                    function(Scope $scope) { return $scope->getId(); },
 | 
			
		||||
                    $this->helper->getReachableScopes($this->user, $role, 
 | 
			
		||||
                        $person->getCenter())
 | 
			
		||||
                );
 | 
			
		||||
                    
 | 
			
		||||
            $centerAndScopeLines[] = sprintf('(%s = %d AND %s IN (%s))',
 | 
			
		||||
                    $metadataPerson->getTableName().'.'.
 | 
			
		||||
                        $metadataPerson->getAssociationMapping('center')['joinColumns'][0]['name'],
 | 
			
		||||
                    $center->getId(),
 | 
			
		||||
                    $metadataActivity->getTableName().'.'.
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            \strtr(
 | 
			
		||||
                $whereClause,
 | 
			
		||||
                [
 | 
			
		||||
                    '{activity.person_id}' => $associationMapping['joinColumns'][0]['name'],
 | 
			
		||||
                    '{activity.scope_id}' => $metadataActivity->getTableName().'.'.
 | 
			
		||||
                        $metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'],
 | 
			
		||||
                    implode(',', $reachablesScopesId));
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        $whereClause .= ' AND ('.implode(' OR ', $centerAndScopeLines).')';
 | 
			
		||||
        
 | 
			
		||||
        return $whereClause;
 | 
			
		||||
                    '{scopes_ids}' => \implode(", ", $scopes_ids)
 | 
			
		||||
,
 | 
			
		||||
                ]
 | 
			
		||||
            ),
 | 
			
		||||
            $parameters
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private function getFromClause(ClassMetadata $metadataActivity,
 | 
			
		||||
            ClassMetadata $metadataPerson)
 | 
			
		||||
    private function getFromClausePerson()
 | 
			
		||||
    {
 | 
			
		||||
        $metadataActivity = $this->em->getClassMetadata(Activity::class);
 | 
			
		||||
        $metadataPerson = $this->em->getClassMetadata(Person::class);
 | 
			
		||||
        $associationMapping = $metadataActivity->getAssociationMapping('person');
 | 
			
		||||
        
 | 
			
		||||
        return $metadataActivity->getTableName().' JOIN '
 | 
			
		||||
@@ -157,14 +166,14 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
            .$associationMapping['joinColumns'][0]['name']
 | 
			
		||||
            ;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 
 | 
			
		||||
     * {@inheritDoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function getEntities(array $ids)
 | 
			
		||||
    {
 | 
			
		||||
        $activities = $this->em->getRepository('ChillActivityBundle:Activity')
 | 
			
		||||
        $activities = $this->em->getRepository(Activity::class)
 | 
			
		||||
              ->findBy(array('id' => $ids));
 | 
			
		||||
        
 | 
			
		||||
        $result = array();
 | 
			
		||||
@@ -183,14 +192,13 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
    {
 | 
			
		||||
        $this->checkContext($context);
 | 
			
		||||
        
 | 
			
		||||
        return array(
 | 
			
		||||
        return [
 | 
			
		||||
           'template' => 'ChillActivityBundle:Timeline:activity_person_context.html.twig',
 | 
			
		||||
           'template_data' => array(
 | 
			
		||||
           'template_data' => [
 | 
			
		||||
              'activity' => $entity,
 | 
			
		||||
              'person' => $args['person'],
 | 
			
		||||
              'user' => $entity->getUser()
 | 
			
		||||
           )
 | 
			
		||||
        );
 | 
			
		||||
              'context' => $context
 | 
			
		||||
            ]
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -210,7 +218,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
 | 
			
		||||
     */
 | 
			
		||||
    private function checkContext($context)
 | 
			
		||||
    {
 | 
			
		||||
        if ($context !== 'person') {
 | 
			
		||||
        if (FALSE === \in_array($context, self::SUPPORTED_CONTEXTS)) {
 | 
			
		||||
            throw new \LogicException("The context '$context' is not "
 | 
			
		||||
                  . "supported. Currently only 'person' is supported");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,10 @@
 | 
			
		||||
// this file loads all assets from the Chill person bundle
 | 
			
		||||
module.exports = function(encore, entries) {
 | 
			
		||||
    entries.push(__dirname + '/Resources/public/index.js');
 | 
			
		||||
    
 | 
			
		||||
    encore.addAliases({
 | 
			
		||||
        ChillActivityAssets: __dirname + '/Resources/public'
 | 
			
		||||
    });
 | 
			
		||||
    
 | 
			
		||||
    encore.addEntry('vue_activity', __dirname + '/Resources/public/vuejs/Activity/index.js');
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,6 @@ chill_activity_activityreasoncategory:
 | 
			
		||||
    resource: "@ChillActivityBundle/config/routes/activityreasoncategory.yaml"
 | 
			
		||||
    prefix:   /
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype:
 | 
			
		||||
    resource: "@ChillActivityBundle/config/routes/activitytype.yaml"
 | 
			
		||||
    prefix:   /
 | 
			
		||||
 | 
			
		||||
chill_admin_activity_index:
 | 
			
		||||
    path:     /{_locale}/admin/activity
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\AdminController::indexActivityAction
 | 
			
		||||
@@ -32,3 +28,30 @@ chill_admin_activity_redirect_to_admin_index:
 | 
			
		||||
            admin_activity:
 | 
			
		||||
                order: 0
 | 
			
		||||
                label: Main admin menu
 | 
			
		||||
 | 
			
		||||
chill_activity_type_admin:
 | 
			
		||||
    path:     /{_locale}/admin/activity/type
 | 
			
		||||
    controller: cscrud_activity_type_controller:index
 | 
			
		||||
    options:
 | 
			
		||||
        menus:
 | 
			
		||||
            admin_activity:
 | 
			
		||||
                order: 2020
 | 
			
		||||
                label: 'Activity Types'
 | 
			
		||||
 | 
			
		||||
chill_activity_type_category_admin:
 | 
			
		||||
    path:     /{_locale}/admin/activity/type_category
 | 
			
		||||
    controller: cscrud_activity_type_category_controller:index
 | 
			
		||||
    options:
 | 
			
		||||
        menus:
 | 
			
		||||
            admin_activity:
 | 
			
		||||
                order: 2999
 | 
			
		||||
                label: 'Activity Types Categories'
 | 
			
		||||
 | 
			
		||||
chill_activity_presence_admin:
 | 
			
		||||
    path:     /{_locale}/admin/activity/presence
 | 
			
		||||
    controller: cscrud_activity_presence_controller:index
 | 
			
		||||
    options:
 | 
			
		||||
        menus:
 | 
			
		||||
            admin_activity:
 | 
			
		||||
                order: 2021
 | 
			
		||||
                label: 'Activity Presences'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,30 +1,26 @@
 | 
			
		||||
chill_activity_activity_list:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/
 | 
			
		||||
    path:     /{_locale}/activity/
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::listAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_show:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/{id}/show
 | 
			
		||||
    path:     /{_locale}/activity/{id}/show
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::showAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_new:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/new
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::newAction
 | 
			
		||||
chill_activity_activity_select_type:
 | 
			
		||||
    path:     /{_locale}/activity/select-type
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::selectTypeAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_create:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/create
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::createAction
 | 
			
		||||
    methods:  POST
 | 
			
		||||
chill_activity_activity_new:
 | 
			
		||||
    path:     /{_locale}/activity/new
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::newAction
 | 
			
		||||
    methods:  [POST, GET]
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_edit:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/{id}/edit
 | 
			
		||||
    path:     /{_locale}/activity/{id}/edit
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::editAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_update:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/{id}/update
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::updateAction
 | 
			
		||||
    methods:  [POST, PUT]
 | 
			
		||||
    methods:  [GET, POST, PUT]
 | 
			
		||||
 | 
			
		||||
chill_activity_activity_delete:
 | 
			
		||||
    path:     /{_locale}/person/{person_id}/activity/{id}/delete
 | 
			
		||||
    path:     /{_locale}/activity/{id}/delete
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityController::deleteAction
 | 
			
		||||
    methods:  [GET, POST, DELETE]
 | 
			
		||||
 
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
chill_activity_activitytype:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::indexAction
 | 
			
		||||
    options:
 | 
			
		||||
        menus:
 | 
			
		||||
            admin_activity: 
 | 
			
		||||
                order: 2020
 | 
			
		||||
                label: "Activity Types"
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_show:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/{id}/show
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::showAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_new:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/new
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::newAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_create:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/create
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::createAction
 | 
			
		||||
    methods:  POST
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_edit:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/{id}/edit
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::editAction
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_update:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/{id}/update
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::updateAction
 | 
			
		||||
    methods:  [POST, PUT]
 | 
			
		||||
 | 
			
		||||
chill_activity_activitytype_delete:
 | 
			
		||||
    path:     /{_locale}/admin/activitytype/{id}/delete
 | 
			
		||||
    controller: Chill\ActivityBundle\Controller\ActivityTypeController::deleteAction
 | 
			
		||||
    methods:  [POST, DELETE]
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
services:     
 | 
			
		||||
services:
 | 
			
		||||
    chill.activity.security.authorization.activity_voter:
 | 
			
		||||
        class: Chill\ActivityBundle\Security\Authorization\ActivityVoter
 | 
			
		||||
        arguments:
 | 
			
		||||
@@ -6,7 +6,7 @@ services:
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: security.voter }
 | 
			
		||||
            - { name: chill.role }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    chill.activity.security.authorization.activity_stats_voter:
 | 
			
		||||
        class: Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter
 | 
			
		||||
        arguments:
 | 
			
		||||
@@ -14,14 +14,27 @@ services:
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: security.voter }
 | 
			
		||||
            - { name: chill.role }
 | 
			
		||||
            
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    chill.activity.timeline:
 | 
			
		||||
        class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
 | 
			
		||||
        arguments:
 | 
			
		||||
            - '@doctrine.orm.entity_manager'
 | 
			
		||||
            - '@chill.main.security.authorization.helper'
 | 
			
		||||
            - '@security.token_storage'
 | 
			
		||||
            - '@Chill\ActivityBundle\Repository\ActivityACLAwareRepository'
 | 
			
		||||
        public: true
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: chill.timeline, context: 'person' }
 | 
			
		||||
            - { name: chill.timeline, context: 'center' }
 | 
			
		||||
 | 
			
		||||
    Chill\ActivityBundle\Menu\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
        resource: '../Menu/'
 | 
			
		||||
        tags: ['chill.menu_builder']
 | 
			
		||||
 | 
			
		||||
    Chill\ActivityBundle\Notification\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
        resource: '../Notification'
 | 
			
		||||
 
 | 
			
		||||
@@ -4,4 +4,5 @@ services:
 | 
			
		||||
            $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
 | 
			
		||||
            $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
 | 
			
		||||
            $logger: '@chill.main.logger'
 | 
			
		||||
            $serializer: '@Symfony\Component\Serializer\SerializerInterface'
 | 
			
		||||
        tags: ['controller.service_arguments']
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ services:
 | 
			
		||||
            - "@request_stack"
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: form.type, alias: translatable_activity_reason_category }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    chill.activity.form.type.translatableactivityreason:
 | 
			
		||||
        class: Chill\ActivityBundle\Form\Type\TranslatableActivityReason
 | 
			
		||||
        arguments:
 | 
			
		||||
@@ -14,7 +14,7 @@ services:
 | 
			
		||||
            $reasonRender: '@Chill\ActivityBundle\Templating\Entity\ActivityReasonRender'
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: form.type, alias: translatable_activity_reason }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    chill.activity.form.type.translatableactivitytype:
 | 
			
		||||
        class: Chill\ActivityBundle\Form\Type\TranslatableActivityType
 | 
			
		||||
        arguments:
 | 
			
		||||
@@ -22,7 +22,7 @@ services:
 | 
			
		||||
            - "@chill_activity.repository.activity_type"
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: form.type, alias: translatable_activity_type }
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
    chill.activity.form.type.activity:
 | 
			
		||||
        class: Chill\ActivityBundle\Form\ActivityType
 | 
			
		||||
        arguments:
 | 
			
		||||
@@ -31,5 +31,14 @@ services:
 | 
			
		||||
            - "@doctrine.orm.entity_manager"
 | 
			
		||||
            - "@chill.main.helper.translatable_string"
 | 
			
		||||
            - "%chill_activity.form.time_duration%"
 | 
			
		||||
            - '@Chill\PersonBundle\Templating\Entity\SocialIssueRender'
 | 
			
		||||
            - '@Chill\PersonBundle\Templating\Entity\SocialActionRender'
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: form.type, alias: chill_activitybundle_activity }
 | 
			
		||||
 | 
			
		||||
    chill.activity.form.type.activityTypeType:
 | 
			
		||||
        class: Chill\ActivityBundle\Form\ActivityTypeType
 | 
			
		||||
        arguments:
 | 
			
		||||
            - "@chill.main.helper.translatable_string"
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: form.type, alias: translatable_activity_type }
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user