本文整理汇总了PHP中Person::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::populate方法的具体用法?PHP Person::populate怎么用?PHP Person::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::populate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculateGFRResult
function calculateGFRResult()
{
$tmpArr = array();
$tmpArr[] = date('Y-m-d H:i:s');
//observation time
$tmpArr[] = 'GFR (CALC)';
//desc
$gender = NSDR::populate($this->_patientId . "::com.clearhealth.person.displayGender");
$crea = NSDR::populate($this->_patientId . "::com.clearhealth.labResults[populate(@description=CREA)]");
$genderFactor = null;
$creaValue = null;
$personAge = null;
$raceFactor = 1;
switch ($gender[key($gender)]) {
case 'M':
$genderFactor = 1;
break;
case 'F':
$genderFactor = 0.742;
break;
}
if ((int) strtotime($crea['observation_time']) >= strtotime('now - 60 days') && strtolower($crea[key($crea)]['units']) == 'mg/dl') {
$creaValue = $crea[key($crea)]['value'];
}
$person = new Person();
$person->personId = $this->_patientId;
$person->populate();
if ($person->age > 0) {
$personAge = $person->age;
}
$personStat = new PatientStatistics();
$personStat->personId = $this->_patientId;
$personStat->populate();
if ($personStat->race == "AFAM") {
$raceFactor = 1.21;
}
$gfrValue = "INC";
if ($personAge > 0 && $creaValue > 0) {
$gfrValue = "" . (int) round(pow($creaValue, -1.154) * pow($personAge, -0.203) * $genderFactor * $raceFactor * 186);
}
trigger_error("gfr:: " . $gfrValue, E_USER_NOTICE);
$tmpArr[] = $gfrValue;
// lab value
$tmpArr[] = 'mL/min/1.73 m2';
//units
$tmpArr[] = '';
//ref range
$tmpArr[] = '';
//abnormal
$tmpArr[] = 'F';
//status
$tmpArr[] = date('Y-m-d H:i:s') . '::' . '0';
// observationTime::(boolean)normal; 0 = abnormal, 1 = normal
$tmpArr[] = '0';
//sign
//$this->_calcLabResults[uniqid()] = $tmpArr;
$this->_calcLabResults[1] = $tmpArr;
// temporarily set index to one(1) to be able to include in selected lab results
return $tmpArr;
}
示例2: 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);
}
示例3: myAlertsAction
public function myAlertsAction()
{
$personId = Zend_Auth::getInstance()->getIdentity()->personId;
$team = new TeamMember();
$teamId = $team->getTeamByPersonId($personId);
$rows = array();
if (true) {
$alertMsg = new GeneralAlert();
$alertMsgIterator = $alertMsg->getIteratorByTeam($teamId);
foreach ($alertMsgIterator as $alert) {
$tmp = array();
$tmp['id'] = $alert->generalAlertId;
$tmp['data'][] = '<img src="' . $this->view->baseUrl . '/img/medium.png' . '" alt="' . $alert->urgency . '" /> ' . $alert->urgency;
// below are temporary data
$objectClass = $alert->objectClass;
if (!class_exists($objectClass)) {
continue;
}
$obj = new $objectClass();
foreach ($obj->_primaryKeys as $key) {
$obj->{$key} = $alert->objectId;
}
$obj->populate();
$patient = new Patient();
$patient->personId = $obj->personId;
$patient->populate();
$tmp['data'][] = $patient->person->getDisplayName();
// patient
$tmp['data'][] = '';
// location
$tmp['data'][] = date('m/d/Y H:i', strtotime($alert->dateTime));
$tmp['data'][] = $alert->message;
$forwardedBy = '';
if ($alert->forwardedBy > 0) {
$person = new Person();
$person->personId = (int) $alert->forwardedBy;
$person->populate();
$forwardedBy = $person->displayName;
}
$tmp['data'][] = $forwardedBy;
// forwarded
$tmp['data'][] = $alert->comment;
// comment
$controllerName = call_user_func($objectClass . "::" . "getControllerName");
$jumpLink = call_user_func_array($controllerName . "::" . "buildJSJumpLink", array($alert->objectId, $alert->userId, $objectClass));
$js = "function jumpLink{$objectClass}(objectId,patientId) {\n{$jumpLink}\n}";
$tmp['data'][] = $js;
$tmp['data'][] = $objectClass . ':' . $alert->objectId . ':' . $patient->personId;
$rows[] = $tmp;
}
}
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct(array('rows' => $rows));
}
示例4: 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";
}
}
示例5: 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 "]}";
}
}
示例6: indexAction
public function indexAction()
{
$personId = (int) $this->_getParam('personId');
$person = new Person();
$person->personId = $personId;
$person->populate();
$this->view->person = $person;
$this->view->chartList = GrowthChartBase::listCharts();
switch (strtolower($person->displayGender)) {
case 'female':
$gender = GrowthChartBase::GENDER_FEMALE;
break;
case 'male':
default:
$gender = GrowthChartBase::GENDER_MALE;
break;
}
$listGrowthCharts = array();
foreach ($this->view->chartList as $key => $value) {
$ormClass = ucfirst($key);
$orm = new $ormClass();
$ormIterator = $orm->getIteratorByGender($gender);
$xMax = 0;
$yMax = 0;
$xMin = 0;
$yMin = 0;
$percentiles = array();
$mappings = $orm->_dataTableMappings;
list($base, $fields) = each($mappings);
$columns = array();
foreach ($ormIterator as $row) {
if ($row->{$base} > $xMax) {
$xMax = $row->{$base};
}
if ($xMin == 0 || $row->{$base} < $xMin) {
$xMin = $row->{$base};
}
foreach ($fields as $field) {
if ($row->{$field} > $yMax) {
$yMax = $row->{$field};
}
if ($yMin == 0 || $row->{$field} < $yMin) {
$yMin = $row->{$field};
}
$columns[$field]['name'] = substr($field, 1);
$columns[$field]['percentiles'][$row->{$base}] = $row->{$field};
}
}
$listGrowthCharts[$key]['data'] = $orm->listVitals($person);
// this MUST be called right after $orm->listVitals($person) is called
$vitalSigns = array();
foreach (GrowthChartBase::$_vitalSigns as $vitalSign) {
$dateVitalsTime = strtotime($vitalSign['dateTime']);
if (!isset($vitalSigns[$vitalSign['vitalSignGroupId']])) {
list($bYear, $bMonth, $bDay) = explode('-', date('Y-m-d', strtotime($person->dateOfBirth)));
list($vYear, $vMonth, $vDay) = explode('-', date('Y-m-d', $dateVitalsTime));
$age = $vMonth >= $bMonth && $vDay >= $bDay || $vMonth > $bMonth ? $vYear - $bYear : $vYear - $bYear - 1;
$vitalSigns[$vitalSign['vitalSignGroupId']]['label'] = date('m/d/Y h:iA', $dateVitalsTime) . ': Age=' . $age * 12 . ' months';
$vitalSigns[$vitalSign['vitalSignGroupId']]['data'] = array();
}
$value = $vitalSign['value'];
$ussValue = $value;
$metricValue = '';
if (strlen($vitalSign['units']) > 0) {
if (strlen($ussValue) > 0) {
$ussValue .= ' ' . $vitalSign['units'];
}
$ret = VitalSignValue::convertValues($vitalSign['vital'], $value, $vitalSign['units']);
if ($ret !== false) {
$ussValue = $ret['uss'];
$metricValue = $ret['metric'];
}
}
$tmp['data'][] = $ussValue;
$tmp['data'][] = $metricValue;
$vitalSigns[$vitalSign['vitalSignGroupId']]['data'][] = $vitalSign['vital'] . '=' . $metricValue . ' (' . $ussValue . ')';
}
$vitalTxt = array();
foreach ($vitalSigns as $groupId => $value) {
$arr = array();
foreach ($value['data'] as $val) {
$arr[] = $val;
}
$vitalTxt[] = $value['label'] . ' ' . implode(' ', $arr);
}
$listGrowthCharts[$key]['vitalSigns'] = implode("\n", $vitalTxt);
$listGrowthCharts[$key]['columns'] = $columns;
$listGrowthCharts[$key]['name'] = GrowthChartBase::prettyName($base);
$listGrowthCharts[$key]['unit'] = constant("{$ormClass}::BASE_UNIT");
$listGrowthCharts[$key]['percentileName'] = constant("{$ormClass}::PERCENTILE_NAME");
$listGrowthCharts[$key]['percentileUnit'] = constant("{$ormClass}::PERCENTILE_UNIT");
$listGrowthCharts[$key]['xMax'] = ceil($xMax);
$listGrowthCharts[$key]['yMax'] = ceil($yMax);
$listGrowthCharts[$key]['xMin'] = floor($xMin);
$listGrowthCharts[$key]['yMin'] = floor($yMin);
}
//file_put_contents('/tmp/growth.charts',print_r($listGrowthCharts,true));
$this->view->listGrowthCharts = $listGrowthCharts;
$this->render();
}
示例7: getScheduleDataAction
public function getScheduleDataAction()
{
$dateStart = date('Y-m-d', strtotime($this->_getParam('dateStart')));
$dateEnd = date('Y-m-d', strtotime($this->_getParam('dateEnd')));
$providerId = (int) $this->_getParam('providerId');
$roomId = (int) $this->_getParam('roomId');
$data = array();
$start = $dateStart . ' 00:00:00';
$end = $dateEnd . ' 23:59:59';
$numberOfEvents = ScheduleEvent::getNumberOfEvents($providerId, $roomId, $start, $end);
$data['numberOfEvents'] = $numberOfEvents;
$title = '';
if ($providerId > 0) {
$person = new Person();
$person->personId = $providerId;
$person->populate();
$title .= $person->lastName . ', ' . $person->firstName . ', ' . $person->suffix;
} else {
if ($roomId > 0) {
$room = new Room();
$room->roomId = $roomId;
$room->populate();
$title .= $room->building->practice->name . '->' . $room->building->name . '->' . $room->name;
}
}
$data['title'] = $title;
$data['dateStart'] = date('m/d/Y', strtotime($dateStart));
$data['dateEnd'] = date('m/d/Y', strtotime($dateEnd));
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct($data);
}
示例8: templateAction
function templateAction()
{
$clinicalNoteId = $this->_getParam('clinicalNoteId', 0);
$revisionId = (int) $this->_getParam('revisionId');
$cn = new ClinicalNote();
$cn->clinicalNoteId = (int) $clinicalNoteId;
$cn->populate();
if ($revisionId > 0) {
$cn->revisionId = $revisionId;
}
$this->_cn = $cn;
$templateId = $cn->clinicalNoteTemplateId;
assert("{$templateId} > 0");
$cnTemplate = $cn->clinicalNoteDefinition->clinicalNoteTemplate;
$this->_form = new WebVista_Form(array('name' => 'cn-template-form'));
$this->_form->setWindow('dummyWindowId');
$this->_form->setAction(Zend_Registry::get('baseUrl') . "clinical-notes-form.raw/process");
$cnXML = simplexml_load_string($cnTemplate->template);
// pre-register print element to view so that other elements can override particularly the onclick event
$this->_buildForm($cnXML);
$this->_form->addElement($this->_form->createElement('hidden', 'clinicalNoteId', array('value' => (int) $cn->clinicalNoteId)));
$formData = array();
$this->_form->removeElement('ok');
$element = $this->_form->createElement('hidden', 'clinicalNoteOKId', array('value' => 'OK'));
$this->_form->addElement($element);
if ($revisionId > 0) {
//$this->_form->removeElement('ok');
$this->_form->removeElement('clinicalNoteOKId');
} else {
$revisionId = GenericData::getUnsignedRevisionId(get_class($cn), $cn->clinicalNoteId);
//$revisionId = $cn->clinicalNoteId;
}
$this->_form->addElement($this->_form->createElement('hidden', 'revisionId', array('value' => (int) $revisionId)));
$db = Zend_Registry::get('dbAdapter');
$cndSelect = $db->select()->from('genericData')->where("objectClass = 'ClinicalNote'")->where('objectId = ?', (int) $cn->clinicalNoteId);
if ($revisionId > 0) {
$cndSelect->where('revisionId = ?', $revisionId);
}
trigger_error($cndSelect->__toString(), E_USER_NOTICE);
foreach ($db->query($cndSelect)->fetchAll() as $row) {
$formData[$row['name']] = $row['value'];
}
$eSignatureId = ESignature::retrieveSignatureId(get_class($cn), $revisionId);
if ($eSignatureId > 0) {
// On signed notes generic data is shown
//$this->_form->removeElement('ok');
$this->_form->removeElement('clinicalNoteOKId');
$esig = new ESignature();
$esig->eSignatureId = $eSignatureId;
$esig->populate();
$signPerson = new Person();
$signPerson->personId = $esig->signingUserId;
$signPerson->populate();
$person = new Person();
$person->personId = $esig->signingUserId;
$person->populate();
$this->view->signatureInfo = "Signed on: " . $esig->signedDateTime . " by: " . $person->firstName . ' ' . $person->lastName . ' ' . $person->suffix;
$element = $this->_form->createElement('hidden', 'clinicalNoteSignatureId', array('value' => $this->view->signatureInfo));
$this->_form->addElement($element);
} else {
// on unsigned notes NSDR is shown but a warning also needs to appear that says data has changed since last save if generic data != NSDR data
if ((string) $cnXML->attributes()->useNSDR && (string) $cnXML->attributes()->useNSDR == 'true') {
$nsdrData = ClinicalNote::getNSDRData($cnXML, $cn, $revisionId);
if ($formData != $nsdrData) {
$msg = __('Data has been changed since last save');
$this->_form->addElement($this->_form->createElement('hidden', 'dataChangedId', array('value' => $msg)));
}
$formData = $nsdrData;
}
}
$this->_form->populate($formData);
$this->view->form = $this->_form;
$templateRevisions = array();
$gdIterator = GenericData::getAllRevisions(get_class($cn), $cn->clinicalNoteId);
foreach ($gdIterator as $gd) {
$templateRevisions[$gd->revisionId] = $gd->dateTime;
}
$this->view->templateRevisions = $templateRevisions;
}
示例9: testPopulate
public function testPopulate()
{
$person = new Person();
$person->personId = 1234;
$person->populate();
$firstName = $person->firstName;
$person->firstName = 'John';
$lastName = $person->lastName;
$person->lastName = 'Doe';
$middleName = $person->middleName;
$person->middleName = 'C';
$person->persist();
// test case 1
$result = NSDR2::populate('1234::com.clearhealth.person');
$this->assertEquals($result['first_name'], $person->firstName, 'TEST CASE 1 failed.');
$this->assertEquals($result['last_name'], $person->lastName, 'TEST CASE 1 failed.');
$this->assertEquals($result['middle_name'], $person->middleName, 'TEST CASE 1 failed.');
// test case 2
$result = NSDR2::populate('1234::com.clearhealth.person.middleName');
$this->assertEquals($result, 'C', 'TEST CASE 2 failed.');
// test case 5
$result = NSDR2::populate('1234::com.clearhealth.person[aggregateDisplay()]');
$this->assertContains('Doe John C', $result, 'TEST CASE 5 failed.');
// revert the person
$person->firstName = $firstName;
$person->lastName = $lastName;
$person->middleName = $middleName;
$person->persist();
}
示例10: printForm
public function printForm($prefix = 0)
{
if (empty($this->_persons)) {
return 0;
}
$GLOBALS['system']->includeDBClass('person');
$dummy = new Person();
?>
<table class="table table-condensed table-auto-width valign-middle">
<?php
$is_first = TRUE;
foreach ($this->_persons as $personid => $details) {
$dummy->populate($personid, $details);
?>
<tr>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td><?php
echo $personid;
?>
</td>
<?php
}
if ($this->show_photos) {
?>
<td>
<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php
echo $personid;
?>
">
<img style="width: 50px; max-width: 50px" src="?call=photo&personid=<?php
echo (int) $personid;
?>
" />
</a>
</td>
<?php
}
?>
<td>
<?php
echo ents($details['first_name'] . ' ' . $details['last_name']);
?>
</td>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td>
<?php
if ($this->groupid) {
echo ents($details['membership_status']);
} else {
$dummy->printFieldValue('status');
}
?>
</td>
<?php
}
?>
<td class="narrow">
<?php
$this->printWidget($prefix, $personid);
?>
</td>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td class="action-cell narrow">
<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php
echo $personid;
?>
"><i class="icon-user"></i>View</a>
<a class="med-popup" tabindex="-1" href="?view=_edit_person&personid=<?php
echo $personid;
?>
"><i class="icon-wrench"></i>Edit</a>
<a class="med-popup" tabindex="-1" href="?view=_add_note_to_person&personid=<?php
echo $personid;
?>
"><i class="icon-pencil"></i>Add Note</a>
</td>
<?php
}
?>
</tr>
<?php
$is_first = FALSE;
}
?>
</table>
<?php
return count($this->_persons);
}
示例11: processView
function processView()
{
$GLOBALS['system']->includeDBClass('family');
$GLOBALS['system']->includeDBClass('person');
$GLOBALS['system']->includeDBClass('person_group');
$GLOBALS['system']->includeDBClass('congregation');
$GLOBALS['system']->includeDBClass('person_note');
if (!empty($_REQUEST['done'])) {
$this->_stage = 'done';
} else {
if (!empty($_POST['confirm_import'])) {
ini_set('memory_limit', '256M');
ini_set('max_execution_time', 60 * 10);
ini_set('zlib.output_compression', 'Off');
// read from session and create
$GLOBALS['system']->doTransaction('BEGIN');
$group = $GLOBALS['system']->getDBObject('person_group', $_SESSION['import']['groupid']);
$this->_captureErrors();
$done = 0;
?>
<h1 style="position: absolute; text-align: center; top: 40%; color: #ccc; width: 100%">Importing...</h1>
<div style="border: 1px solid; width: 50%; height: 30px; top: 50%; left: 25%; position: absolute"><div id="progress" style="background: blue; height: 30px; width: 2%; overflow: visible; line-height: 30px; text-align: center; color: white" /></div>
<p style="text-align: center; color: #888">If this indicator stops making progress, your import may still be running in the background.<br />You should <a href="<?php
echo build_url(array('view' => 'persons__list_all'));
?>
">check your system for the imported persons</a> before running the import again.</p>
<?php
foreach ($_SESSION['import']['families'] as $familydata) {
$members = $familydata['members'];
unset($familydata['members']);
$family = new Family();
$family->populate(0, $familydata);
if ($family->create()) {
foreach ($members as $persondata) {
$notetext = null;
if (!empty($persondata['note'])) {
$notetext = $persondata['note'];
unset($persondata['note']);
}
$person = new Person();
$person->populate(0, $persondata);
$person->setValue('familyid', $family->id);
if ($person->create()) {
$group->addMember($person->id);
if ($notetext) {
$note = new Person_Note();
$note->setValue('subject', 'Import note');
$note->setvalue('details', $notetext);
$note->setValue('personid', $person->id);
$note->create();
unset($note);
}
unset($person);
}
}
$done++;
if ($done % 20 == 0) {
?>
<script>var d = document.getElementById('progress'); d.innerHTML = 'Importing family <?php
echo $done . ' of ' . $_SESSION['import']['total_families'];
?>
'; d.style.width = '<?php
echo (int) ($done / $_SESSION['import']['total_families'] * 100);
?>
%'</script><?php
echo str_repeat(' ', 1024 * 4);
}
flush();
unset($family);
}
}
if ($errors = $this->_getErrors()) {
$msg = 'Errors during import - import aborted. <ul><li>' . implode('</li></li>', $errors) . '</li></ul>';
add_message($msg, 'failure', true);
$GLOBALS['system']->doTransaction('ROLLBACK');
} else {
add_message('Import complete', 'success');
$GLOBALS['system']->doTransaction('COMMIT');
}
?>
<script>document.location = '<?php
echo build_url(array());
?>
&done=1';</script>
<?php
exit;
} else {
if (!empty($_FILES['import'])) {
if (empty($_REQUEST['groupid'])) {
add_message("You must choose a group first", 'error');
$this->stage = 'begin';
return;
}
if (empty($_FILES['import']) || empty($_FILES['import']['tmp_name'])) {
add_message("You must upload a file", 'error');
return;
}
$this->_dummy_family = new Family();
$this->_dummy_person = new Person();
// read the csv and save to session
//.........这里部分代码省略.........
示例12: printForm
function printForm($prefix = 0)
{
require_once 'include/size_detector.class.php';
$order = defined('ATTENDANCE_LIST_ORDER') ? constant('ATTENDANCE_LIST_ORDER') : self::LIST_ORDER_DEFAULT;
if ($this->congregationid) {
$conds = array('congregationid' => $this->congregationid, '!status' => 'archived');
if (strlen($this->age_bracket)) {
$conds['age_bracket'] = $this->age_bracket;
}
$members = $GLOBALS['system']->getDBObjectData('person', $conds, 'AND', $order);
} else {
$group =& $GLOBALS['system']->getDBObject('person_group', $this->groupid);
$members =& $group->getMembers(FALSE, $order);
if (strlen($this->age_bracket)) {
// Not the most efficient but it's a problem when it's a problem
foreach ($members as $i => $person) {
if ($person['age_bracket'] != $this->age_bracket) {
unset($members[$i]);
}
}
}
}
$GLOBALS['system']->includeDBClass('person');
$dummy = new Person();
?>
<table class="table table-condensed table-auto-width valign-middle">
<?php
$is_first = TRUE;
foreach ($members as $personid => $details) {
$v = isset($this->_attendance_records[$personid]) ? $this->_attendance_records[$personid] ? 'present' : 'absent' : (empty($this->_attendance_records) ? '' : 'unknown');
$dummy->populate($personid, $details);
?>
<tr>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td><?php
echo $personid;
?>
</td>
<?php
}
if ($this->show_photos) {
?>
<td>
<img style="width: 50px; max-width: 50px" src="?call=person_photo&personid=<?php
echo (int) $personid;
?>
" />
</td>
<?php
}
?>
<td><?php
echo ents($details['last_name']);
?>
</td>
<td><?php
echo ents($details['first_name']);
?>
</td>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td>
<?php
if ($this->groupid) {
echo ents($details['membership_status']);
} else {
$dummy->printFieldValue('status');
}
?>
</td>
<?php
}
?>
<td class="narrow">
<?php
print_widget('attendances[' . $prefix . '][' . $personid . ']', array('options' => array('unknown' => '?', 'present' => 'Present', 'absent' => 'Absent'), 'type' => 'select', 'style' => 'colour-buttons', 'class' => $is_first ? 'autofocus' : ''), $v);
?>
</td>
<?php
if (!SizeDetector::isNarrow()) {
?>
<td class="action-cell narrow">
<a class="med-popup" tabindex="-1" href="?view=persons&personid=<?php
echo $personid;
?>
"><i class="icon-user"></i>View</a>
<a class="med-popup" tabindex="-1" href="?view=_edit_person&personid=<?php
echo $personid;
?>
"><i class="icon-wrench"></i>Edit</a>
<a class="med-popup" tabindex="-1" href="?view=_add_note_to_person&personid=<?php
echo $personid;
?>
"><i class="icon-pencil"></i>Add Note</a>
</td>
<?php
}
//.........这里部分代码省略.........
示例13: _generate4010A1
protected static function _generate4010A1($claimId, array $claim)
{
static $ctr = 0;
static $visits = array();
static $practices = array();
static $insurancePrograms = array();
static $providers = array();
static $patients = array();
$claimId = (int) $claimId;
$claimLine = new ClaimLine();
$claimLine->populateByClaimId($claimId);
$visitId = (int) $claimLine->visitId;
if (!isset($visits[$visitId])) {
$visit = new Visit();
$visit->visitId = $visitId;
$visit->populate();
$visits[$visitId] = $visit;
}
$visit = $visits[$visitId];
$patientId = (int) $visit->patientId;
if (!isset($patients[$patientId])) {
$patient = new Patient();
$patient->personId = $patientId;
$patient->populate();
$patients[$patientId] = $patient;
}
$patient = $patients[$patientId];
$practiceId = (int) $visit->practiceId;
if (!isset($practices[$practiceId])) {
$practice = new Practice();
$practice->practiceId = $practiceId;
$practice->populate();
$practices[$practiceId] = $practice;
}
$practice = $practices[$practiceId];
$insuranceProgramId = (int) $visit->activePayerId;
if (!isset($insurancePrograms[$insuranceProgramId])) {
$insurance = new InsuranceProgram();
$insurance->insuranceProgramId = $insuranceProgramId;
$insurance->populate();
$insurancePrograms[$insuranceProgramId] = $insurance;
}
$insuranceProgram = $insurancePrograms[$insuranceProgramId];
$providerId = (int) $visit->treatingPersonId;
if (!isset($providers[$providerId])) {
$provider = new Provider();
$provider->personId = $providerId;
$provider->populate();
$providers[$providerId] = $provider;
}
$provider = $providers[$providerId];
$billAs = (int) $provider->billAs;
if ($billAs > 0) {
$providerId = $billAs;
if (!isset($providers[$providerId])) {
$provider = new Provider();
$provider->personId = $providerId;
$provider->populate();
$providers[$providerId] = $provider;
}
$provider = $providers[$providerId];
}
$subscribers = array();
$enumeration = new Enumeration();
$enumeration->populateByUniqueName(InsuranceProgram::INSURANCE_ENUM_NAME);
$enumerationClosure = new EnumerationClosure();
foreach ($enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true) as $enum) {
$rowset = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true);
if ($enum->key == InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) {
foreach ($rowset as $row) {
$subscribers[$row->key] = $row->name;
}
break;
}
}
$insuredRelationship = new InsuredRelationship();
$db = Zend_Registry::get('dbAdapter');
$sqlSelect = $db->select()->from($insuredRelationship->_table)->where('insurance_program_id = ?', (int) $insuranceProgram->insuranceProgramId)->where('person_id = ?', (int) $patientId)->where('active = 1')->order('program_order')->limit(1);
if ($row = $db->fetchRow($sqlSelect)) {
$insuredRelationship->populateWithArray($row);
}
$subs = $insuredRelationship->subscriber;
$subscriberAddr = $subs->address;
$relationship = null;
$relationshipCode = $insuredRelationship->subscriberToPatientRelationship;
if (isset($subscribers[$relationshipCode])) {
$relationship = $subscribers[$relationshipCode];
}
if ($relationship === null) {
$relationship = 'Self';
$relationshipCode = 18;
$subs = new Person();
$subs->personId = $insuredRelationship->personId;
$subs->populate();
}
$subscriber = array('id' => (int) $subs->personId, 'relationship_code' => $relationshipCode, 'group_number' => $insuredRelationship->groupNumber, 'group_name' => $insuredRelationship->groupName, 'relationship' => $relationship, 'last_name' => $subs->lastName, 'first_name' => $subs->firstName, 'middle_name' => $subs->middleName, 'address' => array('line1' => $subscriberAddr->line1, 'line2' => $subscriberAddr->line2, 'city' => $subscriberAddr->city, 'state' => $subscriberAddr->state, 'zip' => $subscriberAddr->zipCode), 'date_of_birth' => date('Ymd', strtotime($subs->dateOfBirth)), 'gender' => $subs->gender, 'contract_type_code' => '', 'contract_amount' => '', 'contract_percent' => '', 'contract_code' => '', 'contract_discount_percent' => '', 'contract_version' => '');
$practiceAddr = $practice->primaryAddress;
$room = new Room();
$room->roomId = (int) $visit->roomId;
$room->populate();
//.........这里部分代码省略.........
示例14: flashUploadAction
function flashUploadAction()
{
$attachmentReferenceId = (int) $this->_getParam('attachmentReferenceId');
$fileData = base64_decode($this->_getParam('fileUpload'));
$attachment = new Attachment();
if (!isset($_FILES['uploadFile']['name'])) {
$attachment->name = date('Y-m-d');
} else {
$attachment->name = $_FILES['uploadFile']['name'];
}
$attachment->attachmentReferenceId = $attachmentReferenceId;
$attachment->mimeType = 'image/jpeg';
$attachment->md5sum = md5($fileData);
$attachment->dateTime = date('Y-m-d H:i:s');
$attachment->persist();
$attachmentBlobArray = array();
$attachmentBlobArray['attachmentId'] = $attachment->attachmentId;
$attachmentBlobArray['data'] = $fileData;
$db = Zend_Registry::get('dbAdapter');
$db->insert('attachmentBlobs', $attachmentBlobArray);
$person = new Person();
$person->personId = $attachmentReferenceId;
$person->populate();
$person->activePhoto = (int) $attachment->attachmentId;
$person->persist();
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender();
return;
}
示例15: _
?>
</a>
</div>
<?php
}
?>
<h3><?php
echo _('Members');
?>
</h3>
<form method="post" enctype="multipart/form-data" action="" class="bulk-person-action">
<?php
$dummy = new Person();
foreach ($family->getMemberData() as $personid => $person) {
$dummy->populate($personid, $person);
?>
<a href="?view=persons&personid=<?php
echo (int) $personid;
?>
">
<div class="family-member">
<?php
if ($GLOBALS['system']->featureEnabled('PHOTOS')) {
?>
<img src="?call=photo&personid=<?php
echo $personid;
?>
" />
<?php
}