本文整理匯總了PHP中CommonDropdown::getSpecificValueToDisplay方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonDropdown::getSpecificValueToDisplay方法的具體用法?PHP CommonDropdown::getSpecificValueToDisplay怎麽用?PHP CommonDropdown::getSpecificValueToDisplay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonDropdown
的用法示例。
在下文中一共展示了CommonDropdown::getSpecificValueToDisplay方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSpecificValueToDisplay
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'field':
if (isset($values['itemtype']) && !empty($values['itemtype'])) {
$target = getItemForItemtype($values['itemtype']);
$searchOption = $target->getSearchOptionByField('field', $values[$field]);
// if (empty($searchOption)) {
// if ($table = getTableNameForForeignKeyField($values[$field])) {
// $searchOption = $target->getSearchOptionByField('field', 'name', $table);
// }
// echo $table.'--';
// }
return $searchOption['name'];
}
break;
case 'value':
if (isset($values['itemtype']) && !empty($values['itemtype'])) {
$target = getItemForItemtype($values['itemtype']);
if (isset($values['field']) && !empty($values['field'])) {
$searchOption = $target->getSearchOptionByField('field', $values['field']);
// MoYo : do not know why this part ?
// if ($table = getTableNameForForeignKeyField($values['field'])) {
// $searchOption = $target->getSearchOptionByField('field', 'name', $table);
// }
return $target->getValueToDisplay($searchOption, $values[$field]);
}
}
break;
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例2: getSpecificValueToDisplay
/**
* @param $field
* @param $values
* @param $options array
*/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'type':
$types = self::getTypes();
return $types[$values[$field]];
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例3: getSpecificValueToDisplay
/**
* @since version 0.84
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'fields':
if (isset($values['itemtype']) && !empty($values['itemtype'])) {
if ($target = getItemForItemtype($values['itemtype'])) {
$searchOption = $target->getSearchOptionByField('field', $values[$field]);
$fields = explode(',', $values[$field]);
$message = array();
foreach ($fields as $field) {
$searchOption = $target->getSearchOptionByField('field', $field);
if (isset($searchOption['name'])) {
$message[] = $searchOption['name'];
}
}
return implode(', ', $message);
}
}
break;
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例4: getSpecificValueToDisplay
/**
* @since version 0.84
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'icon':
if (!empty($values[$field])) {
return " <img style='vertical-align:middle;' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $values[$field] . "'>";
}
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例5: getSpecificValueToDisplay
/**
* @since version 0.84
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'periodicity':
if (preg_match('/([0-9]+)MONTH/', $values[$field], $matches)) {
return sprintf(_n('%d month', '%d months', $matches[1]), $matches[1]);
}
if (preg_match('/([0-9]+)YEAR/', $values[$field], $matches)) {
return sprintf(_n('%d year', '%d years', $matches[1]), $matches[1]);
}
return Html::timestampToString($values[$field], false);
break;
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}