, (*1)
This module makes it possible to import OpenImmo-Data into an existing MetaModel., (*2)
Installation
The contents of the contao
folder needs to be placed within the folder system/modules/metamodels_openimmo/
, while the the src
folder needs to go to composer/anzui/metamodels_openimmo/src
., (*3)
Import the Template
You can save a lot of time and work by importing the pre-made template., (*4)
It consists of the MetaModel "immo" and pre-configured attributes and the corresponding MetaModel-OpenImmo link., (*5)
- In the Backend under "MetaModels - OpenImmo > Settings" select the MetaModels-Version you have installed.
- Hit "Import Template" and you will get a good starting point for your object catalog.
Warning: Importing the template will erase all of your existing MetaModels and MetaModels-OpenImmo links., (*6)
Usage
- Create your metamodel
- In the Backend under "MetaModels - OpenImmo > Links" add a new MetaModel-OpenImmo link
- Select the folder in which the object-data will be uploaded to by your Software
- Select the folder in which file attachments for object should be stored
- Link each field in your metamodel to an OpenImmo field.
- Setup the upload of your object data in your Software to upload the files in the directory you selected in step 3
Synchronising
- Trigger uploading of the data in your software
- In the Backend unter "MetaModels - OpenImmo > Links" click on the "sync" icon
- Select the data-file to sync, by default the oldest unsynced file will be selected
- hit the "Sync" button, if it is a zip file it gets unpacked and you must hit the "Sync" button again
- The data is now synced with your database
Automation
For each MetaModels-OpenImmo Link you can configure automatic syncing and deletion of old files., (*7)
This automation uses Contao's cron service. By default it requires the page to be called by any web browser regulary to work., (*8)
You can also setup Contao's cron service to be executed by your systems cron., (*9)
Field Callbacks
You can add a callback function to each field-link., (*10)
It will be passed the value from the XML, the field object, the immo-array, the xml tree, the current xpath and the metamodel attribute., (*11)
It must return the value to be set on the field., (*12)
public static function fieldCallback($value, $field_obj, &$immo, &$xml, $xpath, $metamodelAttribute)
{
...
return $value;
}
Hooks
MetaModels - OpenImmo provides a hook that is called for each item that will be synced with the database, (*13)
$GLOBALS['TL_HOOKS']['metaModelsOpenImmoSync'][] = array('MyClass', 'myMethod')
It gets passed an array containing all synced fields and the original XML tree for that particular object within the _xml_
key of the array., (*14)
It must return the array. Every modification you made to it will be stored in the database., (*15)