本文整理汇总了PHP中ca_lists::_getListID方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::_getListID方法的具体用法?PHP ca_lists::_getListID怎么用?PHP ca_lists::_getListID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::_getListID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListAsHTMLFormElement
/**
* Returns HTML <select> element containing the specified list, or portion of the list.
*
* @param mixed $pm_list_name_or_id
* @param string $ps_name
* @param array $pa_attributes
* @param array $pa_options Array of options. Valid options include:
* childrenOnlyForItemID = if set only items below item_id in the list item hierarchy are returned. Default (null) is to return all items in the list.
* directChildrenOnly = if set only items with item_id=childrenOnlyForItemID as parent in the list item hierarchy are returned. Default (null) is to return all items in the list.
* nullOption = if set then a "null" (no value) option is available labeled with the value passed in this option
* additionalOptions = an optional array of options that will be passed through to caHTMLSelect; keys are display labels and values are used as option values
* value = if set, the <select> will have default selection set to the item whose *value* matches the option value. If none is set then the first item in the list will be selected
* key = ca_list_item field to be used as value for the <select> element list; can be set to either item_id or item_value; default is item_id
* width = the display width of the list in characters or pixels
* limitToItemsWithID = An optional array of list item_ids. Item_ids not in the array will be omitted from the returned list.
* omitItemsWithID = An optional array of list item_ids. Item_ids in the array will be omitted from the returned list.
* disableItemsWithID = An optional array of list item_ids. Item_ids in the array will be disabled in the returned list.
*
* limitToItemsRelatedToCollections = an array of collection_ids or collection idno's; returned items will be restricted to those attached to the specified collections
* limitToItemsRelatedToCollectionWithRelationshipTypes = array of collection type names or type_ids; returned items will be restricted to those attached to the specified collectionss with the specified relationship type
* limitToListIDs = array of list_ids to restrict returned items to when using "limitToItemsRelatedToCollections"
*
* indentForHierarchy = indicate hierarchy with indentation. [Default is true]
* transaction = transaction to perform database operations within. [Default is null]
*
* @return string - HTML code for the <select> element; empty string if the list is empty
*/
public static function getListAsHTMLFormElement($pm_list_name_or_id, $ps_name, $pa_attributes = null, $pa_options = null)
{
$t_list = new ca_lists();
if ($o_trans = caGetOption('transaction', $pa_options, null)) {
$t_list->setTransaction($o_trans);
}
if (!is_array($pa_options)) {
$pa_options = array();
}
if (!(isset($pa_options['limitToItemsRelatedToCollection']) && is_array($pa_options['limitToItemsRelatedToCollections']))) {
$vn_list_id = $t_list->_getListID($pm_list_name_or_id);
$t_list->load($vn_list_id);
}
$vn_root_id = isset($pa_options['childrenOnlyForItemID']) && $pa_options['childrenOnlyForItemID'] ? $pa_options['childrenOnlyForItemID'] : null;
$va_disabled_item_ids = caGetOption('disableItemsWithID', $pa_options, null);
$vs_render_as = isset($pa_options['render']) ? $pa_options['render'] : '';
$vn_sort_type = $t_list->get('default_sort');
if ($vs_render_as == 'yes_no_checkboxes' && $vn_sort_type == __CA_LISTS_SORT_BY_LABEL__) {
$vn_sort_type = __CA_LISTS_SORT_BY_IDENTIFIER__;
// never allow sort-by-label when rendering as yes/no checkbox
}
if (!in_array($vs_render_as, array('lookup', 'horiz_hierbrowser', 'vert_hierbrowser'))) {
if (isset($pa_options['limitToItemsRelatedToCollections']) && is_array($pa_options['limitToItemsRelatedToCollections'])) {
$t_collection = new ca_collections();
$va_collection_ids = array();
foreach ($pa_options['limitToItemsRelatedToCollections'] as $vn_collection_id) {
if ($vn_collection_id && !is_numeric($vn_collection_id)) {
if ($vn_collection_id = $t_collection->load(array('idno' => $vn_collection_id))) {
$va_collection_ids[] = $vn_collection_id;
}
} else {
if ($vn_collection_id) {
$va_collection_ids[] = $vn_collection_id;
}
}
}
if (sizeof($va_collection_ids)) {
$qr_collections = $t_list->makeSearchResult('ca_collections', $va_collection_ids, array('restrictToRelationshipTypes' => isset($pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes']) ? $pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes'] : null));
$va_item_ids = array();
while ($qr_collections->nextHit()) {
$va_list_items = $qr_collections->get('ca_list_items', array('returnAsArray' => true));
foreach ($va_list_items as $vn_rel_id => $va_list_item) {
$va_item_ids[$vn_rel_id] = $va_list_item['item_id'];
}
}
if ($va_limit_to_listIDs = isset($pa_options['limitToListIDs']) && is_array($pa_options['limitToListIDs']) ? $pa_options['limitToListIDs'] : null) {
// for some reason the option comes back as array(0 => null) if no list is selected in UI
// -> have to make sure to catch this case here
if (sizeof($va_limit_to_listIDs) == 1 && empty($va_limit_to_listIDs[0])) {
$va_limit_to_listIDs = null;
}
}
if (is_array($va_limit_to_listIDs) && sizeof($va_item_ids)) {
// filter out items from tables we don't want
$qr_list_items = $t_list->makeSearchResult("ca_list_items", array_values($va_item_ids));
while ($qr_list_items->nextHit()) {
if (!in_array($qr_list_items->get('ca_list_items.list_id'), $va_limit_to_listIDs)) {
if (is_array($va_k = array_keys($va_item_ids, $qr_list_items->get('ca_list_items.item_id')))) {
foreach ($va_k as $vs_k) {
unset($va_list_items[$vs_k]);
}
}
}
}
}
}
} else {
$va_list_items = $t_list->getItemsForList($pm_list_name_or_id, array_merge($pa_options, array('returnHierarchyLevels' => caGetOption('indentForHierarchy', $pa_options, true), 'item_id' => $vn_root_id, 'extractValuesByUserLocale' => true, 'sort' => $vn_sort_type)));
}
}
if (!is_array($va_list_items)) {
$va_list_items = array();
}
//.........这里部分代码省略.........