<?php
/* 
* Theme: PREMIUMPRESS CORE FRAMEWORK FILE
* Url: www.premiumpress.com
* Author: Mark Fail
*
* THIS FILE WILL BE UPDATED WITH EVERY UPDATE
* IF YOU WANT TO MODIFY THIS FILE, CREATE A CHILD THEME
*
* http://codex.wordpress.org/Child_Themes
*/
if (!defined('THEME_VERSION')) {	header('HTTP/1.0 403 Forbidden'); exit; }

global $CORE, $CORE_UI, $post; 

$logid = $_POST['logid'];
 
$postf = get_post($logid);

$data = $CORE->FUNC("format_logtype", $logid );

//print_r($data);

$fields = array(

    
    "1" => array(
        "label" => __("User ID","premiumpress"),
        "key" => "log_to",
        "data"  =>  "<a href='admin.php?page=members&eid=".$data["user_to"]."' target='_blank'>".$CORE->USER("get_username",$data["user_to"])."</a> (".$data["user_to"].")",
    ),
    "2" => array(
        "label" => __("From User","premiumpress"),
        "key" => "log_from",
        "data"  => get_post_meta($logid, "log_from", true),
    ),
    "3" => array(
        "label" => __("Email ID","premiumpress"),
        "key" => "log_emailid", 
        "data"  => get_post_meta($logid, "log_emailid", true),
    ),
    "4" => array(
        "label" => __("Email Address","premiumpress"),
        "key"   => "log_email",
        "data"  => get_post_meta($logid, "log_email", true),
    ),
    "5" => array(
        "label" => __("Details","premiumpress"),
        "key" => "log_email", 
        "data" => str_replace("/n","<br>",$postf->post_content),
    ), 
   
    "6" => array(
        "label" => __("Type","premiumpress"),
        "key" => "log_type",
        "data"  => $data['log_type'],
    ),
    "7" => array(
        "label" => __("Date","premiumpress"),
        "key" => "",
        "data"  => $postf->post_date." - ".$data['time'],
    ),
    

 
);


if($data["user_to"] ==""){

    unset($fields["1"]);
}

if($data['log_type'] == "listing_added" && $data['pid'] !=""){

    $listing_link = '<a href="'.get_permalink($data['pid']).'" target="_blank">'.get_the_title($data['pid']).'</a>';

    $fields["8"] = array(
        "label" => __("Listing","premiumpress"),
        "key" => "pid",
        "data"  => $listing_link,
    );
}


	// NAME
	$name = notify_string_filter($data, $data['title_from'], "from");
	
	// DESC
	$desc = notify_string_filter($data, $data['desc_from'], "from");
	
?>

<div class="card-popup ">
<div class="bg-primary pt-3">
    <div class="card-popup-content">    
    <div class="text-white mt-3">     
    	<strong class="h2"> <?php echo $name; ?> </strong>
    	<div class="text-truncate mt-2 opacity-8 text-600"><?php echo $desc; ?></div>
         
    </div>      
    </div>      
</div>

<div class="p-3" style="font-size:12px;">

    <?php foreach($fields as $k => $f){ 

        if($f['data'] == ""){ continue; }
        
    ?>
    <div class="container border">
        <div class="row">
        <div class="col-md-4 border-right p-2">
            <?php echo $f['label']; ?>
        </div>
        <div class="col-md-8 p-2">
            <?php echo $f['data']; ?>
        </div>
        </div>
    </div>
    <?php } ?>

</div>