本文整理汇总了PHP中Field::getDatabaseValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::getDatabaseValue方法的具体用法?PHP Field::getDatabaseValue怎么用?PHP Field::getDatabaseValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::getDatabaseValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDisplayValue
function getDisplayValue($record)
{
// XXX: this is also called statically by NoneField->getDisplayValue!
// get date format
if (@$SETTINGS['dateFormat'] == 'dmy') {
$dateFormat = "jS M, Y - h:i:s A";
} elseif (@$SETTINGS['dateFormat'] == 'mdy') {
$dateFormat = "M jS, Y - h:i:s A";
} else {
$dateFormat = "M jS, Y - h:i:s A";
}
// format date
$value = parent::getDatabaseValue($record);
if (!$value && @$record['num']) {
$value = '';
} elseif (!$value && !@$record['num']) {
$value = date($dateFormat);
} else {
if ($value == '0000-00-00 00:00:00') {
$value = '';
} else {
$value = date($dateFormat, strtotime($value));
}
}
//
return $value;
}
示例2: getDisplayValue
function getDisplayValue($record)
{
// override me in derived classes
$value = parent::getDatabaseValue($record);
//
if (!@$this->autoFormat) {
$value = nl2br($value);
}
return $value;
}
示例3: getDisplayValue
function getDisplayValue($record)
{
// override me in derived classes
$value = parent::getDatabaseValue($record);
// obscure password fields
if ($GLOBALS['tableName'] == 'accounts' && $this->name == 'password') {
return '**********';
}
//
return $value;
}
示例4: getDisplayValue
function getDisplayValue($record)
{
// override me in derived classes
$value = parent::getDatabaseValue($record);
$fieldname = $this->name;
if (array_key_exists("{$fieldname}:labels", $record)) {
$value = join("<br/>\n", $record["{$fieldname}:labels"]);
} else {
if (array_key_exists("{$fieldname}:label", $record)) {
$value = $record["{$fieldname}:label"];
}
}
return $value;
}
示例5: getDisplayValue
function getDisplayValue($record)
{
// format createdBy/updatedBy dates
require_once SCRIPT_DIR . '/lib/fieldtypes/date.php';
$dateFields = array('createdDate', 'updatedDate');
if (in_array($this->name, $dateFields)) {
return @DateField::getDisplayValue($record);
// XXX: supress warning about calling a non-static method statically
}
// format createByUserNum/updatedByUserNum
$value = parent::getDatabaseValue($record);
$userNumFields = array('createdByUserNum', 'updatedByUserNum');
if (in_array($this->name, $userNumFields)) {
$accountsTable = "{$GLOBALS['TABLE_PREFIX']}accounts";
$query = mysql_escapef("SELECT username FROM `{$accountsTable}` WHERE num = ?", $value);
list($username) = mysql_get_query($query, true);
$value = $username;
return $value;
}
return parent::getDisplayValue($record);
}
示例6: getDisplayValue
function getDisplayValue($record)
{
$isChecked = parent::getDatabaseValue($record);
$displayText = $isChecked ? @$this->checkedValue : @$this->uncheckedValue;
return $displayText;
}