Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource 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 2920 to 3018

Definition

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

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

    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=0;$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 29th May 2024 12:35 Europe/London time based on the source file dated 23rd May 2024 10:00 Europe/London time.