Persons

Configure persons detail view pid

You can configure the pid where the detail view of persons records will be shown by setting the following constant

plugin.tx_highereducationpackage_personslisting.view.settings.detailPid = 11

If this is set, a link “Show Details” that points to the configured page will be rendered both in list and contact box plugin.

Do not allow to show all persons in one list

By default it is possible to show a list of all persons by setting the category mode to “Ignore” which then shows all persons in the frontend in one big list.

You may wish to disable that function for privacy reasons. You can do so by adding the following Page TSConfig.

# remove "show all" mode in persons listing
TCEFORM.tt_content.pi_flexform.highereducationpackage_personslisting.sDEF.settings\.categoryMode.removeItems = IGNORE
Persons category mode Persons Page TSConfig Persons category mode without ignore mode

Import persons from external xml file

You can import persons from a external xml file. A person can optional have one or more categories. If a person record already exists, it will be updated (including his categories). If a person record does not exist anymore in the import file, it will be deleted in the TYPO3 database (not only set to “hidden” and not only set to “deleted”). The import can be done with a scheduler task or console command.

Scheduler task

For a import scheduler task, there are a few (self-explanatory) options to consider:

Option

Description

Value

Mandatory

Default

Absolute path to the source file (XML)

the xml file to import

var/www/html/persons.xml

yes

Storage (PID) for person records

pid of sys folder for persons

7

yes

Comma separated list of fields to exclude for import

exclude fields from import

last_name, first_name

no

empty

Delete source file after successful import

delete the source file

false, true

no

true

Console command

Similar to the options above, you can can add these also to the console command. For further more information use:

vendor/bin/typo3cms higher_education_package:person --help

This will show you the help of the person import console command:

Usage:
higher_education_package:person [options]
higher_education_package:higher_education_package:person

Options:
-p, --path=PATH                              Absolute path to the source file (XML)
-s, --storage=STORAGE                        Storage (PID) for person records
-e, --excludeFieldList[=EXCLUDEFIELDLIST]    Comma separated list of fields to exclude for import [default: ""]
-d, --deleteAfterImport[=DELETEAFTERIMPORT]  Delete source file after successful import [default: false]
-h, --help                                   Display this help message
-q, --quiet                                  Do not output any message
--ansi                                   Force ANSI output
--no-ansi                                Disable ANSI output
-n, --no-interaction                         Do not ask any interactive question
-v|vv|vvv, --verbose                         Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
This will import persons from external xml file

Example file: person.xml

  • The xml file must contain a root node “persons”.

  • For each person data a node “person” must be included.

  • Each person data must contain a unique “identifier” string to ensure correct update and delete function.

  • Each person data can optional have a categories node with one or more category nodes inside

  • Each category data must contain a unique “identifier” string to ensure correct update and delete function.

  • Each field must be named after the name of the field in the database (eg. “first_name”).

<?xml version="1.0" encoding="UTF-8"?>
<persons>
        <person>
                <identifier>abc123</identifier>
                <last_name>Doe</last_name>
                <title_prefix>Dr.</title_prefix>
                <first_name>Jack</first_name>
                <title_suffix>M.A.</title_suffix>
                <function>Webmaster</function>
                <consultation_hour>Mondays, 1 pm - 3 pm</consultation_hour>
                <room>123</room>
                <building>ABC</building>
                <address><![CDATA[Example Street 1
        D-12345 Examplecity]]></address>
                <phone>+49 12345 6789</phone>
                <fax>+49 12345 6789</fax>
                <email>jack.doe@dummy.net</email>
                <personal_page></personal_page>
                <categories>
                        <category>
                                <identifier>catProf</identifier>
                                <title>Professor</title>
                        </category>
                        <category>
                                <identifier>catSo</identifier>
                                <title>Scientific Officer</title>
                        </category>
                </categories>
        </person>
        <person>
                <identifier>abc456</identifier>
                <last_name>Doe</last_name>
                <title_prefix>Dr.</title_prefix>
                <first_name>Jane</first_name>
                <title_suffix>MA</title_suffix>
                <function>Scientific Officer</function>
                <consultation_hour></consultation_hour>
                <room>987</room>
                <building>Campus 1</building>
                <address><![CDATA[Main Campus
        TYPO3 Street
        Universitytown]]></address>
                <phone>+49 123 456</phone>
                <fax>+49 123 456</fax>
                <email>jane.doe@domain.org</email>
                <personal_page>https://www.dummy.net</personal_page>
        </person>
</persons>

Warning

For security reasons, the import file must not be located under the web folder of your TYPO3 installation.

Logging

In case of failure during the import, you can activate a file logger to find out more informations. You find the responsible checkbox under extension settings, in a separate tab. The corresponding file is written to var/log/typo3_HigherEducationPackageTask_*.log. Optional you can choose a minimal log level, to differentiate between error and info messages.

Activate logging in extension configuration

Make person fields read-only

By default the person records are editable for users with corresponding permissions. You can set all fields to read-only if you don’t want person records to be editable at all by adding the following Page TSConfig.

# set person fields to "read-only"
TCEFORM.tx_highereducationpackage_domain_model_person {
        title_prefix.config.readOnly = 1
        first_name.config.readOnly = 1
        last_name.config.readOnly = 1
        title_suffix.config.readOnly = 1
        function.config.readOnly = 1
        consultation_hour.config.readOnly = 1
        address.config.readOnly = 1
        room.config.readOnly = 1
        building.config.readOnly = 1
        phone.config.readOnly = 1
        fax.config.readOnly = 1
        email.config.readOnly = 1
        personal_page.config.readOnly = 1
        categories.config.readOnly = 1
        starttime.config.readOnly = 1
        endtime.config.readOnly = 1
        sys_language_uid.config.readOnly = 1
        hidden.config.readOnly = 1
}

Note

Currently it’s not possible to set the fields “slug” and “image” to read-only this way, thus those fields aren’t included in the Page TSConfig above.