Ja:Inline Relational Record Editing 1:n
From TYPO3Wiki
| List Projects | The Inline Relational Record Editing-project list pages | See Current Project Members, Wishlist |
| you can help if you like! |
Contents |
??????????????
Inline Relational Record Editing ??? 1:n ?????????? "select" ???? TCEforms ???????????????????? 1:n ???????????????????????????????????? (?) ?????????????????
??????? Fig.1 ??? 2 ???????"company" ? "person" ?????????IRRE ??? 1:n ????????????
1:n ???????????????:
- ????? (????????????) ??????????? (??????????????) ????????????????????
- ??????????????????????
- ?????????????????????????????
- ??????????????????
????????????????
select ????????????????????????????????????????????? uid ???? 1 ????????????????? BLOB ??????????????????Fig.2 ?????"person" ????? uid ? "company" ????? "employees" ??????????????????????? uid ?????????????????????????????
company.employees = '13,18,21,35'
???????????????????????????????? IRRE ??????????????1:n ??????????? select ?????????????????????????? inline ?????????????????????
TCA ?????:
$TCA['company'] = Array(
'ctrl' => ...,
'interface' => ...,
'feInterface' => ...,
'columns' => Array(
'hidden' => ...,
'employees' => Array(
'exclude' => 1,
'label' => 'LLL:EXT:myextension/locallang_db.xml:company.employees',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person',
'maxitems' => 10,
'appearance' => Array(
'collapseAll' => 1,
'expandSingle' => 1,
),
),
),
),
'types' => ...
'palettes' => ...
);
????????????????????
?????????????????????????Fig.3 ???????????????? uid ???????????????????????????????????????????? uid ????????"company" ? "employees" ????????????????????????????????????2 ??????????????????????????????????????????????????????? pid ?????????????
???????????????? 1 ??????????? ("company") ?????????????????????"company" ?????? "association" ???????? "person" ????????????????????????? "company" ? "association" ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????? uid ????????TCA ? "foreign_field" ????????
????: company
| uid | pid | tstamp | crdate_int | cruser_id | deleted | hidden | title | employees |
| 2 | 4 | 1161354302 | 1161354302 | 1 | 0 | 0 | Big Company Corp. | 4 |
????: person
| uid | companyuid | pid | tstamp | crdate_int | cruser_id | deleted | hidden | firstname | lastname | birthdate |
| 13 | 2 | 4 | 1161354302 | 1161354302 | 1 | 0 | 0 | John | Doe | 1979-02-03 |
| 18 | 2 | 4 | 1161354302 | 1161354302 | 1 | 0 | 0 | Steve | Miller | 1977-07-13 |
| 21 | 2 | 4 | 1161354302 | 1161354302 | 1 | 0 | 0 | Jane | Kowalczcky | 1981-11-06 |
| 35 | 2 | 4 | 1161354302 | 1161354302 | 1 | 0 | 0 | Kate | McGuyver | 1982-08-30 |
TCA ?????:
$TCA['company'] = Array(
'ctrl' => ...,
'interface' => ...,
'feInterface' => ...,
'columns' => Array(
'hidden' => ...,
'employees' => Array(
'exclude' => 1,
'label' => 'LLL:EXT:myextension/locallang_db.xml:company.employees',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person',
'foreign_field' => 'companyuid',
'maxitems' => 10,
'appearance' => Array(
'collapseAll' => 1,
'expandSingle' => 1,
),
),
),
),
'types' => ...
'palettes' => ...
);
????????? TCA ?????????????????? foreign field ????????????? (??? type input)?TCEforms ?????? "foreign field" ?????????????????????? inline ????????????? uid ??????????????????????????
???? TCA ????? - ??????? "companyuid" ????????????????:
$TCA['person'] = Array(
...
'columns' => Array(
'companyuid' => Array(
...
'config' => Array(
'type' => 'input',
),
),
...
);
???????????????????? TCA ??????????????????? foreign_sortby ????????????????????????????????????????
sortby ??????????????????????????? (inline ??????????????????? sortby ??????????????):
- $TCA[<table>][<colums>][<field>]['config']['foreign_sortby']
- $TCA[<table>]['ctrl']['sortby']
- $TCA[<table>]['ctrl']['default_sortby']
?? 1 ???????????? foreign_label ??????inline ?????????? $TCA[<table>]['ctrl']['label'] ???????????????????????????????????????????????
TCA ?????:
$TCA['company'] = Array(
...
'columns' => Array(
'employees' => Array(
...
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person',
'foreign_field' => 'companyuid',
'foreign_sortby' => 'sorting',
'foreign_label' => 'lastname',
'maxitems' => 10,
'appearance' => Array(
'collapseAll' => 1,
'expandSingle' => 1,
),
),
),
),
...
);
????????????
???? "person" ? "company" ? "association" ??????????????????????????????????????????????????????????? MM ?????????????????????????? company_person_mm ? association_person_mm ??????????? 2 ?????????
??????????? "_mm" ???????????? MM ?????????????????????????????? 1:n ?????????????????"person" ???????????????????"person" ????????????? "company" ????? "association" ??????????????????
????: company_person_mm
| uid_local | uid_foreign | tablenames | sorting | sorting_foreign |
| 2 | 13 | 1 | ||
| 2 | 18 | 2 | ||
| 2 | 21 | 3 | ||
| 2 | 35 | 4 |
????: association_person_mm
| uid_local | uid_foreign | tablenames | sorting | sorting_foreign |
| 4 | 15 | 1 | ||
| 4 | 23 | 2 |
??????? inline ????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????? TCA ???????????????????????????????????? attributes ??????????????"person" ?????????????????????????????
TCA ?????:
$TCA['association'] = Array(
'ctrl' => ...,
'interface' => ...,
'feInterface' => ...,
'columns' => Array(
'hidden' => ...,
'members' => Array(
'exclude' => 1,
'label' => 'LLL:EXT:myextension/locallang_db.xml:association.members',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'association_person_mm',
'foreign_field' => 'uid_local',
'maxitems' => 10,
),
),
),
'types' => ...
'palettes' => ...
);
???????? inline ????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???"person" ?????????????????????????????????
TCA ?????:
$TCA['association'] = Array(
'ctrl' => ...,
'interface' => ...,
'feInterface' => ...,
'columns' => Array(
'hidden' => ...,
'members' => Array(
'exclude' => 1,
'label' => 'LLL:EXT:myextension/locallang_db.xml:association.members',
'config' => Array(
'type' => 'inline',
'foreign_table' => 'person',
'MM' => 'association_person_mm',
'maxitems' => 10,
'appearance' => Array(
'collapseAll' => 1,
'expandSingle' => 1,
),
),
),
),
'types' => ...
'palettes' => ...
);
