Collections functions
Encryption functions
General functions
Theme permission functions
Resource 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 3176 to 3235

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_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",
    );

    if(
$refs_to_remove 0)
        {
        
$callback_csrf_token generateCSRFToken($usersession"remove_selected_from_collection");
        
$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;

    return;
    }

This article was last updated 11th July 2020 22:35 Europe/London time based on the source file dated 8th July 2020 11:40 Europe/London time.