本文整理汇总了PHP中Person::getFormattedValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::getFormattedValue方法的具体用法?PHP Person::getFormattedValue怎么用?PHP Person::getFormattedValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::getFormattedValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: run
function run()
{
$results = array();
if (!empty($_REQUEST['search'])) {
$name = $_REQUEST['search'];
$GLOBALS['system']->includeDBClass('person');
$results = Person::getPersonsByName($name, array_get($_REQUEST, 'include_archived', false));
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Pragma: no-cache");
// HTTP/1.0
header("Content-Type: application/json");
echo "{\"results\": [";
$arr = array();
$GLOBALS['system']->includeDBClass('person');
$dummy = new Person();
$count = 0;
foreach ($results as $i => $details) {
if ($count++ > 12) {
break;
}
$dummy->populate($i, $details);
$arr[] = '
{
id: ' . $i . ',
value: "' . addcslashes(ents($details['first_name'] . ' ' . $details['last_name']), '"') . '",
info: "' . addcslashes(ents($dummy->getFormattedValue('status') . ', ' . $dummy->getFormattedValue('congregationid')), '"') . '"
}
';
}
echo implode(", ", $arr);
echo "]}";
}
}
示例3: run
function run()
{
// Ref: http://en.wikipedia.org/wiki/VCard
header('Content-type: text/vcf');
header('Content-Disposition: attachment; filename="contacts_' . date('Y-m-d_h:i') . '.vcf"');
$GLOBALS['system']->includeDBClass('person');
$GLOBALS['system']->includeDBClass('family');
$merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => $_REQUEST['personid']));
$dummy = new Person();
$family = new Family();
foreach ($merge_data as $id => $row) {
$dummy->populate($id, $row);
$family->setvalue('home_tel', $row['home_tel']);
echo "BEGIN:VCARD\n";
echo "VERSION:3.0\n";
echo "N:" . $row['last_name'] . ";" . $row['first_name'] . ";;;\n";
echo "FN:" . $row['first_name'] . " " . $row['last_name'] . "\n";
echo "EMAIL;type=INTERNET;type=HOME:" . $row['email'] . "\n";
echo "ADR;type=HOME:;;" . $row['address_street'] . ";" . $row['address_suburb'] . ";" . $row['address_state'] . ";" . $row['address_postcode'] . ";\n";
echo "TEL;type=HOME:" . $family->getFormattedValue('home_tel') . "\n";
echo "TEL;type=WORK:" . $dummy->getFormattedValue('work_tel') . "\n";
echo "TEL;type=MOBILE:" . $dummy->getFormattedValue('mobile_tel') . "\n";
echo "TEL;type=CELL:" . $dummy->getFormattedValue('mobile_tel') . "\n";
if ($g = $dummy->getValue('Gender')) {
echo "GENDER:" . strtoupper($g[0]) . "\n";
}
echo "CATEGORIES:" . $row['congregation'] . "\n";
echo "ORG:" . $dummy->getFormattedValue('congregationid') . "\n";
echo "NOTES:" . $dummy->getFormattedValue('congregationid') . "\n";
echo "ROLE:" . $dummy->getFormattedValue('status') . "\n";
echo "TITLE:" . $dummy->getFormattedValue('status') . "\n";
echo "SOURCE:" . build_url(array('personid' => array($id))) . "\n";
// where to get vcard from
echo "URL:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
// definitive location for full details
echo "UID:" . build_url(array('call' => NULL, 'view' => 'persons', 'personid' => $id)) . "\n";
echo "END:VCARD\n\n";
}
}
示例4: printFormSequential
private function printFormSequential()
{
$cancelURL = build_url(array('*' => NULL, 'view' => 'attendance__record', 'cohortids' => $this->_cohortids, 'attendance_date' => $this->_attendance_date, 'release' => 1));
$totalPrinted = 0;
foreach ($this->_record_sets as $i => $set) {
if ((int) $set->congregationid) {
$congregation = $GLOBALS['system']->getDBObject('congregation', (int) $set->congregationid);
} else {
if ($set->groupid) {
$group =& $GLOBALS['system']->getDBObject('person_group', $set->groupid);
} else {
return;
}
}
$title = $set->getCohortName();
$stats = $abs = array();
if ($set->statuses) {
$options = Attendance_Record_Set::getStatusOptions();
foreach ($set->statuses as $s) {
$stats[] = $options[$s];
}
}
if ($set->age_brackets) {
$GLOBALS['system']->includeDBClass('person');
$p = new Person();
foreach ($set->age_brackets as $ab) {
$p->setValue('age_bracket', $ab);
$abs[] = $p->getFormattedValue('age_bracket');
}
}
$title = implode(', ', $stats) . ' ' . implode(',', $abs) . ' in ' . $title;
?>
<h3><?php
echo ents($title);
?>
</h3>
<div class="width-really-auto form-inline">
<?php
$setPrinted = $set->printForm($i);
if ($setPrinted > 0) {
$totalPrinted += $setPrinted;
?>
<div class="container row-fluid control-group">
<p class="span6">
<?php
echo _('Total headcount:');
?>
<?php
$set->printHeadcountField();
?>
</p>
<p class="span6 align-right nowrap">
<input type="submit" class="btn" value="Save All Attendances" />
<a href="<?php
echo $cancelURL;
?>
" class="btn">Cancel</a>
</p>
</div>
<?php
} else {
?>
<i><?php
echo _('(No persons in this listing)');
?>
</i>
<?php
}
?>
</div>
<?php
}
return $totalPrinted;
}
示例5: getStats
public function getStats()
{
$db = $GLOBALS['db'];
$groupingField = (int) $this->congregationid ? 'p.status' : 'pgms.label';
$SQL = 'SELECT present, ' . $groupingField . ' AS status, count(p.id) AS total
FROM attendance_record ar
JOIN person p ON ar.personid = p.id
LEFT JOIN person_group pg ON pg.id = ar.groupid
LEFT JOIN person_group_membership pgm ON pgm.personid = p.id AND pgm.groupid = pg.id
LEFT JOIN person_group_membership_status pgms ON pgms.id = pgm.membership_status
WHERE date = ' . $db->quote($this->date) . '
AND ar.groupid = ' . $db->quote((int) $this->groupid) . '
';
if ($this->congregationid) {
$SQL .= '
AND p.congregationid = ' . $db->quote($this->congregationid);
}
$SQL .= '
GROUP BY present, ' . $groupingField . '
ORDER BY present, ' . $groupingField;
$res = $db->queryAll($SQL);
check_db_result($res);
$totals = array(0 => 0, 1 => 0);
$breakdowns = array(0 => array(), 1 => array());
$dummy = new Person();
foreach ($res as $r) {
if ($this->congregationid) {
$r['status'] = $dummy->getFormattedValue('status', $r['status']);
}
$totals[$r['present']] += $r['total'];
$breakdowns[$r['present']][] = $r;
}
return array($totals, $breakdowns);
}
示例6: getMergeVars
function getMergeVars($person_data, $email)
{
static $dummy_person = null;
if (is_null($dummy_person)) {
$GLOBALS['system']->includeDBClass('person');
$dummy_person = new Person();
}
$dummy_person->populate(0, $person_data);
return array('EMAIL' => $email, 'FNAME' => $dummy_person->getFormattedValue('first_name'), 'LNAME' => $dummy_person->getFormattedValue('last_name'), 'GENDER' => $dummy_person->getFormattedValue('gender'), 'CONG' => $dummy_person->getFormattedValue('congregationid'), 'STATUS' => $dummy_person->getFormattedValue('status'), 'AGEBRACKET' => $dummy_person->getFormattedValue('age_bracket'));
}
示例7: printResults
function printResults($with_links = FALSE)
{
$db = $GLOBALS['db'];
$groupid = (int) $_REQUEST['groupid'];
$all_member_details = array_get($_REQUEST, 'all_member_details', 0);
if (empty($groupid)) {
return;
}
$sql = '
select family.id as familyid, family.family_name, family.home_tel,
person.*, congregation.long_name as congname,
address_street, address_suburb, address_state, address_postcode
from family
join person on family.id = person.familyid
left join congregation on person.congregationid = congregation.id
where person.status <> "archived"
and family.id in
(select familyid
from person join person_group_membership pgm on person.id = pgm.personid
where pgm.groupid = ' . (int) $groupid;
if (!empty($_REQUEST['congregationid'])) {
$sql .= '
AND person.congregationid in (' . implode(',', array_map(array($db, 'quote'), $_REQUEST['congregationid'])) . ')';
}
$sql .= ')
order by family_name asc, age_bracket asc, gender desc
';
$res = $db->queryAll($sql, null, null, true, true, true);
check_db_result($res);
if (empty($res)) {
?>
<p><i>No families to show</i></p><?php
return;
}
$sql = '
select personid
from person_group_membership pgm
where pgm.groupid = ' . (int) $groupid;
$signups = $db->queryCol($sql);
check_db_result($signups);
$GLOBALS['system']->includeDBClass('family');
$GLOBALS['system']->includeDBClass('person');
$dummy_family = new Family();
$dummy_person = new Person();
?>
<table class="contact-list">
<?php
foreach ($res as $familyid => $family_members) {
$adults = array();
$children = array();
$adults_use_full = false;
$children_use_full = false;
foreach ($family_members as $member) {
if (empty($_REQUEST['age_bracket']) || in_array($member['age_bracket'], $_REQUEST['age_bracket'])) {
$adults[] = $member;
if ($member['last_name'] != $member['family_name']) {
$adults_use_full = true;
}
} else {
$children[] = $member;
if ($member['last_name'] != $member['family_name']) {
$children_use_full = true;
}
}
}
$first_member = reset($family_members);
?>
<tr><td colspan="4"><h2 style="margin-bottom: 0px"><?php
echo $first_member['family_name'];
?>
</h2></td></tr>
<?php
if ($first_member['home_tel']) {
$dummy_family->setValue('home_tel', $first_member['home_tel']);
echo '<tr><td colspan="4"><h3 style="border: 0px; margin: 0px; padding: 0px">';
echo ents($dummy_family->getFormattedValue('home_tel'));
echo '</h3></td></tr>';
}
if (!empty($_REQUEST['include_address']) && $first_member['address_street']) {
echo '<tr><td colspan="4">' . nl2br(ents($first_member['address_street'])) . '<br />';
echo ents($first_member['address_suburb'] . ' ' . $first_member['address_state'] . ' ' . $first_member['address_postcode']);
echo '</td></tr>';
}
$fn = $with_links ? 'printFieldValue' : 'getFormattedValue';
foreach ($adults as $adult) {
$dummy_person->populate($adult['id'], $adult);
?>
<tr>
<td><?php
echo ents($adults_use_full ? $adult['first_name'] . ' ' . $adult['last_name'] : $adult['first_name']);
?>
</td>
<td><?php
echo ents($adult['congname']);
?>
</td>
<td><?php
if ($all_member_details || in_array($adult['id'], $signups)) {
echo ents($dummy_person->getFormattedValue('mobile_tel'));
//.........这里部分代码省略.........
示例8: printView
//.........这里部分代码省略.........
<input type="hidden" name="attendances_submitted" value="1" />
<p class="visible-desktop smallprint">For greatest speed, press P for present and A for absent. The cursor will automatically progress to the next person. To go back, use the arrow keys.</p>
<?php
$totalPrinted = 0;
foreach ($this->_record_sets as $i => $set) {
if ((int) $set->congregationid) {
?>
<input type="hidden" name="congregationid[]" value="<?php
echo $set->congregationid;
?>
" />
<?php
$congregation = $GLOBALS['system']->getDBObject('congregation', (int) $set->congregationid);
$title = $congregation->getValue('name') . ' Congregation';
} else {
if ($set->groupid) {
$group =& $GLOBALS['system']->getDBObject('person_group', $set->groupid);
$title = $group->getValue('name') . ' Group';
?>
<input type="hidden" name="groupid" value="<?php
echo $set->groupid;
?>
" />
<?php
} else {
return;
}
}
if (strlen($set->age_bracket)) {
$GLOBALS['system']->includeDBClass('person');
$p = new Person();
$p->setValue('age_bracket', $set->age_bracket);
$title = $p->getFormattedValue('age_bracket') . ' in ' . $title;
}
?>
<h3><?php
echo ents($title);
?>
</h3>
<div class="width-really-auto form-inline">
<?php
$setPrinted = $set->printForm($i);
if ($setPrinted > 0) {
$totalPrinted += $setPrinted;
if ((int) $set->congregationid) {
$headcountFieldName = 'headcount[congregation][' . $set->congregationid . ']';
$headcountValue = Headcount::fetch('congregation', $this->_attendance_date, $set->congregationid);
} else {
$headcountFieldName = 'headcount[group][' . $set->groupid . ']';
$headcountValue = Headcount::fetch('person_group', $this->_attendance_date, $set->groupid);
}
?>
<div class="container row-fluid control-group">
<p class="span6">
Total headcount:
<input type="text" class="int-box" name="<?php
echo $headcountFieldName;
?>
" value="<?php
echo $headcountValue;
?>
" size="5" />
</p>
<p class="span6 align-right nowrap">
<input type="submit" class="btn" value="Save All Attendances" />
示例9: getMergeData
protected function getMergeData()
{
$merge_type = array_get($_REQUEST, 'merge_type', 'person');
switch ($merge_type) {
case 'family':
$GLOBALS['system']->includeDBClass('family');
$merge_data = Family::getFamilyDataByMemberIDs($_POST['personid']);
$dummy = new Family();
break;
case 'person':
default:
$temp_merge_data = $GLOBALS['system']->getDBObjectData('person', array('id' => $_POST['personid']));
$merge_data = array();
foreach ($_REQUEST['personid'] as $id) {
$merge_data[$id] = $temp_merge_data[$id];
}
$GLOBALS['system']->includeDBClass('person');
$dummy = new Person();
break;
}
foreach ($merge_data as $id => $row) {
@$dummy->populate($id, $row);
foreach ($row as $k => $v) {
if ($k == 'history') {
unset($merge_data[$id][$k]);
}
if ($dummy->hasField($k)) {
$merge_data[$id][$k] = $dummy->getFormattedValue($k);
}
if ($k == 'selected_firstnames') {
$merge_data[$id]['selected_members'] = $v;
}
}
}
return $merge_data;
}
示例10: echo
}
?>
<label>
<input type="checkbox" checked="checked" value="<?php
echo (int) $personid;
?>
" />
</label>
<div>
<strong><?php
echo ents($dummy->toString());
?>
</strong>
<br />
<?php
echo ents($dummy->getFormattedValue('age_bracket'));
echo ' • ';
echo ents($dummy->getFormattedValue('gender'));
echo '<br />';
echo ents($dummy->getFormattedValue('status'));
echo ' • ';
echo ents($dummy->getFormattedValue('congregationid'));
?>
</div>
</div>
</a>
<?php
}
$all_emails = $family->getAllEmailAddrs();
if (!empty($all_emails)) {
示例11: replace_keywords
function replace_keywords($content, $person)
{
static $dummy = NULL;
if (!$dummy) {
$dummy = new Person();
}
$dummy->populate($person['id'], $person);
foreach ($person as $k => $v) {
$keyword = '%' . strtoupper($k) . '%';
if (FALSE !== strpos($content, $keyword)) {
if ($k == 'expirydate') {
$replacement = format_date($v);
} else {
$replacement = $dummy->getFormattedValue($k);
}
$content = str_replace($keyword, $replacement, $content);
}
}
return $content;
}