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

send_collection_feedback()

Description

Sends the feedback to the owner of the collection

Parameters

ColumnTypeDefaultDescription
$collection integer Collection ID
$comment string Comment text

Return

array|void

Location

include/collections_functions.php lines 3361 to 3436

Definition

 
function send_collection_feedback($collection,$comment)
    {
    global 
$applicationname,$lang,$userfullname,$userref,$k,$feedback_resource_select,$regex_email;
    global 
$userref;

    
$cinfo=get_collection($collection);    
    if(
$cinfo===false)
        {
        
error_alert($lang["error-collectionnotfound"]);
        exit();
        }
    
$user=get_user($cinfo["user"]);
    
$body=$lang["collectionfeedbackemail"] . "\n\n";

    if (isset(
$userfullname))
        {
        
$body.=$lang["user"] . ": " $userfullname "\n";
        }
    else
        {
        
# External user.
        
if (!preg_match ("/{$regex_email}/"getval("email",""))) {$errors[]=$lang["youremailaddress"] . ": " $lang["requiredfield"];return $errors;}
        
$body.=$lang["fullname"] . ": " getval("name","") . "\n";
        
$body.=$lang["email"] . ": " getval("email","") . "\n";
        }
    
$body.=$lang["message"] . ": " stripslashes(str_replace("\\r\\n","\n",trim($comment)));

    
$f=get_collection_comments($collection);
    for (
$n=0;$n<count($f);$n++)
        {
        
$body.="\n\n" $lang["resourceid"] . ": " $f[$n]["resource"];
        
$body.="\n" $lang["comment"] . ": " trim($f[$n]["comment"]);
        if (
is_numeric($f[$n]["rating"]))
            {
            
$body.="\n" $lang["rating"] . ": " substr("**********",0,$f[$n]["rating"]);
            }
        }

    if (
$feedback_resource_select)
        {
        
$body.="\n\n" $lang["selectedresources"] . ": ";
        
$file_list="";
        
$result=do_search("!collection" $collection);
        for (
$n=0;$n<count($result);$n++)
            {
            
$ref=$result[$n]["ref"];
            if (
getval("select_" $ref,"")!="")
                {
                global 
$filename_field;
                
$filename=get_data_by_field($ref,$filename_field);
                
$body.="\n" $ref " : " $filename;

                
# Append to a file list that is compatible with Adobe Lightroom
                
if ($file_list!="") {$file_list.=", ";}
                
$s=explode(".",$filename);
                
$file_list.=$s[0];
                }
            }
        
# Append Lightroom compatible summary.
        
$body.="\n\n" $lang["selectedresourceslightroom"] . "\n" $file_list;
        }
    
$cc=getval("email","");
    
get_config_option($user['ref'],'email_user_notifications'$send_email);
    
// Always send a mail for the feedback whatever the user preference, since the  feedback may be very long so can then refer to the CC'd email
    
if (filter_var($ccFILTER_VALIDATE_EMAIL))
        {
        
send_mail($user["email"],$applicationname ": " $lang["collectionfeedback"] . " - " $cinfo["name"],$body,"","","",null,"",$cc);
        }
    else
        {
        
send_mail($user["email"],$applicationname ": " $lang["collectionfeedback"] . " - " $cinfo["name"],$body);
        }

    
// Add a system notification message as well
    
message_add($user["ref"],$lang["collectionfeedback"] . " - " $cinfo["name"] . "<br />" $body,"",(isset($userref))?$userref:$user['ref'],MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN,60 60 *24 30);
    }

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.