本文整理汇总了PHP中Person类的典型用法代码示例。如果您正苦于以下问题:PHP Person类的具体用法?PHP Person怎么用?PHP Person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Person类的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: testStaticReference
public function testStaticReference()
{
$p1 = new Person();
$this->assertEquals(1, $p1::func());
$p2 = new Person();
$this->assertEquals(1, $p2->func());
}
示例3: GetRecipients
public static function GetRecipients($ticket)
{
$recipients = array();
if ($ticket->originator_person_id != null) {
// If this ticket has a person, attempt to send mail to them
$person = new Person();
$person->load($ticket->originator_person_id);
$contact = $person->email->contactmethod;
if (!empty($contact)) {
$recipients[] = $contact;
} else {
// If no contact found then reiterate but for company contacts this time
if ($ticket->originator_company_id != null) {
$contact = $ticket->getCompanyEmail($ticket->originator_company_id);
if (!empty($contact)) {
$recipients[] = $contact;
}
}
}
}
// Last ditch effort.
if (count($recipients) == 0) {
if (!is_null($ticket->originator_email_address)) {
$recipients[] = $ticket->originator_email_address;
}
}
return $recipients;
}
示例4: addPersonToTraining
/**
* Add person to training session
*/
public function addPersonToTraining($person_id, $training_id)
{
$select = $this->select()->from($this->_name, array('doesExist' => 'COUNT(*)'))->setIntegrityCheck(false)->where("person_id = {$person_id} AND training_id = {$training_id}");
$row = $this->fetchRow($select);
if ($row->doesExist) {
return -1;
} else {
//make sure person isn't deleted
$person = new Person();
$prows = $person->find($person_id);
if ($prows) {
$prow = $prows->current();
}
if (!$prows || !$prow || $prow->is_deleted) {
return 0;
}
$data['person_id'] = $person_id;
$data['training_id'] = $training_id;
try {
return $this->insert($data);
} catch (Zend_Exception $e) {
error_log($e);
}
}
}
示例5: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$person = new Person();
$person->last_name = 'Doe';
$person->first_name = 'John';
$person->middle_name = 'Dee';
$person->active = 1;
$person->persist();
$this->_objects['person'] = $person;
$username = 'guest';
$password = 'password';
$user = new User();
$user->userId = $person->personId;
$user->personId = $person->personId;
$user->username = $username;
$user->password = $password;
$user->persist();
$this->_objects['user'] = $user;
$userKey = new UserKey();
$userKey->userId = $user->userId;
$userKey->generateKeys($password);
$userKey->persist();
$this->_objects['userKey'] = $userKey;
}
示例7: addAction
public function addAction()
{
$person_id = $this->_getParam('id');
$request = $this->getRequest();
if ($request->isPost()) {
//validate
$status = ValidationContainer::instance();
$status->checkRequired($this, 'title', $this->tr('Title'));
$training_start_date = @$this->getSanParam('start-year') . '-' . @$this->getSanParam('start-month') . '-' . @$this->getSanParam('start-day');
if ($training_start_date !== '--' and $training_start_date !== '0000-00-00') {
$status->isValidDate($this, 'start-day', t('Training') . ' ' . t('start'), $training_start_date);
}
if ($status->hasError()) {
$status->setStatusMessage(t('The person could not be saved.'));
} else {
$ecourseObj = new ExternalCourse();
$ecourseRow = $ecourseObj->createRow();
$ecourseRow->person_id = $person_id;
$ecourseRow->title = $this->getSanParam('title');
$ecourseRow->training_funder = $this->getSanParam('training_funder');
$ecourseRow->training_location = $this->getSanParam('training_location');
$ecourseRow->training_start_date = $training_start_date;
$ecourseRow->training_length_value = $this->getSanParam('training_length_value');
if ($id = $ecourseRow->save()) {
$status->setStatusMessage('The new course was created.');
$this->_redirect('person/edit/id/' . $person_id);
} else {
$status->setStatusMessage(t('The external course could not be saved.'));
}
}
}
$person = new Person();
$personRow = $person->fetchRow('id = ' . $person_id);
$this->view->assign('person', $personRow->toArray());
}
示例8: Person
public function test_男性の場合は性別を取得するとmaleである()
{
$person = new Person('Rintaro', 'male', '1991/12/14');
$test = $person->get_gender();
$expected = 'male';
$this->assertEquals($expected, $test);
}
示例9: add
public function add()
{
$person = new Person();
$person->save();
(new Customer())->setPerson($person)->save();
$this->getRequest()->redirect("person", "edit", array("id" => $person->getId()));
}
示例10: legal_entity
public function legal_entity($entity)
{
if (!empty($entity)) {
$person = new Person($entity);
return $person->data();
}
}
示例11: search_db
function search_db($netid)
{
global $dbfields;
if (!preg_match("/\\A[a-z]{3}([0-9]*)\\Z/i", $netid)) {
return array();
}
init_db();
$query = "select * from users where netid='" . pg_escape_string($netid) . "'";
$result = pg_query($query);
$present = pg_fetch_array($result, null, PGSQL_ASSOC);
if ($present == null) {
return array();
}
$person = new Person($netid);
pg_free_result($result);
foreach ($dbfields as $f) {
$query = "select * from " . $f . " where netid='" . pg_escape_string($netid) . "'";
$result = pg_query($query);
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$value = $line[$f];
if ($line["ldap"] === "f") {
$person->db_fields[$f][] = $value;
} else {
$person->ldap_fields[$f][] = $value;
}
}
pg_free_result($result);
}
$person->refresh_db();
return array($person);
}
示例12: _new
public function _new()
{
$resource = $this->_uses[$this->modeltype];
if (!$resource->isLoaded()) {
if (empty($this->_data['project_id'])) {
$project = new Project();
$projects = $project->getAll();
$project_id = key($projects);
} else {
$project_id = $this->_data['project_id'];
}
$this->view->set('project_id', $project_id);
$tasks = $this->getTaskList($project_id);
$dates = $this->getStartEndDate($project_id);
$this->view->set('start_date', $dates['start_date']['data']);
$this->view->set('end_date', $dates['end_date']['data']);
} else {
$tasks = $this->getTaskList($resource->project_id);
}
$this->view->set('tasks', $tasks);
$person = new Person();
$cc = new ConstraintChain();
$cc->add(new Constraint('company_id', '=', COMPANY_ID));
$this->view->set('people', $person->getAll($cc));
parent::_new();
}
示例13: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$user = new User('passwordset');
$person = new Person();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['User'], $_POST['Person'])) {
$person->attributes = $_POST['Person'];
if ($person->save()) {
$user->attributes = $_POST['User'];
$user->person_id = $person->id;
if ($user->save()) {
// Assign a role to the user
$command = Yii::app()->db->createCommand();
$effectedRows = $command->insert('auth_assignment', array('itemname' => $user->user_role, 'userid' => $user->id, 'bizrule' => '', 'data' => 's:0:"";'));
if ($effectedRows == 1) {
Yii::app()->user->setFlash('success', Yii::t('user', 'User created and assigned to Role successfuly.'));
} else {
Yii::app()->user->setFlash('error', Yii::t('user', 'user assignment to Role failed.'));
}
$this->redirect(array('view', 'id' => $user->id));
} else {
Yii::app()->user->setFlash('error', Yii::t('user', 'user creation failed.'));
}
} else {
Yii::app()->user->setFlash('error', Yii::t('user', 'person creation failed.'));
}
}
$this->render('create', array('user' => $user, 'person' => $person));
}
示例14: _printResults
function _printResults()
{
if (empty($this->_congregations)) {
return;
}
$GLOBALS['system']->includeDBClass('attendance_record_set');
$stats = Attendance_Record_Set::getCongregationalAttendanceStats($this->_start_date, $this->_end_date, $this->_congregations);
$GLOBALS['system']->includeDBClass('person');
$dummy_person = new Person();
$status_map = $dummy_person->getStatusOptions();
?>
<table class="table table-bordered table-auto-width">
<?php
foreach ($status_map as $k => $v) {
if (isset($stats[$k])) {
?>
<tr>
<th><?php
echo ents($v);
?>
</th>
<td style="width: 5ex"><?php
echo $stats[$k];
?>
%</td>
</tr>
<?php
}
}
?>
</table>
<?php
}
示例15: getPeople
public function getPeople($ids, $profileDetails)
{
$ret = array();
$query = "select * from user_profile where user_id in (" . implode(',', $ids) . ")";
$res = mysql_query($query);
if ($res) {
while ($row = @mysql_fetch_assoc($res)) {
$person_id = $row['user_id'];
$name = new Name($row['first_name'] . ' ' . $row['last_name']);
$name->setGivenName($row['first_name']);
$name->setFamilyName($row['last_name']);
$person = new Person($row['user_id'], $name);
$person->setProfileUrl($row['profile_url']);
$date = date($row['date_of_birth']);
$person->setDateOfBirth($date);
$address = new Address($row['city']);
$address->setLocality($row['city']);
$person->setAddresses($address);
$interests = $row['interests'];
$interests = explode(',', $interests);
$person->setInterests($interests);
$person->setThumbnailUrl(!empty($row['user_image']) ? $this->url_prefix . $row['user_image'] : '');
if (!empty($row['Gender'])) {
if ($row['Gender'] == 'f') {
$person->setGender('FEMALE');
} else {
$person->setGender('MALE');
}
}
$ret[$person_id] = $person;
}
}
return $ret;
}