Documentation

Document generator

Document generator module creates and handes documents.

Before using the module, check if it is installed and connect it via the following structure:

\Bitrix\Main\Loader::includeModule('documentgenerator');

Class Description
Main classes
Body Parser class. Needed to access template content. Allows replacing placeholders with actual values.
Docx Descendant of class Body.
Docxxml Descendant of class Body.
DataProvider Abstract class for data provider. Classes that realises it, passes fields and values. The module has several base descendants of this class. Any DataProvider in one of its fields can return another DataProvider with nesting level unlimited.
EntityDataProvider Descendant of class DataProvider for handling ORM DAOs (data access objects) .
HashDataProvider Descendant of class DataProvider for handling simple providers on hash side.
ArrayDataProvider Descendant of class DataProvider. Provides access to array of values for single field.
DataProviderManager Singleton that stores provider hash. Collects methods for manipulating provider data - their initialization, data retrievals and etc.
Template Compares placeholders from file (Body) and how these placeholder's data can be retrieved. Rules for getting the data consist of (with increasing priority) field settings by default, placeholder settings by default (not used), placeholder settings for current template (not used).
Document Generates document instance or handles already existing document. Document is created based on template containing a file + field settings + main provider type. After that, field/placeholder values must be passed to the document. Now, document must be generated. It will be automatically saved in the document table after generation.
Helper classes
Storage Interface and set of classes responsible for access to file system. It's presented by three hierarchy levels: physical files, b_file and diskи. When disk is installed by default - files are always located there. When disk is not available - uses b_file instead.
Driver Singleton helper. Contains methods for agents.
getRegionsList() Method returns list of regions as an array. Key is regional code, value - array type.
[
    'CODE' => '',// regional code, matches with array code
    'TITLE' => '',// language-dependent region name (on current language)
    'LANGUAGE_ID' => '',// language ID
];
getCurrentRegion() Method returns the current region. Response is the same as in the method getRegionsList(), except that method has region array.
ORM-data access objects (DAOs) (in the folder \Bitrix\DocumentGenerator\Model\)
DocumentTable Document instances.
ExternalLinkTable Short links.
FieldTable Settings for redefining placeholders. Not used yet.
FileTable Module files. This class is also serves as middleware between interface Storage and database.
SpreadsheetTable Configurable tables. Not used yet.
TemplateTable Instances of installed templates.
TemplateProviderTable Template - provide link.
TemplateUserTable Template - access codes link.



© «Bitrix24», 2001-2022
Up