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

Description

Render the share options (used on collection_share.php and resource_share.php)

"password" bool Has a password been set for this share? (password will not actually be displayed)
"editaccesslevel" int Current access level of share
"editexpiration" string Current expiration date
"editgroup" int ID of existing share group

Parameters

ColumnTypeDefaultDescription
$shareopts array array Array of share options. If not set will use the old getval() methods

Return

void

Location

include/render_functions.php lines 3008 to 3114

Definition

 
function render_share_options($shareopts=array())
    {
    global 
$lang$usergroup,$minaccess,$allowed_external_share_groups,$resource_share_expire_never;
    global 
$resource_share_expire_days,$resource_share_expire_days_default;

    
$password $shareopts['password'] ?? getval('password''');
    
$editaccesslevel $shareopts['editaccesslevel'] ?? getval('editaccesslevel''');
    
$editexpiration $shareopts['editexpiration'] ?? getval('editexpiration'null);
    
$editgroup $shareopts['editgroup'] ?? getval('editgroup''');

    if (
        
$editexpiration === "" && $resource_share_expire_days_default 0
        
|| $editexpiration != "" && date('Y-m-d'strtotime($editexpiration)) < date('Y-m-d',time())
        ) {
        
$editexpiration date('Y-m-d',time() + (60*60*24*$resource_share_expire_days_default));
    }

    if(!
hook('replaceemailaccessselector'))
        {
?>
        <div class="Question" id="question_access">
            <label for="archive"> echo escape($lang["access"]) ?></label>
            <select class="stdwidth" name="access" id="access">
            
            
# List available access levels. The highest level must be the minimum user access level.
            
for ($n=$minaccess;$n<=1;$n++) 
                { 
                
$selected $editaccesslevel == $n;
                
?>
                <option value=" echo $n?> if ($selected) {echo "selected";} ?>> echo escape($lang["access" $n])?></option>
                 
                

                
?>
            </select>
            <div class="clearerleft"> </div>
        </div>
        
#hook replaceemailaccessselector
    
    
if(!hook('replaceemailexpiryselector'))
        {
        
?>
        <div class="Question">
            <label> echo escape($lang["expires"]) ?></label>
            <select name="expires" class="stdwidth">
            
            
if($resource_share_expire_never
                { 
?>
                <option value=""> echo escape($lang["never"])?></option> 
                

            for (
$n=1;$n<=$resource_share_expire_days;$n++)
                {
                
$date       time() + (60*60*24*$n);
                
$ymd_date   date('Y-m-d'$date);
                
$selected   = (substr($editexpiration  ?? "",0,10) == $ymd_date);
                
$date_text  nicedate($ymd_date,false,true);
                
$option_class '';
                
$day_date date('D'$date);
                if ((
$day_date == "Sun") || ($day_date == "Sat"))
                    {
                    
$option_class 'optionWeekend';
                    }
                
?>
                <option class=" echo $option_class ?>" value=" echo $ymd_date ?> if ($selected) {echo "selected";} ?>> echo $date_text ?></option>
                
                
?>
            </select>
            <div class="clearerleft"> </div>
        </div>
         
        
}
    if (
checkperm("x")) 
        {
        
# Allow the selection of a user group to inherit permissions from 
        # for this share (the default is to use the current user's user group).
        
?>
        <div class="Question">
            <label for="groupselect"> echo escape($lang["share_using_permissions_from_user_group"]); ?></label>
            <select id="groupselect" name="usergroup" class="stdwidth">
             $grouplist get_usergroups(true);
            foreach (
$grouplist as $group)
                {
                if(!empty(
$allowed_external_share_groups) && !in_array($group['ref'], $allowed_external_share_groups))
                    {
                    continue;
                    }

                
$selected $editgroup == $group["ref"] || ($editgroup == "" && $usergroup == $group["ref"]);
                
?>
                <option value=" echo $group["ref"]; ?> if ($selected) {echo "selected";} ?>> echo $group["name"]; ?></option>
                
                
}
                
?>
            </select>
            <div class="clearerleft"> </div>
        </div>
 
        
}
    elseif(!
checkperm("x") && !empty($allowed_external_share_groups) && in_array($usergroup$allowed_external_share_groups))
        {
        
?>
        <input type="hidden" name="usergroup" value=" echo $usergroup?>">
        
        
}
        
render_share_password_question(!$password);
        
hook("additionalresourceshare");
        
?>
            
    
}

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