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_resource_lock_link()

Parameters

ColumnTypeDefaultDescription
$ref
$lockuser
$editaccess

Location

include/render_functions.php lines 4509 to 4556

Definition

 
function render_resource_lock_link($ref,$lockuser,$editaccess)
    {
    global 
$userref$lang;
    
    
$resource_locked = (int)$lockuser 0;

    
$edit_lock_option false;
    if(
checkperm("a"
        ||
        
$userref == $lockuser
        
||
        (!
$resource_locked && !checkperm("nolock") && $editaccess)
        )
        {
        
$edit_lock_option true;
        }

    if(!
$resource_locked && !$edit_lock_option)
        {
        
// User is not permitted to lock resource
        
return;
        }    
    
    
$lock_details get_resource_lock_message($lockuser);

    echo 
"<li>";
    if(
$edit_lock_option)
        {
        echo 
"<a href='#' id='lock_link_" $ref "' onclick='return updateResourceLock(" $ref ",!resource_lock_status);' ";
        echo 
"title='" .  $lock_details "'";
        echo 
"class='LockedResourceAction " . ($resource_locked "ResourceLocked" "ResourceUnlocked" ). "'>&nbsp;";
        if(
$resource_locked)
            {
            
$locktext = (checkperm("a") || ($lockuser == $userref)) ? $lang["action_unlock"] : $lang["status_locked"];
            }
        else
            {
            
$locktext $lang["action_lock"];
            }
        echo 
$locktext "</a>";
        }
    else
        {
        echo 
"<div  class='ResourceLocked' title='" .  escape($lock_details) . "' >" $lang["status_locked"] . "</div>";
        }

    echo 
"<a id='lock_details_link' href='#' " . ($resource_locked "" "style='display:none;'") . " onclick='if(resource_lock_status){styledalert(\"" escape($lang["status_locked"]) . "\",lockmessage[" escape($ref) . "]);}'>&nbsp;<i class='fas fa-info-circle'></i></a> </li>";
    }

This article was last updated 12th December 2024 18:35 Europe/London time based on the source file dated 12th December 2024 13:05 Europe/London time.