本文整理汇总了PHP中Family::hasField方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::hasField方法的具体用法?PHP Family::hasField怎么用?PHP Family::hasField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Family
的用法示例。
在下文中一共展示了Family::hasField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$fp = fopen('php://output', 'w');
header('Content-type: application/force-download');
header("Content-Type: application/download");
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="jethro_' . date('Y-m-d_h:i') . '.csv"');
$GLOBALS['system']->includeDBClass('family');
$GLOBALS['system']->includeDBClass('person');
switch (array_get($_REQUEST, 'merge_type')) {
case 'family':
$merge_data = Family::getFamilyDataByMemberIDs($_POST['personid']);
$dummy = new Family();
$dummy_family = NULL;
break;
case 'person':
default:
$merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => (array) $_POST['personid']));
$dummy = new Person();
$dummy_family = new Family();
break;
}
$headerrow = array('ID');
foreach (array_keys(reset($merge_data)) as $header) {
if ($header == 'familyid') {
continue;
}
$headerrow[] = strtoupper($dummy->getFieldLabel($header));
}
fputcsv($fp, $headerrow);
foreach ($merge_data as $id => $row) {
@$dummy->populate($id, $row);
$outputrow = array($id);
foreach ($row as $k => $v) {
if ($k == 'history') {
continue;
}
if ($k == 'familyid') {
continue;
}
if ($dummy->hasField($k)) {
$outputrow[] = $dummy->getFormattedValue($k, $v);
// pass value to work around read-only fields
} else {
if ($dummy_family && $dummy_family->hasField($k)) {
$outputrow[] = $dummy_family->getFormattedValue($k, $v);
} else {
$outputrow[] = $v;
}
}
}
fputcsv($fp, $outputrow);
}
fclose($fp);
}