Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 2788 to 2897

Definition

 
function render_share_options($shareopts=array())
    {
    global 
$lang$usergroup$resource_share_expire_never$resource_share_expire_days,$minaccess,$allowed_external_share_groups;
    
$validshareops = array(
        
"password",
        
"editaccesslevel",
        
"editexpiration",
        
"editgroup",
        );
    foreach(
$validshareops as $validshareop)
        {
        if(isset(
$shareopts[$validshareop]))
            {
            $
$validshareop $shareopts[$validshareop];
            }
        else
            {
            $
$validshareop getval($validshareop,'');
            }
        }
    if(!
hook('replaceemailaccessselector'))
        {
?>
        <div class="Question" id="question_access">
            <label for="archive"> echo $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 $lang["access" $n]?></option>
                 
                

                
?>
            </select>
            <div class="clearerleft"> </div>
        </div>
        
#hook replaceemailaccessselector
    
    
if(!hook('replaceemailexpiryselector'))
        {
        
?>
        <div class="Question">
            <label> echo $lang["expires"?></label>
            <select name="expires" class="stdwidth">
             
            
if($resource_share_expire_never
                { 
?>
                <option value=""> echo $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 $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>
         
        
}
    else if(!
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 11th May 2021 11:35 Europe/London time based on the source file dated 11th May 2021 10:25 Europe/London time.