美好的一天。有一个期刊网站。安装MODX 2.2.7,文章1.6.0,MIDX最新。对于期刊的每期,在“文章”中创建一个容器,向其添加文章。我想建立一个作者数据库,将其添加到期刊的不同文章中。每位作者都应该参与大学(因此,必须有一份现成的清单)。此外,对于每个作者,必须有字段姓氏,缩写,电子邮件,大学,ORCID。现在我尝试通过midxdb实现它:
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":""
}
]
}
数据库已创建。在显示电视时,有一个表格,我可以在其中添加作者。我不知道如何实现从表中将每个单独的作者添加到容器中的特定文章。此外,该表不会显示“check_resid”:1。在DB中,添加作者后,他的resource_id - 0。
如何解决此问题?提前谢谢!