本文整理汇总了PHP中ca_lists::getListOfLists方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::getListOfLists方法的具体用法?PHP ca_lists::getListOfLists怎么用?PHP ca_lists::getListOfLists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::getListOfLists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settingHTMLFormElement
//.........这里部分代码省略.........
$vs_return .= "<div id='{$vs_input_id}_colorchip' class='colorpicker_chip' style='background-color: #{$vs_value}'><!-- empty --></div>";
$vs_return .= "<script type='text/javascript'>jQuery(document).ready(function() { jQuery('#{$vs_input_name}_colorchip').ColorPicker({\n\t\t\t\t\t\t\t\tonShow: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeIn(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonHide: function (colpkr) {\n\t\t\t\t\t\t\t\t\tjQuery(colpkr).fadeOut(500);\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonChange: function (hsb, hex, rgb) {\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}').val(hex);\n\t\t\t\t\t\t\t\t\tjQuery('#{$vs_input_name}_colorchip').css('backgroundColor', '#' + hex);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcolor: jQuery('#" . $pa_options["name"] . "').val()\n\t\t\t\t\t\t\t})}); </script>\n";
JavascriptLoadManager::register('jquery', 'colorpicker');
break;
# --------------------------------------------
# --------------------------------------------
case DT_SELECT:
include_once __CA_MODELS_DIR__ . '/ca_relationship_types.php';
$vn_width = isset($va_properties['width']) && strlen($va_properties['width']) > 0 ? $va_properties['width'] : "100px";
$vn_height = isset($va_properties['height']) && strlen($va_properties['height']) > 0 ? $va_properties['height'] : "50px";
$vs_select_element = '';
if (($vs_rel_table = $va_properties['useRelationshipTypeList']) || ($vb_locale_list = (bool) $va_properties['useLocaleList']) || ($vs_list_code = $va_properties['useList']) || ($vb_show_lists = (bool) $va_properties['showLists'] || (bool) $va_properties['showVocabularies'])) {
if ($vs_rel_table) {
$t_rel = new ca_relationship_types();
$va_rels = $t_rel->getRelationshipInfo($vs_rel_table);
$va_rel_opts = array();
if (isset($va_properties['allowNull']) && $va_properties['allowNull']) {
$va_rel_opts['-'] = null;
}
foreach ($va_rels as $vn_type_id => $va_rel_type_info) {
if (!$va_rel_type_info['parent_id']) {
continue;
}
$va_rel_opts[$va_rel_type_info['typename'] . '/' . $va_rel_type_info['typename_reverse']] = $va_rel_type_info['type_id'];
}
} else {
if ($vb_locale_list) {
include_once __CA_MODELS_DIR__ . '/ca_locales.php';
$va_rel_opts = array_flip(ca_locales::getLocaleList(array('return_display_values' => true)));
} else {
if ($vb_show_lists) {
include_once __CA_MODELS_DIR__ . '/ca_lists.php';
$t_list = new ca_lists();
$va_lists = caExtractValuesByUserLocale($t_list->getListOfLists());
$va_rel_opts = array();
foreach ($va_lists as $vn_list_id => $va_list_info) {
if ($va_properties['showVocabularies'] && !$va_list_info['use_as_vocabulary']) {
continue;
}
$va_rel_opts[$va_list_info['name'] . ' (' . $va_list_info['list_code'] . ')'] = $vn_list_id;
}
}
}
}
$va_attr = array();
if ($vn_height > 1) {
$va_attr['multiple'] = 1;
$vs_input_name .= '[]';
}
$va_opts = array('id' => $vs_input_id, 'width' => $vn_width, 'height' => $vn_height);
if ($vn_height > 1) {
if ($vs_value && !is_array($vs_value)) {
$vs_value = array($vs_value);
}
$va_opts['values'] = $vs_value;
} else {
if (is_array($vs_value)) {
$va_opts['value'] = array_pop($vs_value);
} else {
if ($vs_value) {
$va_opts['value'] = $vs_value;
} else {
$va_opts['value'] = null;
}
}
}
示例2: getHierarchyList
/**
* Return array containing information about all lists, including their root_id's
*/
public function getHierarchyList($pb_vocabularies = false)
{
$t_list = new ca_lists();
$va_hierarchies = caExtractValuesByUserLocale($t_list->getListOfLists());
$vs_template = $this->getAppConfig()->get('ca_list_items_hierarchy_browser_display_settings');
$o_db = $this->getDb();
$va_hierarchy_ids = array();
foreach ($va_hierarchies as $vn_list_id => $va_list_info) {
$va_hierarchy_ids[] = intval($vn_list_id);
}
if (!sizeof($va_hierarchy_ids)) {
return array();
}
// get root for each hierarchy
$qr_res = $o_db->query("\n\t\t\tSELECT cli.item_id, cli.list_id, count(*) children\n\t\t\tFROM ca_list_items cli\n\t\t\tLEFT JOIN ca_list_items AS cli2 ON cli.item_id = cli2.parent_id\n\t\t\tINNER JOIN ca_lists AS l ON l.list_id = cli.list_id\n\t\t\tWHERE \n\t\t\t\tcli.parent_id IS NULL and cli.list_id IN (" . join(',', $va_hierarchy_ids) . ") " . ($pb_vocabularies ? " AND (l.use_as_vocabulary = 1)" : "") . "\n\t\t\tGROUP BY\n\t\t\t\tcli.item_id\n\t\t");
$vs_template = $this->getAppConfig()->get('ca_list_hierarchy_browser_display_settings');
while ($qr_res->nextRow()) {
$vn_hierarchy_id = $qr_res->get('list_id');
$va_hierarchies[$vn_hierarchy_id]['list_id'] = $qr_res->get('list_id');
// when we need to edit the list
$va_hierarchies[$vn_hierarchy_id]['item_id'] = $qr_res->get('item_id');
$qr_children = $o_db->query("\n\t\t\t\tSELECT count(*) children\n\t\t\t\tFROM ca_list_items cli\n\t\t\t\tWHERE \n\t\t\t\t\tcli.parent_id = ?\n\t\t\t", (int) $qr_res->get('item_id'));
$vn_children_count = 0;
if ($qr_children->nextRow()) {
$vn_children_count = $qr_children->get('children');
}
$va_hierarchies[$vn_hierarchy_id]['name'] = caProcessTemplateForIDs($vs_template, 'ca_lists', array($vn_hierarchy_id), array('requireLinkTags' => true));
$va_hierarchies[$vn_hierarchy_id]['children'] = intval($vn_children_count);
$va_hierarchies[$vn_hierarchy_id]['has_children'] = $vn_children_count > 0 ? 1 : 0;
}
// sort by label
$va_hierarchies_indexed_by_label = array();
foreach ($va_hierarchies as $vs_k => $va_v) {
$va_hierarchies_indexed_by_label[$va_v['name']][$vs_k] = $va_v;
}
ksort($va_hierarchies_indexed_by_label);
$va_sorted_hierarchies = array();
foreach ($va_hierarchies_indexed_by_label as $vs_l => $va_v) {
foreach ($va_v as $vs_k => $va_hier) {
$va_sorted_hierarchies[$vs_k] = $va_hier;
}
}
return $va_sorted_hierarchies;
}
示例3: htmlFormElement
/**
*
*/
public function htmlFormElement($ps_field, $ps_format = null, $pa_options = null)
{
if ($ps_field == 'list_id') {
// Custom list drop-down
$vs_format = $this->_CONFIG->get('form_element_display_format');
$t_list = new ca_lists();
$va_lists = caExtractValuesByUserLocale($t_list->getListOfLists());
$va_opts = array();
foreach ($va_lists as $vn_list_id => $va_list_info) {
$va_opts[$va_list_info['name'] . ' (' . $va_list_info['list_code'] . ')'] = $vn_list_id;
}
ksort($va_opts);
$vs_format = str_replace('^LABEL', $vs_field_label = $this->getFieldInfo('list_id', 'LABEL'), $vs_format);
$vs_format = str_replace('^EXTRA', '', $vs_format);
$vs_format = str_replace('^ELEMENT', caHTMLSelect($ps_field, $va_opts, array('id' => $ps_field), array('value' => $this->get('list_id'))), $vs_format);
if (!isset($pa_options['no_tooltips']) || !$pa_options['no_tooltips']) {
TooltipManager::add('#list_id', "<h3>{$vs_field_label}</h3>" . $this->getFieldInfo('list_id', 'DESCRIPTION'), $pa_options['tooltip_namespace']);
}
return $vs_format;
}
return parent::htmlFormElement($ps_field, $ps_format, $pa_options);
}