Compare commits

...

722 Commits

Author SHA1 Message Date
148221cdc7 fix namespace of 'self' 2021-04-27 23:21:15 +02:00
58047faac6 force type for connection parameter 2021-04-27 23:20:49 +02:00
40dda65006 fix import namespacees 2021-04-27 23:20:25 +02:00
Pol Dellaiera
054a28ecf4 refactor: Update source code based on PHP conventions. 2021-04-26 17:18:38 +02:00
Pol Dellaiera
6b2eda0f94 chore: Add/update static files. 2021-04-26 15:44:37 +02:00
Pol Dellaiera
1359f1ba58 chore: Update composer.json 2021-04-26 14:02:26 +02:00
3445335b2d Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2021-04-26 13:38:21 +02:00
e52a9a4330 Merge branch 'docs_improvement' into 'master'
More details on how to compile documentation

See merge request Chill-Projet/chill-bundles!19
2021-04-26 11:34:04 +00:00
8adb05c24f Merge branch 'simplify-statement' into 'master'
fix: Simplify statements and fix syntax.

See merge request Chill-Projet/chill-bundles!20
2021-04-26 11:33:08 +00:00
b1207cbd3e Merge branch 'master' into _31_interface_creation_parcours 2021-04-26 13:18:26 +02:00
Pol Dellaiera
09ed671734 fix: Simplify statements and fix syntax.
To make sure that PHP CS Fixer do not fails.
2021-04-26 13:06:40 +02:00
93260ea36f move AccompanyingCourse component in his own directory 2021-04-26 13:02:28 +02:00
Marc Ducobu
8756982a78 More details 2021-04-26 11:30:20 +02:00
a8f55e064d split personAction in sub-component 2021-04-26 11:27:46 +02:00
7df753f1cb props, datas and sub-components 2021-04-23 20:29:35 +02:00
b0fc4e190f rename and cleaning 2021-04-23 19:39:09 +02:00
928e0e1eed test app async working 2021-04-23 13:48:42 +02:00
28e4b2abaf test vue app 2021-04-23 13:13:57 +02:00
c5b21f360c Merge branch 'fix-error-show-other-phonenumber' into 'master'
Show the error message when phonenumber has a validation error on other phonenumbers

See merge request Chill-Projet/chill-bundles!16
2021-04-22 14:09:12 +00:00
2de8338651 webpack alias + move vues firsts files in better place 2021-04-22 14:13:47 +02:00
fbec64664f upgrade test app 2021-04-22 12:12:31 +02:00
6c81fe4ef2 documentation for running tests 2021-04-22 11:58:18 +02:00
520c0e0f96 show the error message when phonenumber has a validation error 2021-04-21 15:05:47 +02:00
2647d4c6a7 Merge branch 'bootstrap-tests-ci' into 'master'
Bootstrap tests and continuous integration

See merge request Chill-Projet/chill-bundles!15
2021-04-21 11:47:05 +00:00
e7df62b373 A first VueJS component, get api datas, a simple button add person
* !! composer require serializer !!
* see: http://localhost:8001/fr/parcours/861/show
2021-04-21 08:53:51 +02:00
c6a87f1286 do not commit composer.lock in library 2021-04-20 21:45:50 +02:00
d57cfe09c8 upgrade deps to chill-app 2021-04-20 21:45:22 +02:00
38cba4948b fix .gitlab-ci definition 2021-04-20 21:45:06 +02:00
d765eecb8e Merge remote-tracking branch 'origin/master' into bootstrap-tests-ci 2021-04-20 21:38:53 +02:00
a7e4900690 Add .gitlab-ci.yml 2021-04-20 15:32:41 +00:00
e98a5b88aa fix some tests in main bundle 2021-04-20 17:21:39 +02:00
1b42656e0f bootstrap to be run on root bundle 2021-04-20 17:20:57 +02:00
b2ff470720 fix container property overriding to non-static 2021-04-20 15:29:54 +02:00
e9674dd334 fixtures: really find Charline 2021-04-20 15:14:15 +02:00
0fcec73a62 Merge branch 'v8-entity-parcours-fixes' into 'master'
Fix some stuff in AccompanyingPeriod

See merge request Chill-Projet/chill-bundles!13
2021-04-20 12:53:07 +00:00
69ea88a4d5 Merge branch 'master' into _31_interface_creation_parcours 2021-04-19 19:19:19 +02:00
332178981a fix documentation for installation + various refernces 2021-04-19 14:36:03 +02:00
9539214d24 add some constants string to constants 2021-04-19 13:34:03 +02:00
c5b4a44ff3 AccompanyingPeriodParticipation: set cascade=persist for accompanyingPeriod
fixes : A new entity was found through the relationship 'Chill\PersonBundle\Entity\AccompanyingPeriodParticipation#accompanyingPeriod'
that was not configured t  o cascade persist operations for entity: Chill\PersonBundle\Entity\AccompanyingPeriod@0000000002b1d44a000000002510e4e2.
To solve this issue: Either explici   tly call EntityManager#persist() on this unknown entity or configure
cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem
implement 'Chill\PersonBundle\Entity\AccompanyingPeriod#__toString()' to get a clue.
2021-04-19 13:32:19 +02:00
b7d6d29fac AccompanyingPeriod/ClosingMotive: fix json_array deprecated 2021-04-19 13:29:17 +02:00
51e9b1fcf2 AccompanyingPeriod/Origin: set label as json 2021-04-19 13:25:13 +02:00
b490f4a82c fix migration for parcours - rename sequence for closing motive 2021-04-19 12:58:47 +02:00
9566ea89b1 fix stylesheets locations, in chill-bundles or in project files 2021-04-15 20:51:04 +02:00
425d51649f vuejs hello world component 2021-04-15 17:14:35 +02:00
c32f730713 add vuejs npm packages and configure webpack 2021-04-15 17:04:49 +02:00
a48d6d2a0a composer require webpack-encore-bundle
Note:
* move flex in root composer.json (otherwise it is not read)
* webpack-encore-bundle needed to use twig function {{ encore_entry_script_tags() }}
* flex recipe add new 'assets' dir
2021-04-15 17:04:49 +02:00
16b155d449 init new AccompanyingCourse (parcours) section 2021-04-15 17:04:02 +02:00
985f067387 fix migration namespace 2021-04-14 13:25:08 +02:00
083f56bff0 Merge branch 'master' into _bootstrap_modal 2021-04-14 10:46:27 +02:00
8a83e8ed22 Merge branch '_8_entity_parcours' into 'master'
WIP issue8 : entity parcours

See merge request Chill-Projet/chill-bundles!8
2021-04-13 20:48:36 +00:00
f526453ba3 enable bootstrap assets for modals features 2021-04-13 19:37:02 +02:00
cc40e7a99a fix sql migration syntax 2021-04-13 15:31:04 +02:00
aa05223a4e fix translation 2021-04-02 19:22:57 +02:00
5bee607afb fix migration review: improve up and down query 2021-04-02 19:21:44 +02:00
de240b099f remove commented code in new repositories 2021-04-02 17:50:45 +02:00
36cdf4c220 Merge branch 'add-wysiwyg' into 'master'
Applique l'éditeur de texte sur plusieurs instances + rendu des "Comment Embeddable"

See merge request Chill-Projet/chill-bundles!7
2021-04-02 12:11:39 +00:00
34e5fbedf2 Merge branch 'features/new-phones' into 'master'
Features/new phones

See merge request Chill-Projet/chill-bundles!5
2021-04-02 12:11:20 +00:00
Jean-Francois Monfort
27c680bb03 Features/new phones 2021-04-02 12:11:20 +00:00
25634ba12b Make some relations bidirectionnal 2021-04-01 11:06:36 +02:00
01f24ecf1f Adapt entity AccompanyingPeriodParticipation attributes and methods (dont break UI) 2021-03-31 20:57:15 +02:00
a98056d31b Transform join table between Person and AccompanyingPeriod in Doctrine entity 2021-03-31 14:42:06 +02:00
bd7b4b3fdb fix repository for AccompanyingPeriod 2021-03-31 10:37:31 +02:00
a3395895cb Rename table closinmotive 2021-03-30 19:44:48 +02:00
1d6a8987e9 Allow to enable multiple simultaneous accompanyingPeriods 2021-03-30 18:35:15 +02:00
fa5d0fbd21 Merge branch 'master' into _8_entity_parcours 2021-03-30 11:21:06 +02:00
3a50aea138 fix service dependency injection for validatorInterface 2021-03-30 11:13:36 +02:00
24d8b55591 minor corrections 2021-03-30 10:18:08 +02:00
85c4560f22 Complete accompanying period entity 2021-03-29 18:40:56 +02:00
c45390dd89 add Accompanying Period Comment and Resource entities 2021-03-29 14:34:02 +02:00
acff64c16f Add Origin Entity in Accompanying Period package 2021-03-29 11:24:57 +02:00
ba31927dc3 move CloseMotive Repository in AccompanyingPeriod package 2021-03-29 11:04:01 +02:00
365a398743 fixtures accompanyingPeriod + fixture new firstnames set 2021-03-27 16:50:57 +01:00
ea4e3c715e fix syntax php7 2021-03-27 13:37:37 +01:00
0a17011cc3 add fixtures to test duplicate person 2021-03-27 12:36:15 +01:00
0d9f3d7dba fix inconsistency in fixtures 2021-03-27 11:50:03 +01:00
dcc6969310 add migration down query to preserve datas 2021-03-27 11:30:50 +01:00
f6801c0c4f make new relation many-to-many between Person and AccompagnyingPeriod 2021-03-26 21:57:18 +01:00
813ecb0201 cleaning 2021-03-26 21:48:27 +01:00
ae81e7be31 add documentation for render and embeddable comments 2021-03-25 22:45:01 +01:00
b79ec18a38 apply ckeditor on multiple entities
Apply ckeditor into:

* activity;
* task;
* document;
* accompanying periods
2021-03-25 22:01:17 +01:00
66e590972a Improve Embeddable Comment Render
* render embeddable comment into twig template;
* add some style
2021-03-25 22:01:17 +01:00
3ca5018e45 fix import of dropzone in uploader 2021-03-25 22:01:17 +01:00
6ea45e4d16 Merge branch 'fix-rtd' into 'master'
Fix Read-the docs

See merge request Chill-Projet/chill-bundles!6
2021-03-25 17:20:27 +00:00
6b65c06ff5 Fix Read-the docs 2021-03-25 17:20:27 +00:00
2ea880c6fa fix readthedocs compilation 2021-03-25 18:05:29 +01:00
18b2af113b upgrade readthedoc def file 2021-03-25 17:43:44 +01:00
c171561de6 Merge documentation into mono-repo 2021-03-25 17:24:26 +01:00
d9759024ef prepare for merging doc into mono-repository 2021-03-25 17:09:49 +01:00
ff5c1c1b5a Add editorconfig file to maintain consistent coding styles 2021-03-25 11:17:34 +01:00
ccc9995613 Merge branch 'add-wysiwyg' into 'master'
Add wysiwyg

See merge request Chill-Projet/chill-bundles!4
2021-03-23 15:10:40 +00:00
daec8c892c doc for ckeditor 2021-03-23 16:07:15 +01:00
127f752e2c doc for crud 2021-03-23 16:07:03 +01:00
b796e94866 remove unused deps 2021-03-23 16:05:04 +01:00
b8b509b6b3 remove unnecessary comment line 2021-03-23 15:48:43 +01:00
11e6efee68 fix comments 2021-03-23 15:46:46 +01:00
03b94c05b8 Apply 1 suggestion(s) to 1 file(s) 2021-03-23 14:39:07 +00:00
9612f23d9c mark class for ChillTextareaType as final 2021-03-23 14:28:09 +00:00
5d533103dc clean ckeditor file 2021-03-22 17:49:21 +01:00
527b658ca0 [ckeditor][markdown] introduce twig filter chill_markdown_to_html 2021-03-22 17:32:57 +01:00
f619171120 set minimum size in ckeditor 2021-03-22 13:45:38 +01:00
28a2c0ea0b use ckeditor in custom type 2021-03-22 13:45:16 +01:00
89d95a0eae bootstrap, enable only conflicts assets (><scratch) 2021-03-21 15:09:08 +01:00
7a0f7a4933 webpack, ckeditor build in a function 2021-03-21 15:09:08 +01:00
6bcdbaf668 separate scratch from chill entrypoint, and move it into a specific module 2021-03-21 15:09:08 +01:00
a302749d00 install php markdown to html, and test change in template 2021-03-21 15:09:08 +01:00
0a0895584c remove button bourbon hack 2021-03-21 15:09:08 +01:00
43a8373a7c ckeditor improve textarea detection 2021-03-21 15:09:08 +01:00
d7d8f2a60a enable bootstrap, disable ckeditor 2021-03-21 15:09:08 +01:00
142f8bdfb5 add setting in chill.yaml to enable or disable new assets (bootstrap, ckeditor and forkawesome) 2021-03-21 15:09:08 +01:00
cb712f4814 try to make ckeditor lighter, disabling features 2021-03-21 15:09:08 +01:00
cf27c2cb79 ckeditor5, it works ! compiled by webpack encore, and display on textarea 2021-03-21 15:09:08 +01:00
8de8f1afb7 webpack: push assets into chill entry 2021-03-21 15:09:08 +01:00
dc1f8e9533 webpack installation of ckeditor5 2021-03-21 15:09:08 +01:00
18fec8c491 webpack, add new entrypoint for bootstrap 2021-03-21 15:09:08 +01:00
3182c3607c remove unused files: css/select2 and css/scratch 2021-03-21 15:09:08 +01:00
e78855fe0c check webpack assets entrypoints 2021-03-21 15:09:08 +01:00
6efa795f2a replace fontawesome by forkawesome 2021-03-21 15:09:08 +01:00
371da5d9bf remove bower and grunt js 2021-03-21 15:09:08 +01:00
f4c556812e "Duplicate": import 11 previous commits from Person bundle, before merging monorepo
Last 11 commits are rewritten to maintain history :

5e461dc Mathieu Jaumotte        Mon Mar 8 18:37:11 2021 +0100   oups
f2179b5 Mathieu Jaumotte        Mon Mar 8 18:33:32 2021 +0100   count linked objects in merge person side panel
7bc76f3 Mathieu Jaumotte        Mon Mar 8 16:54:01 2021 +0100   improve duplicate ux
71aa9f4 Mathieu Jaumotte        Thu Mar 4 21:52:42 2021 +0100   improve duplicates templates
d3c13ce Mathieu Jaumotte        Thu Mar 4 16:15:55 2021 +0100   design UX for duplicate person feature
a8b306e Mathieu Jaumotte        Wed Mar 3 18:38:00 2021 +0100   change migration namespace
8752c71 Jean-Francois Monfort   Thu Feb 18 14:24:37 2021 +0100  Unit testf for duplicate person
0799980 Jean-Francois Monfort   Thu Feb 18 11:39:23 2021 +0100  New screen to find duplicate person manually
a7fa7a5 Jean-Francois Monfort   Thu Feb 11 16:31:30 2021 +0100  New permission for duplicate & export duplicate persons
2980441 Jean-Francois Monfort   Thu Feb 4 17:21:15 2021 +0100   Duplicate module
d06ab66 Jean-Francois Monfort   Thu Jan 28 17:26:20 2021 +0100  List duplicate persons
2021-03-21 15:06:28 +01:00
31ef7ba74f oups 2021-03-21 14:42:26 +01:00
d81fc881af count linked objects in merge person side panel 2021-03-21 14:41:22 +01:00
03ef68dc36 improve duplicate ux 2021-03-21 14:40:16 +01:00
a86feafa53 improve duplicates templates 2021-03-21 14:38:58 +01:00
aa40716898 design UX for duplicate person feature 2021-03-21 14:36:59 +01:00
76c9cd5be3 change migration namespace 2021-03-21 14:29:00 +01:00
e841e9015c Unit testf for duplicate person
Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
2021-03-21 14:21:27 +01:00
3bcb5fb3dd New screen to find duplicate person manually
Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
2021-03-21 14:19:31 +01:00
c34b992437 New permission for duplicate & export duplicate persons
Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
2021-03-21 14:14:38 +01:00
0149457fba Duplicate module
Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
2021-03-21 14:08:55 +01:00
728ea73bdf List duplicate persons
Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>

Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
2021-03-21 14:03:06 +01:00
0cc951b296 fix webpack path with aliases 2021-03-21 10:20:57 +01:00
60b48a97e2 Adding missing dependencies. See trace:
master@chill-vendee cb68f33e71 JFMonfort 2021-02-18  Adding missing dependencies
sf4@chill-standard  732f4af595 MathieuJ  2021-03-08  rebase: Add missing dependencies (cb68f33e713)
sf4@chill-standard  358f7e7be7 MathieuJ  2021-03-08  install php markdown to html, and test change in template
2021-03-20 16:09:45 +01:00
a0e7105e83 fix package name 2021-03-18 13:54:11 +01:00
1ef4a90989 Merge branch 'master' into sf4 2021-03-18 13:51:25 +01:00
3cd6d6af2b add composer file 2021-03-18 13:47:46 +01:00
eaa0ad925f fix folder name 2021-03-18 13:37:13 +01:00
a2f6773f5a import changes on address from chill main 2021-03-18 13:14:37 +01:00
490ea5bd72 Merge branch 'master' into sf4 2021-03-18 13:02:45 +01:00
4a9db7839c Merge remote-tracking branch 'ChillThirdParty/sf4' into sf4 2021-03-18 12:46:49 +01:00
3a6fdb3c3d Merge remote-tracking branch 'ChillTask/sf4' into sf4 2021-03-18 12:46:49 +01:00
a68577cc69 Merge remote-tracking branch 'ChillReport/sf4' into sf4 2021-03-18 12:46:49 +01:00
a4246d4eeb Merge remote-tracking branch 'ChillPerson/sf4' into sf4 2021-03-18 12:46:49 +01:00
47516e0b5a Merge remote-tracking branch 'ChillMain/sf4' into sf4 2021-03-18 12:46:48 +01:00
e73c215ae8 Merge remote-tracking branch 'ChillFamilyMembers/sf4' into sf4 2021-03-18 12:46:48 +01:00
5727629292 Merge remote-tracking branch 'ChillEvent/sf4' into sf4 2021-03-18 12:46:48 +01:00
f28f34690b Merge remote-tracking branch 'ChillDocStore/sf4' into sf4 2021-03-18 12:46:48 +01:00
5ea4b4efe1 Merge remote-tracking branch 'ChillCustomFields/sf4' into sf4 2021-03-18 12:46:47 +01:00
3ede278389 Merge remote-tracking branch 'ChillBudgetBundle/sf4' into sf4 2021-03-18 12:46:47 +01:00
5712cf6f31 Merge remote-tracking branch 'ChillActivityBundle/sf4' into sf4 2021-03-18 12:46:47 +01:00
ec4f747cbb Prepare for moving into monorepo 2021-03-18 12:46:43 +01:00
aa062fe786 Prepare for moving into monorepo 2021-03-18 12:46:43 +01:00
e8086c454d Prepare for moving into monorepo 2021-03-18 12:46:43 +01:00
8883560e5b Prepare for moving into monorepo 2021-03-18 12:46:43 +01:00
5a2551ac4f Prepare for moving into monorepo 2021-03-18 12:46:42 +01:00
842e3b96d8 Prepare for moving into monorepo 2021-03-18 12:46:40 +01:00
772ce28859 Prepare for moving into monorepo 2021-03-18 12:46:40 +01:00
e2d341f0bd Prepare for moving into monorepo 2021-03-18 12:46:40 +01:00
1c89cc9568 Prepare for moving into monorepo 2021-03-18 12:46:40 +01:00
e7ace387ca Prepare for moving into monorepo 2021-03-18 12:46:40 +01:00
6d42196093 Prepare for moving into monorepo 2021-03-18 12:46:39 +01:00
Jean-Francois Monfort
354a202d06 Add CommentEmbeddable to Activity (Ref #21) 2021-03-11 14:28:14 +01:00
Jean-Francois Monfort
f35cb679b7 Add CommentEmbeddable to Activity : remoke remark field (Ref #21) 2021-03-11 14:27:46 +01:00
Jean-Francois Monfort
63dedb90f9 Add CommentEmbeddable to Activity (Ref #21) 2021-03-11 12:35:13 +01:00
Jean-Francois Monfort
cde3c900df Merge branch 'sf4' of framagit.org:Chill-project/Chill-Activity into sf4 2021-03-11 12:32:14 +01:00
Jean-Francois Monfort
c1c3839c62 Add CommentEmbeddable to Activity (Ref #21) 2021-03-11 12:30:11 +01:00
e6d54248d7 minor, cfr MR sf4_cked sur standard, main, person 2021-03-09 15:48:23 +01:00
21d451626b hack to resolve pixel difference (cancel bourbon rule) 2021-03-08 16:49:52 +01:00
8091173746 change migration namespace 2021-03-05 13:14:03 +01:00
f38249026f Merge branch 'sf4' of framagit.org:Chill-project/Chill-Main into sf4 2021-03-04 16:19:55 +01:00
d660eb9184 design UX for duplicate person feature 2021-03-04 16:15:55 +01:00
b49264aec4 fix logger service dependency injection 2021-03-04 16:13:34 +01:00
2c35fb1e5b fix logger service dependency injection 2021-03-04 16:13:34 +01:00
Jean-Francois Monfort
e91ddfae33 Add priority tag support For MenuBuilder 2021-03-04 11:39:27 +01:00
Jean-Francois Monfort
99b25e3abb Add new field attributes to user to store data from SAML connection 2021-03-04 11:39:27 +01:00
cedf08b906 wip.. ckeditor5 2021-03-04 11:06:04 +01:00
72c4eec43f change migration namespace 2021-03-02 17:16:22 +01:00
49c8cc5cdb change migration namespace 2021-03-02 17:15:56 +01:00
85032ce58f change migration namespace 2021-03-02 17:15:54 +01:00
acf26ed5c8 change migration namespace 2021-03-02 17:15:52 +01:00
ba28783f37 change migration namespace 2021-03-02 17:15:50 +01:00
061a024151 change migration namespace 2021-03-02 17:15:47 +01:00
84347ec982 change migration namespace 2021-03-02 17:15:44 +01:00
ac73400a2d change migration namespace 2021-03-02 17:15:42 +01:00
3b6750951c change migration namespace 2021-03-02 17:15:40 +01:00
Jean-Francois Monfort
dca993834b Fix Interface syntax to be comptatible with legacy code 2021-02-18 09:00:13 +01:00
6d3b366479 controller tell which layout twig must serve 2021-02-12 16:48:08 +01:00
34a913e8e6 entity getdata workflow is not always defined 2021-02-12 16:46:50 +01:00
43d12a9647 fix how to get task repository 2021-02-12 16:45:24 +01:00
5efb284c5b fix logger service injection 2021-02-12 16:39:33 +01:00
31e1a40cb7 fix logger service injection 2021-02-12 16:39:33 +01:00
Jean-Francois Monfort
c8507b4a13 Check if formatter key exist 2021-02-11 16:29:57 +01:00
Jean-Francois Monfort
a31e3ad6f6 Fill DirectExportInterface 2021-02-11 16:29:19 +01:00
743e342f25 require phpspreadsheet 2021-02-10 10:06:21 +01:00
f4a76f659e allow reasons not inside a category 2021-02-09 19:18:29 +01:00
cd054fe6ef when reasons are not in a category 2021-02-09 17:48:49 +01:00
c0112bb5e9 fix guzzle exception depreciation with phonenumbers 2021-02-09 15:17:27 +01:00
ecb6006835 Merge branch 'sf4' of framagit.org:chill-project/Chill-CustomFields into sf4 2021-02-09 10:02:45 +01:00
2870754fd0 Merge branch 'sf4-marc' into 'sf4'
Fix error when load fixtures for companies

See merge request Chill-project/Chill-CustomFields!14
2021-02-09 08:58:50 +00:00
Marc Ducobu
e083ca7487 Bug fix : companies fixtures loading fails (Option->text is an json_array) 2021-02-08 23:00:18 +01:00
8cb150483a fix impersonate config 2021-02-08 19:09:10 +01:00
5ea0126a03 autowire+autoconfigure service to avoid container error with parameter_bag + add dep injection + comment debug 2021-02-08 15:46:45 +01:00
150b76a3f0 just a translation 2021-02-08 10:30:39 +01:00
54240f81e8 Merge branch 'sf4-install-marc' into 'sf4'
Deleting config for parameters.yml in the installation guide

See merge request Chill-project/chill-documentation!1
2021-02-08 08:41:34 +00:00
82dbda8b5e improve ux in admin configuration interface 2021-02-06 13:51:47 +01:00
cc2c3ae36d improve ux in admin configuration interface 2021-02-06 13:51:47 +01:00
a1fc070bf7 improve ux in admin configuration interface 2021-02-06 13:51:46 +01:00
6f80bd0d37 improve ux in admin configuration interface 2021-02-06 13:51:46 +01:00
ef5296c33f improve ux in admin configuration interface 2021-02-06 13:51:46 +01:00
41444f4157 admin area, configuration menu 2021-02-05 22:49:00 +01:00
3278d07137 improve ux for admin configuration crud interface 2021-02-05 22:30:23 +01:00
31176f8bc8 improve ux for admin configuration crud interface 2021-02-05 22:30:23 +01:00
5c9e88784f adding crud to manage marital statuses in admin area (CRUDController way, minimal study case) 2021-02-05 18:13:46 +01:00
Marc Ducobu
7cd7db6b02 Deleting config for parameters.yml in the installation guide 2021-02-05 13:41:58 +01:00
0a89b5fc26 fix errors in https://framagit.org/Chill-project/Chill-Person/-/issues/21 2021-02-04 22:39:06 +01:00
1839d829bc fix errors in https://framagit.org/Chill-project/Chill-Person/-/issues/21 2021-02-04 22:39:06 +01:00
1cf0e51e9a fix https://framagit.org/Chill-project/Chill-Person/-/issues/22 bug 2021-02-03 18:50:34 +01:00
c76e401021 fix https://framagit.org/Chill-project/Chill-Person/-/issues/22 bug 2021-02-03 18:50:34 +01:00
2fee88bfce remove Mailer, add SwiftMailer, fix password recover request 2021-02-03 15:45:29 +01:00
03cafbf4c6 complete missing annotations 2021-02-02 11:49:27 +01:00
01e93f7ba3 complete missing annotations 2021-02-02 11:49:27 +01:00
0b8a22ae46 sf4 depreciation: repairing crud custom routes loader 2021-02-02 11:48:19 +01:00
42c2ac48d2 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Main into sf4 2021-02-01 18:21:19 +01:00
60cfa5ddd5 Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
f4a2ab67c2 Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
4f90561362 Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
7ef534438e Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
22efcf0c1d Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
8029b9b8ff Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
eae13ac3d8 Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
d840deb5e2 Replace deprecated extends Controller by AbstractController 2021-02-01 18:17:33 +01:00
Jean-Francois Monfort
0669da565c New button icon for Not a duplication action 2021-01-28 17:15:11 +01:00
ea0ac6dc66 minor change 2021-01-26 15:31:40 +01:00
1c4f789414 translating all roles in admin interface 2021-01-26 15:21:22 +01:00
99e2712cbc translating all roles in admin interface 2021-01-26 15:21:22 +01:00
33b4d7eeac translating all roles in admin interface 2021-01-26 15:21:22 +01:00
37f4adc2fc translating all roles in admin interface 2021-01-26 15:21:21 +01:00
750c3315d7 translating all roles in admin interface 2021-01-26 15:21:21 +01:00
e01794db68 translating all roles in admin interface 2021-01-26 15:21:21 +01:00
580510e6b1 fix title role error 2021-01-26 14:32:31 +01:00
f63c4b42e0 resolving deprecated private service injection on commands classes 2021-01-26 13:47:35 +01:00
b45191bd04 resolving deprecated private service injection on commands classes 2021-01-26 13:47:35 +01:00
9f54665836 resolving deprecated private service injection on commands classes 2021-01-26 13:46:58 +01:00
f162ed3911 import-users command require csv library 2021-01-25 17:33:00 +01:00
Jean-Francois Monfort
b6ec28c146 Fix deprecated code 2021-01-19 17:53:33 +01:00
Jean-Francois Monfort
20af1b180d Use ScopePickerType in EventType for circle field 2021-01-19 17:52:28 +01:00
Jean-Francois Monfort
ce34fea7e4 Fix syntax 2021-01-19 11:48:42 +01:00
Jean-Francois Monfort
764d2cc87a Adapt ScopePicker to replace Entity field by Hidden field if only one choice 2021-01-19 11:39:32 +01:00
Jean-Francois Monfort
84e2cc9e02 Adapt ScopePicker to replace Entity field by Hidden field if only one choice 2021-01-19 11:34:36 +01:00
a0d36b8d78 fixing any depreciations in fixtures feature 2021-01-14 18:57:02 +01:00
e053bf999e fixing any depreciations in fixtures feature 2021-01-14 18:57:02 +01:00
3d0cb12a2d fixing any depreciations in fixtures feature 2021-01-14 18:57:02 +01:00
nobohan
a1150dd0cf update doc for sf4 : bin/console 2021-01-14 16:48:44 +01:00
Jean-Francois Monfort
3989c4faff Fix logger error 2021-01-14 10:42:45 +01:00
nobohan
d5972d5a9d adapt installation instructions for sf4 2021-01-12 15:19:08 +01:00
aa121d6dae twig filter format_date need only one argument 2020-09-10 16:41:15 +02:00
e26ac0b3cc twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
f7e3ab8824 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
041627cd77 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
448b99a652 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
675ae7fd5d twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
ce28ad18b1 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
3d02785da2 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
e09fcf33b2 twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
65a5c94c2f twig filter format_date need only one argument 2020-09-10 16:00:32 +02:00
609a277f03 inject PaginatorFactory in constructor (omit) 2020-09-10 12:02:51 +02:00
0affc534c5 inject PaginatorFactory in constructor 2020-09-08 18:26:37 +02:00
bee6548d78 rename deprecated using path for ObjectManager 2020-09-08 15:42:42 +02:00
540661862a rename deprecated using path for ObjectManager 2020-09-08 15:42:42 +02:00
adbcbbb5b1 rename deprecated using path for ObjectManager 2020-09-08 15:42:42 +02:00
33c9cdeaf2 rename deprecated using path for ObjectManager 2020-09-08 15:42:42 +02:00
46293a9baf rename deprecated using path for ObjectManager 2020-09-08 15:42:42 +02:00
df1c8178ec fix choice deprecation with choices_as_values 2020-09-08 15:41:13 +02:00
20807f637d Merge branch 'sf4' of framagit.org:Chill-project/Chill-Task into sf4 2020-09-08 11:32:41 +02:00
4ef9e57f25 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Doc-Store into sf4 2020-09-08 11:32:23 +02:00
b2048c0f84 rename deprecated Symfony using 2020-09-06 21:15:32 +02:00
d8a9881e63 rename deprecated Symfony using 2020-09-06 21:15:32 +02:00
4d328e849d move back templates files in Resources/views (revert ced9d17d03) 2020-09-06 20:38:42 +02:00
b1a7c4dae6 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
9bc3c20383 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
61be9ca943 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
b2cbba4de8 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
94d446f5d4 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
dc657cbf99 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
3bc05ac2a6 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
d455c15e4f use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
43b0bfa369 use '@foo/bar.html.twig' syntax in twig templates 2020-09-06 20:32:46 +02:00
d3f7e9736b move config yaml files 2020-09-06 10:45:17 +02:00
0fafc5e3a9 fix translations directory 2020-09-06 10:42:47 +02:00
cdfbda147f fix twig date and currency filter deprecation 2020-09-05 15:38:41 +02:00
e34afe1ee6 fix twig date and currency filter deprecation 2020-09-05 15:38:41 +02:00
0b39391a73 fix TreeBuilder deprecation 2020-09-05 15:37:43 +02:00
92f3926bbf fix TreeBuilder deprecation 2020-09-05 15:37:43 +02:00
d62e83a63d fix Twig filter deprecation 2020-09-05 15:37:10 +02:00
d09f3c43c9 fix Twig filter deprecation 2020-09-05 15:37:10 +02:00
9dfb622836 fix deprecated ObjectManager path 2020-09-05 15:34:34 +02:00
7d87605142 fix deprecated ObjectManager path 2020-09-05 15:34:34 +02:00
b161548d53 temporary remove require deps 2020-09-04 22:18:23 +02:00
a71e425012 temporary remove require deps 2020-09-04 22:12:11 +02:00
2aa59d1cf3 fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
1d8d7fa354 fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
f05770235f fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
f5f0e54261 fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
8371487b2e fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
7f2f9bbfae fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
bcce10cf80 fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
7b65aab185 fix deprecated ObjectManager path in data fixtures scripts 2020-09-04 20:35:32 +02:00
a1996779e8 Merge branch 'master' into sf4 2020-08-25 15:41:00 +02:00
96dbd06b75 WIP adapt fixtures script for sf4 2020-08-07 14:10:38 +02:00
f5ca681dbc move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
5c298c641e move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
1aecc2fd3a move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
c98c12051a move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
b8bf9bebcd move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
6c89f3920a move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
298716d035 move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
82da7159e1 move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
f61d54d4cf move files from Resources/translations/ to translations/ 2020-08-04 16:28:07 +02:00
320cbdf908 add thirdparty bundle, fix errors, set new path for all config yaml files 2020-08-04 14:04:49 +02:00
dbd8023885 add thirdparty bundle, fix errors, set new path for all config yaml files 2020-08-04 13:55:59 +02:00
7730f732ed fix error with getInt() and inject PaginatorFactory service in EventController 2020-08-04 12:23:10 +02:00
d4948b176f sf4, setting new path for all config yaml files, and replace 'controller' path syntax in routes definitions 2020-08-04 12:20:16 +02:00
9a9441fa85 enable and fix errors for event bundle + adding knp-time-bundle 2020-08-04 11:33:56 +02:00
f94fb0efc1 enable and fix errors for event bundle + adding knp-time-bundle 2020-08-04 11:33:56 +02:00
4d2f84a9bd fix error in timeline with workflow in task 2020-08-04 10:48:20 +02:00
2a5ee00b86 setting new path for all config yaml files + adding expression-language component 2020-08-04 10:19:50 +02:00
f7902dd940 sf4, adding workflow and fix errors for task bundle 2020-08-04 10:04:25 +02:00
a8befb13c3 sf4, adding workflow and fix errors for task bundle 2020-08-04 10:04:25 +02:00
5292f319be sf4, adding workflow and fix errors for task bundle 2020-08-04 10:04:25 +02:00
00c3d1cb97 sf4, fix errors with report bundle, adapt new config yaml directory 2020-08-03 21:15:03 +02:00
b7eeebfd43 sf4, setting new path for all config yaml files, and replace 'controller' path syntax in routes definitions 2020-08-03 18:05:32 +02:00
98f0ac545e sf4, setting new path for all config yaml files, and replace 'controller' path syntax in routes definitions 2020-08-03 18:05:31 +02:00
f2f22c359f sf4, fix errors for activity, doc-store and async-uploader bundles 2020-08-03 16:43:47 +02:00
5ad3c659ee sf4, fix errors for activity, doc-store and async-uploader bundles 2020-08-03 16:43:47 +02:00
eefbd7ccce sf4, fix treebuilder depreciation 2020-08-03 15:50:56 +02:00
b2d3580e11 sf4, fix treebuilder depreciation 2020-08-03 15:50:56 +02:00
3c37924dc1 sf4, setting new path for all config yaml files, and replace 'controller' path syntax in routes definitions 2020-08-03 13:18:58 +02:00
0a390eae98 sf4, setting new path for all config yaml files, and replace 'controller' path syntax in routes definitions 2020-08-03 13:16:56 +02:00
1c9b38941f install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 12:37:00 +02:00
ec726ced19 sf4, fix error with index 'icon' in menu 2020-08-03 12:34:11 +02:00
fbaaa44ae6 forgotten in commit 59bf6628 (2020/07/16) 2020-08-03 11:27:42 +02:00
eb506475fa install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
8944d21652 install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
f7b5e37079 install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
d983247514 install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
ed7b235321 install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
43a975ae48 install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:39 +02:00
d4130b701e install twig intl-extra, replace localizeddate filter by format_date 2020-08-03 11:10:38 +02:00
e3b5b46bd1 replace tokenStorage injection by tokenStorageInterface 2020-08-03 11:05:54 +02:00
dbb2d5d883 replace tokenStorage injection by tokenStorageInterface 2020-08-03 11:05:54 +02:00
13c69b83f7 fix 'controller' path syntax in routes yaml files 2020-07-31 18:22:43 +02:00
533d27785e sf4, adding require symfony/templating + fix treebuilder depreciation 2020-07-31 18:21:00 +02:00
95682734dd sf4, adding require symfony/templating + fix treebuilder depreciation 2020-07-31 18:21:00 +02:00
b4847a6b61 sf4, adding require symfony/templating + fix treebuilder depreciation 2020-07-31 18:21:00 +02:00
544bd66000 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Main into sf4 2020-07-31 15:59:55 +02:00
98a3b38995 adapt migrations files to flex 2020-07-31 15:59:37 +02:00
9b41d0d0e2 sf4, replace 'controller' path syntax in routes yaml files 2020-07-31 15:59:12 +02:00
f707a649d1 adapt migrations files to flex 2020-07-31 15:59:11 +02:00
2ed1de8629 adapt migrations files to flex 2020-07-31 15:59:09 +02:00
3a710a7f31 adapt migrations files to flex 2020-07-31 15:59:06 +02:00
755c5e5a22 adapt migration files to flex 2020-07-31 15:59:03 +02:00
5875c9f0f7 adapt migrations files to flex 2020-07-31 15:59:03 +02:00
0092557d84 adapt migrations files to flex 2020-07-31 15:56:05 +02:00
a709589229 adapt migrations files to flex 2020-07-31 15:55:04 +02:00
153dad83f9 adapt migrations files to flex 2020-07-31 15:54:18 +02:00
2fc3bb9c25 adapt migrations files to flex 2020-07-31 15:52:06 +02:00
e07b5b1875 sf4, rename *.yml files by *.yaml 2020-07-31 15:26:33 +02:00
cd07426885 rename config 'routing' to 'routes' 2020-07-31 14:49:16 +02:00
e517c72194 setting new path for config files 2020-07-31 14:42:37 +02:00
9c1169644f moving config files 2020-07-31 14:41:48 +02:00
ed4975b41d sf4, fix twig depreciation with loop for and if condition 2020-07-31 12:51:49 +02:00
95cee22a30 sf4, setting new cache and log paths in entrypoint 2020-07-30 18:16:45 +02:00
70efafc0f5 sf4, repair errors and make basic and admin chill pages works 2020-07-30 17:34:45 +02:00
bf3c9ead2d sf4, repair errors and make basic and admin chill pages works 2020-07-30 17:34:45 +02:00
e7c6e65c33 sf4, repair errors and make basic and admin chill pages works 2020-07-30 17:34:45 +02:00
2cd48a5d91 sf4, repair errors and make basic and admin chill pages works 2020-07-30 17:34:45 +02:00
91edb14fb2 sf4, repair errors and make basic and admin chill pages works 2020-07-30 17:34:45 +02:00
f760943baa rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
d8aa11a5af rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
e082d35efb rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
14da65dcdb rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
09a2cea83b rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
a17d396834 rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
b111efb5c5 rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
7d9de642ff rename syntax for ChillMain twig template calls 2020-07-30 14:25:28 +02:00
2d92bc939b sf4 resolve errors and depreciations 2020-07-30 13:53:15 +02:00
6a2b94b4c2 sf4 resolve errors and depreciations 2020-07-30 13:53:15 +02:00
ced9d17d03 sf4 resolve errors and depreciations 2020-07-30 13:53:15 +02:00
1c163df081 fix new namespace of twig extensions 2020-07-30 13:08:08 +02:00
e0e0d3a56f Merge branch 'sf4' of framagit.org:Chill-project/Chill-Task into sf4 2020-07-28 16:57:14 +02:00
4634dbf4e7 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Report into sf4 2020-07-28 16:57:11 +02:00
6734295be7 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Person into sf4 2020-07-28 16:57:06 +02:00
ff8632fc93 Merge branch 'sf4' of framagit.org:Chill-project/Chill-Doc-Store into sf4 2020-07-28 16:56:58 +02:00
a2c12b41a9 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
e774f04d67 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
c1fbde131e upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
7881efa5fe upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
3f9939deb9 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
09bd534256 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
b179ebba72 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
a9faa81b89 upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
651b528e8e upgrade to symfony4, reset all requires into modules 2020-07-28 16:44:36 +02:00
bbdb183994 Merge branch 'sf4' of framagit.org:chill-project/Chill-main into sf4 2020-07-28 16:10:01 +02:00
21ae1db7e0 upgrade to symfony4, remove all deps 2020-07-28 16:08:02 +02:00
c74f242050 mark search service provider as private 2020-07-28 14:54:28 +02:00
f1d61470fe upgrade to symfony4 2020-07-28 14:10:54 +02:00
9b4a71ef8b Merge branch 'sf4' of framagit.org:Chill-project/Chill-Main into sf4 2020-07-28 13:53:51 +02:00
4719fe50ea upgrade to symfony4 2020-07-28 13:51:50 +02:00
a4798e39b1 fix person document controller definition 2020-07-28 13:41:20 +02:00
4527ed35a3 mark all services as private 2020-07-28 13:36:27 +02:00
6ca6974456 make timeline & paginator service private 2020-07-28 13:21:49 +02:00
1fa01474d8 make timeline & paginator service private 2020-07-28 13:12:41 +02:00
d53e6b57a4 make timeline & paginator service private 2020-07-28 13:11:12 +02:00
e05031a743 make timeline & paginator service private 2020-07-28 13:10:59 +02:00
ba7abaebf5 sf4, change deprecated workflow declaration 2020-07-28 12:29:48 +02:00
c2c946221a sf4, fix section menu translations and add missing translations 2020-07-27 19:43:43 +02:00
96c598db46 sf4, fix section menu translations and add missing translations 2020-07-27 19:43:43 +02:00
651f80f003 sf4, fix section menu translations and add missing translations 2020-07-27 19:43:43 +02:00
930ab84a58 sf4, fix section menu translations and add missing translations 2020-07-27 19:43:43 +02:00
5245d9971e sf4, fix section menu translations and add missing translations 2020-07-27 19:43:43 +02:00
90540300c5 sf4, fix error with ORM\Table name of customfieldsgroup 2020-07-27 18:50:19 +02:00
35640929f9 sf4, remove deprecated use Symfony\Component\Form\ChoiceList\LazyChoiceList 2020-07-27 18:00:04 +02:00
8d4d8f3a0d sf4, remove deprecated use Symfony\Component\Form\ChoiceList\LazyChoiceList 2020-07-27 18:00:04 +02:00
9952a885ed fix sf4 error with PickPersonType (error in commit a92686d1) 2020-07-27 17:24:01 +02:00
0d435dcd9b fix sf4 minor corrections on Doctrine ORM mapping Entities 2020-07-27 16:16:17 +02:00
1c7dd27fca fix sf4 minor corrections on Doctrine ORM mapping Entities 2020-07-27 16:16:17 +02:00
5a52eff3b9 fix sf4 minor corrections on Doctrine ORM mapping Entities 2020-07-27 16:16:17 +02:00
208d4b789a fix sf4 minor corrections on Doctrine ORM mapping Entities 2020-07-27 16:16:17 +02:00
4dcf8d1fb2 fix sf4 minor corrections on Doctrine ORM mapping Entities 2020-07-27 16:16:17 +02:00
a70f91d12f sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
43dedaf96b sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
b001309778 sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
415ad5dd21 sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
9cccf86f92 sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
5ba1c14f77 sf4 deprecated: timeline builder was private service 2020-07-27 13:50:23 +02:00
425ad22fbd sf4 deprecated: main.search_provider was private service 2020-07-27 12:51:17 +02:00
7ae24da907 sf4 deprecated: timelinePerson and accompagnyingpersonPeriod was private service 2020-07-27 12:47:27 +02:00
efee2dc2a9 fix sf4 error with controller service dependencyInjection 2020-07-27 12:29:23 +02:00
6ccfa8a130 sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 20:20:28 +02:00
ad8c1bbe9f sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 18:57:58 +02:00
8933d7c61d sf4 deprecated, adding annotations in Entity 2020-07-24 18:17:55 +02:00
91c965cda6 sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 18:08:55 +02:00
3a03d44e9a sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 17:45:32 +02:00
d39666bf8e sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 17:44:40 +02:00
2746d3e003 sf4 deprecated: migrate Doctrine ORM mapping to annotation 2020-07-24 16:45:51 +02:00
nobohan
3033be78d2 fix error: arguments were missing in service definition 2020-07-23 16:22:14 +02:00
nobohan
f9723e587f fix Export: arguments definition in services 2020-07-23 15:25:01 +02:00
9573f44001 fix sf4 deprecated: remove sensio_framework messages 2020-07-23 15:21:14 +02:00
c69d6d6bb8 fix sf4 deprecated: remove sensio_framework messages 2020-07-23 15:21:14 +02:00
4dc2aefb5b fix sf4 deprecated: remove sensio_framework messages 2020-07-23 15:21:14 +02:00
97d3afba9b fix sf4 deprecated: remove sensio_framework messages 2020-07-23 15:21:14 +02:00
ed22551313 fix sf4 deprecated: remove sensio_framework messages 2020-07-23 15:21:14 +02:00
nobohan
d7cdeaa28e sf4 deprecations: new supports and voteOnAttribute methods implemented in PersonDocumentVoter 2020-07-23 14:55:44 +02:00
0db13ef9bb fix sf4 deprecated: set paginator as public service 2020-07-23 14:48:51 +02:00
a812a0c132 fix sf4 deprecated: improve relying AuthorizationHelper service 2020-07-23 12:51:07 +02:00
3d1a12dc8b fix sf4 deprecated: improve relying AuthorizationHelper service 2020-07-23 12:51:07 +02:00
c5b1caefb6 fix sf4 deprecated: improve relying AuthorizationHelper service 2020-07-23 12:51:07 +02:00
nobohan
c8c76e5a8d sf4 deprecations: new supports and voteOnAttribute methods implemented in ParticipationVoter 2020-07-23 12:34:53 +02:00
1d8f72bc14 fix sf4 deprecated: remove choices_as_values form option 2020-07-22 17:05:24 +02:00
a38208f5cf fix sf4 deprecated: remove choices_as_values form option 2020-07-22 17:05:24 +02:00
f394283531 fix sf4 deprecated: remove choices_as_values form option 2020-07-22 17:05:24 +02:00
137294d8b8 fix sf4 deprecated: remove choices_as_values form option 2020-07-22 17:05:24 +02:00
5f8037433d fix sf4 deprecated: remove choices_as_values form option 2020-07-22 17:05:24 +02:00
05868b398e fix sf4 deprecated: rename twig spaceless tags 2020-07-22 16:28:21 +02:00
9850bfba81 fix sf4 deprecated: rename twig spaceless tags 2020-07-22 16:28:21 +02:00
4316667bd2 oups.. 2020-07-22 12:51:35 +02:00
fb5f3532a1 fix sf4 deprecated: cannotBeEmpty() is not allowed with arrayNode 2020-07-22 12:48:06 +02:00
da682c22bc fix sf4 deprecated: exclude entities from autowired services 2020-07-22 10:45:22 +02:00
ae26f72057 fix sf4 deprecated: exclude entities from autowired services 2020-07-22 10:17:18 +02:00
97a4deb159 rename service alias definition 2020-07-22 09:49:15 +02:00
977aa92c55 fix sf4 deprecated twig filter syntax 2020-07-17 14:07:45 +02:00
de177e5764 fix sf4 deprecated using get() method for private container 2020-07-16 16:16:21 +02:00
59bf662886 fix sf4 deprecated getting private container 2020-07-16 15:51:05 +02:00
3c5082dafb fix sf4 deprecated service argument syntax 2020-07-16 15:20:56 +02:00
73a2c2d41a fix sf4 deprecated service alias definition 2020-07-16 15:03:04 +02:00
f833a08515 fix sf4 deprecated service configuration key 2020-07-16 14:48:36 +02:00
a92686d10b deprecated, fix useless repository service definition 2020-07-16 14:44:40 +02:00
b03fc3558e deprecated, new syntax service definition (export_manager) 2020-07-15 18:09:53 +02:00
e886d671c1 deprecated: fix PersonRepository location 2020-07-15 16:00:59 +02:00
88fc2deb68 Mettre à jour CHANGELOG.md 2020-06-10 12:39:22 +02:00
b082b36276 list improvements in current sf3 branch 2020-06-10 12:37:53 +02:00
e785b36709 fix redirection when only one participation edit 2020-06-10 11:58:08 +02:00
9ccb5292ee update the way the bundle load assets
We use now the standard way to load assets.

See [CHANGELOG.md](CHANGELOG.md) for details.
2020-04-23 00:10:27 +02:00
2422fb2ead remove deps to phpspreadsheet 2020-04-22 22:56:25 +02:00
9d05dcc9a3 Merge remote-tracking branch 'origin/master' 2020-04-22 13:23:02 +02:00
2b63c51dee fix installation instructions 2020-04-22 13:09:26 +02:00
Marc Ducobu
74372fcc1d Correction of the url for the git clone command (framasoft.org -> framagit.org) 2020-04-22 09:59:57 +02:00
f2a7c49fe4 fix cire-devs/issues/29 create new event 2020-03-18 12:17:32 +01:00
79b9f0d274 documentation for CRUD 2020-03-13 12:40:16 +01:00
d49c2ea36e add documentation for embedded show/hide 2020-01-24 15:37:39 +01:00
8fe774de4f improve doc for show/hide on collection 2020-01-24 13:55:25 +01:00
c3012b7f8a remove dump() 2020-01-08 11:44:41 +01:00
58f2a9d5e1 update installation process 2019-12-05 11:41:06 +01:00
c29a3e3d80 documentation for show_hide 2019-12-04 16:39:01 +01:00
30e0c663dc adding remove event feature 2019-11-29 15:13:36 +01:00
8618efc35a adding remove participation method 2019-11-28 16:38:03 +01:00
6fe4594d3c styles export tableur form 2019-11-13 11:31:45 +01:00
d2d85a3527 Improve Event export: add fields + translator 2019-10-21 15:50:23 +02:00
8275715b56 Sort collection of participations by firstname in Event entity 2019-10-21 13:04:22 +02:00
7ac7def366 Add Chill context for event admins pages 2019-09-26 20:24:40 +02:00
3274ddb496 complete admin status list 2019-09-26 17:25:40 +02:00
defc884e26 minor changes 2019-07-18 16:46:17 +02:00
073a8cc5ea minor changes 2019-07-18 16:05:24 +02:00
81f3b1acae minor changes 2019-07-18 15:38:29 +02:00
be37d9d73a improve phpspreadsheet participations list export 2019-07-18 12:12:59 +02:00
59668f45a2 phpSpreadsheet export participations list for an event 2019-07-17 17:30:46 +02:00
c26b4f1ae7 add export button, route and controller method 2019-07-17 11:53:56 +02:00
5f4c15667c add tips for using chill:person:move 2019-06-12 14:18:56 +02:00
78910af913 documentation for chill:person:move command 2019-06-11 19:08:24 +02:00
49f921b2f8 try to fix rtd compilation 2019-05-03 15:41:29 +02:00
f1c84fc8da try to fix compilation on rtd 2019-05-03 15:38:10 +02:00
b30755956f add doc for boxes 2019-05-02 23:15:57 +02:00
b5f346aa8f documentation for new options in search 2019-05-02 23:13:38 +02:00
bba2f7214f remove rquirements 2019-05-02 23:13:32 +02:00
9e3d3c145e documentation for return path 2019-05-02 23:01:02 +02:00
ad45e71051 minor changes 2019-05-02 19:27:31 +02:00
8c3c9c4a1f new participation: add optional return_path to POST request 2019-05-02 16:19:28 +02:00
bd19110ecd rename method 2019-05-02 15:20:02 +02:00
55afcc2184 move queries in repository 2019-05-02 15:10:16 +02:00
c2b5e0f767 rename PickSubscriptionType to PickEventType 2019-05-02 12:16:48 +02:00
8a6e7396ca Rename PickEventType to PickEventTypeType for type of events 2019-05-02 12:11:40 +02:00
ee8f303d25 subscribe a person since listByPerson context (issue #19) 2019-05-02 12:08:09 +02:00
27ca8a58d7 Merge remote-tracking branch 'origin/master' 2019-05-02 11:36:59 +02:00
f2cfc12d7f add doc for chill_print_or_message 2019-05-02 11:36:36 +02:00
aa9141be1d hop 2019-04-18 12:58:59 +02:00
642ec803e8 timeline adapt view + corrections 2019-04-18 12:10:15 +02:00
7212f086cc timeline: template for events 2019-02-18 15:22:23 +01:00
cfae470089 wip.. context 2019-02-14 10:36:28 +01:00
Mathieu
3131b55f35 corrections 2019-02-11 15:47:06 +01:00
44487e3ea3 minors changes 2019-02-08 18:00:10 +01:00
b2b6cb6d6a disable csrf_protection on first step new event form 2019-02-08 17:31:08 +01:00
2ff22a73fa add and display events in history timeline 2019-02-08 16:39:12 +01:00
Mathieu
57bbf63d28 correction 2019-02-06 15:57:34 +01:00
8bf4621911 were missing role and center in edit form 2019-02-01 16:18:49 +01:00
156f306daa improve form attributes 2019-02-01 16:13:43 +01:00
4578625bb2 controller: merge newAction and createAction 2019-02-01 16:09:31 +01:00
c7ee9b8ebb correction of moderator relation (user not person) 2019-02-01 15:42:20 +01:00
ed3f0e9657 remove center field of event form 2019-02-01 15:23:54 +01:00
aa02597541 adapt select moderator field in new event form 2019-01-29 14:28:27 +01:00
fda14a52e0 add a first step to pick center in new event form 2019-01-28 18:27:23 +01:00
6d2ea8caab improve message translation 2019-01-25 19:04:20 +01:00
e2be8f119d Merge branch 'EventVoter' into sf3 2019-01-25 18:19:29 +01:00
29b7641528 Fix error on EventVoter 2019-01-25 18:01:37 +01:00
31876ee8b6 wip.. EVENT_SEE and _CREATE works in twig test, not in php test 2019-01-25 15:39:44 +01:00
2d295d8e43 test 2019-01-25 13:45:34 +01:00
1cf02cd1cc correct moderator field select in new form 2019-01-25 13:30:07 +01:00
a36c612542 invert sort list events 2019-01-25 13:29:47 +01:00
78acb56b43 move styles in new css, adapt webpack config 2019-01-25 11:17:29 +01:00
07b5f2f2ff listByPerson: improve translations 2019-01-25 10:35:30 +01:00
f8caaafa5a add fixtures contents, event_types and ACL 2019-01-24 16:21:29 +01:00
a10d48642f wip.. corrections 2019-01-23 09:11:53 +01:00
1e082677de return values of return values cases 2019-01-22 12:15:35 +01:00
15ff92257c wip.. adapt EventVoter to sf3 2019-01-21 17:41:44 +01:00
835ead6ccd dynamic back message in return values 2019-01-21 16:49:33 +01:00
3c434852d5 actions buttons, set return values in url 2019-01-21 15:43:52 +01:00
91124893fd improve actions buttons display for granted cases 2019-01-21 12:19:44 +01:00
f71e273aae new event form, like edit form 2019-01-21 09:52:59 +01:00
c235fb75a7 sort events by date (DESC) 2019-01-17 15:13:02 +01:00
Mathieu
cbb50013b3 correct DQL query 2019-01-17 15:09:49 +01:00
42c9a24472 listByPerson, display only events for current circle 2019-01-17 14:33:31 +01:00
d07cbb15da list events by person, add pagination 2019-01-17 14:31:45 +01:00
Mathieu
0337f252cd correct twig condition to display pagination 2019-01-17 14:29:45 +01:00
7abf403463 display table of events by person 2019-01-17 11:06:49 +01:00
c861c48b37 hop 2019-01-16 16:27:35 +01:00
a9522d5b4b add eventDispatcher for new page 2019-01-16 16:27:03 +01:00
735425f2fd template page for list events participation by person 2019-01-16 16:24:09 +01:00
d89e440784 add item 'events participation' in person menu 2019-01-16 16:19:40 +01:00
d18f3dd3dd styles: display date and time fields on same line 2019-01-16 11:23:50 +01:00
3042b1b0ca fixtures: add an event type 'visit' 2019-01-15 16:35:25 +01:00
ca6f836195 add a new moderator field on events 2019-01-15 16:01:47 +01:00
7836ece3ee add time to event dates 2019-01-15 14:10:45 +01:00
97d79c5a22 make fixtures works for event module 2019-01-15 11:12:06 +01:00
e1b5ec49f5 font-awesome pictos are now managed in css 2019-01-10 15:52:19 +01:00
7b8f2d1206 add time to field date, prepare and run migration script 2019-01-10 15:31:40 +01:00
d123e4137f fix event_participation depreciations 2018-12-20 16:41:25 +01:00
bc30998164 fix edit events depreciations 2018-12-20 15:55:17 +01:00
403d1749e3 fix admin_event_role depreciations 2018-12-20 12:50:54 +01:00
7de5cf03b6 fix admin_eventtype depreciations 2018-12-20 12:40:12 +01:00
cf93fc10fd fix admin_event_status depreciations 2018-12-20 12:38:42 +01:00
9f168a3a3c fix new events page depreciations 2018-12-20 11:36:39 +01:00
49aeb075a4 fix fatal errors 2018-12-20 11:25:46 +01:00
d85a661253 prepare composer.json before migrate to symfony 3 2018-12-19 14:54:35 +01:00
nobohan
2d76050589 add some documentation for managing assets using webpack 2018-04-18 12:34:59 +02:00
Marc Ducobu
29c729c7d7 Maj du schéma des classes de docStoreBundle 2018-03-06 18:28:45 +01:00
Marc Ducobu
f4c3282579 Adding class diagram for docStore 2018-03-06 10:46:48 +01:00
dec55131df [wip] documentation of exports 2017-08-19 23:12:33 +02:00
70832d45e2 add documentation of homepage widget 2017-08-19 23:12:03 +02:00
a052dd7d7c documentation of message to users 2017-08-19 23:11:51 +02:00
b0ca01b2ec add missing file 2017-08-19 23:11:31 +02:00
4eb5f5a0c1 improve installation with docker and move static to _static 2017-07-11 22:40:56 +02:00
08f03a75b0 add forms - new date picker 2017-04-07 23:06:08 +02:00
8a9a63905e add dependency injection / load routes 2017-04-07 23:05:42 +02:00
5ccafcb73f adding useful snippets 2017-03-13 00:40:16 +01:00
8ced86c60e documentation for show/hide element 2016-11-28 23:02:30 +01:00
813f9e389f fixing typo in widget page 2016-10-07 00:31:39 +02:00
fe8ade2ca8 add documentation for widget 2016-10-07 00:27:12 +02:00
53a6ca3d6b adding doc about pagination 2016-09-05 23:16:42 +02:00
6a57cd8388 adding link to dev mailing list and manual, register bundles 2016-07-08 09:21:35 +02:00
1a98980ad0 include installation.rst in a toctree 2016-07-08 09:12:13 +02:00
372dbc94e3 adding ldap bundle to doc 2016-07-08 09:06:45 +02:00
05a404d5b4 add information about logging 2016-06-01 23:20:22 +02:00
20845bd737 adding confirmation_template.html.twig 2016-06-01 22:55:19 +02:00
4d166498e5 adding a link to macros 2016-06-01 22:43:49 +02:00
Marc Ducobu
94f05ea5f4 Creation of a page for the event bundle 2016-03-22 15:36:07 +01:00
8eacdbc5fa fix grammar + improve comprehension 2016-03-15 10:21:11 +01:00
2b0bb364f5 documenting chill_block.person_post_vertical_menu event/delegated block 2016-03-15 00:09:05 +01:00
4f1a47c920 adding doc for delegated blocks
ref Chill-project/Chill-Main#12
2016-03-14 23:59:07 +01:00
534f11b15f fixing year in license 2016-03-14 23:34:46 +01:00
4743e8b3b8 documenting group bundle + macros in main 2016-03-14 23:32:12 +01:00
cbfeb4c04d documenting the activity configuration options 2016-03-14 23:08:57 +01:00
ce6481b9f4 add doc for showing/hiding address in person details 2016-03-14 23:02:15 +01:00
901fa399e9 add doc for UI : macros and CSS classes 2016-02-22 21:08:47 +01:00
786c3e6184 [wip] first documentation for exports 2016-02-09 21:34:23 +01:00
3b4e770130 improve homepage and update links 2016-02-09 13:39:08 +01:00
9267518909 add documentation about fields visibility in person 2016-02-09 13:17:20 +01:00
14e913cd7f upgrade installation guide to 1.0 2016-02-09 12:59:02 +01:00
e64e1e0fb1 add doc for chill_custom_fields_is_empty 2015-12-29 16:39:12 +01:00
b595efa0c9 add doc for birthdate_not_after configuration option 2015-12-23 21:48:57 +01:00
38885e8a0d add doc for show_emtpy_values_in_views
ref Chill-project/Chill-CustomFields#18
2015-12-23 21:23:03 +01:00
d23046edff fix link to documentation 2015-12-23 20:43:30 +01:00
Julien Fastré
f6a801cd47 Merge pull request #4 from jphuart/master
Review of Developper install + Installing your Posgressql server and chill database
2015-12-14 20:07:45 +01:00
Jean Pierre Huart
61052639a8 Changes done to the postgresql install 2015-12-14 14:31:19 +01:00
Jean Pierre Huart
2c08bf2c6c Doc to install as a developper 2015-12-08 17:07:21 +01:00
Jean Pierre Huart
9fa208b93a gitignore modified 2015-11-25 18:48:19 +01:00
Jean Pierre Huart
d667c10d04 Installation of Postgressql server and Chill database 2015-11-25 18:39:27 +01:00
Marc Ducobu
c6bfbd84ae Merge branch 'master' of github.com:Chill-project/Documentation 2015-10-30 18:29:08 +01:00
Marc Ducobu
4b0622f54c Adding information about getting the last version of the docker images 2015-10-30 18:28:10 +01:00
Marc Ducobu
74a18166ef Adding a page about the usage of the layouts / templates 2015-10-30 18:27:31 +01:00
Marc Ducobu
7a603f19bd Changing issue tracker in README : git.framasoft.org 2015-10-30 18:26:47 +01:00
53683cfd5f add button messages to users
refs #633
2015-10-12 22:00:06 +02:00
Marc Ducobu
06c15fdc34 Adding info for macos & docker 2015-10-09 15:17:37 +02:00
Marc Ducobu
a88e8cb6f7 By convention store custom fields data in the parameter cFData -- close #639 2015-10-09 14:48:32 +02:00
Marc Ducobu
3934d18df3 Revisin and adding the ftwig function 'chill_custom_fields_group_widget' 2015-10-01 11:35:44 +02:00
Marc Ducobu
2604c61866 Initialization of is not necessary 2015-10-01 10:36:17 +02:00
Marc Ducobu
3e3ac1c841 Spelling correction 2015-10-01 10:35:36 +02:00
cb48b020f7 adding how to declare new roles
refs #573 @0h30 adding documentation
2015-09-29 10:51:38 +02:00
fdddf77a90 fix doc about docker container demo 2015-09-21 13:31:59 +02:00
a7146a5991 add very quick start with docker instruction 2015-09-09 11:53:54 +02:00
Julien Fastré
1c7c7217cb Merge pull request #3 from jphuart/master
small changes in install
2015-07-21 14:02:45 +02:00
Jean Pierre Huart
70bc025ade Changes proposed accepted and implemented 2015-07-14 10:53:52 +02:00
Jean Pierre Huart
42b2c8ad61 Merge remote-tracking branch 'upstream/master' 2015-07-14 10:42:54 +02:00
7dcb457050 remove -e option for requirements.txt 2015-07-12 11:27:21 +02:00
48ab9afa69 add external requirements for readthedocs 2015-07-12 11:16:38 +02:00
Jean Pierre Huart
44e2445013 small changes in install 2015-07-03 17:39:21 +02:00
1f408ce758 Merge pull request 2 2015-07-02 23:29:48 +02:00
23b669b731 fix some installation steps 2015-07-02 23:28:25 +02:00
Jean Pierre Huart
bf48f22bd9 Install reviewed + update chill + install additional bundles 2015-07-02 17:39:09 +02:00
Jean Pierre Huart
54f4814953 propose reorganisation of installation doc 2015-06-30 17:16:49 +02:00
Julien Fastré
0be232e202 Merge pull request #1 from jphuart/master
Revision of installation steps using docker database
2015-06-28 01:16:15 +02:00
799b612a72 add access control model documentation 2015-06-28 01:14:31 +02:00
Jean Pierre Huart
4408eea3b3 Changes to optional css install 2015-06-26 18:13:58 +02:00
Jean Pierre Huart
1f11924be3 Merge remote-tracking branch 'upstream/master'
syncing for the first time
2015-06-26 18:08:02 +02:00
Jean Pierre Huart
2b0872ab7d Update installation.rst
Details to be deleted
2015-06-26 17:30:23 +02:00
Jean Pierre Huart
859e115de7 Update installation.rst 2015-06-26 17:28:22 +02:00
Marc Ducobu
e7ceb805c6 Adding information about building the .css files - 2 2015-06-08 10:08:21 +02:00
Marc Ducobu
7ae12df918 Adding information about building the .css files 2015-06-08 10:04:30 +02:00
66c33f7feb remove php/sension extensions if building on rtd 2015-05-01 23:10:04 +02:00
dad59e3b04 add docker postgresql image in installation part 2015-05-01 22:59:34 +02:00
ba2335d73e explain how to add extensions 2015-03-27 20:05:25 +01:00
951b65b511 add extensions for php rendering 2015-03-27 19:42:16 +01:00
489d1a5819 documentation for timelines
refs #224

Explain how to publish information into a timeline, and how to create a timeline with a new context
2015-03-26 20:32:56 +01:00
319626bf7d documentation for custom fields bundle
close #265
2015-03-10 22:39:14 +01:00
Marc Ducobu
39f186b4a6 More details about sphinx installation 2015-01-27 17:01:08 +01:00
Marc Ducobu
2b965bafdf Merge branch 'master' of github.com:Chill-project/Documentation 2015-01-27 16:44:44 +01:00
Marc Ducobu
317acfa1a5 Revisioning 2015-01-27 16:44:38 +01:00
74bf42e350 documentation for locale in url
close #288
2015-01-23 15:19:14 +01:00
458a2e71a5 add doc for date localisation
Introduce the twig Intl extension and make ref to the doc.

refs #272
2015-01-23 15:01:47 +01:00
ab36443943 documentation for routing
refs #273
2015-01-22 17:35:37 +01:00
d1140ba6d3 documentation about search in reports 2015-01-15 15:53:08 +01:00
f2ea3edf29 add a table of content for person bundle page
and fixe some errors in rst syntax
2015-01-15 15:48:39 +01:00
9762df463f Documentation about search
refs #223 and refs #377
2015-01-15 15:34:46 +01:00
6ea5a9227d move bundle directory at root
This should ease the browsing fo documentation (less menu and submenus)
2015-01-15 09:27:38 +01:00
cd9b95c7ca add missing report.rst file 2015-01-05 16:29:23 +01:00
21485649db Documente search terms on person bundl 2015-01-05 16:21:14 +01:00
3033845146 Add unaccent requirement 2015-01-04 22:29:27 +01:00
ceef7e746e warning about data losing and migration files updating 2014-12-04 16:57:32 +01:00
f2e4146a43 split text on multiple lines for readability 2014-12-04 16:53:19 +01:00
8129f156de remove a warning, as I tested the instructions locally 2014-12-04 16:50:53 +01:00
7e5945d6a1 improve documentation hierarchy
We create a level into the "installation" directory, and create an index file into this directory.

This will also be more consistent with the "developer" part.
2014-12-04 16:41:46 +01:00
cc6326bc15 add reference on how to create the database after installation 2014-12-04 16:33:54 +01:00
ec446826a3 typo 2014-12-04 16:16:36 +01:00
208bc43e1f add step "app/check.php"
close #235
2014-12-04 16:13:11 +01:00
63d994bc49 documentation about migrations
close #216
2014-12-04 15:59:57 +01:00
f6aaefd1e5 add docs for custom fields twig functions 2014-11-10 13:28:20 +01:00
5c0a9090fa add instructions to assume unchanged symfony files 2014-11-10 13:07:32 +01:00
d323004329 add a todo list on front page 2014-11-10 00:48:05 +01:00
168e12045c doc on custom fields rendering and form 2014-11-10 00:47:46 +01:00
6d7567de01 enable todo extension 2014-11-10 00:47:20 +01:00
Julien Fastré
f9ef4ab515 fix url 2014-11-09 22:02:19 +01:00
f70d3ef0b2 add dev tips for watching a field 2014-11-09 18:53:50 +01:00
a271072f23 precise the exception in case of missing parameter in url 2014-11-07 16:02:18 +01:00
75cc85746e typo 2014-11-07 15:57:21 +01:00
515b8a0762 add doc for menus and flashbag 2014-11-07 15:57:07 +01:00
Marc Ducobu
91ca709cf9 AcmeHelloBundle -> ChillMainBundle 2014-11-07 12:32:25 +01:00
Marc Ducobu
9289a6304b CLChillMainBundle -> ChillMainBundle 2014-11-07 12:31:09 +01:00
a5ff98d855 [work in progress] refs #265 documentation for custom fields 2014-11-05 16:30:59 +01:00
24300c4ebc Merge branch 'master' of github.com:Chill-project/Documentation 2014-10-23 15:03:56 +02:00
30afec9153 refs #235 2014-10-23 14:59:05 +02:00
Marc Ducobu
b424ec49bc Refactoring : champs-libres -> chill-project 2014-10-17 17:29:06 +02:00
0e5cf6fe86 update project name 2014-10-17 07:56:38 +02:00
74f2b23b54 typo in structure to emphasis 2014-10-14 22:32:51 +02:00
e9667ef8d6 fix footnotes 2014-10-14 22:28:13 +02:00
709794eab7 doc for routing and menus 2014-10-14 22:27:08 +02:00
0a4b8daf26 add link 2014-10-14 14:50:28 +02:00
d7cac3dd73 create manual and routing page 2014-10-14 14:50:17 +02:00
6346a9670d add rtd_theme for local builds 2014-10-14 14:49:50 +02:00
77e1540b83 Revert "switch to the rtd theme"
This reverts commit a1466466ae.
2014-10-11 00:15:47 +02:00
74ab54ef46 add licence to footer and correct project name 2014-10-10 23:39:41 +02:00
6a5207597b grammar and mention of symfony framework 2014-10-10 23:39:07 +02:00
a1466466ae switch to the rtd theme 2014-10-10 23:26:15 +02:00
ea56ff5a08 correct hierarchy 2014-10-10 23:16:19 +02:00
a0a6657d18 add gitignore 2014-10-10 23:15:14 +02:00
f148514750 add doc for developers 2014-10-10 18:59:41 +02:00
43f7ba0e16 restructuration of titles order + various informations 2014-10-09 10:14:19 +02:00
46f62fe3ec add missing bash command 2014-09-29 22:26:48 +02:00
6501eba7da improve bash statement using return line 2014-09-29 22:19:30 +02:00
4ae4906754 fix rst syntax 2014-09-29 22:12:17 +02:00
721b93e209 update docs 2014-09-29 22:07:32 +02:00
cc4125078a Merge branch 'master' of github.com:Champs-Libres/Chill-doc 2014-09-29 20:14:33 +02:00
ddea18ebd1 add readme and license 2014-09-29 20:14:28 +02:00
463dfb0bd6 index page 2014-09-29 18:38:51 +02:00
e6af0db5f2 remove build files 2014-09-29 10:07:06 +02:00
665e26cc8a initial commit 2014-09-29 10:04:16 +02:00
1825 changed files with 75987 additions and 65444 deletions

19
.editorconfig Normal file
View File

@@ -0,0 +1,19 @@
; top-most EditorConfig file
root = true
; Unix-style newlines
[*]
charset = utf-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
[*.{php,html,twig}]
indent_style = space
indent_size = 4
[*.md]
max_line_length = 80
[COMMIT_EDITMSG]
max_line_length = 0

64
.env Normal file
View File

@@ -0,0 +1,64 @@
##
## Manually dump .env files in .env.local.php with
## `$ composer symfony:dump-env prod`
##
## Project environment
APP_ENV=dev
## Enable debug
APP_DEBUG=true
## Locale
LOCALE=fr
## Framework secret
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
## Symfony/swiftmailer
MAILER_TRANSPORT=smtp
MAILER_HOST=smtp
MAILER_PORT=1025
MAILER_CRYPT=
MAILER_AUTH=
MAILER_USER=
MAILER_PASSWORD=
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
## Notifications
NOTIFICATION_HOST=localhost:8001
NOTIFICATION_FROM_EMAIL=admin@chill.social
NOTIFICATION_FROM_NAME=Chill
## Gelf
GELF_HOST=gelf
GELF_PORT=12201
## OVH OpenStack Storage User/Role
OS_USERNAME=
OS_PASSWORD=
OS_TENANT_ID=
OS_REGION_NAME=GRA
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
## OVH OpenStack Storage Container
ASYNC_UPLOAD_TEMP_URL_KEY=
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
## Redis Cache
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
## Twilio
TWILIO_SID=~
TWILIO_SECRET=~
## DOCKER IMAGES REGISTRY
#IMAGE_PHP=
#IMAGE_NGINX=
## DOCKER IMAGES VERSION
#VERSION=test
VERSION=prod

6
.env.test Normal file
View File

@@ -0,0 +1,6 @@
# variables for .env environement
# those variables suits for gitlab-ci
# Run tests from root to adapt your own environment
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8

21
.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
.composer/*
composer.phar
composer.lock
docs/build/
.php_cs.cache
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
/bin/
###< symfony/framework-bundle ###
###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

37
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,37 @@
---
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
# Select what we should cache between builds
cache:
paths:
- tests/app/vendor/
before_script:
# add extensions to postgres
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
# Install and run Composer
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- php tests/app/bin/console doctrine:migrations:migrate -n
- php tests/app/bin/console doctrine:fixtures:load -n
# 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
alias: db
- name: redis
alias: redis
# Set any variables we need
variables:
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# fetch the chill-app using git submodules
GIT_SUBMODULE_STRATEGY: recursive
# Run our tests
test:
script:
- bin/phpunit --colors=never

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "_exts/sphinx-php"]
path = _exts/sphinx-php
url = https://github.com/fabpot/sphinx-php.git
[submodule "tests/app"]
path = tests/app
url = https://gitlab.com/Chill-projet/chill-app.git

25
.php_cs.dist Normal file
View File

@@ -0,0 +1,25 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
$config = require __DIR__ . '/vendor/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
$config
->getFinder()
->ignoreDotFiles(false)
->name(['.php_cs.dist']);
$rules = $config->getRules();
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
return $config->setRules($rules);

10
.readthedocs.yml Normal file
View File

@@ -0,0 +1,10 @@
---
version: 2
sphinx:
configuration: docs/source/conf.py
python:
version: 3.7
install:
- requirements: docs/requirements.txt

661
LICENSE Normal file
View File

@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

88
composer.json Normal file
View File

@@ -0,0 +1,88 @@
{
"name": "chill-project/chill-bundles",
"license": "AGPL-3.0-only",
"type": "library",
"description": "Most used bundles for chill-project",
"keywords": ["chill", "social worker"],
"autoload": {
"psr-4": {
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
"Chill\\CustomFieldsBundle\\": "src/Bundle/ChillCustomFieldsBundle",
"Chill\\DocStoreBundle\\": "src/Bundle/ChillDocStoreBundle",
"Chill\\EventBundle\\": "src/Bundle/ChillEventBundle",
"Chill\\FamilyMemberBundle\\": "src/Bundle/ChillFamilyMemberBundle",
"Chill\\MainBundle\\": "src/Bundle/ChillMainBundle",
"Chill\\PersonBundle\\": "src/Bundle/ChillPersonBundle",
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
}
},
"autoload-dev": {
"psr-4": {
"App\\": "tests/app/src/"
}
},
"require": {
"champs-libres/async-uploader-bundle": "dev-sf4",
"graylog2/gelf-php": "^1.5",
"symfony/form": "4.*",
"symfony/twig-bundle": "^4.4",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"composer/package-versions-deprecated": "^1.10",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"symfony/asset": "4.*",
"symfony/monolog-bundle": "^3.5",
"symfony/security-bundle": "4.*",
"symfony/translation": "4.*",
"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.*",
"twig/intl-extra": "^3.0",
"symfony/workflow": "4.*",
"symfony/expression-language": "4.*",
"knplabs/knp-time-bundle": "^1.12",
"symfony/intl": "4.*",
"symfony/swiftmailer-bundle": "^3.5",
"league/csv": "^9.6",
"phpoffice/phpspreadsheet": "^1.16",
"symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2",
"twig/markdown-extra": "^3.3",
"erusev/parsedown": "^1.7",
"symfony/serializer": "^5.2"
},
"conflict": {
"symfony/symfony": "*"
},
"require-dev": {
"drupol/php-conventions": "4.*",
"fakerphp/faker": "^1.13",
"phpunit/phpunit": "^7.0",
"symfony/dotenv": "^5.1",
"symfony/maker-bundle": "^1.20",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"symfony/stopwatch": "^5.1",
"symfony/web-profiler-bundle": "^5.0",
"symfony/var-dumper": "4.*",
"symfony/debug-bundle": "^5.1",
"symfony/phpunit-bridge": "^5.2"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
},
"config": {
"bin-dir": "bin"
}
}

5
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
_exts
build/*
!build/git.txt
*~
.project

451
docs/LICENSE Normal file
View File

@@ -0,0 +1,451 @@
GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
The "publisher" means any person or entity that distributes copies of
the Document to the public.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no
other conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to
give them a chance to provide you with an updated version of the
Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other
documents released under this License, and replace the individual
copies of this License in the various documents with a single copy
that is included in the collection, provided that you follow the rules
of this License for verbatim copying of each of the documents in all
other respects.
You may extract a single document from such a collection, and
distribute it individually under this License, provided you insert a
copy of this License into the extracted document, and follow this
License in all other respects regarding verbatim copying of that
document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the
GNU Free Documentation License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
means any set of copyrightable works thus published on the MMC site.
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
"Incorporate" means to publish or republish a Document, in whole or in
part, as part of another Document.
An MMC is "eligible for relicensing" if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole or
in part into the MMC, (1) had no cover texts or invariant sections, and
(2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

177
docs/Makefile Normal file
View File

@@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/chill-doc.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/chill-doc.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/chill-doc"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/chill-doc"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

35
docs/README.md Normal file
View File

@@ -0,0 +1,35 @@
Chill documentation
====================
Documentation of the Chill software.
The compiled documentation may be read at http://docs.chill.social
Compilation into HTML
=====================
To compile this documentation :
1. Install [sphinx-doc](http://sphinx-doc.org)
``` bash
$ virtualenv .venv # creation of the virtual env (only the first time)
$ source .venv/bin/activate # activate the virtual env
(.venv) $ pip install -r requirements.txt
```
2. Install submodules : $ git submodule update --init;
3. run `make html` from the root directory
4. The base file is located on build/html/index.html
``` bash
$ cd build/html
$ python -m http.server 8888 # will serve the site on the port 8888
```
Contribute
===========
Issue tracker : https://git.framasoft.org/groups/Chill-project/issues
Licence
=======
This documentation is available under the [GNU Free Documentation Licence](http://www.gnu.org/licenses/fdl-1.3.en.html).

6
docs/requirements.txt Normal file
View File

@@ -0,0 +1,6 @@
docutils==0.13.1
Pygments==2.2.0
sphinx==1.8.5
git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php
jsx-lexer===0.0.8
sphinx_rtd_theme==0.5.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,46 @@
# diagramme de classe du module "docStore"
@startuml
title Diagramme de classe du module "docStore"
package "PersonBundle" {
class Person
class Center
class PersonDocument
}
package "DocStoreBundle" {
Document "many" --- "1" DocumentCategory
}
Document <|-- "herite" PersonDocument
class "Document" {
- int id
- varchar_150 title
- text description
- ArrayCollection_DocumentCategory categories
- varchar_150 content #link to openstack
- Center center
- Cercle cercle
- User user
- DateTime date # Creation date
}
class "DocumentCategory" {
.. Primary Key ..
- varchar_150 bundle_id
- int internal_bundle_id
==
- json_array name
- ArrayCollection_Document documents
}
class "PersonDocument" {
- Person person
}
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -0,0 +1,49 @@
# diagramme de classe du module "groupe"
@startuml
title Diagramme de classe du module "groupe"
package "PersonBundle" {
class Person
class Center
}
package "GroupBundle" {
Person "1" <-- Membership
Membership "0..*" <--> "Group"
Type "1" --> "1..*" Role
Membership -right-> "1" Role
Group -right-> "1" Type
Group -left-> "1" Center
}
class Membership {
- role
- person
- group
}
note left: <b>Membership</b> relie les groupes aux\npersonnes. Chaque membership a un\n <b>role</b>, le rôle est à choisir\nparmi ceux possibles pour le <b>type</b> de <b>groupe</b>
class Group {
- type
- memberships
- name
- center
}
note left: Un groupe a un type qui est défini à sa création.
class Type {
- roles
}
note right: Les types de groupe qu'il est possible de créer \nsont définis dans l'interface d'administration.\nExemple de type: "famille", "groupe de parole", "stage", ...
class Role {
- name
}
note right: Pour chaque <b>Type</b> on définit des rôles\npossibles pour ce type de groupe. Par exemple, pour le\ntype "famille" on peut avoir les rôles <i>parents</i> et <i>enfants</i>.
@enduml

View File

@@ -0,0 +1,128 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Export\FilterInterface;
use DateTime;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
{
// add specific role for this filter
public function addRole()
{
// we do not need any new role for this filter, so we return null
return null;
}
// here, we alter the query created by Export
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
// we create the clause here
$clause = $qb->expr()->between(
'person.birthdate',
':date_from',
':date_to'
);
// we have to take care **not to** remove previous clauses...
if ($where instanceof Expr\Andx) {
$where->add($clause);
} else {
$where = $qb->expr()->andX($clause);
}
$qb->add('where', $where);
// we add parameters from $data. $data contains the parameters from the form
$qb->setParameter('date_from', $data['date_from']);
$qb->setParameter('date_to', $data['date_to']);
}
// we give information on which type of export this filter applies
public function applyOn()
{
return 'person';
}
// we build a form to collect some parameters from the users
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
{
$builder->add('date_from', DateType::class, [
'label' => 'Born after this date',
'data' => new DateTime(),
'attr' => ['class' => 'datepicker'],
'widget' => 'single_text',
'format' => 'dd-MM-yyyy',
]);
$builder->add('date_to', DateType::class, [
'label' => 'Born before this date',
'data' => new DateTime(),
'attr' => ['class' => 'datepicker'],
'widget' => 'single_text',
'format' => 'dd-MM-yyyy',
]);
}
// here, we create a simple string which will describe the action of
// the filter in the Response
public function describeAction($data, $format = 'string')
{
return ['Filtered by person\'s birtdate: '
. 'between %date_from% and %date_to%', [
'%date_from%' => $data['date_from']->format('d-m-Y'),
'%date_to%' => $data['date_to']->format('d-m-Y'),
], ];
}
public function getTitle()
{
return 'Filter by person\'s birthdate';
}
// the form created above must be validated. The process of validation
// is executed here. This function is added by the interface
// `ExportElementValidatedInterface`, and can be ignore if there is
// no need for a validation
public function validateForm($data, ExecutionContextInterface $context)
{
$date_from = $data['date_from'];
$date_to = $data['date_to'];
if (null === $date_from) {
$context->buildViolation('The "date from" should not be empty')
//->atPath('date_from')
->addViolation();
}
if (null === $date_to) {
$context->buildViolation('The "date to" should not be empty')
//->atPath('date_to')
->addViolation();
}
if (
(null !== $date_from && null !== $date_to)
&& $date_from >= $date_to
) {
$context->buildViolation('The date "date to" should be after the '
. 'date given in "date from" field')
->addViolation();
}
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
class CountPerson implements ExportInterface
{
/**
* @var EntityManagerInterface
*/
protected $entityManager;
public function __construct(
EntityManagerInterface $em
) {
$this->entityManager = $em;
}
public function buildForm(FormBuilderInterface $builder)
{
// this export does not add any form
}
public function getAllowedFormattersTypes()
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription()
{
return 'Count peoples by various parameters.';
}
public function getLabels($key, array $values, $data)
{
// the Closure which will be executed by the formatter.
return function ($value) {
switch ($value) {
case '_header':
// we have to process specifically the '_header' string,
// which will be used by the formatter to show a column title
return $this->getTitle();
default:
// for all value, we do not process them and return them
// immediatly
return $value;
}
};
}
public function getQueryKeys($data)
{
// this array match the result keys in the query. We have only
// one column.
return ['export_result'];
}
public function getResult($qb, $data)
{
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle()
{
return 'Count peoples';
}
public function getType()
{
return Declarations::PERSON_TYPE;
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// we gather all center the user choose.
$centers = array_map(static function ($el) {
return $el['center'];
}, $acl);
$qb = $this->entityManager->createQueryBuilder();
$qb->select('COUNT(person.id) AS export_result')
->from('ChillPersonBundle:Person', 'person')
->join('person.center', 'center')
->andWhere('center IN (:authorized_centers)')
->setParameter('authorized_centers', $centers);
return $qb;
}
public function requiredRole()
{
return new Role(PersonVoter::STATS);
}
public function supportsModifiers()
{
// explain the export manager which formatters and filters are allowed
return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN];
}
}

View File

@@ -0,0 +1,35 @@
version: '2'
services:
fpm:
image: dev-activity-person-report
links:
- db
- redis
- logstash:gelf
environment:
- ADMIN_PASSWORD=admin
# add a link to custom.yml if needed
# volumes:
# - /tmp/custom.yml:/var/www/chill/app/config/custom.yml
redis:
image: redis
db:
image: chill/database
logstash:
image: logstash
command: logstash -e 'input { gelf { } } output { stdout{ } }'
expose:
- "12201/udp"
volumes:
- /var/log/logstash
nginx:
image: nginx
links:
- fpm
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
volumes_from:
- fpm:ro
ports:
- 8080:80

View File

@@ -0,0 +1,71 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip off;
#include /etc/nginx/conf.d/*.conf;
upstream phpfcgi {
server fpm:9000;
# server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
}
server {
listen 80;
#server_name symfony2;
root /var/www/chill/web;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# pass the PHP scripts to FastCGI server from upstream phpfcgi
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass phpfcgi;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,82 @@
@startuml
actor User
participant Controller
participant ExportFormType as eft
participant ExportManager as em
participant SelectedExport as se
participant AggregatorFormType as aft
collections aggregators as a
participant FilterFormType as fft
collections filters as f
User -> Controller: request "/exports/new/<id of the export>?step=export"
activate Controller
Controller -> eft: build the form (AbstractType::buildForm)
activate eft
eft -> em: get the export
activate em
em -> eft: return the SelectedExport
deactivate em
eft -> se: get the Export Type
activate se
se -> eft: return the export Type (a string)
deactivate se
eft -> aft: build the subform 'aggregators'
activate aft
aft -> em: get aggregators for this export type
activate em
em -> aft: return a collection of aggregators
deactivate em
loop for each aggregator
aft -> a: build eventual subform for the aggregator
activate a
a -> a: append enventually his form
a -> aft
deactivate a
end
aft -> eft
deactivate aft
eft -> fft: build the subform 'filters'
activate fft
fft -> em: get filters for this export type
activate em
em -> fft: return a collection for filters
deactivate em
loop for each filter
fft -> f: build eventual subform for the filter
activate f
f -> f: append eventually his form
f -> fft
deactivate f
end
fft -> eft
deactivate fft
eft -> se: build eventual subform for the export itsefl
activate se
se -> se: append eventually his form
se -> eft
deactivate se
se -> Controller: return a well-build form
deactivate se
Controller -> User: render the page with the form
deactivate Controller
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

View File

@@ -0,0 +1,164 @@
@startuml
participant Controller
participant ExportManager as em
participant SelectedExport as se
participant Formatter as f
collections aggregators as aa
collections filters as ff
activate Controller
Controller -> em: ExportManager::generate(string 'export_alias', Centers[], $data, $formatterdata)
activate em
note left
$data contains the data
from the export form
(export form + aggregators form +
filters forms)
end note
em -> se: Export::initiateQuery($modifiers, $acl, $data)
activate se
note left
$modifiers contains the selected modifiers
and their data. Usually you can ignore this.
$acl contains the list of selected centers. The
export must check that the user has the right
to compute the export for this center
$data the data from the export form (if the export
build a form with `buildForm` function
end note
create Query as q
se -> q: the export will create a query
se -> em: return the query
deactivate se
alt The query is a "native sql query"
note over em, se
When the export create a native query, there aren't any filters
or aggregators which can alter the query.
We immediatly get the results from the query.
end note
else "The query is a query builder"
note over em, se
As the query is a query builder, filters and formatters
will be able to alter the query.
end note
loop for each filter selected by user
em -> ff: FilterInterface::alterQuery(query, $data)
activate ff
note over em, ff
The filter will alter query, adding his own clause (i.e. WHERE clause). It is
his responsability to avoid removing clauses added by other filters / aggregators.
The ExportManager will also transmit the $data filled by the user (if the
filter has a form) to each filter / aggregator.
end note
ff -> q: append some clauses
deactivate ff
end
loop for each aggregator selected by user
note over em, aa
As of filter, aggregators will append their
own clauses in the query (usually GROUP BY clause).
end note
em -> aa: AggregatorInterface::alterQuery(query, data)
activate aa
aa -> q: append some clauses
deactivate aa
end
end alt
note over se
The query is now ready. We will fetch the results from databases.
The Export is responsible for getting the results
end note
em -> se: Export::getResult(query, $data)
activate se
se -> q: getResult()
activate q
q -> se: return result
destroy q
se -> em: return result
deactivate se
em -> f: FormatterInterface::getResponse()
activate f
note over f, ff
The formatter will ask the export, and each aggregators the keys they
are responsible for.
Then, for each of those keys, he will ask to each participant
(Export or aggregator) a Closure, which will render the value in
results into a human readable string.
end note
f -> se: getQueryKeys
activate se
se -> f: return string[]
loop for each keys the export is responsible for
f -> se: ExportInterface::getLabel()
create "closure for key export" as closuree
se -> closuree: create a closure
se -> f: return closure
end
loop for each aggregator
f -> aa: getQueryKeys()
activate aa
aa -> f: return string[]
deactivate aa
loop for each keys the aggregator is responsible for
f -> aa: getLabel()
activate aa
create "closure for key aggregators" as closureg
aa -> closureg: create a closure
aa -> f: return closure
deactivate aa
end
end
loop over results
note over f, closureg
Each row in result will be transformed in a human readable format by the closure.
The human readable string will be appended by the Formatter in his response (a Spreadsheet, CSV file, ...)
end note
f -> closuree: call
activate closuree
closuree -> f: return a human readable format for this value
deactivate closuree
f -> closureg: call
activate closureg
closureg -> f: return a human readable format for the value
deactivate g
f -> f: append the result in his response
end
f -> em: return a Response
deactivate f
em -> Controller: return a Response
deactivate em
deactivate Controller
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,20 @@
@startuml
actor "controller, service, ..." as x
participant "paginator"
participant "Request"
x -> paginator: getCurrentPage()
activate paginator
paginator -> Request: read the `page` parameter in GET request
activate Request
Request -> paginator
deactivate Request
paginator -> paginator: construct a page object for current page number
paginator -> x: return the `page`
deactivate paginator
@enduml

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

View File

@@ -0,0 +1,71 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _activity-bundle:
Activity bundle
###############
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
.. contents:: Table of content
:local:
Entities provided
*****************
.. todo::
Describe the entities provided.
Configuration options
*********************
Those options are available under `chill_activity` key.
Example of configuration:
.. code-block:: yaml
chill_activity:
form:
time_duration:
- { label: '12 minutes', seconds: 720 }
- { label: '30 minutes', seconds: 1800 }
form.time_duration *array*
The duration which might be suggested when the user create or update an activity. The value must be an array of object, where each object must have a :code:`label` and a :code:`seconds` key. The label provide which is shown to user (the label will be translated, if possible) and the seconds the duration.
Example: see the example above
Default value: the values available are 5, 10, 15, 20, 25, 30, 45 minutes, and 1 hour, 1 hour 15, 1 hour 30, 1 hour 45 and 2 hours.
.. _activity-bundle-macros:
Macros
******
Activity reason sticker
=======================
Macro file
`ChillActivityBundle:ActivityReason:macro.html.twig`
Macro envelope
:code:`reason(r)`
:code:`p` is an instance of :class:`Chill\ActivityBundle\Entity\ActivityReason`
When to use this macro ?
When you want to represent an activity reason.
Example usage :
.. code-block:: html+jinja
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
{{ m.reason(r) }}

View File

@@ -0,0 +1,441 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _custom-fields-bundle:
Custom fields bundle
====================
This bundle provides the ability to add custom fields to existing entities.
Those custom fields contains extra data and will be stored in the DB, along with other data's entities. It may be string, text, date, ... or a link to an existing entities.
In the database, custom fields are stored in json format.
.. seealso::
The full specification discussed `here. <https://redmine.champs-libres.coop/issues/239>`_
`JSON Type on postgresql documentation <http://www.postgresql.org/docs/9.3/static/datatype-json.html>`_
The documentation of json type, which is used to store data in the database.
.. contents:: Table of contents
:depth: 4
:local:
Custom Fields concepts
----------------------
Custom fields are extra data which may be added to entities by user. If a developer implements custom fields on a entity, users will be able to add more fields on this entity.
Example: the `person bundle` allows to record `firstname`, `lastname`, `date of birth` fields. But users need to store information about the kind of house he has (if he owns his house, if he rents it, ...). Custom fields allows to create those fields.
Automatically, those fields are added at the person form. They are also printed in the person view and in exports.
Custom fields and custom fields group
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Custom fields are associated to a custom fields group. When a user want to add custom fields on an entity, he must first create a custom fields group and associate this field with an entity. Then he may add add custom fields to this groups.
Some entities needs a **default** custom fields group. For instance, the default custom fields group will be printed on the main form for person, and will be appended on the main person view. Some bundle does not use this feature (i.e. the `report` bundle).
.. note::
In the future of the `person bundle`, other custom fields group will be added in forms accessible from the menu, allowing users to completely customize and separate their entities.
Allow custom fields on an entity
--------------------------------
As a developer, you must allow your users to add custom fields on your entities.
.. warning::
For having custom fields, the class of the entity must contain a variable for storing the custom data. **By convention this variable must be called $cFData**
Create a json field on your entity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Declare a json field in your database :
.. code-block:: yaml
Chill\CustomFieldsBundle\Entity\BlopEntity:
type: entity
# ...
fields:
cFData:
type: json_array
Create the field accordingly in the class logic :
.. code-block:: php
namespace Chill\CustomFieldsBundle\Entity;
/**
* BlopEntity
*/
class BlopEntity
{
/**
* @var array
*/
private $cFData;
/**
* You must set a setter in order to save automatically custom
* fields from forms, using Form Component
*
* @param array $cFData
* @return BlopEntity
*/
public function setCFData(array $cFData)
{
$this->cFData = $cFData;
return $this;
}
/**
* You also must create a getter in order to let Form
* component populate form fields
*
* @return array
*/
public function getCFData()
{
return $this->cFData;
}
Declare your customizable entity in configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This step is necessary to allow user to create custom fields group associated with this entity.
Two methods are available.
The recommended method is to do it in DependencyInjection/Extension class. It is recommended as your bundle will be well set up (for custom field) in every chill installation that use it.
The discouraged method is to declare via the app/config.yml file. This is very quick to set up for a given chill installation but it is not done automatically : in every chill installation that use your bundle, this step has to be performed.
In app/config.yml file (discouraged)
""""""""""""""""""""""""""""""""""""
This method is discouraged but explained first as it helps to undersand the recommended method.
Add those file under `chill_custom_fields` section :
.. code-block:: yaml
chill_custom_fields:
customizables_entities:
- { class: Chill\YourBundleBundle\Entity\BlopEntity, name: blop_entity }
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
* The class, which is a full FQDN class path
Automatically, in DependencyInjection/Extension class (recommended)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
This is the recommended way for declaring customizable classes.
You can prepend configuration of `custom fields bundle` from the class `YourBundle\DependencyInjection\YourBundleExtension`. **Note** that you also have to implements `Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface` on this class to make the `prepend` function being taken into account.
Example here :
.. code-block:: php
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
{
/**
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['ChillCustomFieldsBundle'])) {
throw new MissingBundleException('ChillCustomFieldsBundle');
}
$container->prependExtensionConfig('chill_custom_fields',
array('customizables_entities' =>
array(
array(
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
'name' => 'blop_entity',)
)
)
);
}
}
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
* The class, which is a full FQDN class path
.. seealso::
`How to simplify configuration of multiple bundles <http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html>`_
A cookbook page about prepending configuration.
Adding options to your custom fields groups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You may add options to the groups associated with an entity.
In `config.yml` the declaration should be :
.. code-block:: yaml
chill_custom_fields:
customizables_entities:
-
class: Chill\YourBundleBundle\Entity\BlopEntity
name: BlopEntity
options:
# this will create a "myFieldKey" field as text, with a maxlength attribute to 150 (see http://symfony.com/doc/master/reference/forms/types/text.html)
myFieldKey: {form_type: text, form_options: {attr: [maxlength: 150]}}
In the `PrependExtensionInterface::prepend` function, the options key will be added in the configuration definition :
.. code-block:: php
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
{
/**
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['ChillCustomFieldsBundle'])) {
throw new MissingBundleException('ChillCustomFieldsBundle');
}
$container->prependExtensionConfig('chill_custom_fields',
array('customizables_entities' =>
array(
array(
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
'name' => 'BlopEntity',
'options' => array(
'myFieldKey' => [ 'form_type' => 'text', 'form_options' => [ 'attr' => [ 'maxlength' => 150 ] ]
))
)
)
);
}
}
**Example :** the entity `Report` from **ReportBundle** has to pick some custom fields belonging to a group to print them in *summaries* the timeline page. The definition will use the special type `custom_fields_group_linked_custom_field` which will add a select input with all fields associated with the current custom fields group :
.. code-block:: php
class ChillReportExtension extends Extension implements PrependExtensionInterface
{
/**
*
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['ChillCustomFieldsBundle'])) {
throw new MissingBundleException('ChillCustomFieldsBundle');
}
$container->prependExtensionConfig('chill_custom_fields',
array('customizables_entities' =>
array(
array(
'class' => 'Chill\ReportBundle\Entity\Report',
'name' => 'ReportEntity',
'options' => array(
'summary_fields' => array(
'form_type' => 'custom_fields_group_linked_custom_fields',
'form_options' =>
[
'multiple' => true,
'expanded' => false
]
)
))
)
)
);
}
}
Note that `custom_fields_group_linked_custom_fields` does not create any input on `CustomFieldsGroup` creation : there aren't any fields associated with the custom fields just after the group creation... You have to add custom fields and associate them with the newly created group to see them appears.
Rendering custom fields and custom fields group in a template
-------------------------------------------------------------
.. warning::
Each custom field can be `active` or not. Only `active` custom fields has to be dislayed.
For rendering custom fields, two function are available :
* `chill_custom_field_widget` to render the widget. This function is defined on a customFieldType basis.
* `chill_custom_field_label` to render the label. You can customize the label rendering by choosing the layout you would like to use.
* `chill_custom_field_is_empty` indicates if the content of the custom fields is empty (return a boolean)
For rendering custom fields group, a function is available :
* `chill_custom_fields_group_widget` to render the widget. It will display the custom fields of the group in a dd / dt structure.
chill_custom_field_label
^^^^^^^^^^^^^^^^^^^^^^^^
The signature is :
* `CustomField` **$customField** a customField instance
* `array` **params** the parameters for rendering. Currently, 'label_layout' allow to choose a different label. Default is 'ChillCustomFieldsBundle:CustomField:render_label.html.twig'
Examples
.. code-block:: jinja
{{ chill_custom_field_label(customField) }}
chill_custom_field_widget
^^^^^^^^^^^^^^^^^^^^^^^^^
The signature is :
* array **$fields** the array raw, as stored in the db
* CustomField **$customField** a customField instance
* string **$documentType** the type of document. Default to `html`.
Examples:
.. code-block:: jinja
{{ chill_custom_field_widget(entity.customFields, customField) }}
chill_custom_field_is_empty
^^^^^^^^^^^^^^^^^^^^^^^^^^^
The signature is :
* array **$fields** the array raw, as stored in the db
* CustomField **$customField** a customField instance
Examples :
.. code-block:: jinja
{%- if chill_custom_field_is_empty(cFData, customField) == false -%}
chill_custom_fields_group_widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This function only display custom fields that are `active`.
The signature is :
* array **$fields** the array raw, as stored in the db
* CustomFieldsGroup **$customFieldsGroup** the custom field group to render
.. code-block:: jinja
{{ chill_custom_fields_group_widget(entity.cFData, entity.customFieldsGroup) }}
Custom Fields's form
--------------------
You should simply use the 'custom_field' type in a template, with the group you would like to render in the `group` option's type.
Example :
.. code-block:: php
namespace Chill\ReportBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ReportType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$entityManager = $options['em'];
$builder
->add('user')
->add('date', 'date',
array('required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
#add the custom fields :
->add('cFData', 'custom_field',
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\ReportBundle\Entity\Report'
));
$resolver->setRequired(array(
'em',
'cFGroup',
));
$resolver->setAllowedTypes(array(
'em' => 'Doctrine\Common\Persistence\ObjectManager',
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
));
}
/**
* @return string
*/
public function getName()
{
return 'chill_reportbundle_report';
}
}
Available configuration
------------------------
Those options are available in the configuration, under the `chill_custom_field` key.
Example :
.. code-block:: yaml
chill_custom_field:
show_empty_values_in_views: false
show_empty_values_in_views *boolean*:
Allow to hide / show empty values in views. The aim of this configuration parameter is to hide (or show) empty values when :term:`custom fields group` are rendered.
Default value : `true`
Glossary
--------
.. glossary::
custom fields group
A group of custom fields

View File

@@ -0,0 +1,29 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _event-bundle:
Event bundle
############
Template & Menu
===============
The event bundle has a special template with a specific menu for actions on
events. This menu is called `event`.
ChillEventBundle::layout.html.twig
----------------------------------
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig` and add the menu `event`
It proposes a new block :
* event_content
* where to display content relative to the event.

View File

@@ -0,0 +1,49 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _group-bundle:
Group bundle
############
Allow to group people in a group. This group may be a family, an activity group, ...
.. contents:: Table of content
:local:
Entities
********
.. figure:: /_static/bundles/group/group_classes_uml.png
.. _group-bundle-macros:
Macros
******
Group sticker
==============
Macro file
`ChillGroupBundle:Group:macro.html.twig`
Macro name
:code:`_render`
Macro envelope
:code:`group`, instance of :class:`Chill\GroupBundle\Entity\CGroup`
When to use this macro ?
When you want to represent group.
Example usage :
.. code-block:: html+jinja
{% import 'ChillGroupBundle:Group:macro.html.twig' as m %}
{{ m._render(g) }}

View File

@@ -0,0 +1,29 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Bundles documentation
###############################
You will find here documentation about bundles working with Chill.
.. toctree::
:maxdepth: 2
Main bundle <main.rst>
Custom Fields bundle <custom-fields.rst>
Person bundle <person.rst>
Report bundle <report.rst>
Activity bundle <activity.rst>
Group bundle <group.rst>
Event bundle <event.rst>
Ldap bundle (synchronisation between ldap and database) <ldap.rst>
Your bundle here ?
-------------------
The contributors still do not have a policy about those bundle integration, but we would like to be very open on this subject. Please write to us `or open an issue <https://redmine.champs-libres.coop/projects/chill/issues>`_.

View File

@@ -0,0 +1,204 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _ldap-bundle:
LDAP bundle
###########
This bundle binds the database with an ldap directory.
The bundle synchronize the ldap directory with users in the database. It also
provides a way to check user credentials against the ldap directory.
.. contents:: Table of content
:local:
Current limitations
*******************
- The length of the ldap dn must be < 255 characters
- if the username extracted from the ldap is updated, the changes are not reflected in the database and remains the same
Entities provided
*****************
This bundle provides only one entity : :class:`Chill\\LdapBundle\\Entity\\UserLdapBinding`
How the synchronizer works ?
****************************
#. The synchronizer performs a query on :code:`dn` and :code:`query` defined in the :ref:`configuration <configuration>`.
#. For each entry returned by the query, it looks if the :code:`dn` exists in the database
#. If the entry does not exists :
#. the synchronizer looks for user with same username as defined by :code:`username_attr`, and bind it with the :code:`dn` if it exists.
#. else, a user is created with username defined by :code:`username_attr` (if the ldap contains more than one attribute, the first attribute returned is used)
#. if a user exists which is already binded with the :code:`dn`, the entry is ignored.
#. The synchronizer looks for dn existing in database and which were not returned by the query performed in 1.
#. If they exists, those user are set to :code:`enabled=false`: they are not allowed to login.
Installation
************
This bundle requires :
- PHP LDAP ext
- :code:`symfony/ldap` with minimal version 3.1. Note that, currently, Chill uses Symfony 2.8: you should add the dependency on this single package manually
In your composer.json, for stable version :
.. code-block:: json
"require": {
// .. other dependencies
"symfony/ldap" : "~3.1",
"chill-project/ldap": "~1.0"
}
And for dev version :
.. code-block:: json
"require": {
// .. other dependencies
"symfony/ldap" : "~3.1",
"chill-project/ldap": "dev-master@dev"
}
.. _configuration:
Configuration
**************
Configuration of the bundle
============================
.. code-block:: yaml
# Default configuration for extension with alias: "chill_ldap"
chill_ldap:
server: # Required
# the host of the ldap directory
host: ~ # Required, Example: localhost
# the port to reach the ldap directory
port: 389
# the version of the ldap directory
version: 3
# Is the use of ssl required to establish connection
use_ssl: false
# Is the use of startssl required to establish connection
use_starttls: false
# the user to bind to dn directory. Required for searching existing users.
bind_dn: ~ # Required, Example: cn=user,dn=chill,dn=social
# the user's password to bind to dn directory.
bind_password: ~ # Required, Example: paSSw0rD
user_query: # Required
# The DN where the query is executed
dn: ~ # Example: ou=People,dc=champs-libres,dc=coop
# The query which will allow to retrieve users
query: ~ # Example: (&(objectClass=inetOrgPerson)(userPassword=*))
# The attribute which will provide username (=login)
username_attr: cn
Example :
.. code-block:: yaml
chill_ldap:
server:
# host, bind_dn and bind_password are imported from parameters.yml
host: "%ldap_host%"
bind_dn: "%ldap_bind_dn%"
bind_password: "%ldap_bind_password%"
user_query:
dn: dc=champs-libres,dc=coop
query: "(&(objectClass=inetOrgPerson)(userPassword=*))"
Configuration of the security part of chill
============================================
Simply add the following config in the firewall of the security bundle :
`chill_ldap_form_login: ~`. This config is located in `app/config/security.yml`
Example of a configuration :
.. code-block:: yaml
# in app/config/security.yml
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
default:
anonymous: ~
# enable the login check by a form, agaisnt the database
form_login:
csrf_parameter: _csrf_token
csrf_token_id: authenticate
csrf_provider: form.csrf_provider
# enable the login check by a form, against the ldap
chill_ldap_form_login: ~ # this is the line you should add
Note that, if you enable the login check by form **and** by the ldap,
the password will be checked against the database **and** against the ldap.
If one of them match, the login will succeed.
If you want to completely disable login check against the database,
simply remove the :code:`form_login` entry and all his options.
.. _command-and-crontab:
Command and crontab
===================
Synchronize the database :
.. code-block:: bash
php app/console chill:ldap:synchronize
For getting more debug message :
.. code-block:: bash
php app/console chill:ldap:synchronize -vvv
You should run this command regularly (using crontab or
`systemd timer <https://www.freedesktop.org/software/systemd/man/systemd.timer.html#>`_)
to synchronize ldap and database automatically.

View File

@@ -0,0 +1,49 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _main-bundle:
Main bundle
###########
This bundle is **required** for running Chill.
This bundle provide :
* Access control model (users, groups, and all concepts)
* ...
.. warning::
this section is incomplete.
.. _main-bundle-macros:
Macros
******
Address sticker
===============
Macro file
`ChillMainBundle:Address:macro.html.twig`
Macro name
:code:`_render`
Macro envelope
:code:`address`, instance of :class:`Chill\MainBundle\Entity\Address`
When to use this macro ?
When you want to represent an address.
Example usage :
.. code-block:: html+jinja
{% import 'ChillMainBundle:Address:macro.html.twig' as m %}
{{ m._render(address) }}

View File

@@ -0,0 +1,233 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _person-bundle:
Person bundle
#############
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
.. contents:: Table of content
:local:
Entities provided
*****************
.. todo::
describe entities provided by person bundle
Search terms
************
The class `Chill\PersonBundle\Search\PersonSearch` provide the search module.
Domain
======
The search upon "person" is provided by default. The `@person` domain search may be omitted.
* `@person` is the domain search for people.
Arguments
=========
* `firstname` : provide the search on firstname. Example : `firstname:Depardieu`. May match part of the firstname (`firsname:dep` will match Depardieu)
* `lastname` : provide the search on lastname. May match part of the lastname.
* `birthdate` : provide the search on the birthdate. Example : `birthdate:1996-01-19`
* `gender`: performs search on man/woman. The accepted values are `man` or `woman`.
* `nationality` : performs search on nationality. Value must be a country code `as described in ISO 3166 <http://www.iso.org/iso/fr/home/standards/country_codes.htm>`_. Example : `nationality:FR`.
Default
=======
The default search is performed on firstname and/or lastname. Both are concatened before search. If values are separated by spaces, the clause `AND` is used : the search `dep ge` will match 'Gérard Depardieu` or 'Jean Depagelles', but not 'Charline Depardieu' (missing 'Ge' in word).
Configuration options
*********************
Those options are available under `chill_person` key.
Example of configuration:
.. code-block:: yaml
chill_person:
validation:
birthdate_not_after: P15Y
person_fields:
# note: visible is the default config. This key may be omitted if visible is chosen.
nationality: hidden
email: hidden
place_of_birth: visible
phonenumber: hidden
country_of_birth: hidden
marital_status: visible
spoken_languages: hidden
address: visible
birthdate_not_after *string*
The period duration before today during which encoding birthdate is not possible. The period is a string matching the format of `ISO_8601`, which is also use to build `DateInterval classes <http://php.net/manual/en/dateinterval.construct.php>`_.
Example: `P1D`, `P18Y`
Default value: `P1D` which means that birthdate before the current day (= yesterday) are allowed.
person_fields *array*
This define the visibility of some fields. By default, all fields are visible, but you can choose to hide some of them. Available keys are :
* `nationality`
* `country_of_birth`
* `place_of_birth`
* `phonenumber`
* `email`
* `marital_status`
* `spoken_languages`
* `address`
Possibles values: `hidden` or `visible` (all other value will raise an Exception).
Default value : `visible`, which means that all fields are visible.
Example:
.. code-block:: yaml
chill_person:
person_fields:
nationality: hidden
email: hidden
phonenumber: hidden
.. note::
If all the field of a "box" are hidden, the whole box does not appears. Example: if the fields `phonenumber` and `email` are hidden, the title `Contact information` will be hidden in the UI.
.. note::
If you hide multiple fields, for a better integration you may want to override the template, for a better appeareance. See `the symfony documentation <http://symfony.com/doc/current/book/templating.html#overriding-bundle-templates>`_ about this feature.
.. _person-bundle-macros:
Macros
******
Sticker for a person
=====================
Macro file
`ChillPersonBundle:Person:macro.html.twig`
Macro envelope
:code:`render(p, withLink=false)`
:code:`p` is an instance of :class:`Chill\PersonBundle\Entity\Person`
:code:`withLink` :class:`boolean`
When to use this macro ?
When you want to represent a person.
Example usage :
.. code-block:: html+jinja
{% import "ChillPersonBundle:Person:macro.html.twig" as person_ %}
{{ person_.render(person, true) }}
Layout events and delegated blocks
***********************************
:code:`chill_block.person_post_vertical_menu` event
====================================================
This event is available to add content below of the vertical menu (on the right).
The context is :
- :code:`person` : the current person which is rendered. Instance of :class:`Chill\PersonBundle\Entity\Person`
Widgets
*******
Add a list of person on homepage
================================
The bundle provide a way to add a list of accompanyied person on the homepage:
.. code-block:: yaml
chill_main:
widgets:
homepage:
-
order: 10
widget_alias: person_list
person_list:
# customize the number of items
number_of_items: 20
# only active
only_active: true
# you can add some filtering class, which will implements
# Chill\PersonBundle\PersonListWidget\PersonFilteringInterface
filtering_class: "\Hepc\HomepagePersonFiltering"
# when the view is overriden, you can add some custom fields
# to the view
custom_fields: [school-2fb5440e-192c-11e6-b2fd-74d02b0c9b55]
Commands
********
:code:`chill:person:move`
=========================
.. code-block:: txt
Usage:
chill:person:move [options]
Options:
-f, --from=FROM The person id to delete, all associated data will be moved before
-t, --to=TO The person id which will received data
--dump-sql dump sql to stdout
--force execute sql instead of dumping it
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-e, --env=ENV The Environment name. [default: "dev"]
--no-debug Switches off debug mode.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Move all the associated entities on a "from" person to a "to" person and remove the old person
Move all the entities associated to a person onto another one, and remove the old person.
.. warning::
Some entities are ignored and will be deleted:
- the accompanying periods ;
- the data attached to a person entity: name, address, date of birth, etc. Thos should be merge before the move.
It is advised to run first the command with the :code:`dump-sql` option and, then, use the :code:`force` option.
The moving and suppression is executed inside a transaction, ensuring no data loss if the migration fails.
.. note::
Using bash and awk, it is easy to use a TSV file (values separated by a tab, not a comma) to create move commands. Assuming our file is named :code:`twins.tsv` and contains two columns: the first one with :code:`from` ids, and the second one with :code:`to` ids:
.. code-block:: bash
awk '{ print "php app/console chill:person:move --dump-sql --from " $1 " --to " $2;}' twins.tsv

View File

@@ -0,0 +1,46 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _report-bundle:
Report bundle
#############
This bundle provides the ability to record report about people. We use custom fields to let user add fields to reports.
.. contents:: Table of content
:local:
.. todo::
The documentation about report is not writtend
Concepts
========
Search
======
Domain
------
* `@report` is the domain search for reports.
Arguments
---------
* `date` : The date of the report
Default
-------
The report's date is the default value.
An error is thrown if an argument `date` and a default is used.

417
docs/source/conf.py Normal file
View File

@@ -0,0 +1,417 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# chill-doc documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 28 22:04:08 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
if not on_rtd:
# sys.path.append(os.path.abspath('./../_exts/sphinx-php'))
pass
# adding PhpLexer
try:
from sphinx.highlighting import lexers
from pygments.lexers.compiled import CLexer
from pygments.lexers.web import PhpLexer
php_lexer_available = True
except ImportError:
php_lexer_available = False
print('specific import not available')
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
]
# desactivated
# try:
# import sensio.sphinx.refinclude
# except ImportError:
# print('sensio.sphinx.refinclude is not available')
# else:
# extensions += ['sensio.sphinx.refinclude']
#
# try:
# import sensio.sphinx.configurationblock
# except ImportError:
# print('sensio.sphinx.configurationblock is not available')
# else:
# extensions += ['sensio.sphinx.configurationblock']
#
# try:
# import sensio.sphinx.phpcode
# except ImportError:
# print('sensio.sphinx.phpcode')
# else:
# extensions += ['sensio.sphinx.phpcode']
#
# try:
# import sensio.sphinx.bestpractice
# except ImportError:
# print('sensio.sphinx.bestpractice is not avaialble')
# else:
# extensions += ['sensio.sphinx.bestpractice']
#add configuration for api url
# api_url = 'http://api.chill.social/master/%s'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'Chill Documentation'
copyright = '2014-2016, Champs-Libres, published under the terms of the GNU Free Documentation License, Version 1.3'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.0'
# The full version, including alpha/beta/rc tags.
release = '2.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- Settings for symfony doc extension ---------------------------------------------------
if php_lexer_available:
# enable highlighting for PHP code not between ``<?php ... ?>`` by default
lexers['php'] = PhpLexer(startinline=True)
lexers['php-annotations'] = PhpLexer(startinline=True)
lexers['php-standalone'] = PhpLexer(startinline=True)
lexers['php-symfony'] = PhpLexer(startinline=True)
lexers['varnish3'] = CLexer()
lexers['varnish4'] = CLexer()
config_block = {
'varnish3': 'Varnish 3',
'varnish4': 'Varnish 4'
}
# use PHP as the primary domain
primary_domain = 'php'
# set url for API links
api_url = 'http://api.symfony.com/master/%s'
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default' #overriden if run locally, see end of file
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'chill-docdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
'papersize': 'a4paper'
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'chill-doc.tex', 'chill-doc Documentation',
'Champs-Libres', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'chill-doc', 'chill-doc Documentation',
['Champs-Libres'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'chill-doc', 'chill-doc Documentation',
'Champs-Libres', 'chill-doc', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = 'Chill Documentation'
epub_author = 'Champs-Libres'
epub_publisher = 'Champs-Libres'
epub_copyright = '2014-2016, Champs-Libres'
# The basename for the epub file. It defaults to the project name.
#epub_basename = 'chill-doc'
# The HTML theme for the epub output. Since the default themes are not optimized
# for small screen space, using the same theme for HTML and epub output is
# usually not wise. This defaults to 'epub', a theme designed to save visual
# space.
#epub_theme = 'epub'
# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default'
# Fix unsupported image types using the PIL.
#epub_fix_images = False
# Scale large images.
#epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline'
# If false, no index is generated.
#epub_use_index = True
#-- Options for todo
todo_include_todos = True
#-- include template if not on RTD
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# otherwise, readthedocs.org uses their theme by default, so no need to specify it

View File

@@ -0,0 +1,314 @@
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Access controle model
**********************
.. contents:: Table of content
:local:
Concepts
========
Every time an entity is created, viewed or updated, the software check if the user has the permission to make this action. The decision is made with three parameters :
- the type of entity ;
- the entity's center ;
- the entity'scope
The user must be granted access to the action on this particular entity, with this scope and center.
From an user point of view
--------------------------
The software is design to allow fine tuned access rights for complicated installation and team structure. The administrators may also decide that every user has the right to see all resources, where team have a more simple structure.
Here is an overview of the model.
Chill can be multi-center
^^^^^^^^^^^^^^^^^^^^^^^^^
Chill is designed to be installed once for social center who work with multiple teams separated, or for social services's federation who would like to share the same installation of the software for all their members.
This was required for cost reduction, but also to ease the generation of statistics agregated across federation's members, or from the central unit of the social center with multiple teams.
Otherwise, it is not required to create multiple center: Chill can also work for one center.
Obviously, users working in the different centers are not allowed to see the entities (_persons_, _reports_, _activities_) of other centers. But users may be attached to multiple centers: consequently they will be able to see the entities of the multiple centers they are attached to.
Inside center, scope divide team
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Users are attached to one or more center and, inside to those center, there may exists differents scopes. The aim of those _scopes_ is to divide the whole team of social worker amongst different departement, for instance: the social team, the psychologist team, the nurse team, the administrative team, ... Each team is granted of different rights amongst scope. For instance, the social team may not see the _activities_ of the psychologist team. The administrative team may see the date & time's activities, but is not allowed to see the detail of those entities (the personal notes, ...).
The administrator is responsible of creating those scopes and team. *He may also decide to not define a division inside his team*: he creates only one scope and all entities will belong to this scope, all users will be able to see all entities.
As entities have only one scopes, if some entities must be shared across two different teams, the administrator will have to create a scope *shared* by two different team, and add the ability to create, view, or update this scope to those team.
Example: if some activities must be seen and updated between nurses and psychologists, the administrator will create a scope "nurse and psy" and add the ability for both team "nurse" and "psychologist" to "create", "see", and "update" the activities belonging to scope "nurse and psy".
The concepts translated into code
-----------------------------------
.. figure:: /_static/access_control_model.png
Schema of the access control model
Chill handle **entities**, like *persons*, *reports* (associated to *persons*), *activities* (also associated to *_persons*), ... On creation, those entities are linked to one center and, eventually, to one scope. They implements the interface `HasCenterInterface`.
.. note::
Somes entities are linked to a center through the entity they are associated with. For instance, *activities* or *reports* are associated to a *person*, and the person is associated to a *center*. The *report*'s *center* is always the *person*'s *center*.
Entities may be associated with a scope. In this case, they implement the `HasScopeInterface`.
.. note::
Currently, only the *person* entity is not associated with a scope.
At each step of his lifetime (creation, view of the entity and eventually of his details, update and, eventually, deletion), the right of the user are checked. To decide wether the user is granted right to execute the action, the software must decide with those elements :
- the entity's type;
- the entity's center ;
- the entity's scope, if it exists,
- and, obviously, a string representing the action
All those action are executed through symfony voters and helpers.
How to check authorization ?
----------------------------
Just use the symfony way-of-doing, but do not forget to associate the entity you want to check access. For instance, in controller :
.. code-block:: php
class MyController extends Controller
{
public function viewAction($entity)
{
$this->denyAccessUnlessGranted('CHILL_ENTITY_SEE', $entity);
//... go on with this action
}
}
And in template :
.. code-block:: html+jinja
{{ if is_granted('CHILL_ENTITY_SEE', entity) %}print something{% endif %}
Retrieving reachable scopes and centers
----------------------------------------
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` helps you to get centers and scope reachable by a user.
Those methods are intentionnaly build to give information about user rights:
- getReachableCenters: to get reachable centers for a user
- getReachableScopes : to get reachable scopes for a user
.. note::
The service is reachable through the Depedency injection with the key `chill.main.security.authorization.helper`. Example :
.. code-block:: php
$helper = $container->get('chill.main.security.authorization.helper');
.. todo::
Waiting for a link between our api and this doc, we invite you to read the method signatures `here <https://github.com/Chill-project/Main/blob/add_acl/Security/Authorization/AuthorizationHelper.php>`_
Adding your own roles
=====================
Extending Chill will requires you to define your own roles and rules for your entities. You will have to define your own voter to do so.
To create your own roles, you should:
* implement your own voter. This voter will have to extends the :class:`Chill\\MainBundle\\Security\\AbstractChillVoter`. As defined by Symfony, this voter must be declared as a service and tagged with `security.voter`;
* declare the role through implementing a service tagged with `chill.role` and implementing :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
.. note::
Both operation may be done through a simple class: you can implements :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface` and :class:`Chill\\MainBundle\\Security\\AbstractChillVoter` on the same class. See live example: :class:`Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter`, and similar examples in the `PersonBundle` and `ReportBundle`.
.. seealso::
`How to Use Voters to Check User Permissions <http://symfony.com/doc/current/cookbook/security/voters_data_permission.html>`_
From the symfony cookbook
`New in Symfony 2.6: Simpler Security Voters <http://symfony.com/blog/new-in-symfony-2-6-simpler-security-voters>`_
From the symfony blog
Declare your role
------------------
To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
.. code-block:: php
interface ProvideRoleInterface
{
/**
* return an array of role provided by the object
*
* @return string[] array of roles (as string)
*/
public function getRoles();
/**
* return roles which doesn't need
*
* @return string[] array of roles without scopes
*/
public function getRolesWithoutScope();
}
Then declare your service with a tag `chill.role`. Example :
.. code-block:: yaml
your_service:
class: Chill\YourBundle\Security\Authorization\YourVoter
tags:
- { name: chill.role }
Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`:
.. code-block:: php
namespace Chill\PersonBundle\Security\Authorization;
use Chill\MainBundle\Security\ProvideRoleInterface;
class PersonVoter implements ProvideRoleInterface
{
const CREATE = 'CHILL_PERSON_CREATE';
const UPDATE = 'CHILL_PERSON_UPDATE';
const SEE = 'CHILL_PERSON_SEE';
public function getRoles()
{
return array(self::CREATE, self::UPDATE, self::SEE);
}
public function getRolesWithoutScope()
{
return array(self::CREATE, self::UPDATE, self::SEE);
}
}
Implement your voter
--------------------
Inside this class, you might use the :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelper` to check permission (do not re-invent the wheel). This is a real-world example:
.. code-block:: php
namespace Chill\ReportBundle\Security\Authorization;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
class ReportVoter extends AbstractChillVoter
{
const CREATE = 'CHILL_REPORT_CREATE';
const SEE = 'CHILL_REPORT_SEE';
const UPDATE = 'CHILL_REPORT_UPDATE';
/**
*
* @var AuthorizationHelper
*/
protected $helper;
public function __construct(AuthorizationHelper $helper)
{
$this->helper = $helper;
}
protected function getSupportedAttributes()
{
return array(self::CREATE, self::SEE, self::UPDATE);
}
protected function getSupportedClasses()
{
return array('Chill\ReportBundle\Entity\Report');
}
protected function isGranted($attribute, $report, $user = null)
{
if (! $user instanceof \Chill\MainBundle\Entity\User){
return false;
}
return $this->helper->userHasAccess($user, $report, $attribute);
}
}
Then, you will have to declare the service and tag it as a voter :
.. code-block:: yaml
services:
chill.report.security.authorization.report_voter:
class: Chill\ReportBundle\Security\Authorization\ReportVoter
arguments:
- "@chill.main.security.authorization.helper"
tags:
- { name: security.voter }
Adding role hierarchy
---------------------
You should prepend Symfony's security component directly from your code.
.. code-block:: php
namespace Chill\ReportBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\MainBundle\DependencyInjection\MissingBundleException;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChillReportExtension extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
{
$this->prependRoleHierarchy($container);
}
protected function prependRoleHierarchy(ContainerBuilder $container)
{
$container->prependExtensionConfig('security', array(
'role_hierarchy' => array(
'CHILL_REPORT_UPDATE' => array('CHILL_REPORT_SEE'),
'CHILL_REPORT_CREATE' => array('CHILL_REPORT_SEE')
)
));
}
}

View File

@@ -0,0 +1,104 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _forms:
Assets
#######
The Chill assets (js, css, images, …) can be managed by `Webpack Encore`_, which is a thin wrapper for `Webpack`_ in Symfony applications.
Installation
************
Webpack Encore needs to be run in a Node.js environment, using the Yarn package manager. This Node.js environment can be set up using a node docker image. The bash script `docker-node.sh` set up a Node.js environment with an adequate configuration. Launch this container by typing:
.. code-block:: bash
$ bash docker-node.sh
In this NodeJS environment, install all the assets required by Chill with:
.. code-block:: bash
node@b91cab4f7cfc:/app$ yarn install
This command will install all the packages that are listed in `package.json`.
Any further required dependencies can be installed using the Yarn package. For instance, jQuery is installed by:
.. code-block:: bash
node@b91cab4f7cfc:/app$ yarn add jquery --dev
Usage
*****
Organize your assets
--------------------
Chill assets usually lives under the `/Resources/public` folder of each Chill bundle. The Webpack configuration set up in `webpack.config.js` automatically loads the required assets from the Chill bundles that are used.
For adding your own assets to Webpack, you must add an entry in the `webpack.config.js` file. For instance, the following entry will output a file `main.js` collecting the js code (and possibly css, image, etc.) from `./assets/main.js`.
.. code-block:: js
.addEntry('main', './assets/main.js')
To gather the css files, simply connect them to your js file, using `require`. The css file is seen as a dependency of your js file. :
.. code-block:: js
// assets/js/main.js
require('../css/app.css');
For finer configuration of webpack encore, we refer to the above-linked documentation.
Compile the assets
------------------
To compile the assets, run this line in the NodeJS container:
.. code-block:: bash
node@b91cab4f7cfc:/app$ yarn run encore dev
While developing, you can tell Webpack Encore to continuously watch the files you are modifying:
.. code-block:: bash
node@b91cab4f7cfc:/app$ yarn run encore dev --watch
Use the assets in the templates
--------------------------------
Any entry defined in the webpack.config.js file can be linked to your application using the symfony `asset` helper:
.. code-block:: html
<head>
...
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
</head>
<body>
...
<script src="{{ asset('build/app.js') }}"></script>
</body>
.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore
.. _Webpack: https://webpack.js.org/

View File

@@ -0,0 +1,34 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _create-new-bundle:
Create a new bundle
*******************
Create your own bundle is not a trivial task.
The easiest way to achieve this is seems to be :
1. Prepare a fresh installation of the chill project, in a new directory
2. Create a new bundle in this project, in the src directory
3. Initialize a git repository **at the root bundle**, and create your initial commit.
4. Register the bundle with composer/packagist. If you do not plan to distribute your bundle with packagist, you may use a custom repository for achieve this [#f1]_
5. Move to a development installation, made as described in the :ref:`installation-for-development` section, and add your new repository to the composer.json file
6. Work as :ref:`usual <editing-code-and-commiting>`
.. warning::
This part of the doc is not yet tested
TODO
.. rubric:: Footnotes
.. [#f1] Be aware that we use the Affero GPL Licence, which ensure that all users must have access to derivative works done with this software.

View File

@@ -0,0 +1,522 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _crud:
CRUD
####
Chill provide an API to create a basic CRUD.
One can follow those steps to create a CRUD for one entity:
1. create your model and your form ;
2. configure the crud ;
3. customize the templates if required ;
4. customize some steps of the controller if required ;
An example with the ``ClosingMotive`` (PersonBundle) in the admin part of Chill:
Auto-loading the routes
***********************
Ensure that those lines are present in your file `app/config/routing.yml`:
.. code-block:: yaml
chill_cruds:
resource: 'chill_main_crud_route_loader:load'
type: service
Create your model
*****************
Create your model on the usual way (in this example, ORM informations are stored in yaml file):
.. code-block:: php
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\Common\Collections\Collection;
/**
* ClosingMotive give an explanation why we closed the Accompanying period
*/
class ClosingMotive
{
/**
* @var integer
*/
private $id;
/**
* @var array
*/
private $name;
/**
*
* @var boolean
*/
private $active = true;
/**
*
* @var self
*/
private $parent = null;
/**
* child Accompanying periods
*
* @var Collection
*/
private $children;
/**
*
* @var float
*/
private $ordering = 0.0;
// getters and setters come here
}
The form:
.. code-block:: php
namespace Chill\PersonBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Chill\PersonBundle\Form\Type\ClosingMotivePickerType;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
/**
*
*
*/
class ClosingMotiveType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TranslatableStringFormType::class, [
'label' => 'Nom'
])
->add('active', CheckboxType::class, [
'label' => 'Actif ?',
'required' => false
])
->add('ordering', NumberType::class, [
'label' => 'Ordre d\'apparition',
'required' => true,
'scale' => 5
])
->add('parent', ClosingMotivePickerType::class, [
'label' => 'Parent',
'required' => false,
'placeholder' => 'closing_motive.any parent',
'multiple' => false,
'only_leaf' => false
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('class', \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class)
;
}
}
Configure the crud
******************
The crud is configured using the key ``crud`` under ``chill_main``
.. code-block:: yaml
chill_main:
cruds:
-
# the class which is concerned by the CRUD
class: '\Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class'
# give a name for the crud. This will be used internally
name: closing_motive
# add a base path for the
base_path: /admin/closing-motive
# this is the form class
form_class: 'Chill\PersonBundle\Form\ClosingMotiveType::class'
# you can override the controller to configure some parts
# if you do not configure anything here, the default CRUDController will be used
controller: 'Chill\PersonBundle\Controller\AdminClosingMotiveController::class'
# this is a list of action you can configure
# by default, the actions `index`, `view`, `new` and `edit` are automatically create
# you can add more actions or configure some details about them
actions:
index:
# the default template for index is very poor,
# you will need to override it
template: '@ChillPerson/ClosingMotive/index.html.twig'
# the role required for this role
role: ROLE_ADMIN
new:
role: ROLE_ADMIN
# by default, the template will only show the form
# you can override it
template: '@ChillPerson/ClosingMotive/new.html.twig'
edit:
role: ROLE_ADMIN
template: '@ChillPerson/ClosingMotive/edit.html.twig'
To leave the bundle auto-configure the ``chill_main`` bundle, you can `prepend the configuration of the ChillMain Bundle <https://symfony.com/doc/current/bundles/prepend_extension.html>`_:
.. code-block:: php
namespace Chill\PersonBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
// skipped here
}
public function prepend(ContainerBuilder $container)
{
$this->prependCruds($container);
}
protected function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'cruds' => [
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class,
'name' => 'closing_motive',
'base_path' => '/admin/closing-motive',
'form_class' => \Chill\PersonBundle\Form\ClosingMotiveType::class,
'controller' => \Chill\PersonBundle\Controller\AdminClosingMotiveController::class,
'actions' => [
'index' => [
'template' => '@ChillPerson/ClosingMotive/index.html.twig',
'role' => 'ROLE_ADMIN'
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/ClosingMotive/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillPerson/ClosingMotive/edit.html.twig',
]
]
]
]
]);
}
}
Customize templates
*******************
The current template are quite basic. You can override and extends them.
For a better inclusion, you can embed them instead of extending them.
For index. Note that we extend here the `admin` layout, not the default one:
.. code-block:: html+jinja
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{# we customize the table headers #}
{% block table_entities_thead_tr %}
<th>{{ 'Ordering'|trans }}</th>
<th>{{ 'Label'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{# we customize the content of the table #}
{% for entity in entities %}
<tr>
<td>{{ entity.ordering }}</td>
<td>{{ entity|chill_entity_render_box }}</td>
<td>{{ entity.active }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_edit', { 'id': entity.id }) }}" class="sc-button bt-edit"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_closing_motive_new', { 'parent_id': entity.id } ) }}" class="sc-button bt-new">{{ 'closing_motive.new child'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock %}
For edit template:
.. code-block:: html+jinja
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% as we are in the admin layout, we override the admin content with the CRUD content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{# we do not have "view" page. We empty the corresponding block #}
{% block content_form_actions_view %}{% endblock %}
{% endembed %}
{% endblock %}
For new template:
.. code-block:: html+jinja
{% extends '@ChillMain/Admin/layout.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock %}
Customize some steps in the controller
**************************************
Some steps may be customized by overriding the default controller and some methods. Here, we will override the way the entity is created, and the ordering of the "index" page:
* we will associate a parent ClosingMotive to the element if a parameter `parent_id` is found ;
* we will order the ClosingMotive by the ``ordering`` property
.. code-block:: php
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Symfony\Component\HttpFoundation\Request;
use Chill\MainBundle\Pagination\PaginatorInterface;
/**
* Controller for closing motives
*
*/
class AdminClosingMotiveController extends CRUDController
{
protected function createEntity($action, Request $request): object
{
// we first create an entity "the usual way"
$entity = parent::createEntity($action, $request);
if ($request->query->has('parent_id')) {
// if we find the parent_id parameter, we add the corresponding
// parent to the newly created entity
$parentId = $request->query->getInt('parent_id');
$parent = $this->getDoctrine()->getManager()
->getRepository($this->getEntityClass())
->find($parentId);
if (NULL === $parent) {
throw $this->createNotFoundException('parent id not found');
}
$entity->setParent($parent);
}
return $entity;
}
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
// by default, the query is an instance of QueryBuilder
/** @var \Doctrine\ORM\QueryBuilder $query */
return $query->orderBy('e.ordering', 'ASC');
}
}
How-to and questions
********************
Which role is required for each action ?
========================================
By default, each action will use:
1. the role defined under the action key ;
2. the base role as upper, with the action name appended:
Example: if the base role is ``CHILL_BUNDLE_ENTITY``, the role will become:
* ``CHILL_BUNDLE_ENTITY_VIEW`` for the ``view`` action ;
* ``CHILL_BUNDLE_ENTITY_INDEX`` for the ``index`` action.
The entity will be passed to the role:
* for the ``view`` and ``edit`` action: the entity fetched from database
* for the ``new`` action: the entity which is created (you can override default values using
* for index action (or if you re-use the ``indexAction`` method: ``null``
How to add some route and actions ?
===================================
Add them under the action key:
.. code-block:: yaml
chill_main:
cruds:
-
# snipped
actions:
myaction: ~
The method `myactionAction` will be called by the parameter.
Inside this action, you can eventually call another internal method:
* ``indexAction`` for a list of items ;
* ``viewAction`` for a view
* ``editFormAction`` for an edition
* ``createFormAction`` for a creation
Example:
.. code-block:: php
namespace CSConnectes\SPBundle\Controller;
use Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use CSConnectes\SPBundle\Form\CSPersonPersonalSituationType;
use CSConnectes\SPBundle\Form\CSPersonDispositifsType;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\HttpFoundation\Response;
class CSPersonController extends OneToOneEntityPersonCRUDController
{
public function personalSituationEdit(Request $request, $id)
{
return $this->formEditAction(
'ps_situation_edit',
$request,
$id,
CSPersonPersonalSituationType::class
);
}
public function personalSituationView(Request $request, $id): Response
{
return $this->viewAction('ps_situation_view', $request, $id);
}
}
How to create a CRUD for entities associated to persons
=======================================================
The bundle person provide some controller and template you can override, instead of the ones present in the mainbundle:
* :code:`Chill\PersonBundle\CRUD\Controller\EntityPersonCRUDController` for entities linked with a one-to-may association to :code:`Person` class ;
* :code:`Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController` for entities linked with a one-to-one association to :code:`Person` class.
There are also template defined under ``@ChillPerson/CRUD/`` namespace.
Those controller assume that:
* the entity provide the method :code:`getPerson` and :code:`setPerson` ;
* the `index`'s id path will be the id of the person, and the ids in `view` and `edit` path will be the id of the entity ;
This bundle also use by default the templates inside ``@ChillPerson/CRUD/``.
Reference
*********
Configuration reference
=======================
.. code-block:: txt
chill_main:
cruds:
# Prototype
-
class: ~ # Required
controller: Chill\MainBundle\CRUD\Controller\CRUDController
name: ~ # Required
base_path: ~ # Required
base_role: null
form_class: null
actions:
# Prototype
name:
# the method name to call in the route. Will be set to the action name if left empty.
controller_action: null # Example: 'action'
# the path that will be **appended** after the base path. Do not forget to add arguments for the method. Will be set to the action name, including an `{id}` parameter if left empty.
path: null # Example: /{id}/my-action
# the requirements for the route. Will be set to `[ 'id' => '\d+' ]` if left empty.
requirements: []
# the role that will be required for this action. Override option `base_role`
role: null
# the template to render the view
template: null
Twig default block
==================
This part should be documented.

View File

@@ -0,0 +1,121 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Embeddable comments
###################
Those embeddable comments is a comment with some metadata:
* the one who updated the comment (the comment itself, and not the whole entity);
* the date and time for the last update (again, the comment itself, and not the whole entity).
We make usage of `embeddables <https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/tutorials/embeddables.html>`_.
Embed the comment
=================
The comment may be embedded into the entity:
.. code-block:: php
namespace Chill\ActivityBundle\Entity;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Activity
*
* @ORM\Entity()
*/
class Activity
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
private $comment;
/**
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
*/
public function getComment()
{
return $this->comment;
}
/**
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}
}
Note on relation to :class:`User`
=================================
The embeddable proposed by Doctrine does not support relationship to other entities. The entity Comment is able to render a user's id, but not an User object.
.. code-block:: php
$activity->getComment()->getUserId(); // return user id of the last author
$activity->getComment()->getUser(); // does not work !
Usage into form
===============
Use the :class:`Chill\MainBundle\Form\Type\CommentType` to load the form widget:
.. code-block:: php
namespace Chill\ActivityBundle\Form;
use Chill\MainBundle\Form\Type\CommentType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class ActivityType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('comment', CommentType::class, [
'required' => false,
])
;
}
}
Render the comment
==================
.. code-block:: twig
{{ activity.comment|chill_entity_render_box }}

View File

@@ -0,0 +1,244 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Exports
*******
Export is an important issue for the Chill software : users should be able to :
- compute statistics about their activity ;
- list "things" which make part of their activities.
The `main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles.
.. contents:: Table of content
:local:
.. seealso::
`The issue where this framework was discussed <https://git.framasoft.org/Chill-project/Chill-Main/issues/9>`_
Provides some information about the pursued features and architecture.
Concepts
========
Some vocabulary: 3 "Export elements"
------------------------------------
Four terms are used for this framework :
exports
provides some basic operation on the date. Two kind of exports are available :
- computed data : it may be "the number of people", "the number of activities", "the duration of activities", ...
- list data : it may be "the list of people", "the list of activity", ...
filters
The filters make a filter on the date: it removes some information the user doesn't want to introduce in the computation done by export. In other word, filters make a filter...
Example of filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ...
aggregators
The aggregator aggregates the data into some group (some software use the term 'bucket').
Example of aggregator : "group people by gender", "group people by nationality", "group activity by type", ...
formatters
The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client.
Example of formatter: "format data as CSV", "format data as ods spreadsheet", ...
Anatomy of an export
---------------------
An export may be explained as a sentence, where each part of this sentence refers to one or multiple exports element. Examples :
**Example 1**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender, and format them in a CSV spreadsheet.
Here :
- *count the number of people* is the export part
- *having at least one activity* is the filter part
- *group them by nationality* is the aggregator part
- *group them by gender* is a second aggregator part
- *format the date in a CSV spreadsheet* is the formatter part
Note that :
- aggregators, filters, exports and aggregators are cross-bundle. Here the bundle *activity* provides a filter which apply on an export provided by the person bundle ;
- there may exists multiple aggregator or filter for one export. Currently, only one export is allowed.
The result might be :
+-----------------------+----------------+---------------------------+
| Nationality | Gender | Number of people |
+=======================+================+===========================+
| Russian | Male | 12 |
+-----------------------+----------------+---------------------------+
| Russian | Female | 24 |
+-----------------------+----------------+---------------------------+
| France | Male | 110 |
+-----------------------+----------------+---------------------------+
| France | Female | 150 |
+-----------------------+----------------+---------------------------+
**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in a OpenDocument spreadsheet.
Here :
- *count the average duration of an activity* is the export part
- *activity with type meeting* is a filter part
- *activity which occurs between the 1st of June and the 31st of December* is a filter
- *group them by week* is the aggregator part
- *format the date in an OpenDocument spreadsheet* is the formatter part
The result might be :
+-----------------------+----------------------+
| Week | Number of activities |
+=======================+======================+
| 2015-10 | 10 |
+-----------------------+----------------------+
| 2015-11 | 12 |
+-----------------------+----------------------+
| 2015-12 | 10 |
+-----------------------+----------------------+
| 2015-13 | 9 |
+-----------------------+----------------------+
Authorization and exports
-------------------------
Exports, filters and aggregators should not make see data the user is not allowed to see.
In other words, developers are required to take care of user authorization for each export.
It should exists a special role that should be granted to users which are allowed to build exports. For more simplicity, this role should apply on center, and should not requires special circles.
How does the magic works ?
===========================
To build an export, we rely on the capacity of the database to execute queries with aggregate (i.e. GROUP BY) and filter (i.e. WHERE) instructions.
An export is an SQL query which is initiated by an export, and modified by aggregators and filters.
.. note::
**Example**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender
1. The report initiate the query
.. code-block:: SQL
SELECT count(people.*) FROM people
2. The filter add a where and join clause :
.. code-block:: SQL
SELECT count(people.*) FROM people
RIGHT JOIN activity
WHERE activity.date IS BETWEEN now AND 6 month ago
3. The aggregator "nationality" add a GROUP BY clause and a column in the SELECT statement:
.. code-block:: sql
SELECT people.nationality, count(people.*) FROM people
RIGHT JOIN activity
WHERE activity.date IS BETWEEN now AND 6 month ago
GROUP BY nationality
4. The aggregator "gender" do the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement :
.. code-block:: sql
SELECT people.nationality, people.gender, count(people.*)
FROM people RIGHT JOIN activity
WHERE activity.date IS BETWEEN now AND 6 month ago
GROUP BY nationality, gender
Each filter, aggregator and filter may collect parameters from the user by providing a form. This form is appended to the export form. Here is an example.
.. figure:: /_static/screenshots/development/export_form-fullpage.png
The screenshot show the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which allow to show a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other filter, which are unchecked, does not show the subform.
Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also open a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
The Export Manager
------------------
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which register all exports, aggregators, filters and formatters.
The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` to each export request.
The export form step
--------------------
The form step allow to build a form, aggregating different parts of the module.
The building of forms is separated between different subform, which are responsible for rendering their part of the form (aggregators, filters, and export).
.. figure:: /_static/puml/exports/form_steps.png
:scale: 40%
The formatter form step
-----------------------
The formatter form is processed *after* the user filled the export form. It is built the same way, but receive in parameters the data entered by the user on the previous step (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators).
Processing the export
---------------------
The export process may be explained by this schema :
.. figure:: /_static/puml/exports/processing_export.png
:scale: 40%
(Click to enlarge)
Export, formatters and filters explained
========================================
Exports
-------
This is an example of the ``CountPerson`` export :
.. literalinclude:: /_static/code/exports/CountPerson.php
:language: php
:linenos:
* **Line 36**: the ``getType`` function return a string. This string will be used to find the aggregtors and filters which will apply to this export.
* **Line 41**: a simple description to help user to understand what your export does.
* **Line 46**: The title of the export. A summary of what your export does.
* **Line 51**: The list of roles requires to execute this export.
* **Line 56**: We initiate the query here...
* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` object in one array
* **Line 63**: We create the query, with a query builder.
* **Line 74**: We simply returns the result, but take care of hydrating the results as an array.
* **Line 103**: return the list of formatters types which are allowed to apply on this filter
Filters
-------
This is an example of the *filter by birthdate*. This filter ask some information in a form (`buildForm` is not empty), and this form must be validated. To performs this validations, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`:
.. literalinclude:: /_static/code/exports/BirthdateFilter.php
:language: php
.. todo::
Continue to explain the export framework
.. _main bundle: https://git.framasoft.org/Chill-project/Chill-Main

View File

@@ -0,0 +1,42 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _forms:
Forms and form types
####################
Date picker
***********
Class
:class:`Chill\MainBundle\Form\Type\ChillDateType`
Extend
:class:`Symfony\Component\Form\Extension\Core\Type\DateType`
Usage :
.. code-block:: php
use Chill\MainBundle\Form\Type\ChillDateType;
$builder->add('date' ChillDateType::class);
Text editor
***********
Add a text editor (by default).
Class
:class:`Chill\MainBundle\Form\Type\ChillTextareaType`
Options
* :code:`disable_editor` to disable text editor

View File

@@ -0,0 +1,53 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Development
###########
As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and things we provide to encounter our needs.
.. toctree::
:maxdepth: 2
Instructions to create a new bundle <create-a-new-bundle.rst>
CRUD (Create - Update - Delete) for one entity <crud.rst>
Routing <routing.rst>
Menus <menus.rst>
Forms <forms.rst>
Access control model <access_control_model.rst>
Messages to users <messages-to-users.rst>
Pagination <pagination.rst>
Localisation <localisation.rst>
Logging <logging.rst>
Database migrations <migrations.rst>
Searching <searching.rst>
Timelines <timelines.rst>
Exports <exports.rst>
Embeddable comments <embeddable-comments.rst>
Run tests <run-tests.rst>
Useful snippets <useful-snippets.rst>
manual/index.rst
Assets <assets.rst>
Layout and UI
**************
.. toctree::
:maxdepth: 2
Render entities automatically <render-entity.rst>
Layout / Template usage <user-interface/layout-template-usage.rst>
Classes and mixins <user-interface/css-classes.rst>
Widgets <user-interface/widgets.rst>
Javascript function <user-interface/js-functions.rst>
Help, I am lost !
*****************
Write an email at info@champs-libres.coop, and we will help you !

View File

@@ -0,0 +1,49 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Localisation
*************
Language in url
===============
Language should be present in URL, conventionnaly as first argument.
.. code-block:: none
/fr/your/url/here
This allow users to change from one language to another one on each page, which may be useful in multilanguages teams. If the installation is single-language, the language switcher will not appears.
This is an example of routing defined in yaml :
.. code-block:: yaml
chill_person_general_edit:
pattern: /{_locale}/person/{person_id}/general/edit
defaults: {_controller: ChillPersonBundle:Person:edit }
Date and time
==============
The `Intl extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_ is enabled on the Chill application.
You may format date and time using the `localizeddate` function :
.. code-block:: jinja
date|localizeddate('long', 'none')
By default, we prefer using the `long` format for date formatting.
.. seealso::
`Documentation for Intl Extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_
Read the complete doc for the Intl extension.

View File

@@ -0,0 +1,50 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Logging
*******
.. seealso::
Symfony documentation: `How to user Monolog to write logs <http://symfony.com/doc/current/cookbook/logging/monolog.html>`_
The symfony cookbook page about logging.
A channel for custom logging has been created to store sensitive data.
The channel is named ``chill``.
The installer of chill should be aware that this channel may contains sensitive data and encrypted during backup.
Logging to channel `chill`
============================
You should use the service named ``chill.main.logger``, as this :
.. code-block:: php
$logger = $this->get('chill.main.logger');
You should store data into context, not in the log himself, which should remains the same for the action.
Example of usage :
.. code-block:: php
$logger->info("An action has been performed about a person", array(
'person_lastname' => $person->getLastName(),
'person_firstname' => $person->getFirstName(),
'person_id' => $person->getId(),
'by_user' => $user->getUsername()
));
For further processing, it is a good idea to separate all fields (like firstname, lastname, ...) into different context keys.
By convention, you should store the username of the user performing the action under the ``by_user`` key.

View File

@@ -0,0 +1,17 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Developer manual
*****************
.. toctree::
:maxdepth: 2
routing-and-menus.rst

View File

@@ -0,0 +1,143 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Routing and menus
*****************
The *Chill*'s architecture allows to choose bundle on each installation. This may lead to a huge diversity of installations, and a the developper challenge is to make his code working with all those possibles installations.
*Chill* uses menus to let users access easily to the most used functionalities. For instance, when you land on a "Person" page, you may access directly to his activities, notes, documents, ... in a single click on a side menu.
For a developer, it is easy to extend this menu with his own entries.
.. seealso::
`Symfony documentation about routing <http://symfony.com/doc/current/book/routing.html>`_
This documentation should be read before diving into those lines
`Routes dans Chill <https://redmine.champs-libres.coop/issues/179>`_ (FR)
The issue where we discussed routes. In French.
Create routes
==============
.. note::
We recommand using `yaml` to define routes. We have not tested the existing other ways to create routes (annotations, ...). Help wanted.
The first step is as easy as create a route in symfony, and add some options in his description :
.. code-block:: yaml
chill_main_dummy_0:
pattern: /dummy/{personId}
defaults: { _controller: CLChillMainBundle:Default:index }
options:
#we begin menu information here :
menus:
foo: #must appears in menu named 'foo'
order: 500 #the order will be '500'
label: foolabel #the label shown on menu. Will be translated
otherkey: othervalue #you may add other informations, as needed by your layout
bar: #must also appears in menu named 'bar'
order: 500
label: barlabel
The mandatory parameters under the `menus` definition are :
* `name`: the menu's name, defined as an key for the following entries
* `order`. Note: if we have duplicate order's values, the order will be incremented. We recommand using big intervals within orders and publishing the orders in your documentation
* `label`: the text which will be rendered inside the `<a>` tag. The label should be processed trough the `trans` filter (`{{ route.label|trans }}`)
You *may* also add other keys, which will be used optionally in the way the menu is rendered. See
.. warning::
Although all keys will be kept from your `yaml` definition to your menu template, we recommend not using those keys, which are reserved for a future implementations of Chill :
* `helper`, a text to help user or add more informations to him
* `access` : which will run a test with `Expression Langage <http://symfony.com/doc/current/components/expression_language/index.html>`_ to determine if the user has the ACL to show the menu entry ;
* `condition`, which will test with the menu context if the entry must appears
Show menu in twig templates
===========================
To show our previous menu in the twig template, we invoke the `chill_menu` function. This will render the `foo` menu :
.. code-block:: jinja
{{ chill_menu('foo') }}
Passing variables
^^^^^^^^^^^^^^^^^
If your routes need arguments, i.e. an entity id, you should pass the as argument to the chill_menu function. If your route's pattern is `/person/{personId}`, your code become :
.. code-block:: jinja
{{ chill_menu('foo', { 'args' : { 'personId' : person.id } } ) }}
Of course, `person` is a variable you must define in your code, which should have an `id` accessible property (i.e. : `$person->getId()`).
.. note::
Be aware that your arguments will be passed to all routes in a menu. If a route does not require `personId` in his pattern, the route will become `/pattern?personId=XYZ`. This should not cause problem in your application.
.. warning::
It is a good idea to reuse the same parameter's name in your pattern, to avoid collision. Prefer `/person/{personId}` to `/person/{id}`.
If you don't do that and another developer create a bundle with `person/{personId}/{id}` where `{id}` is the key for something else, this will cause a lot of trouble...
Rendering active entry
^^^^^^^^^^^^^^^^^^^^^^
Now, you want to render differently the *active* route of the menu [#f1]_. You should, in your controller or template, add the active route in your menu :
.. code-block:: jinja
{{ chill_menu('foo', { 'activeRouteKey' : 'chill_main_dummy_0' } ) }}
On menu creation, the route wich has the key `chill_main_dummy_0` will be rendered on a different manner.
Define your own template
-------------------------
By default, the menu is rendered with the default template, which is a simple `ul` list. You may create your own templates :
.. code-block:: html+jinja
#MyBundle/Resources/views/Menu/MyMenu.html.twig
<ul class="myMenu">
{% for route in routes %}
<li><a href="{{ path(route.key, args ) }}" class="{%- if activeRouteKey == route.key -%}active{%- endif -%}">{{ route.label|trans }}</a></li>
{% endfor %}
</ul>
Arguments available in your template :
* The `args` value are the value passed in the 'args' arguments requested by the `chill_menu` function.
* `activeRouteKey` is the key of the currently active route.
* `routes` is an array of routes. The array has this structure: `routes[order] = { 'key' : 'the_route_key', 'label' : 'the route label' }` The order is *resolved*: in case of collision (two routes from different bundles having the same order), the order will be incremented. You may find in the array your own keys (`{ 'otherkey' : 'othervalue'}` in the example above).
Then, you will call your own template with the `layout` argument :
.. code-block:: jinja
{{ chill_menu('foo', { 'layout' : 'MyBundle:Menu:MyMenu.html.twig' } ) }}
.. note::
Take care of specifying the absolute path to layout in the function.
.. rubric:: Footnotes
.. [#f1] In the default template, the currently active entry will be rendered with an "active" class : `<li class="active"> ... </li>`

View File

@@ -0,0 +1,123 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _menus :
Menus
*****
Chill has created his own menu system
.. seealso::
`Routes dans Chill [specification] <https://redmine.champs-libres.coop/issues/179>`_
The issue wich discussed the implementation of routes.
Concepts
========
.. warning::
to be written
Add a menu in a template
========================
In your twig template, use the `chill_menu` function :
.. code-block:: html+jinja
{{ chill_menu('person', {
'layout': 'ChillPersonBundle::menu.html.twig',
'args' : {'id': person.id },
'activeRouteKey': 'chill_person_view'
}) }}
The available arguments are:
* `layout` : a custom layout. Default to `ChillMainBundle:Menu:defaultMenu.html.twig`
* `args` : those arguments will be passed through the url generator.
* `activeRouteKey` must be the route key name.
.. note::
The argument `activeRouteKey` may be a twig variable, defined elsewhere in your template, even in child templates.
Create an entry in an existing menu
===================================
If a route belongs to a menu, you simply add this to his definition in routing.yml :
.. code-block:: yaml
chill_person_history_list:
pattern: /person/{person_id}/history
defaults: { _controller: ChillPersonBundle:History:list }
options:
#declare menus
menus:
# the route should be in 'person' menu :
person:
#and have those arguments :
order: 100
label: menu.person.history
* `order` (mandatory) : the order in the menu. It is preferrable to increment by far more than 1.
* `label` (mandatory) : a translatable string.
* `helper` (optional) : a text to help people to understand what does the menu do. Not used in default implementation.
* `condition` (optional) : an `Expression Language <http://symfony.com/doc/current/components/expression_language/index.html> `_ which will make the menu appears or not. Typically, it may be used to say "show this menu only if the person concerned is more than 18". **Not implemented yet**.
* `access` (optional) : an Expression Language to evalute the possibility, for the user, to show this menu according to Access Control Model. **Not implemented yet.**
You may add additional keys, but should not use the keys described above.
You may add the same route to multiple menus :
.. code-block:: yaml
chill_person_history_list:
pattern: /person/{person_id}/history
defaults: { _controller: ChillPersonBundle:History:list }
options:
menus:
menu1:
order: 100
label: menu.person.history
menu2:
order: 100
label: another.label
Customize menu rendering
========================
You may customize menu rendering by using the `layout` option.
.. warning ::
TODO : this part should be written.
.. _caveats :
Caveats
=======
Currently, you may pass arguments globally to each menu, and they will be all passed to route url. This means that :
* the argument name in the route entry must match the argument key in menu declaration in twig template
* if an argument is missing to generate an url, the url generator will throw a `Symfony\Component\Routing\Exception\MissingMandatoryParametersException`
* if the argument name is not declared in route entry, it will be added to the url, (example: `/my/route?additional=foo`)

View File

@@ -0,0 +1,129 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Messages to users, flashbags and buttons
****************************************
.. _flashbags :
Flashbags
==========
The four following levels are defined :
+-----------+----------------------------------------------------------------------------------------------+
|Key |Intent |
+===========+==============================================================================================+
|alert |A message not linked with the user action, but which should require an action or a |
| |correction. |
+-----------+----------------------------------------------------------------------------------------------+
|success |The user action succeeds. |
+-----------+----------------------------------------------------------------------------------------------+
|notice |A simple message to give information to the user. The message may be linked or not linked with|
| |the user action. |
+-----------+----------------------------------------------------------------------------------------------+
|warning |A message linked with an action, the user should correct. |
+-----------+----------------------------------------------------------------------------------------------+
|error |The user's action failed: he must correct something to process the action. |
+-----------+----------------------------------------------------------------------------------------------+
.. seealso::
`Flash Messages on Symfony documentation <http://symfony.com/doc/current/book/controller.html#flash-messages>`_
Learn how to use flash messages in controller.
Buttons
========
Some actions are available to decorate ``a`` links and ``buttons``.
To add the action on button, use them as class along with ``sc-button`` :
.. code-block:: html
<a class="sc-button bt-create">Create an entity</a>
<button class="sc-button bt-submit" type="submit">Submit</button>
+-----------+----------------+------------------------------------------------------------------------------+
| Action | Class | Description |
+===========+================+==============================================================================+
| Submit | ``bt-submit`` | Submit a form. Use only if action is not "save". |
+-----------+----------------+------------------------------------------------------------------------------+
| Create | ``bt-create`` | - Link to a form to create an entity (alias: ``bt-new``) |
| | or ``bt-new`` | - Submitting this form will create a new entity |
+-----------+----------------+------------------------------------------------------------------------------+
| Reset | ``bt-reset`` | Reset a form |
+-----------+----------------+------------------------------------------------------------------------------+
| Delete | ``bt-delete`` | - Link to a form to delete an entity |
| | | - Submitting this form will remove the entity |
+-----------+----------------+------------------------------------------------------------------------------+
| Edit | ``bt-edit`` or | Link to a form to edit an entity |
| | ``bt-update`` | |
+-----------+----------------+------------------------------------------------------------------------------+
| Save | ``bt-save`` | Submitting this form will save change on the entity |
+-----------+----------------+------------------------------------------------------------------------------+
| Action | ``bt-action`` | Generic link to an action |
+-----------+----------------+------------------------------------------------------------------------------+
| Cancel | ``bt-cancel`` | Cancel an action and go back to another page |
+-----------+----------------+------------------------------------------------------------------------------+
Styling buttons
---------------
Small buttons, mainly to use inline
.. code-block:: html
<p><a class="sc-button bt-create bt-small">You button</a></p>
You can omit content and show a button with an icon only :
.. code-block:: html
<a class="sc-button bt-create"></a>
You can hide content and show it only on hover
.. code-block:: html
<a class="sc-button bt-create has-hidden"><span class="show-on-hover">Showed when mouse pass on</span></a>
You can customize the icon :
.. code-block:: html
<a class="sc-button bt-create change-icon"><i class="fa fa-icon"></i>Button with custom icon</a>
Grouping buttons
----------------
Grouping buttons can be done using ``ul.record_actions`` element (an ``ul`` list with class ``record_actions``):
.. code-block:: html
<ul class="record_actions">
<li class="cancel">
<a class="sc-button bt-cancel">Cancel</a>
<li>
<li>
<a class="sc-button bt-save">Save</a>
</li>
</ul>
The element with the ``cancel`` class will be set in first position.
Inside table, the space between elements will be shorter.
You can add the class ``record_actions_small`` if you want shorter space between elements.

View File

@@ -0,0 +1,101 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Database Migrations
********************
Every bundle potentially brings his own database operations : to persist entities, developers have to create database schema, creating indexes,...
Those schema might be changed (the less is the better) from time to time.
Consequence: each bundle should bring his own migration files, which will bring the database consistent with the operation you will run in your code. They will be gathered into the app installation, ready to be executed by the chill's installer.
Currently, we use `doctrine migration`_ to manage those migration files. A `composer`_ script located in the **chill standard** component will copy the migrations from your bundle to the doctrne migration's excepted directory after each install and/or update operation.
.. seealso::
The `doctrine migration`_ documentation
Learn concepts about migrations files and scripts and the doctrine ORM
The `doctrine migration bundle`_ documentation
Learn about doctrine migration integration with Symfony framework
Shipping migration files
========================
Migrations files should be shipped under the Resource/migrations directory. You could customize the migration directory by adding extra information in your composer.json:
.. code-block:: json
"extra": {
"migration-source": "path/to/my/dir"
}
The class namespace should be `Application\Migrations`, as expected by doctrine migration. Only the files which will be executed by doctrine migration will be moved: they must have the pattern `VersionYYYYMMDDHHMMSS.php` where YYYY is the year, MM the month, DD the day, HH the hour, MM the month and SS the second of creation.
They will be moved automatically by composer when you install or update a bundle.
Executing migration files
==========================
The installers will have to execute migrations files manually, running
.. code-block:: bash
php app/console doctrine:migrations:status #will give the current status of the database
php app/console doctrine:migrations:migrate #process the update
Updating migration files
=========================
.. warning::
After an installation, migration files will be executed and registered as executed in the database (the version timestamp is recorded into the :title:`migrations_versions` table). If you update your migration file code, the file will still be considered as "executed" by doctrine migration, which will not offers the possibility to run the migration again.
Consequently, updating migration file should only be considered during development phase, and not published on public git branches. If you want to edit your database schema, you should create a new migration file, with a new timestamp, which will proceed to your schema adaptations.
Every time a migration file is discovered, the composer'script will check if the migration exists in the local migration directory. If yes, the script will compare two file for changes (using a md5 hash). If migrations are discovered, the script will ask the installer to know if he must replace the file or ignore it.
.. note::
You can manually run composer script by launching `composer run-script post-update-cmd` from your root chill installation's directory.
.. _doctrine migration: http://www.doctrine-project.org/projects/migrations.html
.. _doctrine migration bundle : http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
.. _composer : https://getcomposer.org
Tips for development
====================
Migration and data
------------------
Each time you create a migration script, you should ensure that it will not lead to data losing. Eventually, feel free to use intermediate steps.
Generation
----------
You can generate migration file from the command line, using those commands:
* `php app/console doctrine:migrations:diff` to generate a migration file by comparing your current database to your mapping information
* `php app/console doctrine:migrations:generate` to generate a blank migration file.
Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resources/migrations` into your bundle directory.
Comments and documentation
--------------------------
As files are copied from your bundle to the `app/DoctrineMigrations` directory, the link between your bundle and the copied file will be unclear. Please add all relevant documentation which will allow future developers to make a link between your file and your bundle.
Inside the script
-----------------
The script which move the migrations files to app directory `might be found here
<https://github.com/Champs-Libres/ComposerBundleMigration/blob/master/Composer/Migrations.php>

View File

@@ -0,0 +1,189 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Pagination
##########
The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow you to easily divide results list on different pages.
A simple example
****************
In the controller, get the :class:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
.. literalinclude:: pagination/example.php
:language: php
Then, render the pagination using the dedicated twig function.
.. code-block:: html+twig
{% extends "ChillPersonBundle::layout.html.twig" %}
{% block title 'Item list'|trans %}
{% block personcontent %}
<table>
{# ... your items here... #}
</table>
{% if items|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% endif %}
The function :code:`chill_pagination` will, by default, render a link to the 10 previous page (if they exists) and the 10 next pages (if they exists). Assuming that we are on page 5, the function will render a list to ::
Previous 1 2 3 4 **5** 6 7 8 9 10 11 12 13 14 Next
Understanding the magic
=======================
Where does the :code:`$paginator` get the page number ?
-------------------------------------------------------
Internally, the :code:`$paginator` object has a link to the :code:`Request` object, and it reads the :code:`page` parameter which contains the current page number. If this parameter is not present, the :code:`$paginator` assumes that we are on page 1.
.. figure:: /_static/puml/pagination-sequence.png
The :code:`$paginator` get the current page from the request.
Where does the :code:`$paginator` get the number of items per page ?
--------------------------------------------------------------------
As above, the :code:`$paginator` can get the number of items per page from the :code:`Request`. If none is provided, this is given by the configuration which is, by default, 50 items per page.
:code:`PaginatorFactory`, :code:`Paginator` and :code:`Page`
************************************************************
:code:`PaginatorFactory`
========================
The :code:`PaginatorFactory` may create more than one :code:`Paginator` in a single action. Those :code:`Paginator` instance may redirect to different routes and/or routes parameters.
.. code-block:: php
// create a paginator for the route 'my_route' with some parameters (arg1 and arg2)
$paginatorMyRoute = $paginatorFactory->create($total, 'my_route', array('arg1' => 'foo', 'arg2' => $bar);
Those parameters will override the current parameters.
The :code:`PaginatorFactory` has also some useful shortcuts :
.. code-block:: php
// get current page number
$paginatorFactory->getCurrentPageNumber( )
// get the number of items per page **for the current request**
$paginatorFactory->getCurrentItemsPerPage( )
// get the number of the first item **for the current page**
$paginatorFactory->getCurrentPageFirstItemNumber( )
Working with :code:`Paginator` and :code:`Page`
===============================================
The paginator has some function to give the number of pages are required to displayed all the results, and give some information about the number of items per page :
.. code-block:: php
// how many page count this paginator ?
$paginator->countPages(); // return 20 in our example
// we may get the number of items per page
$paginator->getItemsPerPage(); // return 20 in our example
A :code:`Paginator` instance create instance of :code:`Page`, each :code:`Page`, which is responsible for generating the URL to the page number it represents. Here are some possibilities using :code:`Page` and :code:`Paginator` :
.. code-block:: php
// get the current page
$page = $paginator->getCurrentPage();
// on which page are we ?
$page->getNumber(); // return 5 in this example (we are on page 5)
// generate the url for page 5
$page->generateUrl(); // return '/<your route here>?page=5
// what is the first item number on this page ?
$page->getFistItemNumber(); // return 101 in our example (20 items per page)
// what is the last item number on this page ?
$page->getLastItemNumber(); // return 120 in our example
// we can access directly the next and current page
if ($paginator->hasNextPage()) {
$next = $paginator->getNextPage();
}
if ($paginator->hasPreviousPage()) {
$previous = $paginator->getPreviousPage();
}
// we can access directly to a given page number
if ($paginator->hasPage(10)) {
$page10 = $paginator->getPage(10);
}
// we can iterate over our pages through a generator
foreach ($paginator->getPagesGenerator() as $page) {
$page->getNumber();
}
// check that a page object is the current page
$paginator->isCurrentPage($page); // return false
.. warning::
When calling a page which does not exists, the :code:`Paginator` will throw a `RuntimeException`. Example :
.. code-block:: php
// our last page is 10
$paginator->getPage(99); // out of range => throw `RuntimeException`
// our current page is 1 (the first page)
$paginator->getPreviousPage; // does not exists (the fist page is always 1) => throw `RuntimeException`
.. note::
When you create a :code:`Paginator` for the current route and route parameters, the :code:`Page` instances will keep the same parameters and routes :
.. code-block:: php
// assuming our route is 'my_route', for the pattern '/my/{foo}/route',
// and the current route is '/my/value/route?arg2=bar'
// create a paginator for the current route and route parameters :
$paginator = $paginatorFactory->create($total);
// get the next page
if ($paginator->hasNext()) {
$next = $paginator->getNextPage();
// get the route to the page
$page->generateUrl(); // will print 'my/value/route?arg2=bar&page=2'
}
Having a look to the `full classes documentation may provide some useful information <http://api.chill.social/Chill-Main/master/namespace-Chill.MainBundle.Pagination.html>`_.
Customizing the rendering of twig's :code:`chill_pagination`
************************************************************
You can provide your own layout for rendering the pagination: provides your twig template as a second argument :
.. code-block:: html+jinja
{{ chill_pagination(paginator, 'MyBundle:Pagination:MyTemplate.html.twig') }}
The template will receive the :code:`$paginator` as :code:`paginator` variable. Let's have a look `at the current template <https://framagit.org/Chill-project/Chill-Main/blob/master/Resources/views/Pagination/long.html.twig>`_.

View File

@@ -0,0 +1,51 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class example extends Controller
{
public function yourAction()
{
$em = $this->getDoctrine()->getManager();
// first, get the number of total item are available
$total = $em
->createQuery('SELECT COUNT (item.id) FROM ChillMyBundle:Item item')
->getSingleScalarResult();
// get the PaginatorFactory
$paginatorFactory = $this->get('chill_main.paginator_factory');
// create a pagination instance. This instance is only valid for
// the current route and parameters
$paginator = $paginatorFactory->create($total);
// launch your query on item. Limit the query to the results
// for the current page using the paginator
$items = $em->createQuery('SELECT item FROM ChillMyBundle:Item item WHERE <your clause>')
// use the paginator to get the first item number
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())
// use the paginator to get the number of items to display
->setMaxResults($paginator->getItemsPerPage());
return $this->render(
'ChillMyBundle:Item:list.html.twig',
[
'items' => $items,
'paginator' => $paginator,
]
);
}
}

View File

@@ -0,0 +1,154 @@
Rendering entity automatically
##############################
Some entity need to be rendered automatically for a couple of times: a person, a user, ...
One can use some twig filter to render those entities:
.. code-block:: twig
{{ person|chill_entity_render_box }}
Define a renderer
=================
By default, the object passed through the renderer will be rendered using the :code:`__toString()` method. To customize this behaviour, you have to define a service and tag it using :code:`chill.render_entity`.
The rendered is implemented using :class:`Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface`. This interface has 3 methods:
* :code:`public function supports($entity, array $options): bool`: return true if the :code:`$entity` given in parameter, with custom options, is supported by this renderer;
* :code:`public function renderString($entity, array $options): string`: render the entity as a single string, for instance in a select list;
* :code:`public function renderBox($entity, array $options): string`: render the entity in an html box.
.. warning::
The HTML returned by :code:`renderBox` **MUST BE SAFE** of any XSS injection.
:class:`Chill\MainBundle\Templating\Entity\AbstractChillEntityRender` provides some useful methods to get the opening and closing boxes that should be used.
Usage about rendering comment:
.. code-block:: php
namespace Chill\MainBundle\Templating\Entity;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
use Symfony\Component\Templating\EngineInterface;
class CommentRender extends AbstractChillEntityRender
{
/**
* @var \Chill\MainBundle\Repository\UserRepository
*/
private $userRepository;
/**
*
* @var EngineInterface
*/
private $engine;
public function __construct(
UserRepository $userRepository,
EngineInterface $engine
) {
$this->userRepository = $userRepository;
$this->engine = $engine;
}
/**
* @param CommentEmbeddable $entity
* @param array $options
*
* @return string
*/
public function renderBox($entity, array $options): string
{
// default options
$options = \array_merge([
'user' => [],
'disable_markdown' => false,
'limit_lines' => null,
'metadata' => true
], $options);
if ($entity->getUserId()) {
$user = $this->userRepository->find($entity->getUserId());
}
return $this->engine
->render(
'@ChillMain/Entity/CommentEmbeddable.html.twig',
[
'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'),
'closing_box' => $this->getDefaultClosingBox(),
'user' => $user ?? NULL,
'comment' => $entity,
'options' => $options
]
);
}
/**
* @param CommentEmbeddable $entity
* @param array $options
*
* @return string
*/
public function renderString($entity, array $options): string
{
return $entity->getComment();
}
public function supports($entity, array $options): bool
{
return $entity instanceof CommentEmbeddable;
}
}
Logic inside the template:
.. code-block:: twig
{{ opening_box|raw }}
<div>
{# logic for rendering #}
</div>
{{ closing_box|raw }}
Usage in templates
==================
For rendering entity as a box:
.. code-block:: twig
{{ entity|chill_entity_render_box }}
For rendering entity as a string:
.. code-block:: twig
{{ entity|chill_entity_render_string }}
Available renderer and options
==============================
:code:`Person` (Person Bundle)
------------------------------
* no options
:code:`CommentEmbeddable` (Main Bundle)
---------------------------------------
Options:
* :code:`user`: options which will be passed to "user" renderer
* :code:`disable_markdown`: disable markdown renderer, default to :code:`FALSE`
* :code:`limit_lines` (integer) limit the number of lines. Default to :code:`NULL`. May be an integer.
* :code:`metadata` (boolean): show the last updating user and last updating date. Default to :code:`TRUE`.

View File

@@ -0,0 +1,68 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Routing
#######
Our goal is to ease the installation of the different bundle. Users should not have to dive into complicated config files to install bundles.
A routing loader available for all bundles
===========================================
A Chill bundle may rely on the Routing Loader defined in ChillMain.
The loader will load `yml` or `xml` files. You simply have to add them into `chill_main` config
.. code-block:: yaml
chill_main:
# ... other stuff here
routing:
resources:
- @ChillMyBundle/Resources/config/routing.yml
Load routes automatically
-------------------------
But this force users to modify config files. To avoid this, you may prepend config implementing the `PrependExtensionInterface` in the `YourBundleExtension` class. This is an example from **chill main** bundle :
.. code-block:: php
namespace Chill\MainBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
class ChillMainExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $container)
{
// ...
}
public function prepend(ContainerBuilder $container)
{
//add current route to chill main
//this is where the resource is added automatically in the config
$container->prependExtensionConfig('chill_main', array(
'routing' => array(
'resources' => array(
'@ChillMainBundle/Resources/config/routing.yml'
)
)
));
}
}

View 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

View File

@@ -0,0 +1,276 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Searching
*********
Chill should provide information needed by users when they need it. Searching within bundle, entities,... is an important feature to achieve this goal.
The Main Bundle provide interfaces to ease the developer work. It will also attempt that search will work in the same way accross bundles.
.. contents:: Table of content
:local:
.. seealso::
`Our blog post about searching (in French) <http://blog.champs-libres.coop/vie-des-champs/2015/01/06/va-chercher-chill-la-recherche-dans-chill-logiciel-libre-service-social.html>`_
This blog post give some information for end-users about searching.
`The issue about search behaviour <https://redmine.champs-libres.coop/issues/377>`_
Where the search behaviour is defined.
Searching in a glance for developers
====================================
Chill suggests to use an easy-to-learn language search.
.. note::
We are planning to provide a form to create automatically search pattern according to this language. Watch the `issue regarding this feature <https://redmine.champs-libres.coop/issues/389>`_.
The language is an association of search terms. Search terms may contains :
- **a domain**: this is "the domain you want to search" : it may some entities like people, reports, ... Example : `@person` to search accross people, `@report` to browse reports, ... The search pattern may have **a maximum of one** domain by search, providing more should throw an error, and trigger a warning for users.
- **arguments and their values** : This is "what you search". Arguments narrow the search to specific fields : username, date of birth, nationality, ... The syntax is `argument:value`. I.e.: ` birthdate:2014-12-15`, `firstname:Depardieu`, ... **Arguments are optional**. If the value of an argument contains spaces or characters like punctuation, quotes ("), the value should be provided between parenthesis : `firstname:(Van de snoeck)`, `firstname:(M'bola)`, ...
- **default value** : this the "rest" of the search, not linked with any arguments or domain. Example : `@person dep` (`dep` is the "default value"), or simply `dep` if any domain is provided (which is perfectly acceptable). If a string is not idenfied as argument or domain, it will be present in the "default" term.
If a search pattern (provided by the user) does not contains any domain, the search must be run across default domain/search modules.
A domain may be supported by different search modules. For instance, if you provide the domain `@person`, the end-user may receive results of exact firstname/lastname, but also result with spelling suggestion, ... **But** if results do not fit into the first page (if you have 75 results and the screen show only 50 results), the next page should contains only the results from the required module.
For instance : a user search across people by firstname/lastname, the exact spelling contains 10 results, the "spelling suggestion" results contains 75 names, but show only the first 50. If the user want to see the last 25, the next screen should not contains the results by firstname/lastname.
Allowed characters as arguments
===============================
In order to execute regular expression, the allowed chararcters in arguments are a-z characters, numbers, and the sign '-'. Spaces and special characters like accents are note allowed (the accents are removed during parsing).
Special characters and uppercase
================================
The search should not care about lowercase/uppercase and accentued characters. Currently, they are removed automatically by the `chill.main.search_provider`.
Implementing search module for dev
===================================
To implement a search module, you should :
- create a class which implements the `Chill\MainBundle\Search\SearchInterface` class. An abstract class `Chill\MainBundle\Search\AbstractSearch` will provide useful assertions for parsing date string to `DateTime` objects, ...
- register the class as a service, and tag the service with `chill.search` and an appropriate alias
The search logic is provided under the `/search` route.
.. seealso::
`The implementation of a search module in Person bundle <https://github.com/Chill-project/Person/blob/master/Search/PersonSearch.php>`_
An example of implementationhttps://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php
.. note::
**Internals explained** : the services tagged with `chill.search` are gathered into the `chill.main.search_provider` service during compilation (`see the compiler pass <https://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php>`_).
The `chill.main.search_provider` service allow to :
- retrieve all results (as html string) for all search module concerned by the search (according to the domain provided or modules marked as default)
- retrieve result for one search module
The SearchInterface class
-------------------------
.. code-block:: php
namespace Chill\PersonBundle\Search;
use Chill\MainBundle\Search\AbstractSearch;
use Doctrine\ORM\EntityManagerInterface;
use Chill\PersonBundle\Entity\Person;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Chill\MainBundle\Search\ParsingException;
class PersonSearch extends AbstractSearch
{
// indicate which domain you support
// you may respond TRUE to multiple domain, according to your logic
public function supports($domain, $format='html')
{
return 'person' === $domain;
}
// if your domain must be called when no domain is provided, should return true
public function isActiveByDefault()
{
return true;
}
// if multiple module respond to the same domain, indicate an order for your search.
public function getOrder()
{
return 100;
}
// This is where your search logic should be executed.
// This method must return an HTML string (a string with HTML tags)
// see below about the structure of the $term array
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = array(), $format = 'html')
{
return $this->container->get('templating')->render('ChillPersonBundle:Person:list.html.twig',
array(
// you should implements the `search` function somewhere :-)
'persons' => $this->search($terms, $start, $limit, $options),
// recomposePattern is available in AbstractSearch class
'pattern' => $this->recomposePattern($terms, array('nationality',
'firstname', 'lastname', 'birthdate', 'gender'), $terms['_domain']),
// you should implement the `count` function somewhere :-)
'total' => $this->count($terms)
));
}
}
Values for :code:`$options`
^^^^^^^^^^^^^^^^^^^^^^^^^^^
:code:`$options` is an array with the following keys:
- :code:`SearchInterface::SEARCH_PREVIEW_OPTION` (bool): if the current view is a preview (the first 5 results) or not ;
- :code:`SearchInterface::REQUEST_QUERY_PARAMETERS` (bool): some parameters added to the query (under the key :code:`SearchInterface::REQUEST_QUERY_KEY_ADD_PARAMETERS`) and that can be interpreted. Used, for instance, when calling a result in json format when searching for interactive picker form.
Structure of array `$term`
^^^^^^^^^^^^^^^^^^^^^^^^^^
The array term is parsed automatically by the `main.chill.search_provider` service.
.. note::
If you need to parse a search pattern, you may use the function `parse($pattern)` provided by the service.
The array `$term` have the following structure after parsing :
.. code-block:: php
array(
'_domain' => 'person', //the domain, without the '@'
'argument1' => 'value', //the argument1, with his value
'argument2' => 'my value with spaces', //the argument2
'_default' => 'abcde ef' // the default term
);
The original search would have been : `@person argument1:value argument2:(my value with spaces) abcde ef`
.. warning::
The search values are always unaccented.
Returning a result in json
^^^^^^^^^^^^^^^^^^^^^^^^^^
The json format is mainly used by "select2" widgets.
When returning a result in json, the SearchInterface should only return an array with following keys:
- :code:`more` (bool): if the search has more result than the current page ;
- :code:`results` (array): a list of result, where:
- :code:`text` (string): the text that should be displayed in browser ;
- :code:`id` (string): the id of the entity.
Register the service
--------------------
You should add your service in the configuration, and add a `chill.search` tag and an alias.
Example :
.. code-block:: yaml
services:
chill.person.search_person:
class: Chill\PersonBundle\Search\PersonSearch
#your logic here
tags:
- { name: chill.search, alias: 'person_regular' }
The alias will be used to get the results narrowed to this search module, in case of pagination (see above).
Parsing date
============
The class `Chill\MainBundle\Search\AbstractSearch` provides a method to parse date :
.. code-block:: php
//from subclasses
$date = $this->parseDate($string);
`$date` will be an instance of `DateTime <http://php.net/manual/en/class.datetime.php>`_.
.. seealso::
`The possibility to add periods instead of date <https://redmine.champs-libres.coop/issues/390>`_
Which may be a future improvement for search with date.
Exceptions
==========
The logic of the search is handled by the controller for the `/search` path.
You should throw those Exception from your instance of `SearchInterface` if needed :
Chill\MainBundle\Search\ParsingException
If the terms does not fit your search logic (for instance, conflicting terms)
Expected behaviour
==================
Operators between multiple terms
--------------------------------
Multiple terms should be considered are "AND" instructions :
@person nationality:RU firstname:dep
the people having the Russian nationality AND having DEP in their name
@person birthdate:2015-12-12 charles
the people having 'charles' in their name or firstname AND born on December 12 2015
Spaces in default
-----------------
Spaces in default terms should be considered as "AND" instruction
@person charle dep
people having "dep" AND "charles" in their firstname or lastname. Match "Charles Depardieu" but not "Gérard Depardieu" ('charle' is not present)
Rendering
---------
The rendering should contains :
- the total number of results ;
- the search pattern in the search language. The aim of this is to let users learn the search language easily.
- a title
Frequently Asked Questions (FAQ)
================================
Why renderResults returns an HTML string and not structured array ?
It seems that the form of results may vary (according to access-right logic, ...) and is not easily structurable

View File

@@ -0,0 +1,377 @@
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Timelines
*********
.. contents:: Table of content
:local:
Concept
=======
From an user point of view
--------------------------
Chill has two objectives :
* make the administrative tasks more lightweight ;
* help social workers to have all information they need to work
To reach this second objective, Chill provides a special view: **timeline**. On a timeline view, information is gathered and shown on a single page, from the most recent event to the oldest one.
The information gathered is linked to a *context*. This *context* may be, for instance :
* a person : events linked to this person are shown on the page ;
* a center: events linked to a center are shown. They may concern different peoples ;
* ...
In other word, the *context* is the kind of argument that will be used in the event's query.
Let us recall that only the data the user has allowed to see should be shown.
.. seealso::
`The issue where the subject was first discussed <https://redmine.champs-libres.coop/issues/224>`_
For developers
--------------
The `Main` bundle provides interfaces and services to help to build timelines.
If a bundle wants to *push* information in a timeline, it should be create a service which implements `Chill\MainBundle\Timeline\TimelineProviderInterface`, and tag is with `chill.timeline` and arguments defining the supported context (you may use multiple `chill.timeline` tags in order to support multiple context with a single service/class).
If a bundle wants to provide a new context for a timeline, the service `chill.main.timeline_builder` will helps to gather timeline's services supporting the defined context, and run queries across the models.
.. _understanding-queries :
Understanding queries
^^^^^^^^^^^^^^^^^^^^^
Due to the fact that timelines should show only the X last events from Y differents tables, queries for a timeline may consume a lot of resources: at first on the database, and then on the ORM part, which will have to deserialize DB data to PHP classes, which may not be used if they are not part of the "last X events".
To avoid such load on database, the objects are queried in two steps :
1. An UNION request which gather the last X events, ordered by date. The data retrieved are the ID, the date, and a string key: a type. This type discriminates the data type.
2. The PHP objects are queried by ID, the type helps the program to link id with the kind of objects.
Those methods should ensure that only X PHP objects will be gathered and build by the ORM.
What does the master timeline builder service ?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When the service `chill.main.timeline_builder` is instanciated, the service is informed of each service taggued with `chill.timeline` tags. Then,
1. The service build an UNION query by assembling column and tables names provided by the `fetchQuery` result ;
2. The UNION query is run, the result contains an id and a type for each row (see :ref:`above <understanding-queries>`)
3. The master service gather all id with the same type. Then he searches for the `chill.timeline`'s service which will be able to get the entities. Then, the entities will be fetched using the `fetchEntities` function. All entities are gathered in one query ;
4. The information to render entities in HTML is gathered by passing entity, one by one, on `getEntityTemplate` function.
Pushing events to a timeline
=============================
To push events on a timeline :
1. Create a class which implements `Chill\MainBundle\Timeline\TimelineProviderInterface` ;
2. Define the class as a service, and tag the service with `chill.timeline`, and define the context associated with this timeline (you may add multiple tags for different contexts).
Implementing the TimelineProviderInterface
------------------------------------------
The has the following signature :
.. code-block:: php
namespace Chill\MainBundle\Timeline;
interface TimelineProviderInterface
{
/**
*
* @param string $context
* @param mixed[] $args the argument to the context.
* @return string[]
* @throw \LogicException if the context is not supported
*/
public function fetchQuery($context, array $args);
/**
* Indicate if the result type may be handled by the service
*
* @param string $type the key present in the SELECT query
* @return boolean
*/
public function supportsType($type);
/**
* fetch entities from db into an associative array. The keys **MUST BE**
* the id
*
* All ids returned by all SELECT queries
* (@see TimeLineProviderInterface::fetchQuery) and with the type
* supported by the provider (@see TimelineProviderInterface::supportsType)
* will be passed as argument.
*
* @param array $ids an array of id
* @return mixed[] an associative array of entities, with id as key
*/
public function getEntities(array $ids);
/**
* return an associative array with argument to render the entity
* in an html template, which will be included in the timeline page
*
* The result must have the following key :
*
* - `template` : the template FQDN
* - `template_data`: the data required by the template
*
*
* Example:
*
* ```
* array(
* 'template' => 'ChillMyBundle:timeline:template.html.twig',
* 'template_data' => array(
* 'accompanyingPeriod' => $entity,
* 'person' => $args['person']
* )
* );
* ```
*
* `$context` and `$args` are defined by the bundle which will call the timeline
* rendering.
*
* @param type $entity
* @param type $context
* @param array $args
* @return mixed[]
* @throws \LogicException if the context is not supported
*/
public function getEntityTemplate($entity, $context, array $args);
}
The `fetchQuery` function
^^^^^^^^^^^^^^^^^^^^^^^^^
The fetchQuery function help to build the UNION query to gather events. This function should return an associative array MUST have the following key :
* `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
Those key are optional:
* `WHERE` (in capital) : the WHERE clause.
Where relevant, the data must be quoted to avoid SQL injection.
`$context` and `$args` are defined by the bundle which will call the timeline rendering. You may use them to build a different query depending on this context.
For instance, if the context is `'person'`, the args will be this array :
.. code-block:: php
array(
'person' => $person //a \Chill\PersonBundle\Entity\Person entity
);
You should find in the bundle documentation which contexts are arguments the bundle defines.
.. note::
We encourage to use `ClassMetaData` to define column names arguments. If you change your column names, changes will be reflected automatically during the execution of your code.
Example of an implementation :
.. code-block:: php
namespace Chill\ReportBundle\Timeline;
use Chill\MainBundle\Timeline\TimelineProviderInterface;
use 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
{
/**
*
* @var EntityManager
*/
protected $em;
public function __construct(EntityManager $em)
{
$this->em = $em;
}
public function fetchQuery($context, array $args)
{
$this->checkContext($context);
$metadata = $this->em->getClassMetadata('ChillReportBundle:Report');
return array(
'id' => $metadata->getColumnName('id'),
'type' => 'report',
'date' => $metadata->getColumnName('date'),
'FROM' => $metadata->getTableName(),
'WHERE' => sprintf('%s = %d',
$metadata
->getAssociationMapping('person')['joinColumns'][0]['name'],
$args['person']->getId())
);
}
//....
}
The `supportsType` function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This function indicate to the master `chill.main.timeline_builder` service (which orchestrate the build of UNION queries) that the service supports the type indicated in the result's array of the `fetchQuery` function.
The implementation of our previous example will be :
.. code-block:: php
namespace Chill\ReportBundle\Timeline;
use Chill\MainBundle\Timeline\TimelineProviderInterface;
use Doctrine\ORM\EntityManager;
class TimelineReportProvider implements TimelineProviderInterface
{
//...
/**
*
* {@inheritDoc}
*/
public function supportsType($type)
{
return $type === 'report';
}
//...
}
The `getEntities` function
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is where the service must fetch entities from database and return them to the master service.
The results **must be** an array where the id given by the UNION query (remember `fetchQuery`).
.. code-block:: php
namespace Chill\ReportBundle\Timeline;
use Chill\MainBundle\Timeline\TimelineProviderInterface;
use Doctrine\ORM\EntityManager;
class TimelineReportProvider implements TimelineProviderInterface
{
public function getEntities(array $ids)
{
$reports = $this->em->getRepository('ChillReportBundle:Report')
->findBy(array('id' => $ids));
$result = array();
foreach($reports as $report) {
$result[$report->getId()] = $report;
}
return $result;
}
}
The `getEntityTemplate` function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is where the master service will collect information to render the entity.
The result must be an associative array with :
- **template** is the FQDN of the template ;
- **template_data** is an associative array where keys are the variables'names for this template, and values are the values.
Example :
.. code-block:: php
array(
'template' => 'ChillMyBundle:timeline:template.html.twig',
'template_data' => array(
'period' => $entity,
'person' => $args['person']
)
);
The template must, obviously, exists. Example :
.. code-block:: jinja
<p><i class="fa fa-folder-open"></i>&nbsp;{{ 'An accompanying period is opened for %person% on %date%'|trans({'%person%': person, '%date%': period.dateOpening|localizeddate('long', 'none') } ) }}</p>
Create a timeline with his own context
======================================
You have to create a Controller which will execute the service `chill.main.timeline_builder`. Using the `Chill\MainBundle\Timeline\TimelineBuilder::getTimelineHTML` function, you will get an HTML representation of the timeline, which you may include with twig `raw` filter.
Example :
.. code-block:: php
namespace Chill\PersonBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class TimelinePersonController extends Controller
{
public function personAction(Request $request, $person_id)
{
$person = $this->getDoctrine()
->getRepository('ChillPersonBundle:Person')
->find($person_id);
if ($person === NULL) {
throw $this->createNotFoundException();
}
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
(
'timeline' => $this->get('chill.main.timeline_builder')
->getTimelineHTML('person', array('person' => $person)),
'person' => $person
)
);
}
}

View File

@@ -0,0 +1,73 @@
Useful snippets
###############
Dependency Injection
********************
Configure route automatically
=============================
Add the route for the current bundle automatically on the main app.
.. code-block:: php
namespace Chill\MyBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
class ChillMyExtension extends Extension implements PrependExtensionInterface
{
// ...
public function prepend(ContainerBuilder $container)
{
$this->prependRoutes($container);
}
public function prependRoutes(ContainerBuilder $container)
{
//add routes for custom bundle
$container->prependExtensionConfig('chill_main', array(
'routing' => array(
'resources' => array(
'@ChillMyBundle/Resources/config/routing.yml'
)
)
));
}
Security
********
Get the circles a user can reach
================================
.. code-block:: php
use Symfony\Component\Security\Core\Role\Role;
$authorizationHelper = $this->get('chill.main.security.authorization.helper');
$circles = $authorizationHelper
->getReachableCircles(
$this->getUser(), # from a controller
new Role('CHILL_ROLE'),
$center
);
Controller
**********
Secured controller for person
=============================
.. literalinclude:: useful-snippets/controller-secured-for-person.php
:language: php

View File

@@ -0,0 +1,66 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\HealthBundle\Controller;
use Chill\HealthBundle\Security\Authorization\ConsultationVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\Role\Role;
class ConsultationController extends Controller
{
/**
* @param int $id personId
*
* @throws type
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function listAction($id)
{
/** @var \Chill\PersonBundle\Entity\Person $person */
$person = $this->get('chill.person.repository.person')
->find($id);
if (null === $person) {
throw $this->createNotFoundException('The person is not found');
}
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
/** @var \Chill\MainBundle\Security\Authorization\AuthorizationHelper $authorizationHelper */
$authorizationHelper = $this->get('chill.main.security.'
. 'authorization.helper');
$circles = $authorizationHelper->getReachableCircles(
$this->getUser(),
new Role(ConsultationVoter::SEE),
$person->getCenter()
);
// create a query which take circles into account
$consultations = $this->getDoctrine()->getManager()
->createQuery('SELECT c FROM ChillHealthBundle:Consultation c '
. 'WHERE c.patient = :person AND c.circle IN(:circles) '
. 'ORDER BY c.date DESC')
->setParameter('person', $person)
->setParameter('circles', $circles)
->getResult();
return $this->render('ChillHealthBundle:Consultation:list.html.twig', [
'person' => $person,
'consultations' => $consultations,
]);
}
}

View File

@@ -0,0 +1,77 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
CSS classes and mixins
######################
The stylesheet are based on the framework `ScratchCSS <https://github.com/Champs-Libres/ScratchCSS>`_.
We added some useful classes and mixins for the Chill usage.
CSS Classes
************
Statement "empty data"
======================
CSS Selector
:code:`.chill-no-data-statement`
In which case will you use this selector ?
When a list is empty, and a message fill the list to inform that the data is empty
Example usage
.. code-block:: html+jinja
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
Quotation of user text
=======================
CSS Selector
:code:`blockquote.chill-user-quote`
In which case will you use this selector ?
When you quote text that were filled by the user in a form.
Example usage
.. code-block:: html+jinja
<blockquote class="chill-user-quote">{{ entity.remark|nl2br }}</blockquote>
Boxes
=====
CSS Selector
:code:`chill__box`
In which case will you use this selector ?
When displaying some data in a nice box
Example usage
.. code-block:: html+twig
<span class="chill__box green">A nice box with green background</span>
<span class="chill__box red">A nice box with red background</span>
Mixins
******
Entity decorator
=================
Mixin
:code:`@mixin entity($background-color, $color: white)`
In which case including this mixin ?
When you create a `sticker`, a sort of label to represent a text in a way that the user can associate immediatly with a certain type of class / entity.
Example usage
.. code-block:: sass
span.entity.entity-activity.activity-reason {
@include entity($chill-pink, white);
}

View File

@@ -0,0 +1,261 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Javascript functions
####################
Some function may be useful to manipulate elements on the page.
Show-hide elements according to a form state
*********************************************
The module ``ShowHide`` will allow you to show/hide part of your page using a specific test.
This must be use inside a javascript module.
Usage
=====
In this module, the module will listen to all input given in the ``container_from`` div, and will show or hide the content of the ``container_target`` according to the result of the ``test`` function.
.. code-block:: html+twig
<div id="container_from">
{{ form_row(form.accompagnementRQTHDate) }}
</div>
<div id="container_target">
{{ form_row(form.accompagnementComment) }}
</div>
.. code-block:: javascript
import { ShowHide } from 'ShowHide/show_hide.js';
var
from = document.getElementById("container_from"),
target = document.getElementById("container_target")
;
new ShowHide({
froms: [from], // the value of from should be an iterable
container: [target], // the value of container should be an iterable
test: function(froms, event) {
// iterate over each element of froms
for (let f of froms.values()) {
// get all input inside froms
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'autre') {
return input.checked;
}
}
}
return false;
}
});
Once instantiated, the class ``ShowHide`` will:
1. get all input from each element inside the ``froms`` values
2. attach an event listener (by default, ``change``) to each input inside each entry in ``froms``
3. each time the event is fired, launch the function ``test``
4. show the element in the container given in ``container``, if the result of ``test`` is true, or hide them otherwise.
The test is also launched when the page is loaded.
Show/hide while the user enter data: using the ``input`` event
==============================================================
One can force to use another event on the input elements, instead of the default ``'change'`` event.
For achieving this, use the `event_name` option.
.. code-block:: javascript
new ShowHide({
froms: froms,
test: test_function,
container: containers ,
// using this option, we use the event `input` instead of `change`
event_name: 'input'
});
Examples
--------
.. literalinclude:: js-functions/show_hide.js
:language: javascript
Using Show/Hide in collections forms
====================================
Using show / hide in collection forms implies:
* to launch show/hide manually for each entry when the page is loaded ;
* to catch when an entry is added to the form ;
As the show/hide is started manually and not on page load, we add the option ``load_event: null`` to the options:
.. code-block:: javascript
new ShowHide({
load_event: null,
froms: [ from ],
container: [ container ],
test: my_test_function
});
.. note::
When using ``load_event: null`` inside the options, the value of event will be ``null`` as second argument for the test function.
.. code-block:: javascript
my_test_function(froms, event) {
// event will be null on first launch
}
Example usage: here, we would like to catch for element inside a CV form, where the user may add multiple formation entries.
.. code-block:: javascript
import { ShowHide } from 'ShowHide/show_hide.js';
// we factorize the creation of show hide element in this function.
var make_show_hide = function(entry) {
let
obtained = entry.querySelector('[data-diploma-obtained]'),
reconnue = entry.querySelector('[data-diploma-reconnue]')
;
new ShowHide({
load_event: null,
froms: [ obtained ],
container: [ reconnue ],
test: my_test_function
});
};
// this code is fired when an entry is added on the page
window.addEventListener('collection-add-entry', function(e) {
// if the form contains multiple collection, we filter them here:
if (e.detail.collection.dataset.collectionName === 'formations') {
make_show_hide(e.detail.entry);
}
});
// on page load, we create a show/hide
window.addEventListener('load', function(_e) {
let
formations = document.querySelectorAll('[data-formation-entry]')
;
for (let f of formations.values()) {
make_show_hide(f);
}
});
Handling encapsulated show/hide elements
========================================
This module allow to handle encapsulated show/hide elements. For instance :
* in a first checkbox list, a second checkbox list is shown if some element is checked ;
* in this second checkbox list, a third input is shown if some element is checked inside the second checkbox list.
As a consequence, if the given element in the first checkbox list is unchecked, the third input must also be hidden.
Example: when a situation professionnelle is ``en activite``, the second element ``type contrat`` must be shown if ``en_activite`` is checked. Inside ``type_contrat``, ``type_contrat_aide`` should be shown when ``contrat_aide`` is checked.
.. code-block:: html
<div id="situation_prof">
<input type="radio" name="situationProfessionnelle" value="" checked="checked" />
<input type="radio" name="situationProfessionnelle" value="sans_emploi" />
<input type="radio" name="situationProfessionnelle" value="en_activite" />
</div>
<div id="type_contrat">
<input type="checkbox" name="typeContrat[]" value="cdd" />
<input type="checkbox" name="typeContrat[]" value="cdi" />
<input type="checkbox" name="typeContrat[]" value="contrat_aide" />
</div>
<div id="type_contrat_aide">
<input type="text" name="typeContratAide" />
</div>
The JS code will be:
.. code-block:: javascript
import { ShowHide } from 'ShowHide/show_hide.js';
// we search for the element within the DOM
// NOTE: all the elements should be searched before instanciating the showHides.
// if not, the elements **may** have disappeared from the DOM
var
situation_prof = document.getElementById('situation_prof'),
type_contrat = document.getElementById('type_contrat'),
type_contrat_aide = document.getElementById('type_contrat_aide'),
;
// the first show/hide will apply on situation_prof
new ShowHide({
// the id will help us to keep a track of the element
id: 'situation_prof_type_contrat',
froms: [situation_prof],
container: [type_contrat],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'en_activite') {
return input.checked;
}
}
}
return false;
}
});
// the show/hide will apply on "contrat aide"
var show_hide_contrat_aide = new ShowHide({
froms: [type_contrat],
container: [type_contrat_aide],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'contrat_aide') {
return input.checked;
}
}
}
return false;
}
});
// we handle here the case when the first show-hide is changed: the third input must also disappears
window.addEventListener('show-hide-hide', function (e) {
if (e.detail.id = 'situation_prof_type_contrat') {
// we force the 3rd element to disappears
show_hide_contrat_aide.forceHide();
}
});
// when the first show-hide is changed, it makes appears the second one.
// we check here that the second show-hide is processed.
window.addEventListener('show-hide-show', function (e) {
if (e.detail.id = 'situation_prof_type_contrat') {
show_hide_contrat_aide.forceCompute();
}
});

View File

@@ -0,0 +1,39 @@
import { ShowHide } from 'ShowHide/show_hide.js';
var
div_accompagnement = document.getElementById("form_accompagnement"),
div_accompagnement_comment = document.getElementById("form_accompagnement_comment"),
div_caf_id = document.getElementById("cafId"),
div_caf_inscription_date = document.getElementById("cafInscriptionDate"),
;
// let show/hide the div_accompagnement_comment if the input with value `'autre'` is checked
new ShowHide({
"froms": [div_accompagnement],
"test": function(froms, event) {
for (let el of froms.values()) {
for (let input of el.querySelectorAll('input').values()) {
if (input.value === 'autre') {
return input.checked;
}
}
}
return false;
},
"container": [div_accompagnement_comment]
});
// let show the date input only if the the id is filled
new ShowHide({
froms: [ div_caf_id ],
test: function(froms, event) {
for (let el of froms.values()) {
return el.querySelector("input").value !== "";
}
},
container: [ div_caf_inscription_date ],
// using this option, we use the event `input` instead of `change`
event_name: 'input'
});

View File

@@ -0,0 +1,225 @@
.. Copyright (C) 2015 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Layout / Template usage
#######################
We recommand the use of the existing layouts to ensure the consistency of the design. This section explains the different templates and how to use it.
The layouts are twig templates.
Twig templating helper
======================
`chill_print_or_message`
------------------------
Print a value or use a default template if the value is empty.
The template can be customized.
Two default templates are registered:
- :code:`default`, do not decorate the value ;
- :code:`blockquote`: wrap the value into a blockquote if exists
.. code-block:: html+twig
{{ "This is a message"|chill_print_or_message("No message") }}
<!-- will print "This is a message" -->
{{ ""|chill_print_or_message("No message")}}
<!-- will print <span class="chill-no-data-statement">No message</span> -->
{{ "This is a comment\n with multiples lines"|chill_print_or_message("No comment", 'blockquote') }}
<!-- will print <blockquote class="chill-user-quote">This is a comment<br/>with multiples lines</blockquote> -->
When customizing the template, two arguments are passed to the template:
- :code:`value`: the actual value ;
- :code:`message`: the message, given as argument
Routing with return path
------------------------
Three twig function are available for creating routes and handling "return path".
**Rationale**: When building a "CRUD" (CReate, Update, Delete of an entity), you would like to allow people to go back on some custom cancel page when coming for another place of an application. For instance, if you are in the timeline and show an activity, you would like that the user go back to the timeline when pressing the "return" button at the bottom of the page, instead of going back to the "activity list" page.
Using those function, a :code:`returnPath` parameter will be added in the path generated. It will be used instead of the default one in the subsequente pages.
- :code:`chill_path_add_return_path(name, parameters = [], relative = false)`: will create a path with current page as return path (users will go back to the current page on the next page) ;
- :code:`chill_return_path_or(name, parameters = [], relative = false)`: will create a path to the return path if present, or build the path according to the given parameters ;
- :code:`chill_path_forward_return_path(name, parameters = [], relative = false)`: will create a path and adding the return path that is present for the current page, *forwarding* the return path to the next page. This is useful if you are on a "show" page with a return path (by instance, the "timeline" page), you place a link to the *edit* page and want users to go back to the "timeline" page on the edit page.
- :code:`chill_return_path_or`:
Organisation of the layouts
===========================
ChillMainBundle::layout.html.twig
---------------------------------
This is the base layout. It includes the most import css / js files. It display a page with
* a horizontal navigation menu
* a place for content
* a footer
The layout containts blocks, that are :
* title
* to display title
* css
* where to add some custom css
* navigation_section_menu
* place where to insert the section menu in the navigation menu (by default the navigation menu is inserted)
* navigation_search_bar
* place where to insert a search bar in the navigation menu (by default the search bar is inserted)
* top_banner
* place where to display a banner below the navigation menu (this place is use to display the details of the person)
* sublayout_containter
* place between the header and the footer that can be used to create a new layout (with vertical menu for example)
* content
* place where to display the content (flash message are included outside of this block)
* js
* where to add some custom javascript
ChillMainBundle::layoutWithVerticalMenu.html.twig
-------------------------------------------------
This layout extends `ChillMainBundle::layout.html.twig`. It replaces the block `layout_content` and divides this block for displaying a vertical menu and some content.
It proposes 2 new blocks :
* layout_wvm_content
* where to display the page content
* vertical_menu_content
* where to place the vertical menu
ChillMainBundle::Admin/layout.html.twig
---------------------------------------
This layout extends `ChillMainBundle::layout.html.twig`. It hides the search bar, remplaces the `section menu` with the `admin section menu`.
It proposes a new block :
* admin_content
* where to display the admin content
ChillMainBundle::Admin/layoutWithVerticalMenu.html.twig
-------------------------------------------------------
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig`. It do the same changes than `ChillMainBundle::Admin/layout.html.twig` : hiding the search bar, remplacing the `section menu` with the `admin section menu`.
It proposes a new block :
* admin_content
* where to display the admin content
ChillPersonBundle::layout.html.twig
-----------------------------------
This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the person details in the block `top_banner`, set the menu `person` as the vertical menu.
It proposes 1 new block :
* personcontent
* where to display the information of the person
ChillMainBundle::Export/layout.html.twig
----------------------------------------
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig` and set the menu `export` as the vertical menu.
It proposes 1 new block :
* export_content
* where to display the content of the export
Useful template and helpers
===========================
Macros
------
Every bundle may bring their own macro to print resources with uniformized styles.
See :
- :ref:`Macros in person bundle <person-bundle-macros>` ;
- :ref:`Macros in activity bundle <activity-bundle-macros>` ;
- :ref:`Macros in group bundle <group-bundle-macros>` ;
- :ref:`Macros in main bundle <main-bundle-macros>` ;
Templates
---------
ChillMainBundle::Util:confirmation_template.html.twig
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This template show a confirmation template before making dangerous things. You can add your own message and title, or define those message by yourself in another template.
The accepted parameters are :
- `title` (string) a title for the page. Not mandatory (it won't be rendered if not defined)
- `confirm_question` (string) a confirmation question. This question will not be translated into the template, and may be printed as raw. Not mandatory (it won't be rendered if not defined)
- `form` : (:class:`Symfony\Component\Form\FormView`) a form wich **must** contains an input named `submit`, which must be a :class:`Symfony\Component\Form\Extension\Core\Type\SubmitType`. Mandatory
- `cancel_route` : (string) the name of a route if the user want to cancel the action
- `cancel_parameters` (array) the parameters for the route defined in `cancel_route`
Usage :
.. code-block:: html+twig
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
{
# a title, not mandatory
'title' : 'Remove membership'|trans,
# a confirmation question, not mandatory
'confirm_question' : 'Are you sure you want to remove membership ?'|trans
# a route for "cancel" button (mandatory)
'cancel_route' : 'chill_group_membership_by_person',
# the parameters for 'cancel' route (default to {} )
'cancel_parameters' : { 'person_id' : membership.person.id },
# the form which will send the deletion. This form
# **must** contains a SubmitType
'form' : form
} ) }}

View File

@@ -0,0 +1,333 @@
.. Copyright (C) 2016 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Widgets
##############################################
Rationale
=========
Widgets are useful if you want to publish content on a page provided by another bundle.
Examples :
- you want to publish a list of people on the homepage ;
- you may want to show the group belonging (see :ref:`group-bundle`) below of the vertical menu, only if the bundle is installed.
The administrator of the chill instance may configure the presence of widget. Although, some widget are defined by default (see :ref:`declaring-widget-by-default`).
Concepts
========
A bundle may define *place(s)* where a widget may be rendered.
In a single *place*, zero, one or more *widget* may be displayed.
Some *widget* may require some *configuration*, and some does not require any configuration.
Example:
=========================================== ======== ============================= =======================================
Use case place place defined by... widget provided by...
=========================================== ======== ============================= =======================================
Publishing a list of people on the homepage homepage defined by :ref:`main-bundle` widget provided by :ref:`person-bundle`
=========================================== ======== ============================= =======================================
Creating a widget without configuration
========================================
To add a widget, you should :
- define your widget, implementing :class:`Chill\MainBundle\Templating\Widget\WidgetInterface` ;
- declare your widget with tag `chill_widget`.
Define the widget class
-----------------------
Define your widget class by implemeting :class:`Chill\MainBundle\Templating\Widget\WidgetInterface`.
Example :
.. code-block:: php
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\Templating\Widget\WidgetInterface;
/**
* Add a button "add a person"
*
*/
class AddAPersonWidget implements WidgetInterface
{
public function render(
\Twig_Environment $env,
$place,
array $context,
array $config
) {
// this will render a link to the page "add a person"
return $env->render("ChillPersonBundle:Widget:homepage_add_a_person.html.twig");
}
}
Arguments are :
- :code:`$env` the :class:`\Twig_Environment`, which you can use to render your widget ;
- :code:`$place` a string representing the place where the widget is rendered ;
- :code:`$context` the context given by the template ;
- :code:`$config` the configuration which is, in this case, always an empty array (see :ref:`creating-a-widget-with-config`).
.. note::
The html returned by the :code:`render` function will be considered as html safe. You should strip html before returning it. See also `How to escape output in template <http://symfony.com/doc/current/templating/escaping.html>`_.
Declare your widget
-------------------
Declare your widget as a service and add it the tag :code:`chill_widget`:
.. code-block:: yaml
service:
chill_person.widget.add_person:
class: Chill\PersonBundle\Widget\AddAPersonWidget
tags:
- { name: chill_widget, alias: add_person, place: homepage }
The tag must contains those arguments :
- :code:`alias`: an alias, which will be used to reference the widget into the config
- :code:`place`: a place where this widget is authorized
If you want your widget to be available on multiple places, you should add one tag with each place.
Conclusion
----------
Once your widget is correctly declared, your widget should be available in configuration.
.. code-block:: bash
$ php app/console config:dump-reference chill_main
# Default configuration for extension with alias: "chill_main"
chill_main:
[...]
# register widgets on place "homepage"
homepage:
# the ordering of the widget. May be a number with decimal
order: ~ # Required, Example: 10.58
# the widget alias (see your installed bundles config). Possible values are (maybe incomplete) : person_list, add_person
widget_alias: ~ # Required
If you want to add your widget by default, see :ref:`declaring-widget-by-default`.
.. _creating-a-widget-with-config:
Creating a widget **with** configuration
========================================
You can declare some configuration with your widget, which allow administrators to add their own configuration.
To add some configuration, you will :
- declare a widget as defined above ;
- optionnaly declare it as a service ;
- add a widget factory, which will add configuration to the bundle which provide the place.
Declare your widget class
-------------------------
Declare your widget. You can use some configuration elements in your process, as used here :
.. literalinclude:: ./widgets/ChillPersonAddAPersonWidget.php
:language: php
Declare your widget as a service
--------------------------------
You can declare your widget as a service. Not tag is required, as the service will be defined by the :code:`Factory` during next step.
.. code-block:: yaml
services:
chill_person.widget.person_list:
class: Chill\PersonBundle\Widget\PersonListWidget
arguments:
- "@chill.person.repository.person"
- "@doctrine.orm.entity_manager"
- "@chill.main.security.authorization.helper"
- "@security.token_storage"
# this widget is defined by the PersonListWidgetFactory
You can eventually skip this step and declare your service into the container through the factory (see above).
Declare your widget factory
---------------------------
The widget factory must implements `Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface`. For your convenience, an :class:`Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory` will already implements some easy method.
.. literalinclude:: ./widgets/ChillPersonAddAPersonListWidgetFactory.php
:language: php
.. note::
You can declare your widget into the container by overriding the `createDefinition` method. By default, this method will return the already existing service definition with the id given by :code:`getServiceId`. But you can create or adapt programmatically the definition. `See the symfony doc on how to do it <http://symfony.com/doc/current/service_container/definitions.html#working-with-a-definition>`_.
.. code-block:: php
public function createDefinition(ContainerBuilder $containerBuilder, $place, $order, array $config)
{
$definition = new \Symfony\Component\DependencyInjection\Definition('my\Class');
// create or adapt your definition here
return $definition;
}
You must then register your factory into the :code:`Extension` class which provide the place. This is done in the :code: `Bundle` class.
.. code-block:: php
# Chill/PersonBundle/ChillPersonBundle.php
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Chill\PersonBundle\Widget\PersonListWidgetFactory;
class ChillPersonBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->getExtension('chill_main')
->addWidgetFactory(new PersonListWidgetFactory());
}
}
.. _declaring-widget-by-default:
Declaring a widget by default
=============================
Use the ability `to prepend configuration of other bundle <http://symfony.com/doc/current/bundles/prepend_extension.html>`_. A living example here :
.. literalinclude:: ./widgets/ChillPersonExtension.php
:language: php
Defining a place
================
Add your place in template
--------------------------
A place should be defined by using the :code:`chill_widget` function, which take as argument :
- :code:`place` (string) a string defining the place ;
- :code:`context` (array) an array defining the context.
The context should be documented by the bundle. It will give some information about the context of the page. Example: if the page concerns a people, the :class:`Chill\PersonBundle\Entity\Person` class will be in the context.
Example :
.. code-block:: html+jinja
{# an empty context on homepage #}
{{ chill_widget('homepage', {} }}
.. code-block:: html+jinja
{# defining a place 'right column' with the person currently viewed
{{ chill_widget('right_column', { 'person' : person } }}
Declare configuration for you place
-----------------------------------
In order to let other bundle, or user, to define the widgets inside the given place, you should open a configuration. You can use the Trait :class:`Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait`, which provide the method `addWidgetConfiguration($place, ContainerBuilder $container)`.
Example :
.. literalinclude:: ./widgets/ChillMainConfiguration.php
:language: php
:emphasize-lines: 17, 30, 32, 52
:linenos:
.. _example-chill-main-extension:
You should also adapt the :class:`DependencyInjection\*Extension` class to add ContainerBuilder and WidgetFactories :
.. literalinclude:: ./widgets/ChillMainExtension.php
:language: php
:emphasize-lines: 25-39, 48-49, 56
:linenos:
- line 25-39: we implements the method required by :class:`Chill\MainBundle\DependencyInjection\Widget\HasWidgetExtensionInterface` ;
- line 48-49: we record the configuration of widget into container's parameter ;
- line 56 : we create an instance of :class:`Configuration` (declared above)
Compile the possible widget using Compiler pass
-----------------------------------------------
For your convenience, simply extends :class:`Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass`. This class provides a `doProcess(ContainerBuildere $container, $extension, $parameterName)` method which will do the job for you:
- :code:`$container` is the container builder
- :code:`$extension` is the extension name
- :code:`$parameterName` is the name of the parameter which contains the configuration for widgets (see :ref:`the example with ChillMain above <example-chill-main-extension>`.
.. code-block:: php
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Chill\MainBundle\DependencyInjection\Widget\AbstractWidgetsCompilerPass;
/**
* Compile the service definition to register widgets.
*
*/
class WidgetsCompilerPass extends AbstractWidgetsCompilerPass {
public function process(ContainerBuilder $container)
{
$this->doProcess($container, 'chill_main', 'chill_main.widgets');
}
}
As explained `in the symfony docs <http://symfony.com/doc/current/service_container/compiler_passes.html>`_, you should register your Compiler Pass into your bundle :
.. code-block:: php
namespace Chill\MainBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Chill\MainBundle\DependencyInjection\CompilerPass\WidgetsCompilerPass;
class ChillMainBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new WidgetsCompilerPass());
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
// Chill\MainBundle\DependencyInjection\Configuration.php
namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Configure the main bundle.
*/
class ChillMainConfiguration implements ConfigurationInterface
{
use AddWidgetConfigurationTrait;
/**
* @var ContainerBuilder
*/
private $containerBuilder;
public function __construct(
array $widgetFactories,
ContainerBuilder $containerBuilder
) {
// we register here widget factories (see below)
$this->setWidgetFactories($widgetFactories);
// we will need the container builder later...
$this->containerBuilder = $containerBuilder;
}
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chill_main');
$rootNode
->children()
// ...
->arrayNode('widgets')
->canBeDisabled()
->children()
// we declare here all configuration for homepage place
->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder))
->end() // end of widgets/children
->end() // end of widgets
->end() // end of root/children
->end() // end of root
;
return $treeBuilder;
}
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
//Chill\MainBundle\DependencyInjection\ChillMainExtension.php
namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This class load config for chillMainExtension.
*/
class ChillMainExtension extends Extension implements Widget\HasWidgetFactoriesExtensionInterface
{
/**
* widget factory.
*
* @var WidgetFactoryInterface[]
*/
protected $widgetFactories = [];
public function addWidgetFactory(WidgetFactoryInterface $factory)
{
$this->widgetFactories[] = $factory;
}
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($this->widgetFactories, $container);
}
/**
* @return WidgetFactoryInterface[]
*/
public function getWidgetFactories()
{
return $this->widgetFactories;
}
public function load(array $configs, ContainerBuilder $container)
{
// configuration for main bundle
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
// add the key 'widget' without the key 'enable'
$container->setParameter(
'chill_main.widgets',
['homepage' => $config['widgets']['homepage']]
);
// ...
}
}

View File

@@ -0,0 +1,77 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
// Chill/PersonBundle/Widget/PersonListWidgetFactory
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* add configuration for the person_list widget.
*/
class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
{
/*
* append the option to the configuration
* see http://symfony.com/doc/current/components/config/definition.html
*
*/
public function configureOptions($place, NodeBuilder $node)
{
$node->booleanNode('only_active')
->defaultTrue()
->end();
$node->integerNode('number_of_items')
->defaultValue(50)
->end();
$node->scalarNode('filtering_class')
->defaultNull()
->end();
}
/**
* return an array with the allowed places where the widget can be rendered.
*
* @return string[]
*/
public function getAllowedPlaces()
{
return ['homepage'];
}
/*
* return the service id for the service which will render the widget.
*
* this service must implements `Chill\MainBundle\Templating\Widget\WidgetInterface`
*
* the service must exists in the container, and it is not required that the service
* has the `chill_main` tag.
*/
public function getServiceId(ContainerBuilder $containerBuilder, $place, $order, array $config)
{
return 'chill_person.widget.person_list';
}
/**
* return the widget alias.
*
* @return string
*/
public function getWidgetAlias()
{
return 'person_list';
}
}

View File

@@ -0,0 +1,135 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
// Chill/PersonBundle/Widget/PersonListWidget.php
namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Templating\Widget\WidgetInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTime;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\User\UserInterface;
use Twig_Environment;
/**
* add a widget with person list.
*
* The configuration is defined by `PersonListWidgetFactory`
*/
class ChillPersonAddAPersonWidget implements WidgetInterface
{
/**
* the authorization helper.
*
* @var AuthorizationHelper;
*/
protected $authorizationHelper;
/**
* The entity manager.
*
* @var EntityManager
*/
protected $entityManager;
/**
* Repository for persons.
*
* @var EntityRepository
*/
protected $personRepository;
/**
* @var TokenStorage
*/
protected $tokenStorage;
/**
* @var UserInterface
*/
protected $user;
public function __construct(
EntityRepository $personRepostory,
EntityManager $em,
AuthorizationHelper $authorizationHelper,
TokenStorage $tokenStorage
) {
$this->personRepository = $personRepostory;
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
$this->entityManager = $em;
}
/**
* @param type $place
*
* @return string
*/
public function render(Twig_Environment $env, $place, array $context, array $config)
{
$qb = $this->personRepository
->createQueryBuilder('person');
// show only the person from the authorized centers
$and = $qb->expr()->andX();
$centers = $this->authorizationHelper
->getReachableCenters($this->getUser(), new Role(PersonVoter::SEE));
$and->add($qb->expr()->in('person.center', ':centers'));
$qb->setParameter('centers', $centers);
// add the "only active" where clause
if (true === $config['only_active']) {
$qb->join('person.accompanyingPeriods', 'ap');
$or = new Expr\Orx();
// add the case where closingDate IS NULL
$andWhenClosingDateIsNull = new Expr\Andx();
$andWhenClosingDateIsNull->add((new Expr())->isNull('ap.closingDate'));
$andWhenClosingDateIsNull->add((new Expr())->gte(':now', 'ap.openingDate'));
$or->add($andWhenClosingDateIsNull);
// add the case when now is between opening date and closing date
$or->add(
(new Expr())->between(':now', 'ap.openingDate', 'ap.closingDate')
);
$and->add($or);
$qb->setParameter('now', new DateTime(), Type::DATE);
}
// adding the where clause to the query
$qb->where($and);
$qb->setFirstResult(0)->setMaxResults($config['number_of_items']);
$persons = $qb->getQuery()->getResult();
return $env->render(
'ChillPersonBundle:Widget:homepage_person_list.html.twig',
['persons' => $persons]
);
}
/**
* @return UserInterface
*/
private function getUser()
{
// return a user
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
// Chill/PersonBundle/DependencyInjection/ChillPersonExtension.php
namespace Chill\PersonBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
// ...
}
/**
* Add a widget "add a person" on the homepage, automatically.
*
* @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'widgets' => [
'homepage' => [
[
'widget_alias' => 'add_person',
'order' => 2,
],
],
],
]);
}
}

86
docs/source/index.rst Normal file
View File

@@ -0,0 +1,86 @@
.. chill-doc documentation master file, created by
sphinx-quickstart on Sun Sep 28 22:04:08 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Welcome to Chill documentation!
=====================================
Chill is a free software for social workers.
Chill rely on the php framework `Symfony <http://symfony.com>`_.
Contents of this documentation:
.. toctree::
:maxdepth: 2
installation/index.rst
development/index.rst
Bundles <bundles/index.rst>
Let's talk together !
======================
You may talk to developers using the matrix room: `https://app.element.io/#/room/#chill-social-admin:matrix.org`_
Contribute
==========
* `Issue tracker <https://gitlab.com/groups/Chill-project/issues>`_ You may want to dispatch the issue in the multiple projects. If you do not know in which project is located your bug / feature request, use the project Chill-Main.
User manual
===========
An user manual exists in French and currently focuses on describing the main concept of the software.
`Read (and contribute) to the manual <https://fr.wikibooks.org/wiki/Chill>`_
Available bundles
=================
* Chill-app | https://gitlab.com/Chill-project/Chill-app This is the skeleton of the project. It does contains only few code, but information about configuration of your instance ;
* Chill-bundle: contains the main bundles, the most used in an instance. This means:
* chill-main, the main framework,
* Chill Person, to deal with persons,
* chill custom fields, to add custom fields to some entities,
* chill activity: to add activities to people,
* chill report: to add report to people,
* chill event: to gather people into events,
* chill docs store: to store documents to people, but also entities,
* chill task: to register task with people,
* chill third party: to register third parties,
* chill family members: to register family members
You will also found the following projects :
* The website https://chill.social : https://gitlab.com/Chill-project/chill.social
And various project to build docker containers with Chill.
TODO in documentation
=====================
.. todolist::
Licence
========
The project is available under the `GNU AFFERO GENERAL PUBLIC LICENSE v3`_.
This documentation is published under the `GNU Free Documentation License (FDL) v1.3`_
.. _GNU AFFERO GENERAL PUBLIC LICENSE v3: http://www.gnu.org/licenses/agpl-3.0.html
.. _GNU Free Documentation License (FDL) v1.3: http://www.gnu.org/licenses/fdl-1.3.html

View File

@@ -0,0 +1,259 @@
.. chill-doc documentation master file, created by
sphinx-quickstart on Sun Sep 28 22:04:08 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. Copyright (C) 2014-2019 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Installation & Usage
####################
Requirements
************
- This project use `docker <https://docker.com>`_ to be run. As a developer, use `docker-compose <https://docs.docker.com/compose/overview/>`_ to bootstrap a dev environment in a glance. You do not need any other dependencies ;
- Make is used to automate scripts.
Installation in development mode
********************************
1. Get the code
===============
Clone or download the chill-app project and `cd` into the main directory.
.. code-block:: bash
git clone https://gitlab.com/Chill-Projet/chill-app.git
cd chill-app
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
2. Prepare your variables
=========================
Have a look at the variable in ``.env.dist`` and in ``app/config/parameters.yml.dist`` and check if you need to adapt them. If they do not adapt with your need, or if some are missing:
1. copy the file as ``.env``: ``cp .env.dist .env``
2. you may replace some variables inside ``.env``
**Note**: If you intend to use the bundle ``Chill-Doc-Store``, you will need to configure and install an openstack object storage container with temporary url middleware. You will have to configure `secret keys <https://docs.openstack.org/swift/latest/api/temporary_url_middleware.html#secret-keys>`_.
3. Run the bootstrap script
===========================
This script can be run using `make`
.. code-block:: bash
make init
This script will :
1. force docker-compose to, eventually, pull the base images and build the image used by this project ;
2. run an install script to download `composer <https://getcomposer.org>`_ ;
3. install the php dependencies
4. build assets
4. Start the project
====================
.. code-block:: bash
docker-compose up
**On the first run** (and after each upgrade), you must execute *post update commands* and run database migrations. With a container up and running, execute the following commands:
.. code-block:: bash
make migrate
Chill will be available at ``http://localhost:8001.`` Currently, there isn't any user or data. To add fixtures, run
.. code-block:: bash
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load
There are several users available:
- ``center a_social``
- ``center b_social``
The password is always ``password``.
Now, read `Operations` below.
Operations
**********
Build assets
============
run those commands:
.. code-block:: bash
make build-assets
How to execute the console ?
============================
.. code-block:: bash
# if a container is running
docker-compose exec --user $(id -u) php bin/console
# if not
docker-compose run --user $(id -u) php bin/console
How to create the database schema (= run migrations) ?
======================================================
.. code-block:: bash
# if a container is running
docker-compose exec --user $(id -u) php bin/console doctrine:migrations:migrate
# if not
docker-compose run --user $(id -u) php bin/console doctrine:migrations:migrate
How to read the email sent by the program ?
===========================================
Go at ``http://localhost:8005`` and you should have access to mailcatcher.
In case of you should click on a link in the email, be aware that you should remove the "s" from https.
How to load fixtures ? (development mode only)
==============================================
.. code-block:: bash
# if a container is running
docker-compose exec --user $(id -u) php bin/console doctrine:fixtures:load
# if not
docker-compose run --user $(id -u) php bin/console doctrine:fixtures:load
How to open a terminal in the project
=====================================
.. code-block:: bash
# if a container is running
docker-compose exec --user $(id -u) php /bin/bash
# if not
docker-compose run --user $(id -u) php /bin/bash
How to run composer ?
=====================
.. code-block:: bash
# if a container is running
docker-compose exec --user $(id -u) php ./composer.phar
# if not
docker-compose run --user $(id -u) php ./composer.phar
How to access to PGADMIN ?
==========================
Pgadmin is installed with docker-compose.
You can access it at ``http://localhost:8002``.
Credentials:
- login: admin@chill.social
- password: password
How to run tests ?
==================
Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place.
**Note**: some bundle require the fixture to be executed. See the dedicated _how-tos_.
Exemple, for running test inside `main` bundle:
.. code-block:: bash
# mount into the php image
docker-compose run --user $(id -u) php /bin/bash
# cd into main directory
cd vendor/chill-project/main
# download deps
php ../../../composer.phar install
# run tests
/vendor/bin/phpunit
How to run webpack interactively
================================
Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted.
Build the documentation API
===========================
A basic configuration of `sami <https://github.com/FriendsOfPhp/Sami>`_ is embedded within the project.
A configuration file for `phpDocumentor <https://www.phpdoc.org>`_ is present.
Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run
====================================================================================================================================================================
Run :code:`make build-assets`
Running in production
*********************
Currently, to run this software in production, the *state of the art* is the following :
1. Run the software locally and tweak the configuration to your needs ;
2. Build the image and store them into a private container registry. This can be done using :code:`make build-and-push-image`.
To be sure to target the correct container registry, you have to adapt the values ``IMAGE_NGINX`` and ``IMAGE_PHP`` date in the ``.env`` file.
3. Run the image on your production server, using docker-compose or eventually docker stack. You have to customize the variable set in docker-compose.
See also the :ref:`running-production-tips-and-tricks` below.
.. warning::
In production, you **must** set those variables:
* ``APP_ENV`` to ``prod``
* ``APP_DEBUG`` to ``false``
There are security issues if you keep the same variable than for production.
.. _running-production-tips-and-tricks:
Tips and tricks
===============
Operation on database (backups, running custom sql, replication) are easier to set when run outside of a container. If you run into a container, take care of the volume where data are stored.
The PHP sessions are stored inside redis. This is useful if you distribute the traffic amongst different php server: they will share same sessions if a request goes into a different instance of the container.
When the PHP servers are shared across multiple instances, take care that some data is stored into redis: the same redis server should be reachable by all instances.
It is worth having an eye on the configuration of logstash container.
Design principles
*****************
Why the DB URL is set in environment, and not in parameters.yml ?
=================================================================
Because, at startup, a script does check the db is up and, if not, wait for a couple of seconds before running ``entrypoint.sh``. For avoiding double configuration, the configuration of the PHP app takes his configuration from environment also (and it will be standard in future releases, with symfony 4.0).

8
grumphp.yml Normal file
View File

@@ -0,0 +1,8 @@
imports:
- { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml }
parameters:
tasks.phpcsfixer.config: .php_cs.dist
tasks.license.name: AGPL-3.0
tasks.license.holder: Champs-Libres
tasks.license.date_from: 2001

38
phpunit.xml.dist Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/app/tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
<testsuites>
<testsuite name="MainBundle">
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
</testsuite>
<testsuite name="PersonBundle">
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>

6
resource/header.txt Normal file
View File

@@ -0,0 +1,6 @@
Chill is a software for social workers.
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
@see https://www.champs-libres.coop/

View File

@@ -1,5 +1,16 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;

View File

@@ -1,105 +1,71 @@
<?php
/*
* Chill is a software for social workers
/**
* Chill is a software for social workers.
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* 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/>.
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Entity\Activity;
use Chill\PersonBundle\Entity\Person;
use Chill\ActivityBundle\Form\ActivityType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use DateTime;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\Role;
/**
* Activity controller.
*
*/
class ActivityController extends Controller
class ActivityController extends AbstractController
{
/**
* @var AuthorizationHelper
*/
protected $authorizationHelper;
/**
* @var EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* @var LoggerInterface
*/
protected $logger;
/**
* ActivityController constructor.
*
* @param EventDispatcherInterface $eventDispatcher
*/
public function __construct(EventDispatcherInterface $eventDispatcher)
{
public function __construct(
EventDispatcherInterface $eventDispatcher,
AuthorizationHelper $authorizationHelper,
LoggerInterface $logger
) {
$this->eventDispatcher = $eventDispatcher;
$this->authorizationHelper = $authorizationHelper;
$this->logger = $logger;
}
/**
* Lists all Activity entities.
*
*/
public function listAction($person_id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if ($person === NULL) {
throw $this->createNotFoundException('Person not found');
}
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
$reachableScopes = $this->get('chill.main.security.authorization.helper')
->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(
'activities' => $activities,
'person' => $person
));
}
/**
* Creates a new Activity entity.
*
* @param mixed $person_id
*/
public function createAction($person_id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if ($person === NULL) {
if (null === $person) {
throw $this->createNotFoundException('person not found');
}
@@ -113,133 +79,115 @@ class ActivityController extends Controller
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity,
'creation of this activity not allowed');
$this->denyAccessUnlessGranted(
'CHILL_ACTIVITY_CREATE',
$entity,
'creation of this activity not allowed'
);
$em->persist($entity);
$em->flush();
$this->get('session')
->getFlashBag()
->add('success',
->add(
'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)));
$this->generateUrl(
'chill_activity_activity_show',
['id' => $entity->getId(), 'person_id' => $person_id]
)
);
}
$this->get('session')
->getFlashBag()->add('danger',
->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(
return $this->render('ChillActivityBundle:Activity:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
'person' => $person
));
'form' => $form->createView(),
'person' => $person,
]);
}
/**
* Creates a form to create a Activity entity.
* Deletes a Activity entity.
*
* @param Activity $entity The entity
*
* @return \Symfony\Component\Form\Form The form
* @param mixed $id
* @param mixed $person_id
*/
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)
public function deleteAction(Request $request, $id, $person_id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if ($person === NULL){
throw $this->createNotFoundException('Person not found');
}
/** @var Activity $activity */
$activity = $em->getRepository('ChillActivityBundle:Activity')
->find($id);
$person = $activity->getPerson();
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
$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(
'person' => $person,
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a Activity entity.
*
*/
public function showAction($person_id, $id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if (!$person) {
throw $this->createNotFoundException('person not found');
}
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
if (!$entity) {
if (!$activity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
$deleteForm = $this->createDeleteForm($id, $person);
$event = new PrivacyEvent($person, array(
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'show'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillActivityBundle:Activity:show.html.twig', array(
'person' => $person,
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
$form = $this->createDeleteForm($id, $person);
if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request);
if ($form->isValid()) {
$this->logger->notice('An activity has been removed', [
'by_user' => $this->getUser()->getUsername(),
'activity_id' => $activity->getId(),
'person_id' => $activity->getPerson()->getId(),
'comment' => $activity->getComment()->getComment(),
'scope_id' => $activity->getScope()->getId(),
'reasons_ids' => $activity->getReasons()
->map(static function ($ar) {
return $ar->getId();
})
->toArray(),
'type_id' => $activity->getType()->getId(),
'duration' => $activity->getDurationTime()->format('U'),
'date' => $activity->getDate()->format('Y-m-d'),
'attendee' => $activity->getAttendee(),
]);
$em->remove($activity);
$em->flush();
$this->addFlash('success', $this->get('translator')
->trans('The activity has been successfully removed.'));
return $this->redirect($this->generateUrl(
'chill_activity_activity_list',
[
'person_id' => $person_id,
]
));
}
}
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', [
'activity' => $activity,
'delete_form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing Activity entity.
*
* @param mixed $person_id
* @param mixed $id
*/
public function editAction($person_id, $id)
{
@@ -262,47 +210,141 @@ class ActivityController extends Controller
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id, $person);
$event = new PrivacyEvent($person, array(
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'edit'
));
'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(),
return $this->render('ChillActivityBundle:Activity:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
'person' => $person
));
'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)
* Lists all Activity entities.
*
* @param mixed $person_id
*/
public function listAction($person_id, Request $request)
{
$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')
));
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
return $form;
if (null === $person) {
throw $this->createNotFoundException('Person not found');
}
$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(
['person' => $person, 'scope' => $reachableScopes],
['date' => 'DESC']
);
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
'action' => 'list',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillActivityBundle:Activity:list.html.twig', [
'activities' => $activities,
'person' => $person,
]);
}
/**
* Displays a form to create a new Activity entity.
*
* @param mixed $person_id
*/
public function newAction($person_id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if (null === $person) {
throw $this->createNotFoundException('Person not found');
}
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
$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', [
'person' => $person,
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a Activity entity.
*
* @param mixed $person_id
* @param mixed $id
*/
public function showAction($person_id, $id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if (!$person) {
throw $this->createNotFoundException('person not found');
}
$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_SEE', $entity);
$deleteForm = $this->createDeleteForm($id, $person);
$event = new PrivacyEvent($person, [
'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', [
'person' => $person,
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
]);
}
/**
* Edits an existing Activity entity.
*
* @param mixed $person_id
* @param mixed $id
*/
public function updateAction(Request $request, $person_id, $id)
{
@@ -320,12 +362,12 @@ class ActivityController extends Controller
$deleteForm = $this->createDeleteForm($id, $person);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
$event = new PrivacyEvent($person, array(
$event = new PrivacyEvent($person, [
'element_class' => Activity::class,
'element_id' => $entity->getId(),
'action' => 'update'
));
'action' => 'update',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
if ($editForm->isValid()) {
@@ -333,96 +375,59 @@ class ActivityController extends Controller
$this->get('session')
->getFlashBag()
->add('success',
->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)));
return $this->redirect($this->generateUrl('chill_activity_activity_show', ['id' => $id, 'person_id' => $person_id]));
}
$this->get('session')
->getFlashBag()
->add('error',
->add(
'error',
$this->get('translator')
->trans('This form contains errors')
);
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
'person' => $entity->getPerson(),
'entity' => $entity,
'edit_form' => $editForm->createView(),
return $this->render('ChillActivityBundle:Activity:edit.html.twig', [
'person' => $entity->getPerson(),
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
]);
}
/**
* Deletes a Activity entity.
* Creates a form to create a Activity entity.
*
* @param Activity $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
public function deleteAction(Request $request, $id, $person_id)
private function createCreateForm(Activity $entity)
{
$em = $this->getDoctrine()->getManager();
/* @var $activity Activity */
$activity = $em->getRepository('ChillActivityBundle:Activity')
->find($id);
$person = $activity->getPerson();
if (!$activity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
$form = $this->createDeleteForm($id, $person);
if ($request->getMethod() === Request::METHOD_DELETE) {
$form->handleRequest($request);
if ($form->isValid()) {
$logger = $this->get('chill.main.logger');
$logger->notice("An activity has been removed", array(
'by_user' => $this->getUser()->getUsername(),
'activity_id' => $activity->getId(),
'person_id' => $activity->getPerson()->getId(),
'remark' => $activity->getRemark(),
'scope_id' => $activity->getScope()->getId(),
'reasons_ids' => $activity->getReasons()
->map(function ($ar) { return $ar->getId(); })
->toArray(),
'type_id' => $activity->getType()->getId(),
'duration' => $activity->getDurationTime()->format('U'),
'date' => $activity->getDate()->format('Y-m-d'),
'attendee' => $activity->getAttendee()
));
$em->remove($activity);
$em->flush();
$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
)));
}
}
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', array(
'activity' => $activity,
'delete_form' => $form->createView()
));
return $this->createForm(
ActivityType::class,
$entity,
[
'action' => $this->generateUrl('chill_activity_activity_create', [
'person_id' => $entity->getPerson()->getId(),
]),
'method' => 'POST',
'center' => $entity->getCenter(),
'role' => new Role('CHILL_ACTIVITY_CREATE'),
]
);
}
/**
* Creates a form to delete a Activity entity by id.
*
* @param mixed $id The entity id
* @param mixed $person
*
* @return \Symfony\Component\Form\Form The form
*/
@@ -431,10 +436,33 @@ class ActivityController extends Controller
return $this->createFormBuilder()
->setAction($this->generateUrl(
'chill_activity_activity_delete',
array('id' => $id, 'person_id' => $person->getId())))
['id' => $id, 'person_id' => $person->getId()]
))
->setMethod('DELETE')
->add('submit', SubmitType::class, array('label' => 'Delete'))
->getForm()
;
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}
/**
* 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)
{
return $this->createForm(ActivityType::class, $entity, [
'action' => $this->generateUrl(
'chill_activity_activity_update',
[
'id' => $entity->getId(),
'person_id' => $entity->getPerson()->getId(),
]
),
'method' => 'PUT',
'center' => $entity->getCenter(),
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
]);
}
}

View File

@@ -1,38 +1,28 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReasonCategory controller.
*
*/
class ActivityReasonCategoryController extends Controller
class ActivityReasonCategoryController extends AbstractController
{
/**
* Lists all ActivityReasonCategory entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll();
return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new ActivityReasonCategory entity.
*
*/
public function createAction(Request $request)
{
@@ -45,71 +35,19 @@ class ActivityReasonCategoryController extends Controller
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_show', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_show', ['id' => $entity->getId()]));
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array(
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new ActivityReasonCategory entity.
*
*/
public function newAction()
{
$entity = new ActivityReasonCategory();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a ActivityReasonCategory entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', array(
'entity' => $entity,
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +61,64 @@ class ActivityReasonCategoryController extends Controller
$editForm = $this->createEditForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
));
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to edit a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReasonCategory $entity)
* Lists all ActivityReasonCategory entities.
*/
public function indexAction()
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll();
return $form;
return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new ActivityReasonCategory entity.
*/
public function newAction()
{
$entity = new ActivityReasonCategory();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', [
'entity' => $entity,
]);
}
/**
* Edits an existing ActivityReasonCategory entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +136,50 @@ class ActivityReasonCategoryController extends Controller
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_edit', array('id' => $id)));
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory_edit', ['id' => $id]));
}
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
));
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a ActivityReasonCategory entity.
*
* @param ActivityReasonCategory $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReasonCategory $entity)
{
$form = $this->createForm(ActivityReasonCategoryType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -1,38 +1,28 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Form\ActivityReasonType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReason controller.
*
*/
class ActivityReasonController extends Controller
class ActivityReasonController extends AbstractController
{
/**
* Lists all ActivityReason entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new ActivityReason entity.
*
*/
public function createAction(Request $request)
{
@@ -45,71 +35,19 @@ class ActivityReasonController extends Controller
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason_show', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $entity->getId()]));
}
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreason_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new ActivityReason entity.
*
*/
public function newAction()
{
$entity = new ActivityReason();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a ActivityReason entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
}
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', array(
'entity' => $entity,
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing ActivityReason entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +61,64 @@ class ActivityReasonController extends Controller
$editForm = $this->createEditForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView()
));
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to edit a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReason $entity)
* Lists all ActivityReason entities.
*/
public function indexAction()
{
$form = $this->createForm(ActivityReasonType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activityreason_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
return $form;
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new ActivityReason entity.
*/
public function newAction()
{
$entity = new ActivityReason();
$form = $this->createCreateForm($entity);
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a ActivityReason entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
}
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', [
'entity' => $entity,
]);
}
/**
* Edits an existing ActivityReason entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +136,50 @@ class ActivityReasonController extends Controller
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activityreason_edit', array('id' => $id)));
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $id]));
}
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView()
));
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreason_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a ActivityReason entity.
*
* @param ActivityReason $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(ActivityReason $entity)
{
$form = $this->createForm(ActivityReasonType::class, $entity, [
'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -1,38 +1,28 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\ActivityBundle\Form\ActivityTypeType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* ActivityType controller.
*
*/
class ActivityTypeController extends 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)
{
@@ -45,71 +35,19 @@ class ActivityTypeController extends Controller
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activitytype_show', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_activity_activitytype_show', ['id' => $entity->getId()]));
}
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array(
return $this->render('ChillActivityBundle:ActivityType:new.html.twig', [
'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,
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing ActivityType entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +61,64 @@ class ActivityTypeController extends Controller
$editForm = $this->createEditForm($entity);
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView()
));
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', [
'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)
* Lists all ActivityType entities.
*/
public function indexAction()
{
$form = $this->createForm(ActivityTypeType::class, $entity, array(
'action' => $this->generateUrl('chill_activity_activitytype_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillActivityBundle:ActivityType')->findAll();
return $form;
return $this->render('ChillActivityBundle:ActivityType:index.html.twig', [
'entities' => $entities,
]);
}
/**
* 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', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a ActivityType entity.
*
* @param mixed $id
*/
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', [
'entity' => $entity,
]);
}
/**
* Edits an existing ActivityType entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +136,50 @@ class ActivityTypeController extends Controller
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_activity_activitytype_edit', array('id' => $id)));
return $this->redirect($this->generateUrl('chill_activity_activitytype_edit', ['id' => $id]));
}
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
));
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->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, [
'action' => $this->generateUrl('chill_activity_activitytype_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* 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, [
'action' => $this->generateUrl('chill_activity_activitytype_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -1,41 +1,30 @@
<?php
/*
* Chill is a software for social workers
* Copyright (C) 2015 Champs Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers.
*
* 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.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* 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/>.
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Controller for activity configuration
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @author Champs Libres <info@champs-libres.coop>
* Controller for activity configuration.
*/
class AdminController extends Controller
class AdminController extends AbstractController
{
public function indexActivityAction()
{
return $this->render('ChillActivityBundle:Admin:layout_activity.html.twig');
}
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@@ -1,112 +1,69 @@
<?php
/*
* Chill is a software for social workers
*
* 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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Faker\Factory as FakerFactory;
use Chill\ActivityBundle\Entity\Activity;
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivityReason;
use Chill\ActivityBundle\DataFixtures\ORM\LoadActivityType;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use function in_array;
/**
* Load reports into DB
*
* @author Champs-Libres Coop
* Load reports into DB.
*/
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
class LoadActivity extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* @var \Faker\Generator
* @var \Faker\Generator
*/
private $faker;
public function __construct()
{
$this->faker = FakerFactory::create('fr_FR');
}
}
public function getOrder()
{
return 16400;
}
/**
* Return a random scope
*
* @return \Chill\MainBundle\Entity\Scope
*/
private function getRandomScope()
public function load(ObjectManager $manager)
{
$scopeRef = LoadScopes::$references[array_rand(LoadScopes::$references)];
return $this->getReference($scopeRef);
}
/**
* Return a random activityType
*
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
private function getRandomActivityType()
{
$typeRef = LoadActivityType::$references[array_rand(LoadActivityType::$references)];
return $this->getReference($typeRef);
}
/**
* Return a random activityReason
*
* @return \Chill\ActivityBundle\Entity\ActivityReason
*/
private function getRandomActivityReason(array $excludingIds)
{
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds)) {
// we have a reason which should be excluded. Find another...
return $this->getRandomActivityReason($excludingIds);
$persons = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
->findAll();
foreach ($persons as $person) {
$activityNbr = mt_rand(0, 3);
for ($i = 0; $i < $activityNbr; ++$i) {
echo 'Creating an activity type for : ' . $person . "\n";
$activity = $this->newRandomActivity($person);
$manager->persist($activity);
}
}
return $this->getReference($reasonRef);
$manager->flush();
}
/**
* Return a random user
*
* @return \Chill\MainBundle\Entity\User
*/
private function getRandomUser()
{
$userRef = array_rand(LoadUsers::$refs);
return $this->getReference($userRef);
}
public function newRandomActivity($person)
{
$activity = (new Activity())
@@ -116,33 +73,69 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
->setDurationTime($this->faker->dateTime(36000))
->setType($this->getRandomActivityType())
->setScope($this->getRandomScope())
->setAttendee($this->faker->boolean())
->setRemark('A remark');
$usedId = array();
for ($i = 0; $i < rand(0, 4); $i++) {
->setAttendee($this->faker->boolean());
$usedId = [];
for ($i = 0; mt_rand(0, 4) > $i; ++$i) {
$reason = $this->getRandomActivityReason($usedId);
$usedId[] = $reason->getId();
$activity->addReason($reason);
}
return $activity;
}
public function load(ObjectManager $manager)
/**
* Return a random activityReason.
*
* @return \Chill\ActivityBundle\Entity\ActivityReason
*/
private function getRandomActivityReason(array $excludingIds)
{
$persons = $this->container->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
->findAll();
foreach($persons as $person) {
$activityNbr = rand(0,3);
for($i = 0; $i < $activityNbr; $i ++) {
print "Creating an activity type for : ".$person."\n";
$activity = $this->newRandomActivity($person);
$manager->persist($activity);
}
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds, true)) {
// we have a reason which should be excluded. Find another...
return $this->getRandomActivityReason($excludingIds);
}
$manager->flush();
return $this->getReference($reasonRef);
}
/**
* Return a random activityType.
*
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
private function getRandomActivityType()
{
$typeRef = LoadActivityType::$references[array_rand(LoadActivityType::$references)];
return $this->getReference($typeRef);
}
/**
* Return a random scope.
*
* @return \Chill\MainBundle\Entity\Scope
*/
private function getRandomScope()
{
$scopeRef = LoadScopes::$references[array_rand(LoadScopes::$references)];
return $this->getReference($scopeRef);
}
/**
* Return a random user.
*
* @return \Chill\MainBundle\Entity\User
*/
private function getRandomUser()
{
$userRef = array_rand(LoadUsers::$refs);
return $this->getReference($userRef);
}
}

View File

@@ -1,81 +1,70 @@
<?php
/*
* Chill is a software for social workers
*
* 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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReason;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityReason;
use Doctrine\Persistence\ObjectManager;
/**
* Description of LoadActivityReason
*
* @author Champs-Libres Coop
* Description of LoadActivityReason.
*/
class LoadActivityReason extends AbstractFixture implements OrderedFixtureInterface
{
public static $references = [];
public function getOrder()
{
return 16300;
}
public static $references = array();
public function load(ObjectManager $manager)
{
$reasons = [
[
'name' => ['fr' => 'Recherche logement', 'en' => 'Housing research', 'nl' => 'Woning zoektoch'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Problème avec propriétaire', 'en' => 'Landlord problems', 'nl' => 'Huisbaas problemen'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Retard de payement', 'en' => 'Payement problems', 'nl' => 'Betalings vertragingen'],
'category' => 'cat_Housing'],
'category' => 'cat_Housing', ],
[
'name' => ['fr' => 'Explication législation', 'en' => 'Legislation explanation', 'nl' => 'Legislative uitleg'],
'category' => 'cat_Unemployment procedure'],
'category' => 'cat_Unemployment procedure', ],
[
'name' => ['fr' => 'Coaching entretien d\'activation', 'en' => 'Interview coaching', 'nl' => 'Interview coaching'],
'category' => 'cat_Unemployment procedure'],
'category' => 'cat_Unemployment procedure', ],
[
'name' => ['fr' => 'Récupération des allocations', 'en' => 'Allowance recovery', 'nl' => 'Terugwinning van de uitkeringen'],
'category' => 'cat_Unemployment procedure']
'category' => 'cat_Unemployment procedure', ],
];
foreach ($reasons as $r) {
print "Creating activity reason : " . $r['name']['en'] . "\n";
echo 'Creating activity reason : ' . $r['name']['en'] . "\n";
$activityReason = (new ActivityReason())
->setName(($r['name']))
->setActive(true)
->setCategory($this->getReference($r['category']));
$manager->persist($activityReason);
$reference = 'activity_reason_'.$r['name']['en'];
$reference = 'activity_reason_' . $r['name']['en'];
$this->addReference($reference, $activityReason);
static::$references[] = $reference;
}
$manager->flush();
}
}

View File

@@ -1,35 +1,25 @@
<?php
/*
* Chill is a software for social workers
*
* 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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Doctrine\Persistence\ObjectManager;
/**
* Description of LoadActivityReasonCategory
*
* @author Champs-Libres Coop
* Description of LoadActivityReasonCategory.
*/
class LoadActivityReasonCategory extends AbstractFixture implements OrderedFixtureInterface
{
@@ -37,27 +27,26 @@ class LoadActivityReasonCategory extends AbstractFixture implements OrderedFixtu
{
return 16200;
}
public function load(ObjectManager $manager)
{
$categs = [
['name' =>
['fr' => 'Logement', 'en' => 'Housing', 'nl' => 'Woning']],
['name' =>
['fr' => 'Démarches chômage', 'en' => 'Unemployment procedure', 'nl' => 'Werkloosheid werkwijze']],
['name' => ['fr' => 'Logement', 'en' => 'Housing', 'nl' => 'Woning']],
['name' => ['fr' => 'Démarches chômage', 'en' => 'Unemployment procedure', 'nl' => 'Werkloosheid werkwijze']],
];
foreach ($categs as $c) {
print "Creating activity reason category : " . $c['name']['en'] . "\n";
echo 'Creating activity reason category : ' . $c['name']['en'] . "\n";
$activityReasonCategory = (new ActivityReasonCategory())
->setName(($c['name']))
->setActive(true);
$manager->persist($activityReasonCategory);
$this->addReference(
'cat_'.$c['name']['en'],
$activityReasonCategory);
'cat_' . $c['name']['en'],
$activityReasonCategory
);
}
$manager->flush();
}
}

View File

@@ -1,67 +1,53 @@
<?php
/*
* Chill is a software for social workers
*
* 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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Chill\ActivityBundle\Entity\ActivityType;
use Doctrine\Persistence\ObjectManager;
/**
* Description of LoadActivityType
*
* @author Champs-Libres Coop
* Description of LoadActivityType.
*/
class LoadActivityType extends AbstractFixture implements OrderedFixtureInterface
{
public static $references = [];
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']]
['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']],
];
foreach ($types as $t) {
print "Creating activity type : " . $t['name']['en'] . "\n";
echo 'Creating activity type : ' . $t['name']['en'] . "\n";
$activityType = (new ActivityType())
->setName(($t['name']));
$manager->persist($activityType);
$reference = 'activity_type_'.$t['name']['en'];
$reference = 'activity_type_' . $t['name']['en'];
$this->addReference($reference, $activityType);
static::$references[] = $reference;
}
$manager->flush();
}
}

View File

@@ -1,38 +1,27 @@
<?php
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
/**
* Chill is a software for social workers.
*
* 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.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* 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/>.
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\Entity\RoleScope;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
/**
* Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative,
* and a role CHILL_ACTIVITY_SEE for administrative
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface
{
public function getOrder()
@@ -40,12 +29,12 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
return 16000;
}
public function load(ObjectManager $manager)
{
foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) {
$permissionsGroup = $this->getReference($permissionsGroupRef);
foreach (LoadScopes::$references as $scopeRef){
foreach (LoadScopes::$references as $scopeRef) {
$scope = $this->getReference($scopeRef);
//create permission group
switch ($permissionsGroup->getName()) {
@@ -53,47 +42,48 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
if ($scope->getName()['en'] === 'administrative') {
break 2; // we do not want any power on administrative
}
break;
case 'administrative':
case 'direction':
if (in_array($scope->getName()['en'], array('administrative', 'social'))) {
if (\in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
break 2; // we do not want any power on social or administrative
}
}
break;
}
printf("Adding CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE & CHILL_ACTIVITY_DELETE, and stats and list permissions to %s "
. "permission group, scope '%s' \n",
$permissionsGroup->getName(), $scope->getName()['en']);
printf(
'Adding CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE & CHILL_ACTIVITY_DELETE, and stats and list permissions to %s '
. "permission group, scope '%s' \n",
$permissionsGroup->getName(),
$scope->getName()['en']
);
$roleScopeUpdate = (new RoleScope())
->setRole('CHILL_ACTIVITY_UPDATE')
->setScope($scope);
->setRole('CHILL_ACTIVITY_UPDATE')
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeUpdate);
$roleScopeCreate = (new RoleScope())
->setRole('CHILL_ACTIVITY_CREATE')
->setScope($scope);
->setRole('CHILL_ACTIVITY_CREATE')
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeCreate);
$roleScopeDelete = (new RoleScope())
->setRole('CHILL_ACTIVITY_DELETE')
->setScope($scope);
->setRole('CHILL_ACTIVITY_DELETE')
->setScope($scope);
$permissionsGroup->addRoleScope($roleScopeDelete);
$roleScopeList = (new RoleScope())
->setRole(ActivityStatsVoter::LISTS)
;
->setRole(ActivityStatsVoter::LISTS);
$permissionsGroup->addRoleScope($roleScopeList);
$roleScopeStat = (new RoleScope())
->setRole(ActivityStatsVoter::STATS)
;
->setRole(ActivityStatsVoter::STATS);
$permissionsGroup->addRoleScope($roleScopeStat);
$manager->persist($roleScopeUpdate);
$manager->persist($roleScopeCreate);
$manager->persist($roleScopeDelete);
}
}
$manager->flush();
}
}

View File

@@ -1,37 +1,27 @@
<?php
/*
* Chill is a software for social workers
/**
* Chill is a software for social workers.
*
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* 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/>.
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
@@ -44,50 +34,50 @@ 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__.'/../Resources/config'));
$loader->load('services.yml');
$loader->load('services/export.yml');
$loader->load('services/repositories.yml');
$loader->load('services/fixtures.yml');
$loader->load('services/menu.yml');
$loader->load('services/controller.yml');
$loader->load('services/form.yml');
$loader->load('services/templating.yml');
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$loader->load('services.yaml');
$loader->load('services/export.yaml');
$loader->load('services/repositories.yaml');
$loader->load('services/fixtures.yaml');
$loader->load('services/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);
}
/* (non-PHPdoc)
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prependRoutes(ContainerBuilder $container)
{
//add routes for custom bundle
$container->prependExtensionConfig('chill_main', array(
'routing' => array(
'resources' => array(
'@ChillActivityBundle/Resources/config/routing.yml'
)
)
));
}
public function prependAuthorization(ContainerBuilder $container)
{
$container->prependExtensionConfig('security', array(
'role_hierarchy' => array(
ActivityVoter::UPDATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::CREATE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::DELETE => array(ActivityVoter::SEE_DETAILS),
ActivityVoter::SEE_DETAILS => array(ActivityVoter::SEE)
)
));
$container->prependExtensionConfig('security', [
'role_hierarchy' => [
ActivityVoter::UPDATE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::CREATE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::DELETE => [ActivityVoter::SEE_DETAILS],
ActivityVoter::SEE_DETAILS => [ActivityVoter::SEE],
],
]);
}
/** (non-PHPdoc).
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/
public function prependRoutes(ContainerBuilder $container)
{
//add routes for custom bundle
$container->prependExtensionConfig('chill_main', [
'routing' => [
'resources' => [
'@ChillActivityBundle/config/routes.yaml',
],
],
]);
}
}

View File

@@ -1,12 +1,25 @@
<?php
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use function is_int;
/**
* This is the class that validates and merges configuration from your app/config files
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
@@ -17,55 +30,53 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chill_activity');
$treeBuilder = new TreeBuilder('chill_activity');
$rootNode = $treeBuilder->getRootNode('chill_activity');
$rootNode
->children()
->arrayNode('form')
->canBeEnabled()
->children()
->arrayNode('time_duration')
->isRequired()
->requiresAtLeastOneElement()
->defaultValue(
array(
[ 'label' => '5 minutes', 'seconds' => 300],
[ 'label' => '10 minutes', 'seconds' => 600],
[ 'label' => '15 minutes', 'seconds' => 900],
[ 'label' => '20 minutes', 'seconds' => 1200],
[ 'label' => '25 minutes', 'seconds' => 1500],
[ 'label' => '30 minutes', 'seconds' => 1800],
[ 'label' => '45 minutes', 'seconds' => 2700],
[ 'label' => '1 hour', 'seconds' => 3600],
[ 'label' => '1 hour 15', 'seconds' => 4500],
[ 'label' => '1 hour 30', 'seconds' => 5400],
[ 'label' => '1 hour 45', 'seconds' => 6300],
[ 'label' => '2 hours', 'seconds' => 7200],
)
)
->info('The intervals of time to show in activity form')
->prototype('array')
->children()
->scalarNode('seconds')
->info("The number of seconds of this duration. Must be an integer.")
->cannotBeEmpty()
->validate()
->ifTrue(function($data) {
return !is_int($data);
})->thenInvalid("The value %s is not a valid integer")
->end()
->end()
->scalarNode('label')
->cannotBeEmpty()
->info("The label to show into fields")
->end()
->end()
->end()
->children()
->arrayNode('form')
->canBeEnabled()
->children()
->arrayNode('time_duration')
->isRequired()
->requiresAtLeastOneElement()
->defaultValue(
[
['label' => '5 minutes', 'seconds' => 300],
['label' => '10 minutes', 'seconds' => 600],
['label' => '15 minutes', 'seconds' => 900],
['label' => '20 minutes', 'seconds' => 1200],
['label' => '25 minutes', 'seconds' => 1500],
['label' => '30 minutes', 'seconds' => 1800],
['label' => '45 minutes', 'seconds' => 2700],
['label' => '1 hour', 'seconds' => 3600],
['label' => '1 hour 15', 'seconds' => 4500],
['label' => '1 hour 30', 'seconds' => 5400],
['label' => '1 hour 45', 'seconds' => 6300],
['label' => '2 hours', 'seconds' => 7200],
]
)
->info('The intervals of time to show in activity form')
->prototype('array')
->children()
->scalarNode('seconds')
->info('The number of seconds of this duration. Must be an integer.')
->cannotBeEmpty()
->validate()
->ifTrue(static function ($data) {
return !is_int($data);
})->thenInvalid('The value %s is not a valid integer')
->end()
->end()
->scalarNode('label')
->cannotBeEmpty()
->info('The label to show into fields')
->end()
->end()
->end()
// ->validate()
//
//
// ->ifTrue(function ($data) {
// // test this is an array
// if (!is_array($data)) {
@@ -84,11 +95,10 @@ class Configuration implements ConfigurationInterface
// })
// ->thenInvalid("The data are invalid. The keys must be a string and the value integers")
// ->end()
->end()
->end()
->end()
->end();
->end()
->end()
->end()
->end();
return $treeBuilder;
}

View File

@@ -1,105 +1,178 @@
<?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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Entity\ActivityType;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Activity
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope"
* )
* @ORM\Entity
* @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks
* @UserCircleConsistency(
* "CHILL_ACTIVITY_SEE_DETAILS",
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements HasCenterInterface, HasScopeInterface
{
/**
* @var integer
*/
private $id;
/**
* @var User
*/
private $user;
/**
* @var \DateTime
*/
private $date;
/**
* @var \DateTime
*/
private $durationTime;
/**
* @var string
*/
private $remark;
/**
* @var boolean
* @var bool
* @ORM\Column(type="boolean")
*/
private $attendee;
/**
* @var \Doctrine\Common\Collections\Collection
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*/
private $comment;
/**
* @var DateTime
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @var DateTime
* @ORM\Column(type="time")
*/
private $durationTime;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Person
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*/
private $person;
/**
* @var ActivityReason
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
*/
private $reasons;
/**
* @var ActivityType
*/
private $type;
/**
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $scope;
/**
* @var Person
* @var ActivityType
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*/
private $type;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $user;
/**
* Activity constructor.
*/
private $person;
public function __construct()
{
$this->reasons = new ArrayCollection();
$this->comment = new CommentEmbeddable();
}
/**
* Add a reason.
*
* @return Activity
*/
public function addReason(ActivityReason $reason)
{
$this->reasons[] = $reason;
return $this;
}
/**
* Get id
* Get attendee.
*
* @return integer
* @return bool
*/
public function getAttendee()
{
return $this->attendee;
}
/**
* get the center
* center is extracted from person.
*
* @return Center
*/
public function getCenter()
{
return $this->person->getCenter();
}
/**
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
*/
public function getComment()
{
return $this->comment;
}
/**
* Get date.
*
* @return DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Get durationTime.
*
* @return DateTime
*/
public function getDurationTime()
{
return $this->durationTime;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
@@ -107,21 +180,47 @@ class Activity implements HasCenterInterface, HasScopeInterface
}
/**
* Set user
* Get person.
*
* @param User $user
*
* @return Activity
* @return Person
*/
public function setUser(User $user)
public function getPerson()
{
$this->user = $user;
return $this;
return $this->person;
}
/**
* Get user
* Get reasons.
*
* @return Collection
*/
public function getReasons()
{
return $this->reasons;
}
/**
* Get scope.
*
* @return Scope
*/
public function getScope()
{
return $this->scope;
}
/**
* Get type.
*
* @return ActivityType
*/
public function getType()
{
return $this->type;
}
/**
* Get user.
*
* @return User
*/
@@ -130,82 +229,15 @@ class Activity implements HasCenterInterface, HasScopeInterface
return $this->user;
}
/**
* Set date
*
* @param \DateTime $date
*
* @return Activity
*/
public function setDate($date)
public function removeReason(ActivityReason $reason)
{
$this->date = $date;
return $this;
$this->reasons->removeElement($reason);
}
/**
* Get date
* Set attendee.
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set durationTime
*
* @param \DateTime $durationTime
*
* @return Activity
*/
public function setDurationTime($durationTime)
{
$this->durationTime = $durationTime;
return $this;
}
/**
* Get durationTime
*
* @return \DateTime
*/
public function getDurationTime()
{
return $this->durationTime;
}
/**
* Set remark
*
* @param string $remark
*
* @return Activity
*/
public function setRemark($remark)
{
$this->remark = $remark;
return $this;
}
/**
* Get remark
*
* @return string
*/
public function getRemark()
{
return $this->remark;
}
/**
* Set attendee
*
* @param boolean $attendee
* @param bool $attendee
*
* @return Activity
*/
@@ -217,96 +249,43 @@ class Activity implements HasCenterInterface, HasScopeInterface
}
/**
* Get attendee
*
* @return boolean
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
*/
public function getAttendee()
public function setComment($comment)
{
return $this->attendee;
$this->comment = $comment;
}
/**
* Add a reason
* Set date.
*
* @param ActivityReason $reason
* @param DateTime $date
*
* @return Activity
*/
public function addReason(ActivityReason $reason)
public function setDate($date)
{
$this->reasons[] = $reason;
return $this;
}
public function removeReason(ActivityReason $reason)
{
$this->reasons->removeElement($reason);
}
/**
* Get reasons
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getReasons()
{
return $this->reasons;
}
/**
* Set type
*
* @param ActivityType $type
*
* @return Activity
*/
public function setType(ActivityType $type)
{
$this->type = $type;
$this->date = $date;
return $this;
}
/**
* Get type
* Set durationTime.
*
* @return ActivityType
*/
public function getType()
{
return $this->type;
}
/**
* Set scope
*
* @param Scope $scope
* @param DateTime $durationTime
*
* @return Activity
*/
public function setScope(Scope $scope)
public function setDurationTime($durationTime)
{
$this->scope = $scope;
$this->durationTime = $durationTime;
return $this;
}
/**
* Get scope
*
* @return Scope
*/
public function getScope()
{
return $this->scope;
}
/**
* Set person
*
* @param Person $person
* Set person.
*
* @return Activity
*/
@@ -318,25 +297,38 @@ class Activity implements HasCenterInterface, HasScopeInterface
}
/**
* Get person
* Set scope.
*
* @return Person
* @return Activity
*/
public function getPerson()
public function setScope(Scope $scope)
{
return $this->person;
$this->scope = $scope;
return $this;
}
/**
* get the center
*
* center is extracted from person
*
* @return \Chill\MainBundle\Entity\Center
* Set type.
*
* @return Activity
*/
public function getCenter()
public function setType(ActivityType $type)
{
return $this->person->getCenter();
$this->type = $type;
return $this;
}
/**
* Set user.
*
* @return Activity
*/
public function setUser(User $user)
{
$this->user = $user;
return $this;
}
}

View File

@@ -1,121 +1,68 @@
<?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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
use Doctrine\ORM\Mapping as ORM;
/**
* ActivityReason
* @ORM\Entity
* @ORM\Table(name="activityreason")
* @ORM\HasLifecycleCallbacks
*/
class ActivityReason
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var ActivityReasonCategory
* @ORM\ManyToOne(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
* inversedBy="reasons")
*/
private $category;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var ActivityReasonCategory
*/
private $category;
/**
* @var boolean
*/
private $active = true;
/**
* Get id
* Get active.
*
* @return integer
* @return bool
*/
public function getId()
public function getActive()
{
return $this->id;
return $this->active;
}
/**
* Set name
*
* @param array $name
*
* @return ActivityReason
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return array | string
*/
public function getName($locale = null)
{
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;
}
}
/**
* Set category of the reason. If you set to the reason an inactive
* category, the reason will become inactive
*
* @param ActivityReasonCategory $category
*
* @return ActivityReason
*/
public function setCategory(ActivityReasonCategory $category)
{
if($this->category !== $category && ! $category->getActive()) {
$this->setActive(False);
}
$this->category = $category;
return $this;
}
/**
* Get category
* Get category.
*
* @return ActivityReasonCategory
*/
@@ -125,9 +72,45 @@ class ActivityReason
}
/**
* Set active
* Get id.
*
* @param boolean $active
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get name.
*
* @param mixed|null $locale
*
* @return array | string
*/
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}
/**
* Set active.
*
* @param bool $active
*
* @return ActivityReason
*/
@@ -139,13 +122,33 @@ class ActivityReason
}
/**
* Get active
* Set category of the reason. If you set to the reason an inactive
* category, the reason will become inactive.
*
* @return boolean
* @return ActivityReason
*/
public function getActive()
public function setCategory(ActivityReasonCategory $category)
{
return $this->active;
if ($this->category !== $category && !$category->getActive()) {
$this->setActive(false);
}
$this->category = $category;
return $this;
}
/**
* Set name.
*
* @param array $name
*
* @return ActivityReason
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}

View File

@@ -1,64 +1,89 @@
<?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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* ActivityReasonCategory
* @ORM\Entity
* @ORM\Table(name="activityreasoncategory")
* @ORM\HasLifecycleCallbacks
*/
class ActivityReasonCategory
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
* Array of ActivityReason.
*
* @var ArrayCollection
* @ORM\OneToMany(
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
* mappedBy="category")
*/
private $active = true;
/** @var ArrayCollection array of ActivityReason */
private $reasons;
/**
* ActivityReasonCategory constructor.
*/
public function __construct()
{
$this->reasons = new ArrayCollection();
}
/**
* @return string
*/
public function __toString()
{
return 'ActivityReasonCategory('.$this->getName('x').')';
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
}
/**
* Get id
* Get active.
*
* @return integer
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
@@ -66,7 +91,55 @@ class ActivityReasonCategory
}
/**
* Set name
* Get name.
*
* @param mixed|null $locale
*
* @return array
*/
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}
/**
* Declare a category as active (or not). When a category is set
* as unactive, all the reason have this entity as category is also
* set as unactive.
*
* @param bool $active
*
* @return ActivityReasonCategory
*/
public function setActive($active)
{
if ($this->active !== $active && !$active) {
foreach ($this->reasons as $reason) {
$reason->setActive($active);
}
}
$this->active = $active;
return $this;
}
/**
* Set name.
*
* @param array $name
*
@@ -78,59 +151,4 @@ class ActivityReasonCategory
return $this;
}
/**
* Get name
*
* @return array
*/
public function getName($locale = null)
{
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;
}
}
/**
* Declare a category as active (or not). When a category is set
* as unactive, all the reason have this entity as category is also
* set as unactive
*
* @param boolean $active
* @return ActivityReasonCategory
*/
public function setActive($active)
{
if($this->active !== $active && !$active) {
foreach ($this->reasons as $reason) {
$reason->setActive($active);
}
}
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
}

View File

@@ -1,47 +1,63 @@
<?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/>.
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ActivityType
* @ORM\Entity
* @ORM\Table(name="activitytype")
* @ORM\HasLifecycleCallbacks
*/
class ActivityType
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
private $active = true;
/**
* Get id
* Get active
* return true if the type is active.
*
* @return integer
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
@@ -49,7 +65,59 @@ class ActivityType
}
/**
* Set name
* Get name.
*
* @param mixed|null $locale
*
* @return array | string
*/
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}
/**
* Is active
* return true if the type is active.
*
* @return bool
*/
public function isActive()
{
return $this->getActive();
}
/**
* Set active
* set to true if the type is active.
*
* @param bool $active
*
* @return ActivityType
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Set name.
*
* @param array $name
*
@@ -61,64 +129,4 @@ class ActivityType
return $this;
}
/**
* Get name
*
* @return array | string
*/
public function getName($locale = null)
{
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;
}
}
/**
* get active
*
* return true if the type is active.
*
* @return boolean true if the type is active
*/
public function getActive() {
return $this->active;
}
/**
* get active
*
* return true if the type is active
*
* @return boolean true if the type is active
*/
public function isActive() {
return $this->getActive();
}
/**
* set active
*
* set to true if the type is active
*
* @param boolean $active
* @return \Chill\ActivityBundle\Entity\ActivityType
*/
public function setActive($active) {
$this->active = $active;
return $this;
}
}

View File

@@ -1,107 +1,103 @@
<?php
/*
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
/**
* Chill is a software for social workers.
*
* 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.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* 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/>.
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
use Doctrine\ORM\EntityRepository;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\Query\Expr\Join;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use RuntimeException;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class ActivityReasonAggregator implements AggregatorInterface,
use function array_key_exists;
use function count;
class ActivityReasonAggregator implements
AggregatorInterface,
ExportElementValidatedInterface
{
/**
*
* @var EntityRepository
*/
protected $categoryRepository;
/**
*
* @var EntityRepository
*/
protected $reasonRepository;
/**
*
* @var TranslatableStringHelper
*/
protected $stringHelper;
public function __construct(
EntityRepository $categoryRepository,
EntityRepository $reasonRepository,
TranslatableStringHelper $stringHelper
EntityRepository $categoryRepository,
EntityRepository $reasonRepository,
TranslatableStringHelper $stringHelper
) {
$this->categoryRepository = $categoryRepository;
$this->reasonRepository = $reasonRepository;
$this->stringHelper = $stringHelper;
$this->reasonRepository = $reasonRepository;
$this->stringHelper = $stringHelper;
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function alterQuery(QueryBuilder $qb, $data)
{
// add select element
if ($data['level'] === 'reasons') {
if ('reasons' === $data['level']) {
$elem = 'reasons.id';
$alias = 'activity_reasons_id';
} elseif ($data['level'] === 'categories') {
} elseif ('categories' === $data['level']) {
$elem = 'category.id';
$alias = 'activity_categories_id';
} else {
throw new \RuntimeException('the data provided are not recognized');
throw new RuntimeException('the data provided are not recognized');
}
$qb->addSelect($elem.' as '.$alias);
$qb->addSelect($elem . ' as ' . $alias);
// make a jointure only if needed
$join = $qb->getDQLPart('join');
if (
(array_key_exists('activity', $join)
&&
!$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
(
array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
)
OR
(! array_key_exists('activity', $join))
|| (!array_key_exists('activity', $join))
) {
$qb->add(
'join',
array('activity' =>
new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons')
),
true);
'join',
['activity' => new Join(Join::INNER_JOIN, 'activity.reasons', 'reasons'),
],
true
);
}
// join category if necessary
if ($alias === 'activity_categories_id') {
if ('activity_categories_id' === $alias) {
// add join only if needed
if (!$this->checkJoinAlreadyDefined($qb->getDQLPart('join')['activity'], 'category')) {
$qb->join('reasons.category', 'category');
@@ -118,12 +114,107 @@ class ActivityReasonAggregator implements AggregatorInterface,
}
}
public function applyOn()
{
return 'activity';
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('level', ChoiceType::class, [
'choices' => [
'By reason' => 'reasons',
'By category of reason' => 'categories',
],
'multiple' => false,
'expanded' => true,
'label' => 'Reason\'s level',
]);
}
public function getLabels($key, array $values, $data)
{
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->reasonRepository->findBy(['id' => $values]);
break;
case 'categories':
$this->categoryRepository->findBy(['id' => $values]);
break;
default:
throw new RuntimeException(sprintf(
"the level data '%s' is invalid",
$data['level']
));
}
return function ($value) use ($data) {
if ('_header' === $value) {
return 'reasons' === $data['level'] ?
'Group by reasons'
:
'Group by categories of reason';
}
switch ($data['level']) {
case 'reasons':
/** @var \Chill\ActivityBundle\Entity\ActivityReason $r */
$r = $this->reasonRepository->find($value);
return $this->stringHelper->localize($r->getCategory()->getName())
. ' > '
. $this->stringHelper->localize($r->getName());
break;
case 'categories':
$c = $this->categoryRepository->find($value);
return $this->stringHelper->localize($c->getName());
break;
// no need for a default : the default was already set above
}
};
}
public function getQueryKeys($data)
{
// add select element
if ('reasons' === $data['level']) {
return ['activity_reasons_id'];
}
if ('categories' === $data['level']) {
return ['activity_categories_id'];
}
throw new RuntimeException('the data provided are not recognised');
}
public function getTitle()
{
return 'Aggregate by activity reason';
}
public function validateForm($data, ExecutionContextInterface $context)
{
if (null === $data['level']) {
$context->buildViolation("The reasons's level should not be empty")
->addViolation();
}
}
/**
* Check if a join between Activity and another alias
* Check if a join between Activity and another alias.
*
* @param Join[] $joins
* @param string $alias the alias to search for
* @return boolean
*
* @return bool
*/
private function checkJoinAlreadyDefined(array $joins, $alias)
{
@@ -135,100 +226,4 @@ class ActivityReasonAggregator implements AggregatorInterface,
return false;
}
public function applyOn()
{
return 'activity';
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('level', ChoiceType::class, array(
'choices' => array(
'By reason' => 'reasons',
'By category of reason' => 'categories'
),
'choices_as_values' => true,
'multiple' => false,
'expanded' => true,
'label' => 'Reason\'s level'
));
}
public function validateForm($data, ExecutionContextInterface $context)
{
if ($data['level'] === null) {
$context->buildViolation("The reasons's level should not be empty")
->addViolation();
}
}
public function getTitle()
{
return "Aggregate by activity reason";
}
public function addRole()
{
return new Role(ActivityStatsVoter::STATS);
}
public function getLabels($key, array $values, $data)
{
// for performance reason, we load data from db only once
switch ($data['level']) {
case 'reasons':
$this->reasonRepository->findBy(array('id' => $values));
break;
case 'categories':
$this->categoryRepository->findBy(array('id' => $values));
break;
default:
throw new \RuntimeException(sprintf("the level data '%s' is invalid",
$data['level']));
}
return function($value) use ($data) {
if ($value === '_header') {
return $data['level'] === 'reasons' ?
'Group by reasons'
:
'Group by categories of reason'
;
}
switch ($data['level']) {
case 'reasons':
/* @var $r \Chill\ActivityBundle\Entity\ActivityReason */
$r = $this->reasonRepository->find($value);
return $this->stringHelper->localize($r->getCategory()->getName())
." > "
. $this->stringHelper->localize($r->getName());
;
break;
case 'categories':
$c = $this->categoryRepository->find($value);
return $this->stringHelper->localize($c->getName());
break;
// no need for a default : the default was already set above
}
};
}
public function getQueryKeys($data)
{
// add select element
if ($data['level'] === 'reasons') {
return array('activity_reasons_id');
} elseif ($data['level'] === 'categories') {
return array ('activity_categories_id');
} else {
throw new \RuntimeException('the data provided are not recognised');
}
}
}

Some files were not shown because too many files have changed in this diff Show More