本文整理汇总了PHP中Attachment::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::populate方法的具体用法?PHP Attachment::populate怎么用?PHP Attachment::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::populate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAttachToNotesAction
public function processAttachToNotesAction()
{
$attachmentId = (int) $this->_getParam('attachmentId');
$attachmentReferenceId = $this->_getParam('attachmentReferenceId');
$attachment = new Attachment();
$attachment->attachmentId = $attachmentId;
$attachment->populate();
$attachment->attachmentReferenceId = $attachmentReferenceId;
$attachment->persist();
$json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
$json->suppressExit = true;
$json->direct(true);
}
示例2: viewAttachmentAction
public function viewAttachmentAction()
{
$attachmentId = (int) $this->_getParam('attachmentId');
$attachment = new Attachment();
$attachment->attachmentId = $attachmentId;
$attachment->populate();
$db = Zend_Registry::get('dbAdapter');
$sql = "select data from attachmentBlobs where attachmentId = " . $attachmentId;
$stmt = $db->query($sql);
$row = $stmt->fetch();
$this->view->content = $row['data'];
switch ($attachment->mimeType) {
case 'image/png':
case 'image/jpg':
case 'image/jpeg':
case 'image/gif':
$this->getResponse()->setHeader('Content-Type', $attachment->mimeType);
break;
case 'application/x-shockwave-flash':
$this->getResponse()->setHeader('Content-Type', $attachment->mimeType);
$stmt->closeCursor();
$this->render();
return;
break;
default:
$this->getResponse()->setHeader('Content-Type', 'application/binary');
}
$this->getResponse()->setHeader('Content-Disposition', 'attachment; filename="' . $attachment->name . '"');
$stmt->closeCursor();
$this->render();
}
示例3: getPhoto
public function getPhoto()
{
$picture = '';
if ($this->activePhoto > 0) {
$attachment = new Attachment();
$attachment->attachmentId = (int) $this->activePhoto;
$attachment->populate();
$picture = base64_encode($attachment->rawData);
}
return $picture;
}
示例4: populateXML
public function populateXML(SimpleXMLElement $xml = null, $checked = true)
{
if ($xml === null) {
$xml = new SimpleXMLElement('<data/>');
}
$personId = (int) $this->person_id;
$person = $this->person;
$picture = '';
if ($person->activePhoto > 0) {
$attachment = new Attachment();
$attachment->attachmentId = (int) $person->activePhoto;
$attachment->populate();
$picture = base64_encode($attachment->rawData);
}
$xmlPatient = $xml->addChild('patient');
$xmlPerson = $xmlPatient->addChild('person');
$this->_addChild($xmlPerson, 'picture', $picture, $checked);
$this->_addChild($xmlPerson, 'lastName', $person->lastName, $checked);
$this->_addChild($xmlPerson, 'firstName', $person->firstName, $checked);
$this->_addChild($xmlPerson, 'middleName', $person->middleName, $checked);
$identifier = '';
if ($person->identifierType == 'SSN') {
$identifier = $person->identifier;
}
$this->_addChild($xmlPerson, 'identifier', $identifier, $checked);
$this->_addChild($xmlPerson, 'gender', $person->gender, $checked);
$dateOfBirth = explode(' ', date('m d Y', strtotime($person->dateOfBirth)));
$this->_addChild($xmlPerson, 'dobMonth', $dateOfBirth[0], $checked);
$this->_addChild($xmlPerson, 'dobDay', $dateOfBirth[1], $checked);
$this->_addChild($xmlPerson, 'dobYear', $dateOfBirth[2], $checked);
$statistics = PatientStatisticsDefinition::getPatientStatistics($personId);
$race = '';
if (isset($statistics['Race'])) {
$race = $statistics['Race'];
} else {
if (isset($statistics['race'])) {
$race = $statistics['race'];
}
}
$this->_addChild($xmlPerson, 'race', $race, $checked);
$maritalStatus = $person->maritalStatus ? $person->maritalStatus : 'Other';
$this->_addChild($xmlPerson, 'maritalStatus', $maritalStatus, $checked);
$addresses = Address::listAddresses($personId);
foreach ($addresses as $address) {
switch ($address->type) {
case Address::TYPE_MAIN:
$type = 'mainAddress';
break;
case Address::TYPE_SEC:
$type = 'secondaryAddress';
break;
case Address::TYPE_HOME:
$type = 'homeAddress';
break;
case Address::TYPE_EMPLOYER:
$type = 'employerAddress';
break;
case Address::TYPE_BILLING:
$type = 'billingAddress';
break;
case Address::TYPE_OTHER:
default:
$type = 'otherAddress';
break;
}
$xmlAddress = $xmlPatient->addChild($type);
$this->_addChild($xmlAddress, 'line1', $address->line1, $checked);
$this->_addChild($xmlAddress, 'city', $address->city, $checked);
$this->_addChild($xmlAddress, 'state', $address->state, $checked);
$this->_addChild($xmlAddress, 'zip', $address->postalCode, $checked);
}
$phoneNumbers = PhoneNumber::listPhoneNumbers($personId);
foreach ($phoneNumbers as $phoneNumber) {
switch ($phoneNumber->type) {
case PhoneNumber::TYPE_HOME:
$type = 'homePhone';
break;
case PhoneNumber::TYPE_WORK:
$type = 'workPhone';
break;
case PhoneNumber::TYPE_BILLING:
$type = 'billingPhone';
break;
case PhoneNumber::TYPE_EMPLOYER:
$type = 'employerPhone';
break;
case PhoneNumber::TYPE_MOBILE:
$type = 'mobilePhone';
break;
case PhoneNumber::TYPE_EMERGENCY:
$type = 'emergencyPhone';
break;
case PhoneNumber::TYPE_FAX:
$type = 'faxPhone';
break;
case PhoneNumber::TYPE_HOME_EVE:
$type = 'homeEvePhone';
break;
case PhoneNumber::TYPE_HOME_DAY:
$type = 'homeDayPhone';
//.........这里部分代码省略.........
示例5: _editView
protected function _editView($viewId = 0, $mode = 'add')
{
$reportView = new ReportView();
$reportView->reportBaseId = (int) $this->_getParam('baseId');
if ($viewId > 0) {
$reportView->reportViewId = $viewId;
$reportView->populate();
}
$form = new WebVista_Form(array('name' => $mode . '-view'));
$form->setAction(Zend_Registry::get('baseUrl') . 'reports-manager.raw/process-' . $mode . '-view');
$form->loadORM($reportView, 'ReportView');
$form->setWindow('winReportBaseViewId');
$this->view->form = $form;
$queries = array();
$reportQuery = new ReportQuery();
$reportQuery->reportBaseId = $reportView->reportBaseId;
$reportQueryIterator = $reportQuery->getIteratorByBaseId();
$this->view->queries = $reportQueryIterator->toArray('reportQueryId', 'displayName');
$mappings = array();
if ($reportView->unserializedColumnDefinitions === null) {
$reportView->unserializedColumnDefinitions = array();
}
foreach ($reportView->unserializedColumnDefinitions as $col) {
$mappings[] = $this->_generateMappingGridRowData($col);
}
$this->view->mappings = $mappings;
$this->view->transformTypes = ReportView::getTransformTypes();
$this->view->showResults = ReportView::getShowResultOptions();
$showResultsOptions = $reportView->unserializedShowResultsOptions;
if (isset($showResultsOptions['pdfTemplateFile'])) {
$attachment = new Attachment();
$attachment->attachmentId = (int) $showResultsOptions['pdfTemplateFile'];
$attachment->populate();
$showResultsOptions['pdfTemplateFileContent'] = '<a href="' . $this->view->baseUrl . '/attachments.raw/view-attachment?attachmentId=' . $attachment->attachmentId . '">' . $attachment->name . '</a>';
}
$this->view->showResultsOptions = $showResultsOptions;
$this->view->lineEndings = ReportView::getLineEndingOptions();
$this->render('edit-view');
}
示例6: defaultPatientHeaderAction
public function defaultPatientHeaderAction()
{
$personId = (int) $this->_getParam('personId');
// e76f18cd-d388-4c53-b940-53cb81b80c5e
$referenceId = $this->_getParam('referenceId');
$data = $this->_getAttachmentData($referenceId);
$patient = new Patient();
$patient->personId = $personId;
$patient->populate();
$person = $patient->person;
$picture = '';
if ($person->activePhoto > 0) {
$attachment = new Attachment();
$attachment->attachmentId = (int) $person->activePhoto;
$attachment->populate();
$picture = base64_encode($attachment->rawData);
}
$xml = new SimpleXMLElement('<patientHeader/>');
$xmlPatient = $xml->addChild('patient');
$this->_addChild($xmlPatient, 'picture', $picture);
$this->_addChild($xmlPatient, 'lastName', $person->lastName);
$this->_addChild($xmlPatient, 'firstName', $person->firstName);
$this->_addChild($xmlPatient, 'dateOfBirth', $person->dateOfBirth);
$this->_addChild($xmlPatient, 'gender', $person->gender);
$statistics = PatientStatisticsDefinition::getPatientStatistics($personId);
$race = '';
if (isset($statistics['Race'])) {
$race = $statistics['Race'];
} else {
if (isset($statistics['race'])) {
$race = $statistics['race'];
}
}
$this->_addChild($xmlPatient, 'race', $race);
$this->_addChild($xmlPatient, 'maritalStatus', $person->displayMaritalStatus);
$addresses = Address::listAddresses($personId);
$phoneNumbers = PhoneNumber::listPhoneNumbers($personId);
$address = null;
if (isset($addresses[Address::TYPE_BILLING])) {
$address = $addresses[Address::TYPE_BILLING];
} else {
if (isset($addresses[Address::TYPE_HOME])) {
$address = $addresses[Address::TYPE_HOME];
} else {
if (isset($addresses[Address::TYPE_MAIN])) {
$address = $addresses[Address::TYPE_MAIN];
} else {
if (isset($addresses[Address::TYPE_SEC])) {
$address = $addresses[Address::TYPE_SEC];
} else {
if (isset($addresses[Address::TYPE_OTHER])) {
$address = $addresses[Address::TYPE_OTHER];
}
}
}
}
}
if ($address !== null) {
$phone = '';
if (isset($phoneNumbers[PhoneNumber::TYPE_BILLING])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_BILLING]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_HOME])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_HOME]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_WORK])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_WORK]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_HOME_DAY])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_HOME_DAY]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_HOME_EVE])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_HOME_EVE]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_MOBILE])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_MOBILE]->number;
} else {
if (isset($phoneNumbers[PhoneNumber::TYPE_BEEPER])) {
$phone = $phoneNumbers[PhoneNumber::TYPE_BEEPER]->number;
}
}
}
}
}
}
}
$this->_addChild($xmlPatient, 'billingLine1', $address->line1);
$this->_addChild($xmlPatient, 'billingCity', $address->city);
$this->_addChild($xmlPatient, 'billingState', $address->state);
$this->_addChild($xmlPatient, 'billingZip', $address->postalCode);
$this->_addChild($xmlPatient, 'phoneNumber', $phone);
}
if ($person->primaryPracticeId > 0) {
$practice = new Practice();
$practice->practiceId = (int) $person->primaryPracticeId;
$practice->populate();
$address = $practice->primaryAddress;
$xmlPractice = $xml->addChild('practice');
$this->_addChild($xmlPractice, 'name', $practice->name);
$this->_addChild($xmlPractice, 'primaryLine1', $address->line1);
//.........这里部分代码省略.........
示例7: Person
function _makeThumbnail($height, $width, $personId)
{
$person = new Person();
$person->personId = $personId;
$person->populate();
$picFile = '';
if ($person->activePhoto > 0) {
$attachmentId = $person->activePhoto;
$attachment = new Attachment();
$attachment->attachmentId = $attachmentId;
$attachment->populate();
$db = Zend_Registry::get('dbAdapter');
$sql = "select data from attachmentBlobs where attachmentId = " . $attachmentId;
$stmt = $db->query($sql);
$row = $stmt->fetch();
$picFile = tempnam('/tmp', 'patpic');
file_put_contents($picFile, $row['data']);
$stmt->closeCursor();
} else {
$patientDir = Zend_Registry::get('config')->document->legacyStorePath . '/' . $personId;
if ($personId == 0 || !file_exists($patientDir)) {
$this->noPictureAction();
}
$dir = dir($patientDir);
$picturePath = array();
while (false !== ($entry = $dir->read())) {
if (preg_match('/.*_pat_pic([0-9]+.*).jpg/', $entry, $matches)) {
$timestamp = strtotime($matches[1]);
if (!isset($picturePath['timestamp']) || isset($picturePath['timestamp']) && $timestamp > $picturePath['timestamp']) {
$picturePath['timestamp'] = $timestamp;
$picturePath['path'] = $patientDir . '/' . $entry;
}
}
}
$picFile = $picturePath['path'];
}
if (!file_exists($picFile)) {
$this->noPictureAction();
}
$patientPicture = new ResizeImage();
$patientPicture->load($picFile);
$patientPicture->resize((int) $width, (int) $height);
return $patientPicture;
}
示例8: viewAttachmentAction
public function viewAttachmentAction()
{
$attachmentId = (int) $this->_getParam('attachmentId');
$attachment = new Attachment();
$attachment->attachmentId = $attachmentId;
$attachment->populate();
$db = Zend_Registry::get('dbAdapter');
$sql = "select data from attachmentBlobs where attachmentId = " . $attachmentId;
$stmt = $db->query($sql);
$row = $stmt->fetch();
$this->view->content = $row['data'];
$stmt->closeCursor();
$this->getResponse()->setHeader('Content-Type', 'application/binary');
$this->getResponse()->setHeader('Content-Disposition', 'attachment; filename="' . $attachment->name . '"');
$this->render();
}