Skip to content
Snippets Groups Projects
Select Git revision
  • f069c6be3ce15b18cfba47e65ccada7df6d31e3f
  • master default protected
  • subtemplate
  • release_7.0.6
  • php84
  • 6.x
  • v5.x-test
  • 5x
  • 7.1.0
  • 7.0.6
  • 7.0.5
  • 7.0.4
  • 7.0.3
  • 7.0.2
  • 7.0.1
  • 7.0.0
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.1.4
  • 6.1.3
  • 6.1.2
  • 6.1.1
  • 6.1.0
  • 6.0.3
  • 6.0.2
  • 5.0.6
  • 6.0.1
28 results

ContenuController.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test4.php 1.44 KiB
    <?php
    
    /**
     * @var $this       \Application\View\Renderer\PhpRenderer
     * @var $controller \Zend\Mvc\Controller\AbstractController
     * @var $viewName   string
     * @var $sl         \Zend\ServiceManager\ServiceLocatorInterface
     */
    
    
    /** @var \Application\Provider\Chargens\ChargensProvider $s */
    $s  = $sl->get('chargens');
    
    /** @var \Application\Service\Etape $se */
    $se = $sl->get('applicationEtape');
    
    $data = file_get_contents('/home/laurent/data.csv');
    $data = explode( "\n", $data );
    
    $sql = [];
    
    $thids = [
        'fi' => 6,
        'fa' => 7,
        'fc' => 8,
    ];
    
    foreach( $data as $d ){
        if ($d != ''){
            $d = explode( "\t", $d);
    
            $code = trim($d[0]);
            $e = [];
            $e['fi'] = (int)trim($d[9]);
            $e['fc'] = (int)trim($d[10]);
            $e['fa'] = (int)trim($d[11]);
            //var_dump($code, $fi, $fc, $fa);
    
            $etape = $se->getRepo()->findOneBy([
                'sourceCode' => $code,
                'annee' => $se->getServiceContext()->getAnnee(),
            ]);
    
            if ($etape){
                $etapeId = $etape->getId();
    
                foreach( $e as $ec => $eff ){
                    if ($eff > 0){
                        $thid = $thids[$ec];
                        $scenarioId = 1;
                        $sql[] = "OSE_CHARGENS.INIT_SCENARIO_NOEUD_EFFECTIF($etapeId,$scenarioId,$thid, $eff, TRUE );";
                    }
                }
            }else{
    //            var_dump('étape non trouvée : '.$code);
            }
        }
    }
    
    echo implode( "<br />\n", $sql );