Loading code/Créateur de formule.php→code/Formulator.php +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ function affCreateData(\Application\Model\FormuleCalcul $fc) $pad = str_pad('', $kl - strlen($k), ' '); echo "\t'$k'$pad => '$v',\n"; } echo "];"; echo "],"; echo '</pre>'; if (!empty($params)) { Loading code/test1.php +5 −13 Original line number Diff line number Diff line Loading @@ -10,31 +10,23 @@ use UnicaenCode\Util; $file = getcwd() . '/cache/OSE-calculHC-Rennes2-20211101.xlsx'; $file = getcwd() . '/cache/t.xlsx'; $fc = new \Application\Model\FormuleCalcul($file, 'TEST'); $f = 'IF(ISERROR([.J20]);1;[.J20])*IF(AND([.$A20]="ES3";i_structure_code<>"ES3";[.$AE$15]>=12);4/3;1)'; $cell = 'AN20'; $f = 'SUM([.AD$1:.AD$1048576])'; $formule = 'IF(AND([.$E20]="Oui";[.$I20]<>"Référentiel";[.$I20]<>"ETD";[.$G20]=1;OR([.$A20]="I2000";[.$A20]="I2300"));[.$N20]*[.$AE20];0)'; $f = 'IF([.AJ$15]>0;[.AI20]/[.AJ$15];0)'; //$f = 'IF(AND([.$D20]="Oui";[.$N20]<>"Oui";[.$A20]=i_structure_code;[.$O20]="Oui");IF([.$AG$16];[.$M20]*[.$AD20];0);0)'; $fc->testFormule($cell, $formule); //xmlDump($fc->getSheet()->getCell($cell)->getNode()); //xmlDump($fc->getSheet()->getNode()); //$fc->testFormule($f); $c = $fc->getSheet()->getCell('AG16'); var_dump($c->getDeps()); //echo $fc->getSheet(1)->html(); //Util::highlight($fc->makePackageBody(), 'plsql', true, ['show-line-numbers' => true]); //xmlDump($fc->getSheet()->getNode()); code/test2.php +9 −23 Original line number Diff line number Diff line <?php use Unicaen\OpenDocument\Calc; /** * @var $this \Application\View\Renderer\PhpRenderer * @var $controller \Laminas\Mvc\Controller\AbstractController Loading @@ -8,29 +10,13 @@ * @var $viewFile string */ $file = getcwd() . '/cache/t.xlsx'; $file = getcwd() . '/cache/Téléchargement/OSE-calculHC-Rennes2-20211101.xlsx'; $sheet = 1; //$file = getcwd() . '/cache/test.ods'; //$sheet = 0; /* $document = new \Unicaen\OpenDocument\Document(); $document->loadFromFile($file); $s = $document->getCalc()->getSheet($sheet); //xmlDump($document->getContent()); $c = $s->getCell('BG15'); $rc = array_keys($s->getRefCells($c)); var_dump($rc); //echo $s->html(); */ $formule = '[.AG15]>=[.AF16]'; $fc = new \Application\Model\FormuleCalcul($file, 'TEST'); $d = $fc->getFormuleCells(); foreach ($formules as $f) { $formule = new \Unicaen\OpenDocument\Calc\Formule($f); $formule->analyse(); $formule->displayTerms(); $formule->displayExprs(); echo '<table class="table table-bordered">'; foreach ($d as $name => $cell) { echo '<tr><th>' . $name . '</th><td>' . htmlentities($cell->getFormule() ?? $cell->getValue()) . '</td></tr>'; } echo '</table>'; data/formules.php +1 −9 Original line number Diff line number Diff line <?php return [ 1 => [ 'LIBELLE' => 'Université de Caen (version 2016)', 'PACKAGE_NAME' => 'FORMULE_UNICAEN_2016', 'ACTIVE' => false, ], 2 => [ 'LIBELLE' => 'Université de Montpellier', 'PACKAGE_NAME' => 'FORMULE_MONTPELLIER', Loading Loading @@ -53,9 +48,6 @@ return [ 12 => [ 'LIBELLE' => 'Université de Poitiers', 'PACKAGE_NAME' => 'FORMULE_POITIERS', 'I_PARAM_1_LIBELLE' => 'Heures max. référentiel en service', 'I_PARAM_2_LIBELLE' => 'Heures max. référentiel en HC', 'I_PARAM_3_LIBELLE' => 'Heures max. enseignement en HC', ], 13 => [ 'LIBELLE' => 'Université Paris 8', Loading Loading @@ -84,7 +76,7 @@ return [ 'PACKAGE_NAME' => 'FORMULE_SORBONNE_NOUVELLE', ], 19 => [ 'LIBELLE' => 'Université de Caen (version 2021)', 'LIBELLE' => 'Université de Caen', 'PACKAGE_NAME' => 'FORMULE_UNICAEN', ], 20 => [ Loading module/Application/src/Model/FormuleCalcul.php +4 −0 Original line number Diff line number Diff line Loading @@ -806,6 +806,7 @@ END FORMULE_" . $this->getName() . ";"; $isIf = false; foreach ($expr as $i => $term) { if ($term !== null) { if ($term['type'] === 'function' && $term['name'] === 'IF') { $isIf = true; } Loading @@ -815,6 +816,7 @@ END FORMULE_" . $this->getName() . ";"; $plsql .= '[PB TRADUCTION]'; } } } return $this->postReplace($plsql); } Loading Loading @@ -1038,6 +1040,7 @@ END FORMULE_" . $this->getName() . ";"; if (!empty($term['exprs'])) { $plExprs = []; foreach ($term['exprs'] as $e => $fExpr) { $fExpr[] = null; $plExprs[$e] = $this->traductionExpr($fExpr); } $plsql .= implode(' AND ', $plExprs); Loading @@ -1060,6 +1063,7 @@ END FORMULE_" . $this->getName() . ";"; if (!empty($term['exprs'])) { $plExprs = []; foreach ($term['exprs'] as $e => $fExpr) { $fExpr[] = null; $plExprs[$e] = $this->traductionExpr($fExpr); } $plsql .= implode(' OR ', $plExprs); Loading Loading
code/Créateur de formule.php→code/Formulator.php +1 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ function affCreateData(\Application\Model\FormuleCalcul $fc) $pad = str_pad('', $kl - strlen($k), ' '); echo "\t'$k'$pad => '$v',\n"; } echo "];"; echo "],"; echo '</pre>'; if (!empty($params)) { Loading
code/test1.php +5 −13 Original line number Diff line number Diff line Loading @@ -10,31 +10,23 @@ use UnicaenCode\Util; $file = getcwd() . '/cache/OSE-calculHC-Rennes2-20211101.xlsx'; $file = getcwd() . '/cache/t.xlsx'; $fc = new \Application\Model\FormuleCalcul($file, 'TEST'); $f = 'IF(ISERROR([.J20]);1;[.J20])*IF(AND([.$A20]="ES3";i_structure_code<>"ES3";[.$AE$15]>=12);4/3;1)'; $cell = 'AN20'; $f = 'SUM([.AD$1:.AD$1048576])'; $formule = 'IF(AND([.$E20]="Oui";[.$I20]<>"Référentiel";[.$I20]<>"ETD";[.$G20]=1;OR([.$A20]="I2000";[.$A20]="I2300"));[.$N20]*[.$AE20];0)'; $f = 'IF([.AJ$15]>0;[.AI20]/[.AJ$15];0)'; //$f = 'IF(AND([.$D20]="Oui";[.$N20]<>"Oui";[.$A20]=i_structure_code;[.$O20]="Oui");IF([.$AG$16];[.$M20]*[.$AD20];0);0)'; $fc->testFormule($cell, $formule); //xmlDump($fc->getSheet()->getCell($cell)->getNode()); //xmlDump($fc->getSheet()->getNode()); //$fc->testFormule($f); $c = $fc->getSheet()->getCell('AG16'); var_dump($c->getDeps()); //echo $fc->getSheet(1)->html(); //Util::highlight($fc->makePackageBody(), 'plsql', true, ['show-line-numbers' => true]); //xmlDump($fc->getSheet()->getNode());
code/test2.php +9 −23 Original line number Diff line number Diff line <?php use Unicaen\OpenDocument\Calc; /** * @var $this \Application\View\Renderer\PhpRenderer * @var $controller \Laminas\Mvc\Controller\AbstractController Loading @@ -8,29 +10,13 @@ * @var $viewFile string */ $file = getcwd() . '/cache/t.xlsx'; $file = getcwd() . '/cache/Téléchargement/OSE-calculHC-Rennes2-20211101.xlsx'; $sheet = 1; //$file = getcwd() . '/cache/test.ods'; //$sheet = 0; /* $document = new \Unicaen\OpenDocument\Document(); $document->loadFromFile($file); $s = $document->getCalc()->getSheet($sheet); //xmlDump($document->getContent()); $c = $s->getCell('BG15'); $rc = array_keys($s->getRefCells($c)); var_dump($rc); //echo $s->html(); */ $formule = '[.AG15]>=[.AF16]'; $fc = new \Application\Model\FormuleCalcul($file, 'TEST'); $d = $fc->getFormuleCells(); foreach ($formules as $f) { $formule = new \Unicaen\OpenDocument\Calc\Formule($f); $formule->analyse(); $formule->displayTerms(); $formule->displayExprs(); echo '<table class="table table-bordered">'; foreach ($d as $name => $cell) { echo '<tr><th>' . $name . '</th><td>' . htmlentities($cell->getFormule() ?? $cell->getValue()) . '</td></tr>'; } echo '</table>';
data/formules.php +1 −9 Original line number Diff line number Diff line <?php return [ 1 => [ 'LIBELLE' => 'Université de Caen (version 2016)', 'PACKAGE_NAME' => 'FORMULE_UNICAEN_2016', 'ACTIVE' => false, ], 2 => [ 'LIBELLE' => 'Université de Montpellier', 'PACKAGE_NAME' => 'FORMULE_MONTPELLIER', Loading Loading @@ -53,9 +48,6 @@ return [ 12 => [ 'LIBELLE' => 'Université de Poitiers', 'PACKAGE_NAME' => 'FORMULE_POITIERS', 'I_PARAM_1_LIBELLE' => 'Heures max. référentiel en service', 'I_PARAM_2_LIBELLE' => 'Heures max. référentiel en HC', 'I_PARAM_3_LIBELLE' => 'Heures max. enseignement en HC', ], 13 => [ 'LIBELLE' => 'Université Paris 8', Loading Loading @@ -84,7 +76,7 @@ return [ 'PACKAGE_NAME' => 'FORMULE_SORBONNE_NOUVELLE', ], 19 => [ 'LIBELLE' => 'Université de Caen (version 2021)', 'LIBELLE' => 'Université de Caen', 'PACKAGE_NAME' => 'FORMULE_UNICAEN', ], 20 => [ Loading
module/Application/src/Model/FormuleCalcul.php +4 −0 Original line number Diff line number Diff line Loading @@ -806,6 +806,7 @@ END FORMULE_" . $this->getName() . ";"; $isIf = false; foreach ($expr as $i => $term) { if ($term !== null) { if ($term['type'] === 'function' && $term['name'] === 'IF') { $isIf = true; } Loading @@ -815,6 +816,7 @@ END FORMULE_" . $this->getName() . ";"; $plsql .= '[PB TRADUCTION]'; } } } return $this->postReplace($plsql); } Loading Loading @@ -1038,6 +1040,7 @@ END FORMULE_" . $this->getName() . ";"; if (!empty($term['exprs'])) { $plExprs = []; foreach ($term['exprs'] as $e => $fExpr) { $fExpr[] = null; $plExprs[$e] = $this->traductionExpr($fExpr); } $plsql .= implode(' AND ', $plExprs); Loading @@ -1060,6 +1063,7 @@ END FORMULE_" . $this->getName() . ";"; if (!empty($term['exprs'])) { $plExprs = []; foreach ($term['exprs'] as $e => $fExpr) { $fExpr[] = null; $plExprs[$e] = $this->traductionExpr($fExpr); } $plsql .= implode(' OR ', $plExprs); Loading