mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master' into integrate_wopi_bundle
This commit is contained in:
commit
80672a038c
@ -3,6 +3,7 @@
|
|||||||
namespace Chill\DocGeneratorBundle\Context;
|
namespace Chill\DocGeneratorBundle\Context;
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,11 +22,22 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
|||||||
* Generate the form that display
|
* Generate the form that display
|
||||||
*/
|
*/
|
||||||
public function getForm($entity) {
|
public function getForm($entity) {
|
||||||
// TODO Get FormFactory and create a form
|
throw new \Exception("No implemented yet", 1);
|
||||||
|
|
||||||
|
$choices = [];
|
||||||
|
if(get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
|
||||||
|
foreach ($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
|
||||||
|
$choices[$person->getId()] = $person->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// access to the house hold for the AccompanyingPeriod pr the SocialAction
|
$builder->add('members', ChoiceType::class, [
|
||||||
// and configure the form to select member of the family
|
'choices' => $choices,
|
||||||
|
'placeholder' => 'Choose a person',
|
||||||
|
'label' => 'Person to add'
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,17 +53,26 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
|||||||
* Get the data that will be injected to the generated document
|
* Get the data that will be injected to the generated document
|
||||||
*/
|
*/
|
||||||
public function getData($entity): array {
|
public function getData($entity): array {
|
||||||
$ret = [];
|
$datas = array(
|
||||||
|
'setValue' => array(),
|
||||||
|
'cloneRowAndSetValues' => array()
|
||||||
|
); // TODO CREER UNE CLASSE POUR CA
|
||||||
|
|
||||||
if(get_class($entity) == AccompanyingPeriod::class) {
|
if(get_class($entity) == AccompanyingPeriodWorkEvaluation::class) {
|
||||||
// TODO mettre ça dans un service
|
$values = array();
|
||||||
$ret = ['AccompanyingPeriod' => $entity];
|
foreach($entity->getAccompanyingPeriodWork()->getPersons() as $person) {
|
||||||
} elseif(get_class($entity) == SocialAction::class) {
|
$i = 1;
|
||||||
$ret = ['SocialAction' => $entity];
|
$values[] = array(
|
||||||
|
'personRowId' => $i,
|
||||||
|
'personFirstName' => $person->getFirstName(),
|
||||||
|
'personLastName' => $person->getLastName(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$datas['cloneRowAndSetValues'][] = array(
|
||||||
|
'personRowId', $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO AJOUTER LES DONNES DU FORMULAIRE
|
return $datas;
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,14 +70,17 @@ class DocGeneratorTemplateController extends AbstractController
|
|||||||
|
|
||||||
if ($template->getContext() == HouseholdMemberSelectionContext::class) {
|
if ($template->getContext() == HouseholdMemberSelectionContext::class) {
|
||||||
$context = new HouseholdMemberSelectionContext();
|
$context = new HouseholdMemberSelectionContext();
|
||||||
// $datas = $context->getData($entity);
|
$datas = $context->getData($entity);
|
||||||
$datas = [];
|
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("Not implemented", 1);
|
throw new \Exception("Not implemented", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$templateProcessor = new TemplateProcessor($tmpfname);
|
$templateProcessor = new TemplateProcessor($tmpfname);
|
||||||
$templateProcessor->setValues(array('firstname' => 'John', 'lastname' => 'Doe'));
|
|
||||||
|
// TODO foreach ($datas['setValue'] as $key => $value) {
|
||||||
|
foreach ($datas['cloneRowAndSetValues'] as $cloneRowAndSetValues) {
|
||||||
|
$templateProcessor->cloneRowAndSetValues($cloneRowAndSetValues[0], $cloneRowAndSetValues[1]);
|
||||||
|
}
|
||||||
|
|
||||||
$tmpfname2 = tempnam(sys_get_temp_dir(), 'DOC_GENERATED');
|
$tmpfname2 = tempnam(sys_get_temp_dir(), 'DOC_GENERATED');
|
||||||
$templateProcessor->saveAs($tmpfname2);
|
$templateProcessor->saveAs($tmpfname2);
|
||||||
|
@ -24,9 +24,9 @@ class LoadDocGeneratorTemplate extends AbstractFixture
|
|||||||
[
|
[
|
||||||
'name' => ['fr' => 'FORMULAIRE AEB'],
|
'name' => ['fr' => 'FORMULAIRE AEB'],
|
||||||
'desc' => 'stocké sur openstack comedienbe',
|
'desc' => 'stocké sur openstack comedienbe',
|
||||||
'file' => 'FORMULAIRE_AEB.docx',
|
'file' => 'FORMULAIRE_AEB_WITH_DATA_INJ.docx',
|
||||||
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
||||||
'entities' => ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction', AccompanyingPeriodWorkEvaluation::class],
|
'entities' => [AccompanyingPeriodWorkEvaluation::class],
|
||||||
], [
|
], [
|
||||||
'name' => ['fr' => 'AIDE ALIMENTAIRE'],
|
'name' => ['fr' => 'AIDE ALIMENTAIRE'],
|
||||||
'desc' => 'stocké sur openstack comedienbe',
|
'desc' => 'stocké sur openstack comedienbe',
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
{% block layout_wvm_content %}
|
{% block layout_wvm_content %}
|
||||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
|
<th></th>
|
||||||
<th>{{ 'Title'|trans }}</th>
|
<th>{{ 'Title'|trans }}</th>
|
||||||
<th>{{ 'File'|trans }}</th>
|
<th>{{ 'File'|trans }}</th>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -10,6 +11,7 @@
|
|||||||
{% block table_entities_tbody %}
|
{% block table_entities_tbody %}
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{{ entity.id }}</td>
|
||||||
<td>{{ entity.name | localize_translatable_string }}</td>
|
<td>{{ entity.name | localize_translatable_string }}</td>
|
||||||
<td>{{ entity.file }}</td>
|
<td>{{ entity.file }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user