Returns the row in a datatable by its LabelFilter::FLAG_IS_ROW_EVOLUTION metadata.

@param DataTable $table
@param int $labelIdx
@return Row|false
761105
private function getRowEvolutionRowFromLabelIdx($table, $labelIdx)
    {
        $labelIdx = (int)$labelIdx;
        foreach ($table->getRows() as $row) {
            if ($row->getMetadata(LabelFilter::FLAG_IS_ROW_EVOLUTION) === $labelIdx) {
                return $row;
            }
        }
        return false;
    }
224507
public TableRow getRow(final Table table, final TableAppender appender, final int rowIndex)
            throws FastOdsException, IOException {
        TableBuilder.checkRow(rowIndex);
        return this.getRowSecure(table, appender, rowIndex, true);
    }
1172896
public static String getIndexTableName(String schema, String table)
    {
        return schema.equals("default") ? table + "_idx" : schema + '.' + table + "_idx";
    }
942746
private function createDataTableMapFromIndex($index, $resultIndices, $keyMetadata)
    {
        $result = new DataTable\Map();
        $result->setKeyName(reset($resultIndices));
        $resultIndex = key($resultIndices);

        array_shift($resultIndices);

        $hasIndices = !empty($resultIndices);

        foreach ($index as $label => $value) {
            $keyMetadata[$resultIndex] = $this->createTableIndexMetadata($resultIndex, $label);

            if ($hasIndices) {
                $newTable = $this->createDataTableMapFromIndex($value, $resultIndices, $keyMetadata);
            } else {
                $newTable = $this->createDataTable($value, $keyMetadata);
            }

            $result->addTable($newTable, $this->prettifyIndexLabel($resultIndex, $label));
        }

        return $result;
    }
418068
public function areColumnsNotAlreadyRenamed($table)
    {
        $period = $table->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);

        return !$period || $period->getLabel() === 'day';
    }
753809
@Override
    public DataSet filterBy(int[] labels) {
        List<DataSet> list = asList();
        List<DataSet> newList = new ArrayList<>();
        List<Integer> labelList = new ArrayList<>();
        for (int i : labels)
            labelList.add(i);
        for (DataSet d : list) {
            int outcome = d.outcome();
            if (labelList.contains(outcome)) {
                newList.add(d);
            }
        }

        return DataSet.merge(newList);
    }
1347043
public function filter($table)
    {
        // always do recursive filter
        $this->enableRecursive(true);
        $recurse = false; // only recurse if there are columns to remove/keep

        // remove columns specified in $this->columnsToRemove
        if (!empty($this->columnsToRemove)) {
            $this->removeColumnsFromTable($table);
            $recurse = true;
        }

        // remove columns not specified in $columnsToKeep
        if (!empty($this->columnsToKeep)) {
            foreach ($table as $index => $row) {
                $columnsToDelete = array();
                foreach ($row as $name => $value) {
                    $keep = false;

                    // @see self::APPEND_TO_COLUMN_NAME_TO_KEEP
                    foreach ($this->columnsToKeep as $nameKeep => $true) {
                        if (strpos($name, $nameKeep . self::APPEND_TO_COLUMN_NAME_TO_KEEP) === 0) {
                            $keep = true;
                        }
                    }

                    if (!$keep
                        && $name != 'label' // label cannot be removed via whitelisting
                        && !isset($this->columnsToKeep[$name])
                    ) {
                        // we cannot remove row directly to prevent notice "ArrayIterator::next(): Array was modified
                        // outside object and internal position is no longer valid in /var/www..."
                        $columnsToDelete[] = $name;
                    }
                }
                foreach ($columnsToDelete as $columnToDelete) {
                    unset($table[$index][$columnToDelete]);
                }
            }

            $recurse = true;
        }

        // recurse
        if ($recurse && !is_array($table)) {
            foreach ($table as $row) {
                $this->filterSubTable($row);
            }
        }

        return $table;
    }
371067
private function getDataSet($label, $data, $index = 0)
    {
        $set = $this->datasets[$index];
        $set['label'] = $label;
        $set['data'] = $data;

        return $set;
    }
901848
protected function handleGetMutatorColumn($method, $label)
    {
        if ($this->model()->eloquent()->hasGetMutator($method)) {
            return $this->addColumn($method, $label);
        }

        return false;
    }
374718
public function getLabel(int $labelId)
    {
        if ( ! $this->validateId($labelId)) {
            return false;
        }

        $result = $this->get('labels/' . $labelId);

        if (200 === $result->getStatusCode()) {
            return json_decode($result->getBody()->getContents());
        }

        return false;
    }
1213802
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period)
    {
        $currentLevel = & $index;

        foreach ($metadataNamesToIndexBy as $metadataName) {
            if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) {
                $key = $idSite;
            } elseif ($metadataName == DataTableFactory::TABLE_METADATA_PERIOD_INDEX) {
                $key = $period;
            } else {
                $key = $row[self::METADATA_CONTAINER_ROW_KEY][$metadataName];
            }

            if (!isset($currentLevel[$key])) {
                $currentLevel[$key] = array();
            }

            $currentLevel = & $currentLevel[$key];
        }

        $currentLevel = $row;
    }
316115
public function onLabelCallback(array $row, $label, DataContainer $dc, $attributes)
    {
        /** @var Image $imageAdapter */
        $imageAdapter = $this->framework->getAdapter(Image::class);

        // Align the icon with the text
        if (false !== \stripos($attributes, 'style="')) {
            $attributes = \str_replace('style="', 'style="vertical-align:text-top;', $attributes);
        } else {
            $attributes .= \trim($attributes.' style="vertical-align:text-top;"');
        }

        return $imageAdapter->getHtml('iconPLAIN.svg', '', $attributes).' '.$label;
    }
693061
protected function getBorderForCell($rowIndex, $columnIndex)
    {
        $cell = $this->_table->getCell($rowIndex, $columnIndex);
        $border = $cell->getBorder();
        if ($border === null) {
            $border = new PHPRtfLite_Border($this->_rtf);
            $cell->setCellBorder($border);
        }

        return $border;
    }
142640
public function getHeaderCode(\mpf\widgets\datatable\Table $table)
    {
        $label = $this->getLabel();
        if (!$this->order) {
            return $label;
        }
        $order = $this->dataProvider->getOrder();
        $prefix = '';

        $this->iconArrowUp = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), ($this->iconSize . 'x' . $this->iconSize)), $this->iconArrowUp);
        $this->iconArrowDown = str_replace(array('%DATATABLE_ASSETS%', '%SIZE%'), array($table->getAssetsURL(), ($this->iconSize . 'x' . $this->iconSize)), $this->iconArrowDown);
        if ('%MPF_ASSETS%' == substr($this->iconArrowUp, 0, 12)) {
            $this->iconArrowUp = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowUp, 12));
        }
        if ('%MPF_ASSETS%' == substr($this->iconArrowDown, 0, 12)) {
            $this->iconArrowDown = AssetsPublisher::get()->mpfAssetFile(substr($this->iconArrowDown, 12));
        }
        if ($order[0] == (is_string($this->order) ? $this->order : '`' . $this->name . '`')) {
            $prefix = ('ASC' == $order[1]) ? Html::get()->image($this->iconArrowUp, 'Order Descendent', ['class' => 'order-by-img']) : Html::get()->image($this->iconArrowDown, 'Order Ascendent', ['class' => 'order-by-img']);
        }
        return $this->dataProvider->getColumnOrderLink(is_string($this->order) ? $this->order : '`' . $this->name . '`', $prefix . $label);
    }
857595
public function getDataTables($label = null)
    {
        if ($label !== null) {
            return isset($this->extraTables[$label]) ?
                   $this->extraTables[$label] : array();
        }

        return $this->extraTables;
    }
796161
private function prettifyIndexLabel($labelType, $label)
    {
        if ($labelType == self::TABLE_METADATA_PERIOD_INDEX) { // prettify period labels
            $period = $this->periods[$label];
            $label = $period->getLabel();
            if ($label === 'week' || $label === 'range') {
                return $period->getRangeString();
            }

            return $period->getPrettyString();
        }
        return $label;
    }
564605
protected function getDataTablesColumn(DataTablesProviderInterface $dtProvider, $data) {

        $this->getLogger()->debug(sprintf("DataTables controller search for a column with name \"%s\"", $data));

        $dtColumn = $this->getDataTablesWrapper($dtProvider)->getColumn($data);
        if (null === $dtColumn) {
            throw new BadDataTablesColumnException($data);
        }

        $this->getLogger()->debug(sprintf("DataTables controller found a column with name \"%s\"", $data));

        return $dtColumn;
    }