JHtml::_('behavior.formvalidation');
if (count($this->items['orders'])) {
    ?>

    <div>
        <?php 
    echo JText::_('MOD_VIDEOTRANSLATION_YOU_HAVE_SELECTED');
    ?>
    </div>

    <?php 
    for ($i = 0; $i < count($this->items['orders']); $i++) {
        ?>
        <div style="width: 200px;">
            <div style="float: left; margin-right: 20px;"><?php 
        echo maxsite_the_russian_time(date('j F H:i', $this->items['orders'][$i]->start), $this->lang);
        ?>
 - <?php 
        echo date('H:i', $this->items['orders'][$i]->end);
        ?>
</div>
            <div style="float: left; color: #B1231F; cursor: pointer;" class="removeTimeFromSession" time="<?php 
        echo $this->items['orders'][$i]->start;
        if (isset($this->items['orders'][$i]->time)) {
            echo ',', implode(',', $this->items['orders'][$i]->time);
        }
        ?>
">x</div>
        </div>
        <div style="clear: both;"></div>
    <?php 
 function sentNotificationEmail($order, $event)
 {
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $model = JModelLegacy::getInstance('PartnersDetails', 'VideoTranslationModel', array('ignore_request' => true));
     $difference = $model->differenceTime($order->user_timezone);
     //recipient
     $user =& JFactory::getUser($order->user_id);
     $customer_email = $user->email;
     $recipient = array($customer_email);
     $subject = JText::sprintf('COM_VIDEOTRANSLATION_SUBJECT_CUSTOMER_THEME1', $order->envitee_name);
     $link = $event->location . "&order_id=" . $order->id . "&usertype=1&Itemid=155&lang=ru";
     $body = JText::sprintf('COM_VIDEOTRANSLATION_BODY_CUSTOMER', $order->envitee_name, maxsite_the_russian_time(date('j F', $event->dtstart - $difference)), date('H:i', $event->dtstart - $difference), date('H:i', $event->dtend - $difference), $order->user_timezone);
     $body .= "<br /> " . JText::_("COM_VIDEOTRANSLATION_SIGNATURE");
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $model = JModelLegacy::getInstance('approve', 'VideoTranslationModel', array('ignore_request' => true));
     $model->mailGeneration($recipient, $subject, $body);
 }
    function sentNotificationEmail($order, $event)
    {
        JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
        $model = JModelLegacy::getInstance('PartnersDetails', 'VideoTranslationModel', array('ignore_request' => true));
        $language_tag = $model->getSystemLanguage($order->your_partner_language);
        $tag = $model->LoadSpecificLanguageFile($language_tag);
        $difference = $model->differenceTime($order->envitee_timezone);
        $subject = JText::sprintf('COM_VIDEOTRANSLATION_SUBJECT_PARTNER_THEME2', $order->first_name . ' ' . $order->last_name);
        //recipient
        $recipient = array($order->envitee_email);
        //$link = $event->location."&order_id=".$order->id."&usertype=2&Itemid=155&lang=".$tag;
        $link = $event->location;
        $link = '
                        <a style="
                            width:145px;
                            height: 41px;
                            display: block;
                            background-color: #ed6f6d;
                            color: #ffffff;
                            cursor: pointer;
                            text-align:center;
                            display:table-cell;
                            vertical-align:middle;
                            border-radius: 4px;
                            text-decoration:none;
                            "
                            href="' . $link . '"

                            >' . JText::_("COM_VIDEOTRASLATION_SESSION_LINK") . '</a>

                ';
        $body = '<table width="100%" cellpadding="10" >
                    <tr>
                        <td bgcolor="#252d35">
                            <img src="' . JURI::base() . 'images/logo.png" alt="logo"/>
                        </td>
                    </tr>
                ';
        $body .= '<tr><td>' . JText::sprintf('COM_VIDEOTRANSLATION_BODY_PARTNER2', $order->first_name . ' ' . $order->last_name, maxsite_the_russian_time(date('j F', $event->dtstart - $difference), $tag), date('H:i', $event->dtstart - $difference), date('H:i', $event->dtend - $difference), $order->envitee_timezone, $link) . '</td></tr>';
        $body .= "<tr><td><br /> " . JText::_("COM_VIDEOTRANSLATION_SIGNATURE") . '</td></tr></table>';
        $this->mailGeneration($recipient, $subject, $body);
    }
// No direct access to this file
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
require_once JPATH_SITE . '/components/com_videotranslation/lib/russian-date.php';
?>
<h1>
<?php 
echo JText::_('COM_VIDEOTRANSLATION_INVITATION');
?>
</h1>


<div>
<?php 
echo JText::sprintf('COM_VIDEOTRANSLATION_SOMEBODY_INVITES_YOU_ON_MEETING', $this->item->first_name . ' ' . $this->item->last_name, maxsite_the_russian_time($this->item->date), $this->item->start, $this->item->end, $this->item->envitee_timezone);
?>
</div>

<br />

<form action="<?php 
echo JRoute::_('index.php');
?>
"
      method="post" name="adminForm" id="userdetails-form" class="form-validate">


    <?php 
foreach ($this->form->getFieldset() as $field) {
    ?>
 function sentNotificationInterpreter($order, $event)
 {
     //        JModelLegacy::addIncludePath(JPATH_ROOT.'/components/com_videotranslation/models', 'VideoTranslationModel');
     //        $model = JModelLegacy::getInstance('PartnersDetails', 'VideoTranslationModel', array('ignore_request' => true));
     //$difference = $model->differenceTime($order->user_timezone);
     $subject_obj =& JTable::getInstance('subject', 'VideoTranslationTable');
     $subject_obj->load($order->subj_id);
     $difference = 0;
     $translator =& JFactory::getUser($order->translator_id);
     $translator_email = $translator->email;
     $recipient = array($translator_email);
     $subject = JText::sprintf('COM_VIDEOTRANSLATION_TRANSLATOR_SUBJECT_YELLOW_LIGHT', maxsite_the_russian_time(date('j F H:i', $event->dtstart + $difference)) . ' - ' . date('H:i', $event->dtend + $difference), $subject_obj->name);
     //$link = $event->location."&order_id=".$order->id."&usertype=3&Itemid=155&lang=ru";
     $link = $event->location;
     $body = JText::sprintf('COM_VIDEOTRANSLATION_TRANSLATOR_BODY_YELLOW_LIGHT', $order->first_name . ' ' . $order->last_name, $order->envitee_name, $subject_obj->name, maxsite_the_russian_time(date('j F', $event->dtstart + $difference)), date('H:i', $event->dtstart + $difference), date('H:i', $event->dtend + $difference), $link);
     $body .= "<br /> " . JText::_("COM_VIDEOTRANSLATION_SIGNATURE");
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $model = JModelLegacy::getInstance('approve', 'VideoTranslationModel', array('ignore_request' => true));
     $model->mailGeneration($recipient, $subject, $body);
 }
 function getInvitationTextArea()
 {
     require_once JPATH_SITE . '/components/com_videotranslation/lib/russian-date.php';
     JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_videotranslation/models', 'VideoTranslationModel');
     $cart_model = JModelLegacy::getInstance('Cart', 'VideoTranslationModel', array('ignore_request' => true));
     $items = $cart_model->getItems();
     //echo date('Y m d H:i:s',$items[0]->start); die;
     //        echo "<pre>";
     //        print_r($items); die;
     $this->items = $items;
     $session = JFactory::getSession();
     $cart = $session->get('cart');
     $this->difference = $this->differenceTimeInviterInvitee($cart['my_partner_timezone'], $cart['my_timezone']);
     //      $this->difference = 0;
     //     echo $this->difference; die;
     //echo $cart['my_partner_timezone']; die;
     $languageTable =& JTable::getInstance('language', 'VideoTranslationTable');
     $languageTable->load($cart['your_partner_language']);
     $lang = JFactory::getLanguage();
     $lang->load('com_videotranslation', JPATH_SITE, $languageTable->system_language);
     $tag = substr($languageTable->system_language, 0, 2);
     $link = '[LINK]';
     //        $time = ' ';
     //        for($i=0;$i<count($items);$i++) {
     //
     //            $time
     //
     //        }
     //        echo "<pre>";
     //        print_r($items); die;
     $text = JText::sprintf('COM_VIDEOTRANSLATION_BODY_PARTNER1', maxsite_the_russian_time(date('j F', $items[0]->start + $this->difference), $tag), date('H:i', $items[0]->start + $this->difference), date('H:i', $items[0]->end + $this->difference), $cart['my_partner_timezone'], $link);
     $text = str_replace("<br />", "\r\n", $text);
     $lang->load('com_videotranslation', JPATH_SITE, $lang->getTag(), true);
     return $text;
 }