- Coding standards
- Security in ResourceSpace
- Developer reference
- Database
-
- Table: activity_log
- Table: annotation
- Table: annotation_node
- Table: collection
- Table: collection_keyword
- Table: collection_log
- Table: collection_resource
- Table: collection_savedsearch
- Table: comment
- Table: daily_stat
- Table: dash_tile
- Table: dynamic_tree_node
- Table: external_access_keys
- Table: filter
- Table: filter_rule
- Table: filter_rule_node
- Table: ip_lockout
- Table: job_queue
- Table: keyword
- Table: keyword_related
- Table: mail_log
- Table: message
- Table: node
- Table: node_keyword
- Table: plugins
- Table: preview_size
- Table: report
- Table: report_periodic_emails
- Table: report_periodic_emails_unsubscribe
- Table: request
- Table: research_request
- Table: resource
- Table: resource_alt_files
- Table: resource_custom_access
- Table: resource_data
- Table: resource_dimensions
- Table: resource_keyword
- Table: resource_log
- Table: resource_node
- Table: resource_related
- Table: resource_type
- Table: resource_type_field
- Table: search_log
- Table: site_text
- Table: slideshow
- Table: sysvars
- Table: user
- Table: user_collection
- Table: user_dash_tile
- Table: user_message
- Table: user_preferences
- Table: user_rating
- Table: user_report
- Table: user_userlist
- Table: usergroup
- Table: usergroup_collection
- Table: usergroup_dash_tile
- Action functions
- Admin functions
- Ajax functions
- Annotation functions
- API functions
- Collections functions
-
- get_user_collections()
- get_collection()
- get_collection_resources()
- get_collection_resources_with_data()
- add_resource_to_collection()
- remove_resource_from_collection()
- collection_writeable()
- collection_readable()
- set_user_collection()
- create_collection()
- delete_collection()
- refresh_collection_frame()
- search_public_collections()
- do_collections_search()
- add_collection()
- remove_collection()
- index_collection()
- save_collection()
- get_max_theme_levels()
- get_theme_headers()
- themes_comparator()
- collections_comparator()
- collections_comparator_desc()
- get_themes()
- get_smart_theme_headers()
- get_smart_themes_nodes()
- email_collection()
- generate_collection_access_key()
- get_saved_searches()
- add_saved_search()
- remove_saved_search()
- add_smart_collection()
- get_search_title()
- add_saved_search_items()
- allow_multi_edit()
- save_themename()
- get_theme_image()
- swap_collection_order()
- update_collection_order()
- get_collection_resource_comment()
- save_collection_resource_comment()
- relate_to_collection()
- get_mycollection_name()
- get_collection_comments()
- send_collection_feedback()
- copy_collection()
- collection_is_research_request()
- add_to_collection_link()
- remove_from_collection_link()
- change_collection_link()
- get_collection_external_access()
- delete_collection_access_key()
- collection_log()
- get_collection_log()
- get_collection_videocount()
- collection_max_access()
- collection_min_access()
- collection_set_public()
- collection_set_private()
- collection_set_themes()
- remove_all_resources_from_collection()
- get_home_page_promoted_collections()
- get_featured_collection_resources()
- is_collection_approved()
- get_featured_collection_categ_sub_fcs()
- edit_collection_external_access()
- generate_featured_collection_image_urls()
- show_hide_collection()
- update_collection_parent()
- get_session_collections()
- get_featured_collections()
- update_collection_user()
- featured_collections_permissions_filter_sql()
- compile_collection_actions()
- featured_collection_check_access_control()
- makeFilenameUnique()
- order_featured_collections_by_hasresources()
- new_featured_collection_form()
- get_featured_collection_categories()
- get_last_resource_edit()
- is_featured_collection_category()
- GetThemesFromRequest()
- is_featured_collection_category_by_children()
- collection_download_get_archive_file()
- validate_collection_parent()
- collection_download_use_original_filenames_when_downloading()
- get_featured_collection_category_branch_by_leaf()
- collection_download_process_text_file()
- process_posted_featured_collection_categories()
- collection_download_log_resource_ready()
- get_featured_collection_ref_by_name()
- update_zip_progress_file()
- allow_collection_share()
- collection_download_process_data_only_types()
- allow_featured_collection_share()
- collection_download_process_summary_notes()
- filter_featured_collections_by_root()
- collection_download_process_csv_metadata_file()
- get_featured_collections_by_resources()
- collection_download_process_command_to_file()
- can_delete_featured_collection()
- collection_download_process_collection_download_name()
- collection_download_process_archive_command()
- collection_download_clean_temp_files()
- collection_cleanup_inaccessible_resources()
- relate_all_collection()
- update_collection_type()
- get_user_selection_collection()
- delete_old_collections()
- order_featured_collections()
- strip_prefix_chars()
- allow_upload_to_collection()
- get_all_featured_collections()
- compute_featured_collections_acess_control()
- compute_featured_collections_access_control()
- cleanup_anonymous_collections()
- can_share_upload_link()
- can_edit_upload_share()
- create_upload_link()
- generate_share_key()
- upload_share_active()
- upload_share_setup()
- external_upload_notify()
- purge_expired_shares()
- Comment functions
- Config functions
-
- validate_field()
- render_select_option()
- render_bool_option()
- render_text_option()
- set_config_option()
- get_config_option()
- get_config_option_users()
- get_config_options()
- process_config_options()
- config_clean()
- config_html()
- config_add_html()
- config_text_input()
- config_add_text_input()
- config_file_input()
- config_colouroverride_input()
- config_add_file_input()
- config_single_select()
- config_add_single_select()
- config_boolean_select()
- config_add_boolean_select()
- config_checkbox_select()
- config_add_checkbox_select()
- config_add_colouroverride_input()
- config_add_single_ftype_select()
- config_single_ftype_select()
- config_generate_AutoSaveConfigOption_function()
- config_process_file_input()
- config_generate_html()
- config_merge_non_image_types()
- get_header_image()
- config_register_core_fieldvars()
- config_add_hidden_input()
- config_register_core_field_refs()
- CSV export functions
- Dash functions
-
- existing_dash_tile()
- dash_tile_featured_collection_get_resources()
- create_dash_tile()
- update_dash_tile()
- delete_dash_tile()
- revoke_all_users_flag_cascade_delete()
- append_default_position()
- reorder_default_dash()
- update_default_dash_tile_order()
- get_tile()
- all_user_dash_tile_active()
- existing_tile()
- cleanup_dash_tiles()
- checkTileConfig()
- checkConfigCustomHomePanels()
- get_alluser_available_tiles()
- get_default_dash()
- deleteDefaultDashTile()
- updateDashTileOrder()
- get_managed_dash()
- add_usergroup_dash_tile()
- append_usergroup_position()
- reorder_usergroup_dash()
- update_usergroup_dash_tile_order()
- build_usergroup_dash()
- get_tile_user_groups()
- get_usergroup_available_tiles()
- get_usergroup_tile()
- add_user_dash_tile()
- get_user_tile()
- create_new_user_dash()
- update_user_dash_tile_order()
- delete_user_dash_tile()
- empty_user_dash()
- reorder_user_dash()
- append_user_position()
- get_user_available_tiles()
- get_user_dash()
- deleteDashTile()
- render_delete_dialog_JS()
- parse_dashtile_link()
- build_dash_tile_list()
- allow_tile_colour_change()
- render_dash_tile_colour_chooser()
- update_tile_preview_colour()
- get_tile_custom_style()
- delete_usergroup_dash_tile()
- allowPromotedResources()
- render_upgrade_available_tile()
- generate_dash_tile_toolbar()
- Encryption functions
- Facial recognition functions
- General functions
-
- escape_command_args()
- run_command()
- run_external()
- error_alert()
- xml_entities()
- get_xml_entity_at_index_0()
- sanitize_char()
- format_display_field()
- format_string_more_link()
- sortmulti()
- draw_performance_footer()
- sql_affected_rows()
- get_imagemagick_path()
- get_utility_path()
- get_executable_path()
- truncate_cache_arrays()
- txt2html()
- is_html()
- rs_setcookie()
- get_editable_states()
- validate_html()
- generateURL()
- tail()
- move_array_element()
- emptyiszero()
- array_column()
- get_slideshow_files_data()
- form_value_display()
- job_queue_add()
- job_queue_update()
- job_queue_delete()
- job_queue_get_jobs()
- job_queue_run_job()
- user_set_usergroup()
- generateSecureKey()
- IsModal()
- generateCSRFToken()
- ResolveKB()
- isValidCSRFToken()
- generateFormToken()
- generateAjaxToken()
- enforcePostRequest()
- findDuplicates()
- is_resourcespace_upgrade_available()
- get_recent_users()
- check_script_last_ran()
- trim_filename()
- count_errors()
- search_array_by_keyvalue()
- bypass_permissions()
- set_sysvar()
- get_sysvar()
- hook()
- strip_tags_and_attributes()
- show_pagetime()
- get_debug_log_dir()
- debug()
- rcRmdir()
- job_queue_get_job()
- daily_stat()
- job_queue_purge()
- pagename()
- text()
- get_section_list()
- resolve_user_agent()
- get_ip()
- get_inner_html_from_tag()
- array_flip_by_value_key()
- reshape_array_by_value_keys()
- permission_j()
- permission_negative_j()
- cleanup_files()
- is_int_loose()
- ip_matches()
- getval()
- getvalescaped()
- getuid()
- escape_check()
- unescape()
- escape_check_array_values()
- nicedate()
- redirect()
- trim_spaces()
- trim_array()
- tidylist()
- tidy_trim()
- average_length()
- get_stats_activity_types()
- get_stats_years()
- newlines()
- get_all_site_text()
- get_site_text()
- check_site_text_custom()
- save_site_text()
- string_similar()
- formatfilesize()
- filesize2bytes()
- get_mime_type()
- send_mail()
- send_mail_phpmailer()
- log_mail()
- rs_quoted_printable_encode()
- rs_quoted_printable_encode_subject()
- pager()
- send_statistics()
- remove_extension()
- verify_extension()
- get_allowed_extensions()
- get_allowed_extensions_by_type()
- getAbsolutePath()
- getFolderContents()
- mb_basename()
- strip_extension()
- is_process_lock()
- set_process_lock()
- clear_process_lock()
- filesize_unlimited()
- strip_leading_comma()
- convert()
- get_temp_dir()
- convert_path_to_url()
- Language functions
- Log functions
- Login functions
- Message functions
- Migration functions
- Node functions
-
- compute_node_branch_path()
- compute_nodes_by_parent()
- get_resource_nodes_batch()
- get_nodes_by_refs()
- process_node_search_syntax_to_names()
- set_node()
- delete_node()
- delete_nodes_for_resource_type_field()
- get_node()
- get_nodes()
- is_parent_node()
- get_tree_node_level()
- get_root_node_by_leaf()
- reorder_node()
- reorder_nodes()
- render_new_node_record()
- get_node_order_by()
- draw_tree_node_table()
- node_field_options_override()
- add_node_keyword()
- remove_node_keyword()
- remove_all_node_keyword_mappings()
- check_node_indexed()
- add_node_keyword_mappings()
- remove_node_keyword_mappings()
- add_resource_nodes()
- add_resource_nodes_multi()
- get_resource_nodes()
- delete_resource_nodes()
- delete_resource_nodes_multi()
- delete_all_resource_nodes()
- copy_resource_nodes()
- get_nodes_from_keywords()
- update_resource_node_hitcount()
- copy_resource_type_field_nodes()
- get_parent_nodes()
- get_nodes_count()
- extract_node_options()
- get_node_by_name()
- get_node_id()
- node_name_comparator()
- node_orderby_comparator()
- get_node_elements()
- get_node_tree()
- get_tree_strings()
- PDF functions
- Plugin functions
-
- config_multi_archive_select()
- config_add_multi_archive_select()
- plugin_encode_complex_configs()
- plugin_decode_complex_configs()
- activate_plugin()
- deactivate_plugin()
- purge_plugin_config()
- get_plugin_yaml()
- config_json_encode()
- config_encode()
- get_plugin_config()
- set_plugin_config()
- is_plugin_activated()
- handle_rsc_upload()
- display_rsc_upload()
- config_gen_setup_post()
- config_gen_setup_html()
- config_section_header()
- config_add_section_header()
- config_add_text_list_input()
- config_multi_select()
- config_add_multi_select()
- config_single_user_select()
- config_add_single_user_select()
- config_multi_user_select()
- config_add_multi_user_select()
- config_single_group_select()
- config_add_single_group_select()
- config_multi_group_select()
- config_add_multi_group_select()
- config_multi_ftype_select()
- config_add_multi_ftype_select()
- config_single_rtype_select()
- config_add_single_rtype_select()
- config_multi_rtype_select()
- config_add_multi_rtype_select()
- config_db_single_select()
- config_add_db_single_select()
- config_db_multi_select()
- config_add_db_multi_select()
- config_add_hidden()
- config_text_field()
- config_userselect_field()
- config_field_select()
- config_boolean_field()
- config_custom_select_multi()
- config_custom_select()
- get_plugin_css()
- plugin_activate_for_setup()
- include_plugin_config()
- register_plugin_language()
- get_plugin_path()
- register_plugin()
- Render functions
-
- render_trash()
- render_browse_bar()
- generate_browse_bar_item()
- render_help_link()
- render_question_div()
- render_custom_fields()
- render_selected_resources_counter()
- render_edit_selected_btn()
- render_clear_selected_btn()
- render_selected_collection_actions()
- render_user_collection_select()
- render_csrf_data_attributes()
- check_display_condition()
- has_browsebar()
- display_upload_options()
- display_field_data()
- render_resource_lock_link()
- EditNav()
- SaveAndClearButtons()
- UpdateResultOrder()
- display_size_option()
- show_upgrade_in_progress()
- render_audio_download_link()
- render_table()
- render_array_in_table_cells()
- render_new_featured_collection_cta()
- render_featured_collection_category_selector()
- render_featured_collections()
- render_featured_collection()
- DrawOption()
- render_featured_collections_category_permissions()
- render_top_page_error_style()
- render_workflow_state_question()
- render_share_password_question()
- pclick()
- pblur()
- render_question_form_helper()
- render_hidden_input()
- render_search_field()
- render_sort_order()
- render_dropdown_option()
- render_actions()
- render_user_group_multi_select()
- render_user_group_select()
- render_user_group_checkbox_select()
- render_text_question()
- render_split_text_question()
- render_dropdown_question()
- render_access_key_tr()
- is_field_displayed()
- display_multilingual_text_field()
- display_field()
- render_date_range_field()
- renderBreadcrumbs()
- renderCallToActionTile()
- renderSocialMediaShareLinksForUrl()
- renderLockButton()
- render_resource_image()
- calculate_image_display()
- render_share_options()
- render_field_selector_question()
- render_filter_bar_button()
- render_upload_here_button()
- Reporting functions
- Request functions
- Research functions
- Slideshow functions
- Theme permission functions
- User functions
-
- check_password()
- resolve_users()
- check_access_key()
- check_access_key_collection()
- make_username()
- get_registration_selectable_usergroups()
- open_access_to_user()
- open_access_to_group()
- resolve_open_access()
- remove_access_to_user()
- user_email_exists()
- resolve_user_emails()
- create_password_reset_key()
- get_rs_session_id()
- get_notification_users()
- verify_antispam()
- check_share_password()
- get_users_from_permission_lookup()
- offset_user_local_timezone()
- checkPermission_anonymoususer()
- checkPermission_dashadmin()
- checkPermission_dashuser()
- checkPermission_dashmanage()
- checkPermission_dashcreate()
- checkperm()
- checkperm_user_edit()
- internal_share_access()
- save_usergroup()
- set_user_profile()
- delete_profile_image()
- get_profile_image()
- get_profile_text()
- get_languages_notify_users()
- get_upload_url()
- emulate_user()
- is_authenticated()
- validate_user()
- setup_user()
- get_users()
- get_users_with_permission()
- get_user_by_email()
- get_user_by_username()
- get_usergroups()
- get_usergroup()
- get_user()
- save_user()
- email_user_welcome()
- email_reset_link()
- auto_create_user_account()
- email_user_request()
- new_user()
- get_active_users()
- change_password()
- make_password()
- bulk_mail()
- get_user_log()
- resolve_userlist_groups()
- resolve_userlist_groups_smart()
- remove_groups_smart_from_userlist()
- Video functions
- Database functions
-
- sql_is_null_or_eq_val()
- sql_null_or_val()
- sql_truncate_text_val()
- errorhandler()
- db_use_multiple_connection_modes()
- db_set_connection_mode()
- db_get_connection_mode()
- db_clear_connection_mode()
- sql_connect()
- db_begin_transaction()
- sql_query_prepared()
- db_end_transaction()
- db_rollback_transaction()
- sql_query()
- sql_value()
- sql_array()
- sql_insert_id()
- get_query_cache_location()
- clear_query_cache()
- check_db_structs()
- CheckDBStruct()
- sql_limit()
- Metadata functions
- Resource functions
-
- get_resource_path()
- get_resource_data()
- put_resource_data()
- create_resource()
- update_hitcount()
- save_resource_data()
- set_resource_defaults()
- save_resource_data_multi()
- append_field_value()
- remove_keyword_mappings()
- remove_keyword_from_resource()
- add_keyword_mappings()
- add_keyword_to_resource()
- remove_all_keyword_mappings_for_field()
- update_field()
- ()
- email_resource()
- delete_resource()
- get_resource_type_field()
- get_resource_field_data()
- get_resource_field_data_batch()
- get_resource_types()
- get_resource_top_keywords()
- clear_resource_data()
- get_max_resource_ref()
- get_resource_ref_range()
- copy_resource()
- resource_log()
- get_resource_log()
- get_resource_type_name()
- get_resource_custom_access()
- get_resource_custom_access_users_usergroups()
- save_resource_custom_access()
- get_custom_access()
- get_themes_by_resource()
- update_resource_type()
- relate_to_array()
- get_exiftool_fields()
- createTempFile()
- stripMetadata()
- write_metadata()
- delete_exif_tmpfile()
- update_resource()
- import_resource()
- get_alternative_files()
- add_alternative_file()
- delete_alternative_file()
- get_alternative_file()
- save_alternative_file()
- user_rating_save()
- process_notify_user_contributed_submitted()
- notify_user_contributed_submitted()
- notify_user_contributed_unsubmitted()
- get_field()
- get_field_options_with_stats()
- save_field_options()
- get_resources_matching_keyword()
- get_keyword_from_option()
- add_field_option()
- get_resource_access()
- get_custom_access_user()
- edit_resource_external_access()
- get_resource_data_batch()
- resource_download_allowed()
- get_edit_access()
- filter_match()
- log_diff()
- get_metadata_templates()
- get_resource_collections()
- download_summary()
- check_use_watermark()
- autocomplete_blank_fields()
- get_resource_files()
- reindex_resource()
- get_page_count()
- update_disk_usage()
- update_disk_usage_cron()
- get_total_disk_usage()
- overquota()
- notify_user_resources_approved()
- get_original_imagesize()
- generate_resource_access_key()
- get_resource_external_access()
- delete_resource_access_key()
- resource_type_config_override()
- update_archive_status()
- delete_resources_in_collection()
- update_related_resource()
- can_share_resource()
- delete_resource_custom_access_usergroups()
- truncate_join_field_value()
- get_video_snapshots()
- resource_file_readonly()
- delete_resource_custom_user_access()
- get_video_info()
- copyAllDataToResource()
- copyResourceDataValues()
- copy_locked_data()
- copy_locked_fields()
- copyRelatedResources()
- process_edit_form()
- update_timestamp()
- get_extension()
- get_last_resource_edit_array()
- get_default_archive_state()
- save_original_file_as_alternative()
- replace_resource_file()
- get_external_shares()
- get_resource_all_image_sizes()
- sanitize_date_field_input()
- download_link_generate_key()
- download_link_check_key()
- filter_check()
- update_resource_keyword_hitcount()
- copy_hitcount_to_live()
- get_image_sizes()
- get_preview_quality()
- get_related_resources()
- get_field_options()
- get_data_by_field()
- get_resources_by_resource_data_value()
- get_all_image_sizes()
- image_size_restricted_access()
- get_fields()
- get_hidden_indexed_fields()
- get_category_tree_fields()
- get_OR_fields()
- get_nopreview_icon()
- purchase_set_size()
- payment_set_complete()
- get_indexed_resource_type_fields()
- get_resource_type_fields()
- notify_resource_change()
- add_verbatim_keywords()
- metadata_field_edit_access()
- get_download_filename()
- get_resource_type_from_extension()
- canSeePreviewTools()
- checkPreviewToolsOptionUniqueness()
- alt_is_ffmpeg_alternative()
- create_resource_type_field()
- metadata_field_view_access()
- get_workflow_states()
- delete_resource_type_field()
- tab_names()
- get_resource_table_joins()
- update_resource_lock()
- get_resource_lock_message()
- Search functions
-
- get_search_default_restypes()
- get_selectedtypes()
- render_advanced_search_buttons()
- get_collections_resource_count()
- get_search_params()
- resolve_soundex()
- suggest_refinement()
- get_advanced_search_fields()
- get_advanced_search_collection_fields()
- search_form_to_search_query()
- refine_searchstring()
- compile_search_actions()
- search_filter()
- search_special()
- resolve_nodes_from_string()
- rebuild_specific_field_search_from_node()
- search_get_previews()
- get_upload_here_selected_nodes()
- get_default_search_states()
- get_filter_sql()
- split_keywords()
- cleanse_string()
- resolve_keyword()
- add_partial_index()
- highlightkeywords()
- str_highlight()
- sorthighlights()
- get_suggested_keywords()
- get_related_keywords()
- get_grouped_related_keywords()
- save_related_keywords()
- get_simple_search_fields()
- get_fields_for_search_display()
- get_filters()
- get_filter()
- get_filter_rules()
- get_filter_rule()
- save_filter()
- save_filter_rule()
- delete_filter()
- delete_filter_rule()
- copy_filter()
- update_search_from_request()
compile_collection_actions()
Description
Helper function for render_actions(). Compiles actions that are normally valid for collectionsParameters
Column | Type | Default | Description |
---|---|---|---|
$collection_data | array | Collection data | |
$top_actions | boolean | Set to true if actions are to be rendered in the search filter bar (above results) | |
$resource_data | array | array | Resource data |
Return
array |
Location
include/collections_functions.php lines 3167 to 3707
Definition
function compile_collection_actions(array $collection_data, $top_actions, $resource_data=array())
{
global $baseurl_short, $lang, $k, $userrequestmode, $zipcommand, $collection_download, $use_zip_extension, $archiver_path,
$manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $enable_collection_copy,
$manage_collections_remove_link, $userref, $collection_purge, $show_edit_all_link, $result,
$edit_all_checkperms, $preview_all, $order_by, $sort, $archive, $contact_sheet_link_on_collection_bar,
$show_searchitemsdiskusage, $emptycollection, $remove_resources_link_on_collection_bar, $count_result,
$download_usage, $home_dash, $top_nav_upload_type, $pagename, $offset, $col_order_by, $find, $default_sort,
$default_collection_sort, $starsearch, $restricted_share, $hidden_collections, $internal_share_access, $search,
$usercollection, $disable_geocoding, $geo_locate_collection, $collection_download_settings, $contact_sheet,
$allow_resource_deletion, $pagename,$upload_then_edit, $enable_related_resources,$list, $enable_themes,
$system_read_only;
#This is to properly render the actions drop down in the themes page
if ( isset($collection_data['ref']) && $pagename!="collections" )
{
if(!is_array($result))
{
$result = get_collection_resources_with_data($collection_data['ref']);
}
if(('' == $k || $internal_share_access) && is_null($list))
{
$list = get_user_collections($userref);
}
$count_result = count($result);
}
if(isset($search) && substr($search, 0, 11) == '!collection' && ($k == '' || $internal_share_access))
{
# Extract the collection number - this bit of code might be useful as a function
$search_collection = explode(' ', $search);
$search_collection = str_replace('!collection', '', $search_collection[0]);
$search_collection = explode(',', $search_collection); // just get the number
$search_collection = escape_check($search_collection[0]);
}
// Collection bar actions should always be a special search !collection[ID] (exceptions might arise but most of the
// time it should be handled using the special search). If top actions then search may include additional refinement inside the collection
if(isset($collection_data['ref']) && !$top_actions)
{
$search = "!collection{$collection_data['ref']}";
}
$urlparams = array(
"search" => $search,
"collection" => (isset($collection_data['ref']) ? $collection_data['ref'] : ""),
"ref" => (isset($collection_data['ref']) ? $collection_data['ref'] : ""),
"restypes" => isset($_COOKIE['restypes']) ? $_COOKIE['restypes'] : "",
"starsearch" => $starsearch,
"order_by" => $order_by,
"col_order_by"=> $col_order_by,
"sort" => $sort,
"offset" => $offset,
"find" => $find,
"k" => $k);
$options = array();
$o=0;
if(empty($collection_data))
{
return $options;
}
if(empty($order_by))
{
$order_by = $default_collection_sort;
}
if($pagename == 'collection_manage')
{
$min_access = collection_min_access($collection_data['ref']);
}
else
{
$min_access = collection_min_access(empty($resource_data) ? $result : $resource_data);
}
// If resourceconnect plugin activated, need to consider if resource connect resources exist in the collection - if yes display view all resources link
$count_resourceconnect_resources = hook("countresult","", array($urlparams["collection"],0));
$count_resourceconnect_resources = is_numeric($count_resourceconnect_resources) ? $count_resourceconnect_resources : 0;
// View all resources
if(
!$top_actions // View all resources makes sense only from collection bar context
&& (
($k=="" || $internal_share_access)
&& (isset($collection_data["c"]) && $collection_data["c"] > 0)
|| (is_array($result) && count($result) > 0) || ($count_resourceconnect_resources > 0)
)
)
{
$tempurlparams = array(
'sort' => 'ASC',
'search' => (isset($collection_data['ref']) ? "!collection{$collection_data['ref']}" : $search),
);
$data_attribute['url'] = generateURL($baseurl_short . "pages/search.php",$urlparams,$tempurlparams);
$options[$o]['value']='view_all_resources_in_collection';
$options[$o]['label']=$lang['view_all_resources'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 10;
$o++;
}
// Download option
if($min_access == 0 )
{
if( $download_usage && ( isset($zipcommand) || $use_zip_extension || ( isset($archiver_path) && isset($collection_download_settings) ) ) && $collection_download && $count_result > 0)
{
$download_url = generateURL($baseurl_short . "pages/download_usage.php",$urlparams);
$data_attribute['url'] = generateURL($baseurl_short . "pages/terms.php",$urlparams,array("url"=>$download_url));
$options[$o]['value']='download_collection';
$options[$o]['label']=$lang['action-download'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 20;
$o++;
}
else if( (isset($zipcommand) || $use_zip_extension || ( isset($archiver_path) && isset($collection_download_settings) ) ) && $collection_download && $count_result > 0)
{
$download_url = generateURL($baseurl_short . "pages/collection_download.php",$urlparams);
$data_attribute['url'] = generateURL($baseurl_short . "pages/terms.php",$urlparams,array("url"=>$download_url));
$options[$o]['value']='download_collection';
$options[$o]['label']=$lang['action-download'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 20;
$o++;
}
}
// Upload to collection
if(allow_upload_to_collection($collection_data))
{
if($upload_then_edit)
{
$data_attribute['url'] = generateURL($baseurl_short . "pages/upload_plupload.php",array(),array("collection_add"=>$collection_data['ref']));
}
else
{
$data_attribute['url'] = generateURL($baseurl_short . "pages/edit.php",array(),array("uploader"=>$top_nav_upload_type,"ref"=>-$userref, "collection_add"=>$collection_data['ref']));
}
$options[$o]['value']='upload_collection';
$options[$o]['label']=$lang['action-upload-to-collection'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 30;
$o++;
}
// Preview all
if((is_array($result) && count($result) != 0) && ($k=="" || $internal_share_access) && $preview_all)
{
$data_attribute['url'] = generateURL($baseurl_short . "pages/preview_all.php",$urlparams);
$options[$o]['value']='preview_all';
$options[$o]['label']=$lang['preview_all'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 40;
$o++;
}
// Remove all resources from collection
if(!checkperm("b") && 0 < $count_result && ($k=="" || $internal_share_access) && isset($emptycollection) && $remove_resources_link_on_collection_bar && collection_writeable($collection_data['ref']))
{
$data_attribute['url'] = generateURL($baseurl_short . "pages/collections.php",$urlparams,array("emptycollection"=>$collection_data['ref'],"removeall"=>"true","ajax"=>"true","submitted"=>"removeall"));
$options[$o]['value'] = 'empty_collection';
$options[$o]['label'] = $lang['emptycollection'];
$options[$o]['data_attr'] = $data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 50;
$o++;
}
if(!collection_is_research_request($collection_data['ref']) || !checkperm('r'))
{
if(!$top_actions && checkperm('s') && $pagename === 'collections')
{
// Collection feedback
if(isset($collection_data['request_feedback']) && $collection_data['request_feedback'])
{
$data_attribute['url'] = sprintf('%spages/collection_feedback.php?collection=%s&k=%s',
$baseurl_short,
urlencode($collection_data['ref']),
urlencode($k)
);
$options[$o]['value']='collection_feedback';
$options[$o]['label']=$lang['sendfeedback'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESOURCE;
$options[$o]['order_by'] = 70;
$o++;
}
}
}
else
{
$research = sql_value('SELECT ref value FROM research_request WHERE collection="' . escape_check($collection_data['ref']) . '";', 0);
// Manage research requests
$data_attribute['url'] = generateURL($baseurl_short . "pages/team/team_research.php",$urlparams);
$options[$o]['value']='manage_research_requests';
$options[$o]['label']=$lang['manageresearchrequests'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESEARCH;
$options[$o]['order_by'] = 80;
$o++;
// Edit research requests
$data_attribute['url'] = generateURL($baseurl_short . "pages/team/team_research_edit.php",$urlparams,array("ref"=>$research));
$options[$o]['value']='edit_research_requests';
$options[$o]['label']=$lang['editresearchrequests'];
$options[$o]['data_attr']=$data_attribute;
$options[$o]['category'] = ACTIONGROUP_RESEARCH;
$options[$o