Return translated consumable effects from $sheet for quality.
$sheet can be either string sheet id or item array from ryzom_item_info()

@param string|array $sheet
@param int $quality
@param string $lang

@return array
972812
static function consumable_effects($sheet, $quality, $lang)
    {
        if (!is_array($sheet)) {
            $sheet = ryzom_item_info($sheet);
        }

        if ($sheet === false || empty($sheet['properties'])) {
            return array();
        }

        $effects = array();
        foreach ($sheet['properties'] as $property) {
            $params = explode(':', $property);
            if (empty($params)) {
                continue;
            }

            $name = strtoupper(array_shift($params));
            switch ($name) {
                case 'SP_CHG_CHARAC':
                    if (isset(self::$characteristic_to_int[strtolower($params[0])])) {
                        $ui = ryzom_translate('uiCaracId' . self::$characteristic_to_int[strtolower($params[0])] . '.uxt', $lang);
                        $bonus = (int)($params[1] * $quality + $params[2]);
                        $time = (int)$params[3];
                        if ($bonus > 0) {
                            $tt = ryzom_translate('uiItemConsumableEffectUpCharac.uxt', $lang);
                        } else {
                            $tt = ryzom_translate('uiItemConsumableEffectDownCharac.uxt', $lang);
                        }

                        $effects[] = strtr($tt, array(
                            '%charac' => $ui,
                            '%bonus' => $bonus,
                            '%minutes' => (int)($time / 60),
                            '%secondes' => (int)($time % 60),
                        ));
                    }
                    break;
                case 'SP_LIFE_AURA':
                case 'SP_LIFE_AURA2':
                case 'SP_STAMINA_AURA':
                case 'SP_STAMINA_AURA2':
                case 'SP_SAP_AURA':
                case 'SP_SAP_AURA2':
                    $uiKeys = array(
                        'SP_LIFE_AURA' => 'uiItemConsumableEffectLifeAura.uxt',
                        'SP_LIFE_AURA2' => 'uiItemConsumableEffectLifeAura.uxt',
                        'SP_STAMINA_AURA' => 'uiItemConsumableEffectStaminaAura.uxt',
                        'SP_STAMINA_AURA2' => 'uiItemConsumableEffectStaminaAura.uxt',
                        'SP_SAP_AURA' => 'uiItemConsumableEffectSapAura.uxt',
                        'SP_SAP_AURA2' => 'uiItemConsumableEffectSapAura.uxt',
                    );

                    $tt = ryzom_translate($uiKeys[$name], $lang);

                    if (substr($name, -1) == '2') {
                        $params[0] *= $quality;
                        $params[3] = 0;
                        $params[4] = 0;
                    }
                    $effects[] = strtr($tt, array(
                        '%modifier' => (int)$params[0],
                        '%minutes' => (int)($params[1] / 60),
                        '%secondes' => (int)($params[1] % 60),
                        '%radius' => (int)$params[2],
                        '%targetDisableTime' => (int)$params[3],
                        '%userDisableTime' => (int)$params[4],
                    ));
                    break;
                case 'SP_MOD_DEFENSE':
                case 'SP_MOD_MELEE_SUCCESS':
                case 'SP_MOD_RANGE_SUCCESS':
                case 'SP_MOD_MAGIC_SUCCESS':
                case 'SP_MOD_CRAFT_SUCCESS':
                case 'SP_MOD_FORAGE_SUCCESS':
                    $array = array(
                        'SP_MOD_DEFENSE_SUCCESS' => array(
                            0 => 'uiItemConsumableEffectModDefenseSuccess.uxt',
                            'dodge' => 'uiItemConsumableEffectModDodgeSuccess.uxt',
                            'parry' => 'uiItemConsumableEffectModParrySuccess.uxt',
                        ),
                        'SP_MOD_MELEE_SUCCESS' => 'uiItemConsumableEffectModMeleeSuccess.uxt',
                        'SP_MOD_RANGE_SUCCESS' => 'uiItemConsumableEffectModRangeSuccess.uxt',
                        'SP_MOD_MAGIC_SUCCESS' => 'uiItemConsumableEffectModMagicSuccess.uxt',
                        'SP_MOD_CRAFT_SUCCESS' => 'uiItemConsumableEffectModCraftSuccess.uxt',
                        'SP_MOD_FORAGE_SUCCESS' => array(
                            'commonecosystem' => 'uiItemConsumableEffectModForageSuccess.uxt',
                            'desert' => 'uiItemConsumableEffectModDesertForageSuccess.uxt',
                            'forest' => 'uiItemConsumableEffectModForestForageSuccess.uxt',
                            'lacustre' => 'uiItemConsumableEffectModLacustreForageSuccess.uxt',
                            'jungle' => 'uiItemConsumableEffectModJungleForageSuccess.uxt',
                            'primaryroot' => 'uiItemConsumableEffectModPrimaryRootForageSuccess.uxt',
                        ),
                    );
                    if (isset($array[$name])) {
                        $tt = $array[$name];
                        $index = 0;
                        if (is_array($tt)) {
                            if (isset($tt[strtolower($params[0])])) {
                                $tt = $tt[strtolower($params[0])];
                            } else if (isset($tt[0])) {
                                $tt = $tt[0];
                            } else {
                                $tt = false;
                            }
                            $index = 1;
                        }
                        if ($tt !== false) {
                            $tt = ryzom_translate($tt, $lang);
                            $effects[] = strtr($tt, array(
                                '%modifier' => ($params[$index] * $quality + $params[$index + 1]),
                                '%minutes' => (int)($params[$index + 2] / 60),
                                '%secondes' => (int)($params[$index + 2] % 60),
                            ));
                        }
                    }
                    break;
                default:
                    //
                    break;
            }
        }

        return $effects;
    }
349074
protected function doRead(
        string $file,
        string $sheet,
        string $range,
        int $offset = ClientInterface::DEFAULT_OFFSET,
        int $limit = ClientInterface::DEFAULT_LIMIT
    ): array {
        try {
            $range = $this->getPageRange($range, $offset, $limit);
            $googleFile = $this->googleServiceSheets->spreadsheets_values->get(
                $file,
                $this->getTableRange($sheet, $range)
            );

            return $googleFile->getValues();
        } catch (\Google_Exception $e) {
            throw new ReadRequestFailedException(
                "Failed reading data from GoogleSpreadsheet (file: {$file}, sheet: {$sheet}, table: {$range}).",
                500,
                $e
            );
        }
    }
763043
public function getCssStyle($row, $col, $sheet=0)
    {
        $css = "";
        $font = $this->font($row, $col, $sheet);
        if ($font != "") {
            $css .= "font-family:$font;";
        }
        $align = $this->align($row, $col, $sheet);
        if ($align != "") {
            $css .= "text-align:$align;";
        }
        $height = $this->height($row, $col, $sheet);
        if ($height != "") {
            $css .= "font-size:$height" . "pt;";
        }
        $bgcolor = $this->bgColor($row, $col, $sheet);
        if ($bgcolor != "") {
            $bgcolor = $this->colors[$bgcolor];
            $css .= "background-color:$bgcolor;";
        }
        $color = $this->color($row, $col, $sheet);
        if ($color != "") {
            $css .= "color:$color;";
        }
        $bold = $this->bold($row, $col, $sheet);
        if ($bold) {
            $css .= "font-weight:bold;";
        }
        $italic = $this->italic($row, $col, $sheet);
        if ($italic) {
            $css .= "font-style:italic;";
        }
        $underline = $this->underline($row, $col, $sheet);
        if ($underline) {
            $css .= "text-decoration:underline;";
        }
        // Borders
        $bLeft = $this->borderLeft($row, $col, $sheet);
        $bRight = $this->borderRight($row, $col, $sheet);
        $bTop = $this->borderTop($row, $col, $sheet);
        $bBottom = $this->borderBottom($row, $col, $sheet);
        $bLeftCol = $this->borderLeftColor($row, $col, $sheet);
        $bRightCol = $this->borderRightColor($row, $col, $sheet);
        $bTopCol = $this->borderTopColor($row, $col, $sheet);
        $bBottomCol = $this->borderBottomColor($row, $col, $sheet);
        // Try to output the minimal required style
        if ($bLeft != "" && $bLeft == $bRight && $bRight == $bTop && $bTop == $bBottom) {
            $css .= "border:" . $this->lineStylesCss[$bLeft] . ";";
        } else {
            if ($bLeft != "") {
                $css .= "border-left:" . $this->lineStylesCss[$bLeft] . ";";
            }
            if ($bRight != "") {
                $css .= "border-right:" . $this->lineStylesCss[$bRight] . ";";
            }
            if ($bTop != "") {
                $css .= "border-top:" . $this->lineStylesCss[$bTop] . ";";
            }
            if ($bBottom != "") {
                $css .= "border-bottom:" . $this->lineStylesCss[$bBottom] . ";";
            }
        }
        // Only output border colors if there is an actual border specified
        if ($bLeft != "" && $bLeftCol != "") {
            $css .= "border-left-color:" . $bLeftCol . ";";
        }
        if ($bRight != "" && $bRightCol != "") {
            $css .= "border-right-color:" . $bRightCol . ";";
        }
        if ($bTop != "" && $bTopCol != "") {
            $css .= "border-top-color:" . $bTopCol . ";";
        }
        if ($bBottom != "" && $bBottomCol != "") {
            $css .= "border-bottom-color:" . $bBottomCol . ";";
        }

        return $css;
    }
668273
public function getIndex(PHPExcel_Worksheet $pSheet)
    {
        foreach ($this->workSheetCollection as $key => $value) {
            if ($value->getHashCode() == $pSheet->getHashCode()) {
                return $key;
            }
        }

        throw new PHPExcel_Exception("Sheet does not exist.");
    }
340975
private <P> SheetBindingErrors<P> loadSheet(final Sheet sheet, final Class<P> clazz, final AnnotationReader annoReader)
            throws XlsMapperException {

        // 値の読み込み対象のJavaBeanオブジェクトの作成
        final P beanObj = configuration.createBean(clazz);

        final SheetBindingErrors<P> errors =  configuration.getBindingErrorsFactory().create(beanObj);
        errors.setSheetName(sheet.getSheetName());
        errors.setSheetIndex(sheet.getWorkbook().getSheetIndex(sheet));

        final LoadingWorkObject work = new LoadingWorkObject();
        work.setAnnoReader(annoReader);
        work.setErrors(errors);

        // セルのキャッシュ情報の初期化
        configuration.getCellFormatter().init(configuration.isCacheCellValueOnLoad());

        final FieldAccessorFactory adpterFactory = new FieldAccessorFactory(annoReader);

        // リスナークラスの@PreLoad用メソッドの実行
        final XlsListener listenerAnno = annoReader.getAnnotation(beanObj.getClass(), XlsListener.class);
        if(listenerAnno != null) {
            for(Class<?> listenerClass : listenerAnno.value()) {
                final Object listenerObj = configuration.createBean(listenerClass);

                for(Method method : listenerObj.getClass().getMethods()) {
                    if(annoReader.hasAnnotation(method, XlsPreLoad.class)) {
                        Utils.invokeNeedProcessMethod(listenerObj, method, beanObj, sheet, configuration, work.getErrors(), ProcessCase.Load);
                    }
                }
            }

        }

        // @PreLoad用のメソッドの実行
        for(Method method : clazz.getMethods()) {

            if(annoReader.hasAnnotation(method, XlsPreLoad.class)) {
                Utils.invokeNeedProcessMethod(beanObj, method, beanObj, sheet, configuration, work.getErrors(), ProcessCase.Load);
            }
        }

        final List<FieldAccessorProxy> accessorProxies = new ArrayList<>();

        // public メソッドの処理
        for(Method method : clazz.getMethods()) {
            method.setAccessible(true);
            for(Annotation anno : annoReader.getAnnotations(method)) {
                final XlsFieldProcessor annoFieldProcessor = anno.annotationType().getAnnotation(XlsFieldProcessor.class);
                if(ClassUtils.isAccessorMethod(method) && annoFieldProcessor != null) {
                    // 登録済みのFieldProcessorの取得
                    FieldProcessor<?> processor = configuration.getFieldProcessorRegistry().getProcessor(anno.annotationType());

                    // アノテーションに指定されているFieldProcessorの場合
                    if(processor == null && annoFieldProcessor.value().length > 0) {
                        processor = configuration.createBean(annoFieldProcessor.value()[0]);

                    }

                    if(processor != null) {
                        final FieldAccessor accessor = adpterFactory.create(method);
                        final FieldAccessorProxy accessorProxy = new FieldAccessorProxy(anno, processor, accessor);
                        if(!accessorProxies.contains(accessorProxy)) {
                            accessorProxies.add(accessorProxy);
                        }

                    } else {
                        // FieldProcessorが見つからない場合
                        throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.XlsFieldProcessor.notResolve")
                                .varWithAnno("anno", anno.annotationType())
                                .format());
                    }

                }

                if(anno instanceof XlsPostLoad) {
                    work.addNeedPostProcess(new NeedProcess(beanObj, beanObj, method));
                }
            }

        }

        // フィールドの処理
        for(Field field : clazz.getDeclaredFields()) {

            field.setAccessible(true);
            for(Annotation anno : annoReader.getAnnotations(field)) {

                final XlsFieldProcessor annoFieldProcessor = anno.annotationType().getAnnotation(XlsFieldProcessor.class);
                if(annoFieldProcessor != null) {

                    // 登録済みのFieldProcessorの取得
                    FieldProcessor<?> processor = configuration.getFieldProcessorRegistry().getProcessor(anno.annotationType());

                    // アノテーションに指定されているFieldProcessorの場合
                    if(processor == null && annoFieldProcessor.value().length > 0) {
                        processor = configuration.createBean(annoFieldProcessor.value()[0]);

                    }

                    if(processor != null) {
                        final FieldAccessor accessor = adpterFactory.create(field);
                        final FieldAccessorProxy accessorProxy = new FieldAccessorProxy(anno, processor, accessor);
                        if(!accessorProxies.contains(accessorProxy)) {
                            accessorProxies.add(accessorProxy);
                        }

                    } else {
                        // FieldProcessorが見つからない場合
                        throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.XlsFieldProcessor.notResolve")
                                .varWithAnno("anno", anno.annotationType())
                                .format());
                    }

                }


            }
        }

        // 順番を並び替えて保存処理を実行する
        Collections.sort(accessorProxies, new FieldAccessorProxyComparator());
        for(FieldAccessorProxy accessorProxy : accessorProxies) {
            accessorProxy.loadProcess(sheet, beanObj, configuration, work);
        }

        // リスナークラスの@PostLoadの取得
        if(listenerAnno != null) {
            for(Class<?> listenerClass : listenerAnno.value()) {
                Object listenerObj = configuration.createBean(listenerClass);
                for(Method method : listenerObj.getClass().getMethods()) {
                    if(annoReader.hasAnnotation(method, XlsPostLoad.class)) {
                        work.addNeedPostProcess(new NeedProcess(beanObj, listenerObj, method));
                    }
                }
            }

        }

        //@PostLoadが付与されているメソッドの実行
        for(NeedProcess need : work.getNeedPostProcesses()) {
            Utils.invokeNeedProcessMethod(need.getProcess(), need.getMethod(), need.getTarget(), sheet, configuration, work.getErrors(), ProcessCase.Load);
        }

        // セルのキャッシュ情報の初期化
        configuration.getCellFormatter().init(configuration.isCacheCellValueOnLoad());

        return errors;
    }
440472
def get_sheet_index(sheet_name)
    ruby_19 { sheet_name = convert_to_ascii_if_ascii(sheet_name) }

    # Handle utf8 sheetnames
    if is_utf8?(sheet_name)
      ruby_18 { sheet_name = utf8_to_16be(sheet_name) } ||
      ruby_19 { sheet_name = sheet_name.encode('UTF-16BE') }
    end

    if @ext_sheets[sheet_name].nil?
      raise "Unknown sheet name '#{sheet_name}' in formula\n"
    else
      return @ext_sheets[sheet_name]
    end
  end
128784
public function getFillFormat($chartIndex)
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() . '/worksheets/' . $this->worksheetName . '/charts/' . $chartIndex . '/chartArea/fillFormat';
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        return $json->FillFormat;
    }
936965
protected function getCellOptions($options)
    {
        $cellOptions = $options['cell-options'];

        $inheritableOptions = $this->getInheritableOptions();

        foreach ($inheritableOptions as $inheritableOption) {
            $cellOptions[$inheritableOption] =
                isset($cellOptions[$inheritableOption])
                ? $cellOptions[$inheritableOption]
                : $options[$inheritableOption];
        }

        if (isset($cellOptions['translate_content']) && $cellOptions['translate_content']) {
            $cellOptions['translator'] = $this->translator;
        }

        return $cellOptions;
    }
4397
public function get($string = null, $range = '') {
        if($range) {
            $value = isset($this->range[$range][$string]) ? $this->range[$range][$string] : $string;
        }
        else {
            $value = isset($this->lang[$string]) ? $this->lang[$string] : $string;
        }

        return $value;
    }
691236
static function getList ($lang)
    {
        global $config;
        $query = sprintf(
            file_get_contents('sql/getListPages.sql'),
            mysql_real_escape_string($lang)
        );
        $query=$config->connexionBdd->requete($query);
        $result=array();
        while ($row = mysql_fetch_assoc($query)) {
            array_push($result, $row);
        }
        return $result;
    }
834392
public static function loadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheet) {

        $directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);

        // no user style sheet has been created yet
        $file = $directory->getFile($styleSheet);
        if (! $file->exists()) {
            \common_Logger::d('Stylesheet ' . $styleSheet . ' does not exist yet, returning empty array');
            return array();
        }

        return self::cssToArray($file->read());
    }
1286376
public static function downloadCssFile(\core_kernel_classes_resource $item, $lang, $styleSheetPath){

        $directory = \taoItems_models_classes_ItemsService::singleton()->getItemDirectory($item, $lang);
        $file = $directory->getFile($styleSheetPath);
        if ($file->exists()) {
            return $file->read();
        }
        return null;
    }
888204
function export(array $data, $sheet) {
		$groups = array();

		// split full list into separate files
		// reading them back in is a lot faster this way
		foreach ($data as $id => $array) {
			$key = floor($id / 1000000);
			$groups[$key][$id] = $array['name'].'.'.$array['sheet'];
		}

		$ext = $this->encoder->name();
		foreach ($groups as $key => $array) {
			$idx = sprintf("%02x", $key);
			$filename = "{$this->path}/{$sheet}-{$idx}.{$ext}";
			file_put_contents($filename, $this->encoder->encode($array));
		}
	}
327903
private function parse_definition( $objPHPExcel, $sheetIndex = 0 ){
		$rtn = array();
		$objPHPExcel->setActiveSheetIndex($sheetIndex);
		$objSheet = $objPHPExcel->getActiveSheet();

		parse_str( $objSheet->getCell('A1')->getCalculatedValue(), $rtn );

		$rtn['tbl_highest_row'] = $objSheet->getHighestRow(); // e.g. 10
		$rtn['tbl_highest_col_name'] = $objSheet->getHighestColumn(); // e.g 'F'
		$rtn['tbl_highest_col'] = \PHPExcel_Cell::columnIndexFromString( $rtn['tbl_highest_col_name'] ); // e.g. 5

		$rtn['row_definition'] = @intval($rtn['row_definition']);
		$rtn['row_data_start'] = @intval($rtn['row_data_start']);
		if( !@strlen($rtn['skip_empty_col']) ){
			// 省略されていた場合にデフォルト値を与える
			$rtn['skip_empty_col'] = 20;
		}
		$rtn['skip_empty_col'] = intval($rtn['skip_empty_col']);

		$rtn['col_define'] = array();

		$mergedCells = $objSheet->getMergeCells();
		$mergeInfo = array();
		foreach( $mergedCells as $mergeRow ){
			if( preg_match( '/^([a-zA-Z]+)'.$rtn['row_definition'].'\:([a-zA-Z]+)'.$rtn['row_definition'].'$/', $mergeRow, $matched ) ){
				$mergeInfo[$matched[1]] = $matched[2];
			}
		}

		$col = 'A';
		$skip_count = 0;
		while(1){
			$def_key = $objSheet->getCell($col.$rtn['row_definition'])->getCalculatedValue();
			if(!strlen($def_key)){
				$skip_count ++;
				$col ++;
				if( $skip_count > $rtn['skip_empty_col'] ){
					break;
				}
				continue;
			}
			$skip_count = 0;

			$rtn['col_define'][$def_key] = array(
				'key'=>trim($def_key),
				'col'=>$col,
				// 'name'=>$def_name,
			);

			if( @strlen($mergeInfo[$col]) ){
				$mergeStartCol = $mergeInfo[$col];
				while( strcmp($mergeStartCol, $col) ){
					$col ++;
				}
			}else{
				$col ++;
			}
		}

		return $rtn;
	}
1274952
protected function addRow(
        PHPExcel_Worksheet &$sheet,
        DataObjectInterface $item,
        array $fields
    ) {
        $row = $sheet->getHighestRow() + 1;
        $col = 0;

        foreach ($fields as $field => $type) {
            if ($item->hasField($field) || $item->hasMethod("get{$field}")) {
                $value = $item->$field;
            } else {
                $viewer = SSViewer::fromString('$' . $field . '.RAW');
                $value = $item->renderWith($viewer, true);
            }
            $sheet->setCellValueByColumnAndRow($col, $row, $value);
            $col++;
        }

        return $sheet;
    }
780204
public function sheetToAlpha($sheet)
  {
    $fixed_sheet=false;
    foreach ($sheet as $key => $value) {
      foreach ($value as $value_key => $value_value) {
        unset($value[$value_key]);
        $value[$this->numToAlpha($value_key)]=$value_value;
      }
      unset($sheet[$key]);
      $fixed_sheet[$key+1]=$value;
    }
    return $fixed_sheet;
  }
537260
public function getSinglelangFields($table, $lang)
    {
        $langTable = getLangTableName($table, $lang);

        $baseFields = $this->getFields($table);
        $langFields = $this->getFields($langTable);

        //Some fields (for example OXID) must be taken from core table.
        $langFields = $this->filterCoreFields($langFields);

        $fields = array_merge($baseFields, $langFields);
        $singleLangFields = [];

        foreach ($fields as $fieldName => $field) {
            if (preg_match("/(({$table}|{$langTable})\.)?(?<field>.+)_(?<lang>[0-9]+)$/", $field, $matches)) {
                if ($matches['lang'] == $lang) {
                    $singleLangFields[$matches['field']] = $field;
                }
            } else {
                $singleLangFields[$fieldName] = $field;
            }
        }

        return $singleLangFields;
    }