This commit is contained in:
Marc Ducobu 2016-05-06 16:30:15 +02:00
commit 510d3ff480
8 changed files with 103 additions and 54 deletions

View File

@ -57,12 +57,12 @@ interface ExportInterface extends ExportElementInterface
* what the user is allowed to see. (Do not show personal data the user
* is not allowed to see).
*
* @param QueryBuilder $qb
* @param array $requiredModifiers
* @param array $acl an array where each row has a `center` key containing the Chill\MainBundle\Entity\Center, and `circles` keys containing the reachable circles. Example: `array( array('center' => $centerA, 'circles' => array($circleA, $circleB) ) )`
* @param array $data the data from the form, if any
* @return the query to execute.
*/
public function initiateQuery(QueryBuilder $qb, array $requiredModifiers, array $acl, array $data = array());
public function initiateQuery(array $requiredModifiers, array $acl, array $data = array());
/**
* Inform which ModifiersInterface (i.e. AggregatorInterface, FilterInterface)
@ -102,11 +102,11 @@ interface ExportInterface extends ExportElementInterface
/**
* Return the results of the query builder.
*
* @param QueryBuilder $qb
* @param QueryBuilder|\Doctrine\ORM\NativeQuery $query
* @param mixed[] $data the data from the export's fomr (added by self::buildForm)
* @return mixed[] an array of results
*/
public function getResult(QueryBuilder $qb, $data);
public function getResult($query, $data);
/**

View File

@ -382,36 +382,53 @@ class ExportManager
public function generate($exportAlias, array $pickedCentersData, array $data, array $formatterData)
{
$export = $this->getExport($exportAlias);
$qb = $this->em->createQueryBuilder();
//$qb = $this->em->createQueryBuilder();
$centers = $this->getPickedCenters($pickedCentersData);
$qb = $export->initiateQuery(
$qb,
$query = $export->initiateQuery(
$this->retrieveUsedModifiers($data),
$this->buildCenterReachableScopes($centers, $export),
$data[ExportType::EXPORT_KEY]
);
//handle filters
$this->handleFilters($export, $qb, $data[ExportType::FILTER_KEY], $centers);
if ($query instanceof \Doctrine\ORM\NativeQuery) {
// throw an error if the export require other modifier, which is
// not allowed when the export return a `NativeQuery`
if (count($export->supportsModifiers()) > 0) {
throw new \LogicException("The export with alias `$exportAlias` return "
. "a `\Doctrine\ORM\NativeQuery` and supports modifiers, which is not "
. "allowed. Either the method `supportsModifiers` should return an empty "
. "array, or return a `Doctrine\ORM\QueryBuilder`");
}
} elseif ($query instanceof QueryBuilder) {
//handle filters
$this->handleFilters($export, $query, $data[ExportType::FILTER_KEY], $centers);
//handle aggregators
$this->handleAggregators($export, $query, $data[ExportType::AGGREGATOR_KEY], $centers);
$this->logger->debug('current query is '.$query->getDQL(), array(
'class' => self::class, 'function' => __FUNCTION__
));
} else {
throw new \UnexpectedValueException("The method `intiateQuery` should return "
. "a `\Doctrine\ORM\NativeQuery` or a `Doctrine\ORM\QueryBuilder` "
. "object.");
}
//handle aggregators
$this->handleAggregators($export, $qb, $data[ExportType::AGGREGATOR_KEY], $centers);
// $this->logger->debug('current query is '.$qb->getDQL(), array(
// 'class' => self::class, 'function' => __FUNCTION__
// ));
$result = $export->getResult($qb, $data[ExportType::EXPORT_KEY]);
$result = $export->getResult($query, $data[ExportType::EXPORT_KEY]);
/* @var $formatter Formatter\CSVFormatter */
$formatter = $this->getFormatter($this->getFormatterAlias($data));
$filters = array();
$aggregators = $this->retrieveUsedAggregators($data[ExportType::AGGREGATOR_KEY]);
$aggregatorsData = array();
foreach($aggregators as $alias => $aggregator) {
$aggregatorsData[$alias] = $data[ExportType::AGGREGATOR_KEY][$alias]['form'];
if ($query instanceof QueryBuilder) {
$aggregators = $this->retrieveUsedAggregators($data[ExportType::AGGREGATOR_KEY]);
foreach($aggregators as $alias => $aggregator) {
$aggregatorsData[$alias] = $data[ExportType::AGGREGATOR_KEY][$alias]['form'];
}
}
return $formatter->getResponse(

View File

@ -4396,7 +4396,7 @@ span.entity.entity-activity.activity-reason {
html, body {
min-height: 100%;
font-family: 'open_sansregular'; }
font-family: 'Open Sans'; }
header {
position: relative; }
@ -4468,7 +4468,11 @@ ul.custom_fields.choice li {
line-height: 1.5em; }
.footer p {
font-family: 'open_sanslight'; }
font-family: 'Open Sans';
font-weight: 300; }
.footer a {
color: white;
text-decoration: underline; }
.time_compound input[type=text], .time_compound select {
width: 4em;
@ -4479,7 +4483,8 @@ ul.custom_fields.choice li {
margin-right: 0.2em; }
.open_sansbold {
font-family: "open_sansbold"; }
font-family: 'Open Sans';
font-weight: bold; }
ul.record_actions {
padding-left: 0; }
@ -4491,7 +4496,8 @@ dd {
margin-left: 0; }
dt {
font-family: "open_sanssemibold"; }
font-family: 'Open Sans';
font-weight: 600; }
/* INPUT CLASS -> */
div.input_with_post_text {

File diff suppressed because one or more lines are too long

View File

@ -1,29 +1,32 @@
@font-face {
font-family: 'open_sanssemibold';
/*font-family: 'open_sanssemibold';*/
font-family: 'Open Sans';
src: url('opensans-semibold-webfont.eot');
src: url('opensans-semibold-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-semibold-webfont.woff2') format('woff2'),
url('opensans-semibold-webfont.woff') format('woff'),
url('opensans-semibold-webfont.ttf') format('truetype'),
url('opensans-semibold-webfont.svg#open_sanssemibold') format('svg');
font-weight: normal;
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: 'open_sanssemibold_italic';
/*font-family: 'open_sanssemibold_italic';*/
font-family: 'Open Sans';
src: url('opensans-semibolditalic-webfont.eot');
src: url('opensans-semibolditalic-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-semibolditalic-webfont.woff2') format('woff2'),
url('opensans-semibolditalic-webfont.woff') format('woff'),
url('opensans-semibolditalic-webfont.ttf') format('truetype'),
url('opensans-semibolditalic-webfont.svg#open_sanssemibold_italic') format('svg');
font-weight: normal;
font-style: normal;
font-weight: 600;
font-style: italic;
}
@font-face {
font-family: 'open_sansitalic';
/*font-family: 'open_sansitalic';*/
font-family: 'Open Sans';
src: url('opensans-italic-webfont.eot');
src: url('opensans-italic-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-italic-webfont.woff2') format('woff2'),
@ -31,35 +34,38 @@
url('opensans-italic-webfont.ttf') format('truetype'),
url('opensans-italic-webfont.svg#open_sansitalic') format('svg');
font-weight: normal;
font-style: normal;
font-style: italic;
}
@font-face {
font-family: 'open_sanslight';
/*font-family: 'open_sanslight';*/
font-family: 'Open Sans';
src: url('opensans-light-webfont.eot');
src: url('opensans-light-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-light-webfont.woff2') format('woff2'),
url('opensans-light-webfont.woff') format('woff'),
url('opensans-light-webfont.ttf') format('truetype'),
url('opensans-light-webfont.svg#open_sanslight') format('svg');
font-weight: normal;
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'open_sanslight_italic';
/*font-family: 'open_sanslight_italic';*/
font-family: 'Open Sans';
src: url('opensans-lightitalic-webfont.eot');
src: url('opensans-lightitalic-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-lightitalic-webfont.woff2') format('woff2'),
url('opensans-lightitalic-webfont.woff') format('woff'),
url('opensans-lightitalic-webfont.ttf') format('truetype'),
url('opensans-lightitalic-webfont.svg#open_sanslight_italic') format('svg');
font-weight: normal;
font-style: normal;
font-weight: 300;
font-style: italic;
}
@font-face {
font-family: 'open_sansregular';
/*font-family: 'open_sansregular';*/
font-family: 'Open Sans';
src: url('opensans-regular-webfont.eot');
src: url('opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-regular-webfont.woff2') format('woff2'),
@ -71,50 +77,54 @@
}
@font-face {
font-family: 'open_sansbold';
/*font-family: 'open_sansbold';*/
font-family: 'Open Sans';
src: url('opensans-bold-webfont.eot');
src: url('opensans-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-bold-webfont.woff2') format('woff2'),
url('opensans-bold-webfont.woff') format('woff'),
url('opensans-bold-webfont.ttf') format('truetype'),
url('opensans-bold-webfont.svg#open_sansbold') format('svg');
font-weight: normal;
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'open_sansbold_italic';
/*font-family: 'open_sansbold_italic';*/
font-family: 'Open Sans';
src: url('opensans-bolditalic-webfont.eot');
src: url('opensans-bolditalic-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-bolditalic-webfont.woff2') format('woff2'),
url('opensans-bolditalic-webfont.woff') format('woff'),
url('opensans-bolditalic-webfont.ttf') format('truetype'),
url('opensans-bolditalic-webfont.svg#open_sansbold_italic') format('svg');
font-weight: normal;
font-style: normal;
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'open_sansextrabold';
/*font-family: 'open_sansextrabold';*/
font-family: 'Open Sans';
src: url('opensans-extrabold-webfont.eot');
src: url('opensans-extrabold-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-extrabold-webfont.woff2') format('woff2'),
url('opensans-extrabold-webfont.woff') format('woff'),
url('opensans-extrabold-webfont.ttf') format('truetype'),
url('opensans-extrabold-webfont.svg#open_sansextrabold') format('svg');
font-weight: normal;
font-weight: 800;
font-style: normal;
}
@font-face {
font-family: 'open_sansextrabold_italic';
/*font-family: 'open_sansextrabold_italic';*/
font-family: 'Open Sans';
src: url('opensans-extrabolditalic-webfont.eot');
src: url('opensans-extrabolditalic-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-extrabolditalic-webfont.woff2') format('woff2'),
url('opensans-extrabolditalic-webfont.woff') format('woff'),
url('opensans-extrabolditalic-webfont.ttf') format('truetype'),
url('opensans-extrabolditalic-webfont.svg#open_sansextrabold_italic') format('svg');
font-weight: normal;
font-style: normal;
font-weight: 800;
font-style: italic;
}

View File

@ -7,7 +7,7 @@
html,body {
min-height:100%;
font-family: 'open_sansregular';
font-family: 'Open Sans';
}
header {
@ -95,8 +95,14 @@ ul.custom_fields.choice li {
.footer {
p {
font-family: 'open_sanslight';
font-family: 'Open Sans';
font-weight: 300;
}
a {
color: white;
text-decoration: underline;
}
}
// inline time input
@ -114,7 +120,9 @@ ul.custom_fields.choice li {
}
.open_sansbold {
font-family:'open_sansbold'
font-family: 'Open Sans';
font-weight: bold;
}
// Symfony records actions
@ -130,7 +138,8 @@ dd {
}
dt {
font-family: "open_sanssemibold";
font-family: 'Open Sans';
font-weight: 600;
}

View File

@ -1,3 +1,5 @@
"This program is free software: you can redistribute it and/or modify it under the terms of the <strong>GNU Affero General Public License</strong>": "Ce programme est un logiciel libre: vous pouvez le redistribuer et/ou le modifier selon les termes de la licence <strong>GNU Affero GPL</strong>"
User manual: Manuel d'utilisation
Search: Rechercher
'Search persons, ...': 'Recherche des personnes, ...'
Person name: Nom / Prénom de la personne
@ -19,6 +21,10 @@ Admin Menu: Menu d'administration
Details: Détails
yes: oui
no: non
valid: valide
Valid: Valide
Not valid: Non valide
not valid: non valide
Edit: Modifier
Update: Mettre à jour

View File

@ -149,7 +149,8 @@
</div>
<footer class="footer">
<p>{{ 'Programme sous license' | trans }} <b>AGPL</b></p>
<p>{{ 'This program is free software: you can redistribute it and/or modify it under the terms of the <strong>GNU Affero General Public License</strong>'|trans|raw }}
<br/> <a href="https://{{ app.request.locale }}.wikibooks.org/wiki/Chill">{{ 'User manual'|trans }}</a></p>
</footer>
{% javascripts output="js/libs.js"