本文整理汇总了PHP中ca_metadata_elements::getAttributeTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getAttributeTypes方法的具体用法?PHP ca_metadata_elements::getAttributeTypes怎么用?PHP ca_metadata_elements::getAttributeTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_metadata_elements
的用法示例。
在下文中一共展示了ca_metadata_elements::getAttributeTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttributesByElement
/**
*
* @param string $type can be one of: ["ca_objects", "ca_entities", "ca_places", "ca_occurrences", "ca_collections", "ca_list_items", "ca_object_representations", "ca_storage_locations", "ca_movements", "ca_loans", "ca_tours", "ca_tour_stops"]
* @param int $item_id primary key
* @param string $attribute_code_or_id
* @return array
* @throws SoapFault
*/
public function getAttributesByElement($type, $item_id, $attribute_code_or_id)
{
if (!($t_subject_instance = $this->getTableInstance($type, $item_id, true))) {
throw new SoapFault("Server", "Invalid type or item_id");
}
$t_locale = new ca_locales();
$t_element = new ca_metadata_elements();
$va_attrs = $t_subject_instance->getAttributesByElement($attribute_code_or_id);
$va_return = array();
$va_element_type_cfg = ca_metadata_elements::getAttributeTypes();
foreach ($va_attrs as $vo_attr) {
$va_attr = array();
foreach ($vo_attr->getValues() as $vo_value) {
$t_element->load($vo_value->getElementID());
$va_attr[] = array("value_id" => $vo_value->getValueID(), "display_value" => $vo_value->getDisplayValue(), "element_code" => $vo_value->getElementCode(), "element_id" => $vo_value->getElementID(), "attribute_info" => $t_subject_instance->getAttributeLabelAndDescription($vo_value->getElementCode()), "datatype" => $va_element_type_cfg[$t_element->get("datatype")], "locale" => $t_locale->localeIDToCode($vo_attr->getLocaleID()));
}
$va_return[$vo_attr->getAttributeID()] = $va_attr;
}
return $va_return;
}
示例2: getAttributeNameForTypeCode
/**
* Returns data type name for numeric code
*
* @param $pn_type_code numeric type code
* @return string Name of data type (eg. 'Text') or null if code is not defined
*/
public static function getAttributeNameForTypeCode($pn_type_code)
{
$va_types = ca_metadata_elements::getAttributeTypes();
return isset($va_types[$pn_type_code]) ? $va_types[$pn_type_code] : null;
}