Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

render_resource_lock_link()

Parameters

ColumnTypeDefaultDescription
$ref
$lockuser
$editaccess

Location

include/render_functions.php lines 3908 to 3955

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("noex") && $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" ). "'>";
        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='" .  htmlspecialchars($lock_details) . "' >" $lang["status_locked"] . "</div>";
        }

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

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