Inheritance: extends JObject
示例#1
1
 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
0
 public function testStaticReference()
 {
     $p1 = new Person();
     $this->assertEquals(1, $p1::func());
     $p2 = new Person();
     $this->assertEquals(1, $p2->func());
 }
示例#3
0
 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;
 }
 /**
  * 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
0
 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
0
 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 = '******';
     $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;
 }
 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
0
 public function test_男性の場合は性別を取得するとmaleである()
 {
     $person = new Person('Rintaro', 'male', '1991/12/14');
     $test = $person->get_gender();
     $expected = 'male';
     $this->assertEquals($expected, $test);
 }
示例#9
0
文件: Router.php 项目: xama5/uver-erp
 public function add()
 {
     $person = new Person();
     $person->save();
     (new Customer())->setPerson($person)->save();
     $this->getRequest()->redirect("person", "edit", array("id" => $person->getId()));
 }
 public function legal_entity($entity)
 {
     if (!empty($entity)) {
         $person = new Person($entity);
         return $person->data();
     }
 }
示例#11
0
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
0
 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
0
 /**
  * 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));
 }
    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
0
 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;
 }
 function edit($id = null)
 {
     $this->Person->id = $id;
     if (empty($this->data)) {
         // Load data.
         $this->data = $this->Person->read();
         $this->set('person', $this->data);
         $father = new Person();
         $father->id = $this->data['Person']['father_id'];
         $this->set('father', $father->read());
         $mother = new Person();
         $mother->id = $this->data['Person']['mother_id'];
         $this->set('mother', $mother->read());
         $spouse = new Person();
         $spouse->id = $this->data['Person']['spouse_id'];
         $this->set('spouse', $spouse->read());
         // Household list.
         $this->set('households', $this->Household->find('list', array('order' => 'name DESC')));
     } else {
         // Save data.
         if ($this->Person->save($this->data)) {
             $this->flash('Person updated.', '/people');
         } else {
             $this->flash('Error saving personal information');
         }
     }
 }
示例#17
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSetMoreThanTwoParents()
 {
     $father = new Person('Peter', 'Rack', Person::GENDER_MALE);
     $mother1 = new Person('Petra', 'Rack', Person::GENDER_FEMALE);
     $mother2 = new Person('Christine', 'Bauer', Person::GENDER_FEMALE);
     $this->person->setParents([$father, $mother1, $mother2]);
 }
示例#18
0
文件: Router.php 项目: xama5/uver-erp
 public function add_post()
 {
     $person = new Person();
     $person->save();
     (new Employee())->setPerson($person)->setHours($_POST["hours"])->setWage($_POST["wage"])->save();
     $this->getRequest()->redirect("person", "edit", array("id" => $person->getId()));
 }
示例#19
0
 /**
  * @dataProvider provider_人データ
  */
 public function test_設定した性別は取得した性別と一致する($name, $gender, $birthdate)
 {
     $person = new Person($name, $gender, $birthdate);
     $test = $person->get_gender();
     $expected = $gender;
     $this->assertEquals($expected, $test);
 }
 function launch()
 {
     global $configArray;
     global $interface;
     //Check to see if we are doing the reindex.  If so, we need to do it in batches
     //Because PHP will time out doing the full reindex, break up into chunks of 25 records at a time.
     //Process is as follows:
     //1. Display form for the user to start the reindex process
     //2. System loads the total nummber of records in the database
     //5. Total number of records in the database are stored in the session with the filename and current status
     //6. Information sent back to browser with number of records, etc.
     //7. Browser does AJAX callbacks to run each batch and update progress bar when each finishes. (in JSON.php)
     //8. Separate action available to cancel the batch
     if (isset($_REQUEST["submit"])) {
         $person = new Person();
         $person->find();
         $numRecords = $person->N;
         $_SESSION['genealogyDateFix']['currentRecord'] = 0;
         $_SESSION['genealogyDateFix']['numRecords'] = $numRecords;
         $interface->assign('startDateFix', true);
         $interface->assign('numRecords', $numRecords);
         $interface->assign('percentComplete', 0);
     }
     $interface->setTemplate('genealogyFixDates.tpl');
     $interface->setPageTitle('Fix Dates in Genalogy Information');
     $interface->display('layout.tpl');
 }
示例#21
0
function send_mail($to_list, $from_person, $cc_list, $subject, $message)
{
    if (empty($message)) {
        return false;
    }
    $crlf = "\n";
    if (!is_array($to_list)) {
        $to_list = array($to_list);
    }
    $to = player_rfc2822_address_list($to_list);
    if (!$from_person) {
        $from_person = new Person();
        $from_person->email = variable_get('app_admin_email', 'webmaster@localhost');
        $from_person->fullname = variable_get('app_admin_name', 'Leaguerunner Administrator');
    }
    $from = $from_person->rfc2822_address();
    $headers = "From: {$from}{$crlf}";
    if ($cc_list) {
        $cc = player_rfc2822_address_list($cc_list);
        $headers .= "Cc: {$cc}{$crlf}";
    }
    if (empty($to) && empty($cc)) {
        return false;
    }
    return mail($to, $subject, $message, $headers, "-f {$from_person->email}");
}
示例#22
0
 public function systemCompany(&$do, &$errors)
 {
     $user = getCurrentUser();
     $person = new Person();
     $person->load($user->person_id);
     $format = new xmlrpcmsg('elgg.user.newCommunity', array(new xmlrpcval($person->firstname . ' ' . $person->surname, "string"), new xmlrpcval($person->email, "string"), new xmlrpcval($do->company, "string")));
     $client = new xmlrpc_client("_rpc/RPC2.php", "tech2.severndelta.co.uk", 8091);
     $request = $client->send($format);
     if (!$request->faultCode()) {
         $response = $request->value();
         if ($response->structmemexists('owner') && $response->structmemexists('community')) {
             $person->published_username = $response->structmem('owner')->scalarval();
             $person->save();
             $do->published = true;
             $do->published_username = $response->structmem('community')->scalarval();
             $do->published_owner_id = $person->id;
             $do->save();
         } else {
             $errors[] = 'Failed to publish company';
         }
     } else {
         $errors[] = "Code: " . $request->faultCode() . " Reason '" . $request->faultString();
         return false;
     }
     return true;
 }
 function processView()
 {
     if (empty($_REQUEST['personid'])) {
         trigger_error("Cannot add note, no person ID specified", E_USER_WARNING);
         return;
     }
     if (!is_array($_REQUEST['personid'])) {
         $this->_person =& $GLOBALS['system']->getDBObject('person', $_REQUEST['personid']);
         $_REQUEST['personid'] = array($_REQUEST['personid']);
     }
     if ($templateID = array_get($_REQUEST, 'note_template_id')) {
         $this->_note_template = new Note_Template($templateID);
     }
     $GLOBALS['system']->includeDBClass('person_note');
     $this->_note = new Person_Note();
     $this->_note->processForm();
     if (array_get($_REQUEST, 'new_note_submitted')) {
         if ($this->_note_template) {
             $this->_note_template->processNoteFieldWidgets();
             $this->_note_template->applyDataBlock($this->_note);
         }
         $success = $failure = 0;
         foreach ($_REQUEST['personid'] as $personid) {
             if ($this->_note_template && $this->_note_template->usesCustomFields()) {
                 $person = new Person($personid);
                 if (!$person->acquireLock()) {
                     add_message("Could not acquire lock on " . $person->toString() . ' - note not saved', 'error');
                     continue;
                     // don't save the note if can't apply the values
                 }
                 $this->_note_template->applyFieldValues($person);
                 if (!$person->save()) {
                     add_message("Could not save values on " . $person->toString() . ' - note not saved', 'error');
                     continue;
                     // don't save the note if can't apply the values
                 }
             }
             $this->_note->id = 0;
             $this->_note->setValue('personid', $personid);
             if ($this->_note->create()) {
                 $success++;
             }
         }
         if ($success) {
             if ($this->_person) {
                 add_message('Note added');
                 redirect('persons', array('personid' => $this->_person->id), 'note_' . $this->_note->id);
                 // exits
             } else {
                 if ($success == count($_REQUEST['personid'])) {
                     add_message('Note added to ' . count($_REQUEST['personid']) . ' persons');
                 } else {
                     add_message('Note successfully added to ' . $success . ' of the ' . count($_REQUEST['personid']) . ' selected persons');
                 }
                 redirect(-1);
             }
         }
     }
 }
示例#24
0
 public function getPerson($givenName, $familyName)
 {
     /* pretend to go to the database, get the person... */
     $person = new Person();
     $person->setPrefix("Mr.");
     $person->setGivenName("John");
     return $person;
 }
示例#25
0
function get_one_person()
{
    $person_id = empty($_GET['pid']) ? 0 : $_GET['pid'];
    $_person = new Person();
    $response = $_person->findById($person_id);
    echo header("Content-type: application/json; charset=utf-8");
    echo json_encode($response);
}
示例#26
0
 public function test_女性の場合は性別を取得するとfemaleである()
 {
     fwrite(STDOUT, __METHOD__ . "\n");
     $person = new Person('Mayuri', 'female', '1994/2/1');
     $test = $person->get_gender();
     $expected = 'female';
     $this->assertEquals($expected, $test);
 }
示例#27
0
 /**
  * 
  * @param Person $person
  * @param Person $attendancePerson - person who take attendance
  * @return boolean
  */
 public function registerAttendance($person, $attendancePerson)
 {
     if ($person->can_take_Attendance($attendancePerson->id)) {
         // register attendance into DB
         return true;
     }
     return false;
 }
示例#28
0
 public function viewperson()
 {
     $view = new Newsletterview();
     $view->load($this->_data['id']) or sendBack();
     $person = new Person();
     $person->load($view->person_id);
     sendTo('persons', 'view', 'contacts', array('id' => $person->id));
 }
示例#29
0
 public function addCustomer($company, $firstname, $lastname, $address, $zip, $city)
 {
     $person = new Person();
     $person->setCompany($company)->setFirstname($firstname)->setLastname($lastname)->setAddress($address)->setCity($city)->setZip($zip)->save();
     $customer = new Customer();
     $customer->setPerson($person)->save();
     return $customer;
 }
 public function testEmptyConstructor()
 {
     $user = new Person();
     $this->assertNull($user->id);
     $this->assertNull($user->vorname);
     $this->assertNull($user->name);
     $this->assertNull($user->email);
     $this->assertEquals('', $user->__toString());
 }