本文整理汇总了PHP中CustomField::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::getById方法的具体用法?PHP CustomField::getById怎么用?PHP CustomField::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::getById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFieldValueString
public function getFieldValueString($lab_config_id, $tabletype)
{
global $con;
$lab_config_id = mysql_real_escape_string($lab_config_id, $con);
$field_type = CustomField::getById($this->fieldId, $lab_config_id, $tabletype);
$field_value = $this->fieldValue;
if (trim($field_value) == "" || $field_value == null) {
$field_value = "-";
return $field_value;
}
if ($field_type->fieldTypeId == CustomField::$FIELD_NUMERIC) {
$range = $field_type->getFieldRange();
return $field_value . " {$range['2']}";
} else {
if ($field_type->fieldTypeId == CustomField::$FIELD_DATE) {
return DateLib::mysqlToString($field_value);
} else {
return $field_value;
}
}
}
示例2: testDeleteUserCascadesToDeleteEverythingItShould
/**
* @depends testCreateAndGetUserById
*/
public function testDeleteUserCascadesToDeleteEverythingItShould()
{
$group = new Group();
$group->name = 'Os mais legais do Rio';
$this->assertTrue($group->save());
$user = new User();
$user->username = 'carioca';
$user->title->value = 'Senhor';
$user->firstName = 'José';
$user->lastName = 'Olivereira';
$user->jobTitle = 'Traficante';
$user->primaryAddress->street1 = 'R. das Mulheres, 69';
$user->primaryAddress->street2 = '';
$user->primaryAddress->city = 'Centro';
$user->primaryAddress->state = 'RJ';
$user->primaryAddress->postalCode = '';
$user->primaryAddress->country = 'Brasil';
$user->primaryEmail->emailAddress = 'jose@gmail.com';
$user->primaryEmail->optOut = 1;
$user->primaryEmail->isInvalid = 0;
$user->manager = User::getByUsername('bill');
$user->setPassword('Senhor');
$user->groups->add($group);
$user->save();
$this->assertTrue($user->save());
$titleId = $user->title->id;
$primaryAddressId = $user->primaryAddress->id;
$primaryEmailId = $user->primaryEmail->id;
$groupId = $group->id;
$user->delete();
unset($user);
unset($group);
Group::getById($groupId);
User::getByUsername('bill');
try {
CustomField::getById($titleId);
$this->fail("Title should have been deleted.");
} catch (NotFoundException $e) {
}
try {
Address::getById($primaryAddressId);
$this->fail("Address should have been deleted.");
} catch (NotFoundException $e) {
}
try {
Email::getById($primaryEmailId);
$this->fail("Email should have been deleted.");
} catch (NotFoundException $e) {
}
}
示例3: getCustomFieldEditForm
public function getCustomFieldEditForm($field_id, $lab_config_id, $type)
{
# Returns HTML form fields for editing a custom field
# $type = 1 for specimen custom field
# $type = 2 for patient custom field
# $type = 3 for labtitle custom field
$custom_field = CustomField::getById($field_id, $lab_config_id, $type);
if($custom_field == null)
{
?>
<div class='sidetip_nopos'>
<?php echo LangUtil::$generalTerms['MSG_NOTFOUND']; ?>
</div>
<?php
return;
}
?>
<input type='hidden' name='id' value='<?php echo $custom_field->id; ?>'></input>
<input type='hidden' name='lid' value='<?php echo $lab_config_id; ?>'></input>
<input type='hidden' name='t' value='<?php echo $type; ?>'></input>
<table>
<tbody>
<tr valign='top'>
<td>
<?php echo LangUtil::$generalTerms['NAME']; ?>
</td>
<td>
<input type='input' id='fname' name='fname' value='<?php echo $custom_field->fieldName; ?>' class='uniform_width'>
</input>
</td>
</tr>
<tr valign='top'>
<td>
<?php echo LangUtil::$generalTerms['TYPE']; ?>
</td>
<td>
<input type='hidden' id='ftype' name='ftype' value='<?php echo $custom_field->fieldTypeId; ?>'></input>
<?php echo $custom_field->getFieldTypeName(); ?>
</td>
</tr>
<?php
if($custom_field->fieldTypeId == CustomField::$FIELD_OPTIONS || $custom_field->fieldTypeId == CustomField::$FIELD_MULTISELECT)
{
?>
<tr valign='top'>
<td>
<?php echo LangUtil::$generalTerms['OPTIONS']; ?>
</td>
<td>
<span id='options_list'>
<?php
# Show existing options with fields to add new options
$options = $custom_field->getFieldOptions();
$count = 1;
foreach($options as $option)
{
?>
<input type='text' name='option[]' value='<?php echo $option; ?>' class='uniform_width'>
</input>
<br>
<?php
}
?>
</span>
<small><a href='javascript:appendoption();'><?php echo LangUtil::$generalTerms['ADDANOTHER']; ?> »</a></small>
</td>
</tr>
<?php
}
if($custom_field->fieldTypeId == CustomField::$FIELD_NUMERIC)
{
# Show existing range value fields
$range = $custom_field->getFieldRange();
?>
<tr valign='top'>
<td>
<?php echo LangUtil::$generalTerms['RANGE']; ?>
</td>
<td>
<input type='text' value='<?php echo $range[0]; ?>' name='range_lower' id='range_lower' size='5'></input>
-
<input type='text' value='<?php echo $range[1]; ?>' name='range_upper' id='range_upper' size='5'></input>
</td>
</tr>
<tr valign='top' id='unit_row'>
<td>
<?php echo LangUtil::$generalTerms['UNIT']; ?>
</td>
<td>
<input type='text' value='<?php echo $range[2]; ?>' name='unit' id='unit' class='uniform_width'></input>
</td>
</tr>
<?php
}
?>
<tr>
<td>
Enable:
</td>
//.........这里部分代码省略.........
示例4: testDeleteContactCascadesToDeleteEverythingItShould
public function testDeleteContactCascadesToDeleteEverythingItShould()
{
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertEquals(6, count(ContactState::GetAll()));
$manager = UserTestHelper::createBasicUser('Godzilla');
$this->assertTrue($manager->save());
$account = new Account();
$account->name = 'Os Drogas Mais Legais';
$this->assertTrue($account->save());
$contact = new Contact();
$contact->title->value = 'Senhor';
$contact->firstName = 'José';
$contact->lastName = 'Olivereira';
$contact->jobTitle = 'Traficante';
$contact->primaryAddress->street1 = 'R. das Mulheres, 69';
$contact->primaryAddress->street2 = '';
$contact->primaryAddress->city = 'Centro';
$contact->primaryAddress->state = 'RJ';
$contact->primaryAddress->postalCode = '';
$contact->primaryAddress->country = 'Brasil';
$contact->primaryEmail->emailAddress = 'jose@gmail.com';
$contact->primaryEmail->optOut = 1;
$contact->primaryEmail->isInvalid = 0;
$contact->secondaryAddress->street1 = 'Passagem do Comando Vermelho';
$contact->secondaryAddress->street2 = '';
$contact->secondaryAddress->city = 'Complexo do Alemão';
$contact->secondaryAddress->state = 'RJ';
$contact->secondaryAddress->postalCode = '';
$contact->secondaryAddress->country = 'Brasil';
$contact->account = $account;
$contact->state->name = 'Novo Hermão';
$contact->state->order = 6;
$this->assertTrue($contact->save());
$titleId = $contact->title->id;
$primaryAddressId = $contact->primaryAddress->id;
$primaryEmailId = $contact->primaryEmail->id;
$secondaryAddressId = $contact->secondaryAddress->id;
$accountId = $account->id;
$stateId = $contact->state->id;
$this->assertEquals(7, count(ContactState::GetAll()));
//new state created. Confirm this
$contact->delete();
unset($contact);
unset($manager);
unset($account);
User::getByUsername('godzilla');
Account::getById($accountId);
ContactState::getById($stateId);
try {
CustomField::getById($titleId);
$this->fail("Title should have been deleted.");
} catch (NotFoundException $e) {
}
try {
Address::getById($primaryAddressId);
$this->fail("Primary address should have been deleted.");
} catch (NotFoundException $e) {
}
try {
Email::getById($primaryEmailId);
$this->fail("Primary email should have been deleted.");
} catch (NotFoundException $e) {
}
try {
Address::getById($secondaryAddressId);
$this->fail("Secondary address should have been deleted.");
} catch (NotFoundException $e) {
}
}