Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: ReferenceHelper  - X-Ref

getInstance()   X-Ref
Get an instance of this class.

return: ReferenceHelper

__construct()   X-Ref
Create a new ReferenceHelper.


columnSort($a, $b)   X-Ref
Compare two column addresses
Intended for use as a Callback function for sorting column addresses by column.

param: string $a First column to test (e.g. 'AA')
param: string $b Second column to test (e.g. 'Z')
return: int

columnReverseSort($a, $b)   X-Ref
Compare two column addresses
Intended for use as a Callback function for reverse sorting column addresses by column.

param: string $a First column to test (e.g. 'AA')
param: string $b Second column to test (e.g. 'Z')
return: int

cellSort($a, $b)   X-Ref
Compare two cell addresses
Intended for use as a Callback function for sorting cell addresses by column and row.

param: string $a First cell to test (e.g. 'AA1')
param: string $b Second cell to test (e.g. 'Z1')
return: int

cellReverseSort($a, $b)   X-Ref
Compare two cell addresses
Intended for use as a Callback function for sorting cell addresses by column and row.

param: string $a First cell to test (e.g. 'AA1')
param: string $b Second cell to test (e.g. 'Z1')
return: int

adjustPageBreaks(Worksheet $worksheet, $numberOfColumns, $numberOfRows)   X-Ref
Update page breaks when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

adjustComments($worksheet)   X-Ref
Update cell comments when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing

adjustHyperlinks($worksheet, $numberOfColumns, $numberOfRows)   X-Ref
Update hyperlinks when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

adjustConditionalFormatting($worksheet, $numberOfColumns, $numberOfRows)   X-Ref
Update conditional formatting styles when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

adjustDataValidations(Worksheet $worksheet, $numberOfColumns, $numberOfRows)   X-Ref
Update data validations when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

adjustMergeCells(Worksheet $worksheet)   X-Ref
Update merged cells when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing

adjustProtectedCells(Worksheet $worksheet, $numberOfColumns, $numberOfRows)   X-Ref
Update protected cells when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

adjustColumnDimensions(Worksheet $worksheet)   X-Ref
Update column dimensions when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing

adjustRowDimensions(Worksheet $worksheet, $beforeRow, $numberOfRows)   X-Ref
Update row dimensions when inserting/deleting rows/columns.

param: Worksheet $worksheet The worksheet that we're editing
param: int $beforeRow Number of the row we're inserting/deleting before
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)

insertNewBefore(string $beforeCellAddress,int $numberOfColumns,int $numberOfRows,Worksheet $worksheet)   X-Ref
Insert a new column or row, updating all possible related data.

param: string $beforeCellAddress Insert before this cell address (e.g. 'A1')
param: int $numberOfColumns Number of columns to insert/delete (negative values indicate deletion)
param: int $numberOfRows Number of rows to insert/delete (negative values indicate deletion)
param: Worksheet $worksheet The worksheet that we're editing

updateFormulaReferences($formula = '',$beforeCellAddress = 'A1',$numberOfColumns = 0,$numberOfRows = 0,$worksheetName = '',bool $includeAbsoluteReferences = false)   X-Ref
No description

updateFormulaReferencesAnyWorksheet(string $formula = '', int $numberOfColumns = 0, int $numberOfRows = 0)   X-Ref
Update all cell references within a formula, irrespective of worksheet.


updateCellReferencesAllWorksheets(string $formula, int $numberOfColumns, int $numberOfRows)   X-Ref
No description

updateColumnRangesAllWorksheets(string $formula, int $numberOfColumns)   X-Ref
No description

updateRowRangesAllWorksheets(string $formula, int $numberOfRows)   X-Ref
No description

updateCellReference($cellReference = 'A1', bool $includeAbsoluteReferences = false)   X-Ref
Update cell reference.

param: string $cellReference Cell address or range of addresses
return: string Updated cell range

updateNamedFormulae(Spreadsheet $spreadsheet, $oldName = '', $newName = '')   X-Ref
Update named formulae (i.e. containing worksheet references / named ranges).

param: Spreadsheet $spreadsheet Object to update
param: string $oldName Old name (name to replace)
param: string $newName New name

updateDefinedNames(Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns, int $numberOfRows)   X-Ref
No description

updateNamedRange(DefinedName $definedName, Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns, int $numberOfRows)   X-Ref
No description

updateNamedFormula(DefinedName $definedName, Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns, int $numberOfRows)   X-Ref
No description

updateCellRange(string $cellRange = 'A1:A1', bool $includeAbsoluteReferences = false)   X-Ref
Update cell range.

param: string $cellRange Cell range    (e.g. 'B2:D4', 'B:C' or '2:3')
return: string Updated cell range

clearColumnStrips(int $highestRow, int $beforeColumn, int $numberOfColumns, Worksheet $worksheet)   X-Ref
No description

clearRowStrips(string $highestColumn, int $beforeColumn, int $beforeRow, int $numberOfRows, Worksheet $worksheet)   X-Ref
No description

clearStripCell(Worksheet $worksheet, string $coordinate)   X-Ref
No description

adjustAutoFilter(Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns)   X-Ref
No description

adjustAutoFilterDeleteRules(int $columnIndex, int $numberOfColumns, array $autoFilterColumns, AutoFilter $autoFilter)   X-Ref
No description

adjustAutoFilterInsert(int $startCol, int $numberOfColumns, int $rangeEnd, AutoFilter $autoFilter)   X-Ref
No description

adjustAutoFilterDelete(int $startCol, int $numberOfColumns, int $rangeEnd, AutoFilter $autoFilter)   X-Ref
No description

adjustTable(Worksheet $worksheet, string $beforeCellAddress, int $numberOfColumns)   X-Ref
No description

adjustTableDeleteRules(int $columnIndex, int $numberOfColumns, array $tableColumns, Table $table)   X-Ref
No description

adjustTableInsert(int $startCol, int $numberOfColumns, int $rangeEnd, Table $table)   X-Ref
No description

adjustTableDelete(int $startCol, int $numberOfColumns, int $rangeEnd, Table $table)   X-Ref
No description

duplicateStylesByColumn(Worksheet $worksheet, int $beforeColumn, int $beforeRow, int $highestRow, int $numberOfColumns)   X-Ref
No description

duplicateStylesByRow(Worksheet $worksheet, int $beforeColumn, int $beforeRow, string $highestColumn, int $numberOfRows)   X-Ref
No description

__clone()   X-Ref
__clone implementation. Cloning should not be allowed in a Singleton!