本文整理匯總了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;
}