forked from PHPOffice/PHPWord
-
Notifications
You must be signed in to change notification settings - Fork 2
Table templae tags
Robert edited this page Nov 24, 2015
·
1 revision
private function getTableTags(array $data)
{
$tags = ['row' => [['clone' => '${lineRow}', 'rows' => 0]],
'tags' => []];
if (count($data) > 0) {
$i = 0;
foreach ($data as $key => $value) {
$i++;
$tags['tags']['${lineRow#'.$i.'}'] = '';
$tags['tags']['${lineCode#'.$i.'}'] =
htmlspecialchars($value['code'], ENT_COMPAT, 'UTF-8');
$tags['tags']['photos'][] = [
'tag' => '${linePhoto#'.$i.'}',
'replacement' => $value['photo_path']
];
$tags['row'][] = [
'clone' => '${lineTestCode#'.$i.'}',
'rows' => count($value['sub_data'])
];
$ii = 0;
foreach ($value['sub_data'] as $subKey => $subData) {
$ii++;
$tags['tags']['${lineTestCode#'.$i.'#'.$ii.'}'] =
htmlspecialchars($subData['sub_test_code'], ENT_COMPAT, 'UTF-8');
$tags['tags']['${lineTestDesc#'.$i.'#'.$ii.'}'] =
htmlspecialchars($remedyData['sub_test_desc'], ENT_COMPAT, 'UTF-8');
}
}
$tags['row'][0]['rows'] = $i;
}
return $tags;
}