Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

render_selected_collection_actions()

Description

Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)

Parameters

This function accepts no parameters.

Return

void

Location

include/render_functions.php lines 3704 to 3764

Definition

 
function render_selected_collection_actions()
    {
    global 
$USER_SELECTION_COLLECTION$usercollection$usersession$lang$CSRF_token_identifier$search,
           
$render_actions_extra_options$render_actions_filter$resources_count$result;

    
$orig_resources_count $resources_count;
    
$orig_search $search;
    
$search "!collection{$USER_SELECTION_COLLECTION}";

    
$orig_result $result;
    
$result get_collection_resources_with_data($USER_SELECTION_COLLECTION);

    
$selected_resources array_column($result"ref");
    
$resources_count count($selected_resources);
    
$usercollection_resources get_collection_resources($usercollection);
    
$refs_to_remove count(array_intersect($selected_resources$usercollection_resources));
    
$collection_data get_collection($USER_SELECTION_COLLECTION);

    
$valid_selection_collection_actions = array(
        
"relate_all",
        
"save_search_items_to_collection",
        
"remove_selected_from_collection",
        
"search_items_disk_usage",
        
"csv_export_results_metadata",
        
"share_collection",
        
"download_collection",
        
"license_batch",
        
"consent_batch"
    
);

    if(
$refs_to_remove 0)
        {
        
$callback_csrf_token generateCSRFToken($usersession"collection_remove_resources");
        
$render_actions_extra_options = array(
            array(
                
"value" => "remove_selected_from_collection",
                
"label" => $lang["remove_selected_from_collection"],
                
"data_attr" => array(
                    
"callback" => "RemoveSelectedFromCollection('{$CSRF_token_identifier}', '{$callback_csrf_token}');",
                ),
                
"category" => ACTIONGROUP_COLLECTION,
            ),
        );
        }
    
$render_actions_filter = function($action) use ($valid_selection_collection_actions)
        {
        return 
in_array($action["value"], $valid_selection_collection_actions);
        };

    
// override the language for actions as it's now specific to a selection of resources
    
$lang["relateallresources"] = $lang["relate_selected_resources"];
    
$lang["savesearchitemstocollection"] = $lang["add_selected_to_collection"];
    
$lang["searchitemsdiskusage"] = $lang["selected_items_disk_usage"];
    
$lang["share"] = $lang["share_selected"];

    
render_actions($collection_datatruefalse);

    
$search $orig_search;
    
$result $orig_result;
    
$resources_count $orig_resources_count;
    }

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 3rd December 2024 11:55 Europe/London time.