本文整理汇总了PHP中ca_metadata_elements::getAttributeTypeCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getAttributeTypeCode方法的具体用法?PHP ca_metadata_elements::getAttributeTypeCode怎么用?PHP ca_metadata_elements::getAttributeTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_metadata_elements
的用法示例。
在下文中一共展示了ca_metadata_elements::getAttributeTypeCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processMetadataElement
private function processMetadataElement($po_element, $pn_parent_id)
{
require_once __CA_MODELS_DIR__ . "/ca_metadata_elements.php";
require_once __CA_MODELS_DIR__ . "/ca_lists.php";
if (($vn_datatype = ca_metadata_elements::getAttributeTypeCode(self::getAttribute($po_element, "datatype"))) === false) {
return false;
// should not happen due to XSD restrictions, but just in case
}
$vs_element_code = self::getAttribute($po_element, "code");
$t_lists = new ca_lists();
if ($this->opb_updating) {
$t_md_element = ca_metadata_elements::getInstance($vs_element_code) ? ca_metadata_elements::getInstance($vs_element_code) : new ca_metadata_elements();
} else {
$t_md_element = new ca_metadata_elements();
}
$t_md_element->setMode(ACCESS_WRITE);
$t_md_element->set('element_code', $vs_element_code);
$t_md_element->set('parent_id', $pn_parent_id);
$t_md_element->set('documentation_url', (string) $po_element->documentationUrl);
$t_md_element->set('datatype', $vn_datatype);
$vs_list = self::getAttribute($po_element, "list");
if (isset($vs_list) && $vs_list && $t_lists->load(array('list_code' => $vs_list))) {
$vn_list_id = $t_lists->getPrimaryKey();
} else {
$vn_list_id = null;
}
$t_md_element->set('list_id', $vn_list_id);
$this->_processSettings($t_md_element, $po_element->settings);
if ($t_md_element->getPrimaryKey()) {
$t_md_element->update();
} else {
$t_md_element->insert();
}
if ($t_md_element->numErrors()) {
$this->addError("There was an error while inserting metadata element {$vs_element_code}: " . join(" ", $t_md_element->getErrors()));
return false;
}
$vn_element_id = $t_md_element->getPrimaryKey();
// add element labels
self::addLabelsFromXMLElement($t_md_element, $po_element->labels, $this->opa_locales);
if ($po_element->elements) {
foreach ($po_element->elements->children() as $vo_child) {
$this->processMetadataElement($vo_child, $vn_element_id);
}
}
return $vn_element_id;
}