Пример #1
0
 public function getRuleTable($sRuleOptionName = 'option')
 {
     $aFormatedRule = array();
     foreach ($this->aRawRuleList as $aRawRule) {
         $sTableId = $aRawRule[0];
         $sEnding = $aRawRule[1];
         $aDeclensionList = array();
         $sPreviousOption = '';
         $sCurrentOption = '';
         for ($i = 2, $iLength1 = count($aRawRule); $i < $iLength1; $i++) {
             $sValue = $aRawRule[$i][0];
             $aOptionList = array('val' => $sValue);
             $sCurrentOption = Conversion::getJsonFromArray($aOptionList);
             for ($j = 1, $iLength2 = count($aRawRule[$i]); $j < $iLength2; $j++) {
                 $sInformation = $aRawRule[$i][$j];
                 $sFeatureClass = $this->oDmConverter->getClassName($sInformation);
                 if (!is_null($sFeatureClass) && !empty($sFeatureClass)) {
                     $sFeatureValue = $this->oDmConverter->getProperName($sInformation);
                     $aOptionList[$sFeatureClass] = $sFeatureValue;
                     $sCurrentOption .= $sFeatureClass . $sFeatureValue;
                 } else {
                     echo 'Traduction manquante : ';
                     // DEBUG ONLY
                     var_dump($sInformation);
                     echo '<br />';
                     //                        die;
                 }
             }
             if ($sPreviousOption !== $sCurrentOption) {
                 $aDeclensionList[] = $aOptionList;
                 $sPreviousOption = $sCurrentOption;
             }
         }
         $aFormatedRule[$sTableId] = array('ending' => $sEnding, $sRuleOptionName => $aDeclensionList);
     }
     return $aFormatedRule;
 }
Пример #2
0
<?php

ini_set('max_execution_time', 90);
ob_start();
header('Content-Type: text/html; charset=utf-8');
/*** error reporting ***/
error_reporting(-1);
ini_set('display_errors', 'On');
/*** error reporting ***/
define('REAL_PATH_ROOT', realpath('./') . '/');
require_once REAL_PATH_ROOT . 'autoloader.php';
try {
    $oJSRealService = new JSRealFrService("fr");
    $aExportedFile = $oJSRealService->export();
    $sOutput = Conversion::getJsonFromArray(array_merge(array('bSuccess' => true), $aExportedFile));
} catch (Exception $ex) {
    $sOutput = Conversion::getJsonFromArray(array('bSuccess' => false, 'sErrorMessage' => $e->getMessage(), 'iErrorCode' => $e->getCode()));
}
//ob_end_clean();
echo $sOutput;
Пример #3
0
 private function exportToJson($sJsonFilePath, array $aData, $bCompress = false)
 {
     $sNewJsonContent = Conversion::getJsonFromArray($aData, $bCompress);
     if (Filesystem::put($sJsonFilePath, $sNewJsonContent) !== false) {
         return Filesystem::name($sJsonFilePath) . '.' . Filesystem::extension($sJsonFilePath);
     } else {
         throw new FileNotCreatedException('File : ' . $sJsonFilePath);
     }
 }