Commit bcc9b6aa authored by Alexandre Zvenigorosky's avatar Alexandre Zvenigorosky
Browse files

Affichage des années

parent 8722a4de
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Application\Exception\DbException;
use Application\Form\CentreCout\Traits\CentreCoutSaisieFormAwareTrait;
use Application\Form\CentreCout\Traits\CentreCoutStructureSaisieFormAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
use Doctrine\ORM\QueryBuilder;

class CentreCoutController extends AbstractController
{
+13 −0
Original line number Diff line number Diff line
@@ -114,4 +114,17 @@ class CentreCoutService extends AbstractEntityService
            return null;
        }
    }

    /**
     * Retourne la liste des types de modulateurs
     *
     * @param QueryBuilder|null $qb
     * @param string|null $alias
     * @return CentreCout[]
     */
    public function getList( QueryBuilder $qb=null, $alias=null ){
        list($qb,$alias) = $this->initQuery($qb,$alias);
        $qb->addOrderBy("$alias.parent");
        return parent::getList($qb, $alias);
    }
}
 No newline at end of file
+158 −57
Original line number Diff line number Diff line
@@ -12,36 +12,51 @@ $this->headTitle()->append("Centres de cout");
$canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEGE_EDITION));

?>
<h1 class="page-header">Centres de cout</h1>

<h1 class="page-header">Centres de coûts</h1>
<?php
$tblListe = [];
$tblRef   = [];
$i        = 0;
foreach ($centreCouts as $fr) {
    if ($fr->getParent() == null) $tblRef[$i++] = $fr;
}
$nTblListe = $i;
$i         = 0;
?>
<table class="table table-bordered table-sort">
    <thead>
    <th style="word-wrap: break-word ; ">Code</th>
    <th style="word-wrap: break-word ; ">Libelle</th>
    <th style="word-wrap: break-word ; ">Activite</th>
    <th style="word-wrap: break-word ; ">Type Ressource</th>
    <th style="word-wrap: break-word ; ">Parent</th>
    <th style="word-wrap: break-word ; ">Source</th>
    <th style="word-wrap: break-word ; ">Source Code</th>
    <th style="word-wrap: break-word ; ">Unite Budgetaire</th>
    <?php if ($canEdit) echo '<th>Actions</th>' ?>
    <th>Structures</th>
    <th style="word-wrap: break-word ; ">Activité</th>
    <th style="word-wrap: break-word ; ">Type de ressource</th>
    <th style="word-wrap: break-word ; ">Unité budgétaire</th>
    <?php if ($canEdit) echo '<th style="word-wrap: break-word ; ">Source/Actions</th>' ?>
    <th style="word-wrap: break-word ; ">Structure</th>
    </thead>
    <tbody>
    <?php foreach ($centreCouts

                   as $fr): ?>
    <?php
    while ($i < $nTblListe) {
        $j            = 0;
        $tblListe[$i] = [];
        foreach ($centreCouts as $frf) {
            if (($frf->getParent()) && ($frf->getParent()->getId() == $tblRef[$i]->getId())) {
                $tblListe[$i][$j++] = $frf;
            }
        }
        $i++;
    }
    for ($i = 0;
    $i < $nTblListe;
    $i++) {
    $fr  = $tblRef[$i];
    $nFr = count($tblListe[$i]); ?>
    <tr>
            <td style="word-wrap: break-word ; "><?= $fr->getCode() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getLibelle() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getActivite()->getLibelle() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getTypeRessource() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getParent() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getSource() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getSourceCode() ?></td>
            <td style="word-wrap: break-word ; "><?= $fr->getUniteBudgetaire() ?></td>
            <?php if (($fr->getSource()->getLibelle() == 'OSE') && $canEdit) { ?>
            <td style="text-align:center;width:1px;white-space: nowrap">
        <td><?= $fr->getCode() . '<br>' ?></td>
        <td><?= $fr->getLibelle() . '<br>' ?></td>
        <td><?= $fr->getActivite()->getLibelle() . '<br>' ?></td>
        <td><?= $fr->getTypeRessource() . '<br>' ?></td>
        <td><?= $fr->getUniteBudgetaire() . '<br>' ?></td>
        <td><?php if (($fr->getSource()->getLibelle() == 'OSE') && ($canEdit)) { ?>
            <a class="ajax-modal" data-event="centre-cout-saisie"
               href="<?= $this->url('centre-cout/saisie', ['centre-cout' => $fr->getId()]) ?>"
               title="Modifier la Centre de Cout">
@@ -58,32 +73,116 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
                <span class="glyphicon glyphicon-remove"></span>
            </a>
           <?php  }
                else {
                    echo "<td>&nbsp;</td>";
                } ?>
           else echo $fr->getSource(); ?>
        </td>
        <td>
            <?php
                $tblOk = false;
            $tblOk = $okActions=false;
            foreach ($centreCoutStructures as $ccs) {
                    if ($ccs->getCentreCout()->getId() == $fr->getId()) $tblOk = true;
                if ($ccs->getCentreCout()->getId() == $fr->getId()) {
                    $tblOk = true;
                    if (($ccs->getSource()->getLibelle() == 'OSE') && $canEdit) $okActions = true;
                }
            }
            if ($tblOk) { ?>
                    <table class="table table-bordered table-bordered">
                <table class="table table-bordered">
                    <thead>
                    <th> Structure</th>
                    <th> Source</th>
                    <th> Code</th>
                        <th> Unité budgétaire</th>
                        <?php if ($canEdit) echo '<th>Actions</th>' ?>
                    <th> Actions</th>
                    <?php // if ($okActions) echo '<th>Actions</th>' ?>
                    </thead>
                    <tbody>
                    <?php foreach ($centreCoutStructures as $ccs) {
                        if ($ccs->getCentreCout()->getId() == $fr->getId()) { ?>
                            <tr>
                                <td><?= $ccs->getStructure() ?></td>
                                <td><?= $ccs->getSourceCode() ?></td>
                                <?php if (($ccs->getSource()->getLibelle() == 'OSE') && $canEdit) { ?>
                                <td>
                                    <a class="ajax-modal" data-event="centre-cout-saisie"
                                       href="<?= $this->url('centre-cout/saisie-structure', ['centre-cout' => $fr->getId(), 'centre-cout-structure' => $ccs->getId()]) ?>"
                                       title="Modifier la structure">
                                        <span class="glyphicon glyphicon-edit"></span></a>
                                    <a class="pop-ajax"
                                       href="<?= $this->url('centre-cout/delete-structure', ['centre-cout-structure' => $ccs->getId()]) ?>"
                                       title="Supprimer la sructure du Centre de Cout"
                                       data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>"
                                       data-confirm="true"
                                       data-confirm-button="Oui"
                                       data-cancel-button="Non"
                                       data-submit-reload="true"
                                    >
                                        <span class="glyphicon glyphicon-remove"></span>
                                    </a>
                                    <?php } ?>
                                </td>
                            </tr>
                        <?php }
                    } ?>
                    </tbody>
                </table>
            <?php } ?>
        </td>

    </tr>
    <?php if ($nFr) { ?>
        <?php
        for ($j = 0;
        $j < $nFr;
        $j++) {
        $frf = $tblListe[$i][$j]; ?>
        <tr>
            <td data-order="<?= $fr->getCode() ?>" style="word-wrap: break-word; padding-left:30px; "><?= $frf->getCode() ?></td>
            <td style="word-wrap: break-word ; "><?= $frf->getLibelle() ?></td>
            <td style="word-wrap: break-word ; "><?= $frf->getActivite()->getLibelle() ?></td>
            <td style="word-wrap: break-word ; "><?= $frf->getTypeRessource() ?></td>
            <td style="word-wrap: break-word ; "><?= $frf->getUniteBudgetaire() ?></td>
            <?php if (($frf->getSource()->getLibelle() == 'OSE') && $canEdit) { ?>
                <td style="text-align:center;width:1px;white-space: nowrap">
                    <a class="ajax-modal" data-event="centre-cout-saisie"
                       href="<?= $this->url('centre-cout/saisie', ['centre-cout' => $frf->getId()]) ?>"
                       title="Modifier la Centre de Cout">
                        <span class="glyphicon glyphicon-edit"></span></a>
                    <a class="pop-ajax"
                       href="<?= $this->url('centre-cout/delete', ['centre-cout' => $frf->getId()]) ?>"
                       title="Supprimer la Centre de Cout"
                       data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>"
                       data-confirm="true"
                       data-confirm-button="Oui"
                       data-cancel-button="Non"
                       data-submit-reload="true"
                    >
                        <span class="glyphicon glyphicon-remove"></span>
                    </a>
                </td>
            <?php } else echo '<td>'.$frf->getSource(); ?></td>
            <td>
                <?php
                $tblOk = $okActions=false;
                foreach ($centreCoutStructures as $ccs) {
                    if ($ccs->getCentreCout()->getId() == $frf->getId()) {
                        $tblOk = true;
                        if (($ccs->getSource()->getLibelle() == 'OSE') && $canEdit) $okActions = true;
                    }
                }
                if ($tblOk) { ?>
                    <table class="table table-bordered">
                        <thead>
                        <th> Structure</th>
                        <th> Source</th>
                        <th> Code</th>
                        <th> Actions</th>
                        <?php // if ($okActions) echo '<th>Actions</th>' ?>
                        </thead>
                        <tbody>
                        <?php foreach ($centreCoutStructures as $ccs) {
                            if ($ccs->getCentreCout()->getId() == $frf->getId()) { ?>
                                <tr>
                                    <td><?= $ccs->getStructure() ?></td>
                                    <td><?= $ccs->getSource() ?></td>
                                    <td><?= $ccs->getSourceCode() ?></td>
                                    <td><?= $ccs->getUniteBudgetaire() ?></td>
                                    <?php if (($ccs->getSource()->getLibelle() == 'OSE') && $canEdit) { ?>
                                    <td>
                                        <a class="ajax-modal" data-event="centre-cout-saisie"
@@ -109,16 +208,18 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
                        </tbody>
                    </table>
                <?php } ?>
                 <?php if (($canEdit) && ($fr->getSource()->getLibelle() == 'OSE')){ ?>
            <?php if (($canEdit) && ($frf->getSource()->getLibelle() == 'OSE')) { ?>
                <a class="ajax-modal" data-event="centre-cout-saisie"
                   href="<?= $this->url('centre-cout/saisie-structure', ['centre-cout' => $fr->getId()]) ?>"
                   href="<?= $this->url('centre-cout/saisie-structure', ['centre-cout' => $frf->getId()]) ?>"
                   title="Ajouter une structure">
                    <button type="button" class="btn btn-xs btn-primary">Ajouter une structure</button>
                </a>
            <?php } ?>
            </td>
        </tr>
    <?php endforeach; ?>
    <?php } ?>
<?php } ?>
<?php } ?>
</tbody>
</table>
<?php if ($canEdit): ?>