MIGX. Добавление полей к каждой статье в контейнер
Здравствуйте. Есть сайт журнала. Установлен MODX 2.2.7, Articles 1.6.0. Для каждого выпуска журнала создается контейнер в Articles, в который добавляются статьи. Хочу сделать базу авторов, которые будут добавляться в каждую статью журнала. Каждый автор должен иметь причастность к Университету (соответственно, должен быть готовый их список). Помимо этого для каждого автора должны быть поля Фамилия, Инициалы, Адрес почты, Университет, Идентификатор ORCID. Сейчас я попробовал реализовать это через midxdb так:
XML:
Как быть в этой ситуации? Заранее благодарю.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<model package="authors" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="myAuthor" table="my_authors" extends="xPDOSimpleObject">
<field key="surname" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="initials" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="email" dbtype="text" phptype="string" null="false" default="" />
<field key="orcid" dbtype="text" phptype="string" null="false" default="" />
<field key="university" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="mod_user" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="resource_id" dbtype="int" precision="11" phptype="integer" null="false" default="0" />
<field key="resource_ids" dbtype="text" phptype="string" null="false" default="" />
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<aggregate alias="University" class="myUniversity" local="university" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="User" class="modUser" local="mod_user" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="Resource" class="modResource" local="resource_id" foreign="id" cardinality="one" owner="foreign" />
</object>
<object class="myUniversity" table="my_universities" extends="xPDOSimpleObject">
<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default=""/>
<field key="abb" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
<field key="address" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
<field key="country" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<composite alias="Authors" class="myAuthor" local="id" foreign="university" cardinality="many" owner="local" />
</object>
</model>
JSON:{
"formtabs":[
{
"MIGX_id":7,
"caption":"Info",
"print_before_tabs":"0",
"fields":[
{
"MIGX_id":23,
"field":"surname",
"caption":"\u0424\u0430\u043c\u0438\u043b\u0438\u044f",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":1
},
{
"MIGX_id":24,
"field":"initials",
"caption":"\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u044b",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":2
},
{
"MIGX_id":25,
"field":"email",
"caption":"\u041f\u043e\u0447\u0442\u0430",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"email",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":3
},
{
"MIGX_id":27,
"field":"university",
"caption":"\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442",
"description":"",
"description_is_code":"0",
"inputTV":"",
"inputTVtype":"listbox",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"@SELECT '' AS `name` ,'' AS `id` FROM `[[+PREFIX]]my_universities` UNION SELECT `name`,`id` FROM `[[+PREFIX]]my_universities` WHERE `deleted` = 0",
"default":"",
"useDefaultIfEmpty":"0",
"pos":4
},
{
"MIGX_id":28,
"field":"mod_user",
"caption":"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c",
"description":"",
"description_is_code":"0",
"inputTV":"select-user",
"inputTVtype":"",
"validation":"",
"configs":"",
"restrictive_condition":"",
"display":"",
"sourceFrom":"config",
"sources":"",
"inputOptionValues":"",
"default":"",
"useDefaultIfEmpty":"0",
"pos":5
}
],
"pos":1
}
],
"contextmenus":"update||recall_remove_delete",
"actionbuttons":"addItem||toggletrash",
"columnbuttons":"",
"filters":[
{
"MIGX_id":1,
"name":"search",
"label":"search",
"emptytext":"Seatch bu surname...",
"type":"textbox",
"getlistwhere":{
"surname:LIKE":"%[[+search]]%",
"OR:university:LIKE":"%[[+search]]%"
},
"getcomboprocessor":"",
"combotextfield":"",
"comboidfield":"",
"comboparent":"",
"default":""
}
],
"extended":{
"migx_add":"",
"disable_add_item":"",
"add_items_directly":"",
"formcaption":"",
"update_win_title":"",
"win_id":"authors",
"maxRecords":"",
"addNewItemAt":"bottom",
"multiple_formtabs":"",
"multiple_formtabs_label":"",
"multiple_formtabs_field":"",
"multiple_formtabs_optionstext":"",
"multiple_formtabs_optionsvalue":"",
"actionbuttonsperrow":4,
"winbuttonslist":"",
"extrahandlers":"",
"filtersperrow":4,
"packageName":"authors",
"classname":"myAuthor",
"task":"",
"getlistsort":"",
"getlistsortdir":"",
"sortconfig":"",
"gridpagesize":"",
"use_custom_prefix":"0",
"prefix":"",
"grid":"",
"gridload_mode":1,
"check_resid":1,
"check_resid_TV":"",
"join_alias":"",
"has_jointable":"yes",
"getlistwhere":"",
"joins":[
{
"alias":"University",
"selectfields":"name"
}
],
"hooksnippets":"",
"cmpmaincaption":"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0411\u0414 \u005c\u0022\u0410\u0432\u0442\u043e\u0440\u044b\u002c \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u044b\u005c",
"cmptabcaption":"\u0410\u0432\u0442\u043e\u0440\u044b",
"cmptabdescription":"\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u043e\u0432",
"cmptabcontroller":"",
"winbuttons":"",
"onsubmitsuccess":"",
"submitparams":""
},
"columns":[
{
"MIGX_id":2,
"header":"id",
"dataIndex":"id",
"width":"",
"sortable":"false",
"show_in_grid":"0",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":1,
"header":"\u0424\u0430\u043c\u0438\u043b\u0438\u044f",
"dataIndex":"surname",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":6,
"header":"\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u044b",
"dataIndex":"initials",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":5,
"header":"\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442",
"dataIndex":"University_name",
"width":"",
"sortable":"false",
"show_in_grid":1,
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":3,
"header":"deleted",
"dataIndex":"deleted",
"width":"",
"sortable":"false",
"show_in_grid":"0",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
},
{
"MIGX_id":4,
"header":"published",
"dataIndex":"published",
"width":"",
"sortable":"false",
"show_in_grid":"0",
"renderer":"",
"clickaction":"",
"selectorconfig":"",
"renderchunktpl":"",
"renderoptions":"",
"editor":""
}
]
}
База данных создалась. Есть таблица, в котору я могу добавлять авторов. Я не знаю как реализовать добавление каждого отдельного автора из таблицы в конкретную статью из контейнера. При добавлении TV MIGXDB таблица появляется и в нее можно добавить новых авторов, но нельзя добавить их причастность к конкретной статье. Так же таблица вовсе не выводиться при «check_resid»:1.Как быть в этой ситуации? Заранее благодарю.