<?php

$params = get_query_var("workroom_id");
$item_id = get_item_id_by_workroom_id($params);
?>
<div class="wrapper_collab">
	<div class="wrapper_collabinside">
		
		<?php 
/* Collaboration Room Info: Start */
?>
		<?php 
include collaboration_plugin_dir . 'templates/frontend/frontend-workroom-info.php';
?>
		<?php 
/* Collaboration Room Info: End */
?>

		<?php 
/* Collaboration Navigation & Messaging: Start */
?>
		<div class="collabcolcontainer">

            <?php 
include collaboration_plugin_dir . 'templates/frontend/frontend-left-navs.php';
?>
            
            <?php 
/* Center Col Content: Start */
?>
            <div class="collabcol centercol collabcontent">
 function Invitation_Collaborators()
 {
     $Workroom_Id = $_POST['Workroom_Id'];
     $Action = $_POST['Action'];
     $Collaborator_Id = $_POST['Collaborator_Id'];
     //==============
     if ($Action == 'Invited') {
         $Item_ID = get_item_id_by_workroom_id($Workroom_Id);
         //get_post_meta($Workroom_Id,'Unfinished_Item_ID',true);
         $author_id = get_post_field('post_author', $Workroom_Id);
         $to_author_id = $Collaborator_Id;
         $Alert_Title = 'You have received Invitation From ' . get_the_author_meta('display_name', $author_id) . ' to join in his workroom';
         //Generate Alert Id
         $Alert_Id = uniqid();
         //End Alert Id
         $InvAlerts = new stdClass();
         $InvAlerts->Collaborator_Name = get_the_author_meta('display_name', $to_author_id);
         $InvAlerts->Workroom_Name = get_the_title($Workroom_Id);
         $InvAlerts->Invitation_Accept_Link = $this->Get_Invitation_Accept_Link($Workroom_Id, $to_author_id, $Alert_Id);
         $InvAlerts->Invitation_Sender = get_the_author_meta('display_name', $author_id);
         ob_start();
         include collaboration_plugin_dir . 'templates/frontend/emails/collaboration-invitation-email-template.php';
         $Get_Template = ob_get_clean();
         ob_start();
         include collaboration_plugin_dir . 'templates/frontend/emails/collaboration-email-css.php';
         $css = ob_get_clean();
         wp_mail('*****@*****.**', $Alert_Title, $css . $Get_Template);
         wp_mail(get_the_author_meta('user_email', $to_author_id), $Alert_Title, $css . $Get_Template);
         //Add Alerts
         $collection = array('Edd_Alert_Message' => $Get_Template, 'Edd_Alert_Title' => $Alert_Title, 'Edd_Alert_To' => $to_author_id, 'Edd_Alert_Id' => $Alert_Id, 'Edd_Alert_From' => $author_id, 'Edd_Alert_Message_Url' => $this->Get_Invitation_Accept_Link($Workroom_Id, $to_author_id, $Alert_Id, false));
         $this->update_collaborators_invitation($Workroom_Id, 'Invited', $to_author_id, $Alert_Id);
         edd_add_alerts($collection);
         //End Alerts
         $status = array('Collaborator_Id' => $Collaborator_Id);
         echo json_encode($status);
     }
 }
function get_teams_as_workroom($Workroom_Id)
{
    $item_id = get_item_id_by_workroom_id($Workroom_Id);
    $main = get_main_item_id_by_workroom_id($Workroom_Id);
    $all_parents = get_list_of_parent_items($item_id, array($item_id));
    $all_childs = get_list_of_childs($item_id, $all_parents);
    foreach ($all_childs as $records) {
        $author_id = get_post_field('post_author', $records);
        $status = get_post_meta($Workroom_Id, 'Invitation_Status_' . $author_id, true);
        $collects_items[$author_id] = (object) array('Collaborator_Id' => $author_id, 'Invitation_Status' => $status, 'Item_Id' => $records, 'Main_Item_Id' => $main);
    }
    return $collects_items;
}