本文整理汇总了PHP中ca_metadata_elements::getAttributeNameForTypeCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getAttributeNameForTypeCode方法的具体用法?PHP ca_metadata_elements::getAttributeNameForTypeCode怎么用?PHP ca_metadata_elements::getAttributeNameForTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_metadata_elements
的用法示例。
在下文中一共展示了ca_metadata_elements::getAttributeNameForTypeCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getElementTypesForCodes
/**
* Returns the names of the datatypes for a given list of metadata elements
*
* @param array $element_codes List of codes of the elements in question
* @return array Names of the datatypes, e.g. "List", "Text", etc.
*/
public function getElementTypesForCodes($element_codes)
{
$vo_db = new Db();
if (!is_array($element_codes)) {
throw new SoapFault("Server", "Invalid argument");
}
$va_return = array();
foreach ($element_codes as $vs_element_code) {
$qr_elements = $vo_db->query("SELECT datatype FROM ca_metadata_elements WHERE element_code=?", $vs_element_code);
while ($qr_elements->nextRow()) {
$va_return[$vs_element_code] = ca_metadata_elements::getAttributeNameForTypeCode(intval($qr_elements->get("datatype")));
}
}
return $va_return;
}
示例2: caNavUrl
print caNavUrl($this->request, 'administrate/setup', 'Elements', 'Edit', array('parent_id' => $vn_element_id, 'element_id' => $va_sub_element['element_id']));
?>
" class="caDeleteLabelButton"><?php
print caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__);
?>
</a>
<a href="<?php
print caNavUrl($this->request, 'administrate/setup', 'Elements', 'Delete', array('parent_id' => $vn_element_id, 'element_id' => $va_sub_element['element_id']));
?>
" class="caDeleteLabelButton"><?php
print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__);
?>
</a>
<span class="labelDisplay">
<?php
print $va_sub_element['name'] . ' (' . $va_sub_element['element_code'] . ') [' . ca_metadata_elements::getAttributeNameForTypeCode($va_sub_element['datatype']) . ']';
?>
</span>
</div>
<?php
}
?>
</div>
<div class="button labelInfo caAddLabelButton">
<a href="<?php
print caNavUrl($this->request, 'administrate/setup', 'Elements', 'Edit', array('parent_id' => $vn_element_id, 'element_id' => 0));
?>
">
<?php
print caNavIcon($this->request, __CA_NAV_BUTTON_ADD__);
?>
示例3: getElementAsDOM
private function getElementAsDOM($pn_parent_id)
{
$t_element = new ca_metadata_elements();
$t_list = new ca_lists();
$qr_elements = $this->opo_db->query("SELECT * FROM ca_metadata_elements WHERE parent_id = ? ORDER BY element_id", $pn_parent_id);
if (!$qr_elements->numRows()) {
return null;
}
$vo_elements = $this->opo_dom->createElement("elements");
while ($qr_elements->nextRow()) {
$vo_element = $this->opo_dom->createElement("metadataElement");
$vo_element->setAttribute("code", $this->makeIDNO($qr_elements->get("element_code")));
$vo_element->setAttribute("datatype", ca_metadata_elements::getAttributeNameForTypeCode($qr_elements->get("datatype")));
if ($qr_elements->get("list_id")) {
$t_list->load($qr_elements->get("list_id"));
$vo_element->setAttribute("list", $t_list->get("list_code"));
}
$vo_labels = $this->opo_dom->createElement("labels");
$qr_element_labels = $this->opo_db->query("SELECT * FROM ca_metadata_element_labels WHERE element_id=?", $qr_elements->get("element_id"));
while ($qr_element_labels->nextRow()) {
$vo_label = $this->opo_dom->createElement("label");
$vo_label->setAttribute("locale", $this->opt_locale->localeIDToCode($qr_element_labels->get("locale_id")));
$vo_label->appendChild($this->opo_dom->createElement("name", caEscapeForXML($qr_element_labels->get("name"))));
if (strlen(trim($qr_element_labels->get("description"))) > 0) {
$vo_label->appendChild($this->opo_dom->createElement("description", caEscapeForXML($qr_element_labels->get("description"))));
}
$vo_labels->appendChild($vo_label);
}
$vo_element->appendChild($vo_labels);
$t_element->load($qr_elements->get("element_id"));
$vo_settings = $this->opo_dom->createElement("settings");
if (is_array($va_settings = $t_element->getSettings())) {
foreach ($va_settings as $vs_setting => $va_values) {
if (is_null($va_values)) {
continue;
}
if (!is_array($va_values)) {
$va_values = array($va_values);
}
foreach ($va_values as $vs_value) {
$vo_setting = $this->opo_dom->createElement("setting", $vs_value);
$vo_setting->setAttribute("name", $vs_setting);
$vo_settings->appendChild($vo_setting);
}
}
}
$vo_element->appendChild($vo_settings);
$vo_sub_elements = $this->getElementAsDOM($qr_elements->get("element_id"));
if ($vo_sub_elements) {
$vo_element->appendChild($vo_sub_elements);
}
$vo_elements->appendChild($vo_element);
}
return $vo_elements;
}
示例4: getModelInfoForType
private function getModelInfoForType($ps_type)
{
$t_instance = $this->_getTableInstance($this->getTableName());
$t_list = new ca_lists();
$va_return = array();
$vs_type_list_code = $t_instance->getTypeListCode();
// type info
$va_item = $t_list->getItemFromList($vs_type_list_code, $ps_type);
$va_return["type_info"] = $va_item;
$va_return["type_info"]["display_label"] = $t_list->getItemFromListForDisplay($vs_type_list_code, $ps_type);
// applicable element codes and related info
$va_elements = array();
$va_codes = $t_instance->getApplicableElementCodes($va_item["item_id"]);
$va_codes = array_flip($va_codes);
foreach ($va_codes as $vs_code => $va_junk) {
// subelements
$t_element = $t_instance->_getElementInstance($vs_code);
foreach ($t_element->getElementsInSet() as $va_element_in_set) {
if ($va_element_in_set["datatype"] == 0) {
continue;
}
// don't include sub-containers
$va_element_in_set["datatype"] = ca_metadata_elements::getAttributeNameForTypeCode($va_element_in_set["datatype"]);
$va_elements[$vs_code]["elements_in_set"][$va_element_in_set["element_code"]] = $va_element_in_set;
}
// element label and description
$va_label = $t_instance->getAttributeLabelAndDescription($vs_code);
$va_elements[$vs_code]["name"] = $va_label["name"];
if (isset($va_label["description"])) {
$va_elements[$vs_code]["description"] = $va_label["description"];
}
}
$va_return["elements"] = $va_elements;
// possible relationships with "valid tables" (i.e. those that are accessible via services)
$t_rel_types = new ca_relationship_types();
foreach ($this->opa_valid_tables as $vs_table) {
$vs_rel_table = $t_rel_types->getRelationshipTypeTable($this->getTableName(), $vs_table);
$va_info = $t_rel_types->getRelationshipInfo($vs_rel_table);
foreach ($va_info as $va_tmp) {
$va_return["relationship_types"][$vs_table][$va_tmp["type_code"]] = $va_tmp;
}
}
return $va_return;
}