本文整理汇总了PHP中ca_metadata_elements::getSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_metadata_elements::getSettings方法的具体用法?PHP ca_metadata_elements::getSettings怎么用?PHP ca_metadata_elements::getSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_metadata_elements
的用法示例。
在下文中一共展示了ca_metadata_elements::getSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: GetDetail
/**
* Fetch details on an item from a remote data source and output results of the 'display' key in the response.
*
*/
public function GetDetail()
{
$pn_element_id = $this->request->getParameter('element_id', pInteger);
$t_element = new ca_metadata_elements($pn_element_id);
$va_data = array();
if (!$t_element->getPrimaryKey()) {
// error
$va_items['error'] = array('label' => _t('ERROR: Invalid element_id'), 'idno' => '');
} else {
$vs_service = $t_element->getSetting('service');
$va_settings = $t_element->getSettings();
$pn_attribute_id = $this->request->getParameter('id', pInteger);
$t_attr_val = new ca_attribute_values();
if ($t_attr_val->load(array('attribute_id' => $pn_attribute_id, 'element_id' => $pn_element_id))) {
$t_attr = new ca_attributes();
if ($t_attr->load($pn_attribute_id)) {
if (!caCanRead($this->request->getUserID(), $t_attr->get('table_num'), $t_attr->get('row_id'), $t_element->get('element_code'))) {
$va_items['error'] = array('label' => _t('ERROR: You do not have access to this item'), 'idno' => '');
} else {
$vs_url = $t_attr_val->get('value_longtext2');
if (!($o_plugin = InformationServiceManager::getInformationServiceInstance($vs_service))) {
$va_items['error'] = array('label' => _t('ERROR: Invalid service'), 'idno' => '');
} else {
$vs_cache_key = md5(print_r($va_settings, true) . $vs_url);
if (CompositeCache::contains($vs_cache_key, 'InformationServiceExtendedInfo')) {
$va_data = CompositeCache::fetch($vs_cache_key, 'InformationServiceExtendedInfo');
} else {
$va_data = $o_plugin->getExtendedInformation($va_settings, $vs_url);
CompositeCache::save($vs_cache_key, $va_data, 'InformationServiceExtendedInfo');
}
}
}
}
}
}
$this->view->setVar('detail', $va_data);
return $this->render('ajax_information_service_detail_html.php');
}