本文整理汇总了PHP中ca_list_items::getLabelDisplayField方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_list_items::getLabelDisplayField方法的具体用法?PHP ca_list_items::getLabelDisplayField怎么用?PHP ca_list_items::getLabelDisplayField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_list_items
的用法示例。
在下文中一共展示了ca_list_items::getLabelDisplayField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFacetHierarchyAncestorList
/**
* Given a item_id (request parameter 'id') returns a list of ancestors for use in the hierarchy browser
* Returned data is JSON format
*/
public function getFacetHierarchyAncestorList()
{
$pn_id = $this->request->getParameter('id', pInteger);
$va_access_values = caGetUserAccessValues($this->request);
$ps_facet_name = $this->request->getParameter('facet', pString);
$this->view->setVar("facet_name", $ps_facet_name);
$this->view->setVar("key", $this->request->getParameter('key', pString));
$ps_browse_type = $this->request->getParameter('browseType', pString);
if (!($va_browse_info = caGetInfoForBrowseType($ps_browse_type))) {
// invalid browse type – throw error
die("Invalid browse type");
}
$this->view->setVar("browse_type", $ps_browse_type);
$vs_class = $va_browse_info['table'];
$o_browse = caGetBrowseInstance($vs_class);
if (!is_array($va_facet_info = $o_browse->getInfoForFacet($ps_facet_name))) {
return null;
}
if ($ps_cache_key = $this->request->getParameter('key', pString)) {
$o_browse->reload($ps_cache_key);
}
$va_ancestors = array();
switch ($va_facet_info['type']) {
case 'attribute':
// is it a list attribute?
$t_element = new ca_metadata_elements();
if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) {
if ($t_element->get('datatype') == 3) {
// 3=list
if (!$pn_id) {
$t_list = new ca_lists();
$pn_id = $t_list->getRootListItemID($t_element->get('list_id'));
}
$t_item = new ca_list_items($pn_id);
if ($t_item->getPrimaryKey()) {
$vs_primary_key = $t_item->primaryKey();
$this->view->setVar("primary_key", $vs_primary_key);
$vs_display_fld = $t_item->getLabelDisplayField();
$this->view->setVar("display_field", $vs_display_fld);
$vs_label_table_name = $t_item->getLabelTableName();
$va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'additionalTableWheres' => array('(' . $vs_label_table_name . '.is_preferred = 1 OR ' . $vs_label_table_name . '.is_preferred IS NULL)'))));
array_shift($va_ancestors);
}
}
}
break;
case 'label':
// label facet
$va_facet_info['table'] = $this->ops_tablename;
// fall through to default case
// fall through to default case
default:
$t_item = $this->request->datamodel->getInstanceByTableName($va_facet_info['table']);
$t_item->load($pn_id);
if (method_exists($t_item, "getHierarchyList")) {
$va_access_values = caGetUserAccessValues($this->request);
$va_facet = $o_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values));
$va_hierarchy_list = $t_item->getHierarchyList(true);
$vn_hierarchies_in_use = 0;
foreach ($va_hierarchy_list as $vn_i => $va_item) {
if (isset($va_facet[$va_item[$t_item->primaryKey()]])) {
$vn_hierarchies_in_use++;
if ($vn_hierarchies_in_use > 1) {
break;
}
}
}
}
if ($t_item->getPrimaryKey()) {
$vs_primary_key = $t_item->primaryKey();
$this->view->setVar("primary_key", $vs_primary_key);
$vs_display_fld = $t_item->getLabelDisplayField();
$this->view->setVar("display_field", $vs_display_fld);
$vs_label_table_name = $t_item->getLabelTableName();
$va_ancestors = array_reverse($t_item->getHierarchyAncestors(null, array('includeSelf' => true, 'additionalTableToJoin' => $vs_label_table_name, 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array($vs_display_fld, 'locale_id'), 'additionalTableWheres' => array('(' . $vs_label_table_name . '.is_preferred = 1 OR ' . $vs_label_table_name . '.is_preferred IS NULL)'))));
}
if ($vn_hierarchies_in_use <= 1) {
array_shift($va_ancestors);
}
break;
}
$this->view->setVar('ancestors', $va_ancestors);
switch ($this->request->getParameter('returnAs', pString)) {
case "json":
return $this->render('Browse/facet_hierarchy_ancestors_json.php');
break;
# ------------------------------------------------
# ------------------------------------------------
case "html":
default:
return $this->render('Browse/facet_hierarchy_ancestors_html.php');
break;
# ------------------------------------------------
}
}