<?php
/**
 * @name          : Joomla Social Pinboard
 * @version	  : 1.5.0
 * @package       : apptha
 * @since         : Joomla 1.5
 * @author        : Apptha - http://www.apptha.com
 * @copyright     : Copyright (C) 2011 Powered by Apptha
 * @license       : http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @abstract      : Social Pinboard Component Boarddisplay view
 * @Creation Date : March 2013
 * @Modified Date : March 2013
 * */
// No direct Access
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_wishlogue/css/edit-style.css');
$document->addScript('components/com_wishlogue/javascript/chrome.js');
$document->addStyleSheet('templates/wishlogue/html/com_wishlogue/css/style.css');
$document->addStyleSheet('templates/wishlogue/html/com_wishlogue/css/pinboard.css');
$document->addStyleSheet('components/com_wishlogue/css/reset.css');
//$document->addStyleSheet('components/com_wishlogue/css/pinboard.css');
$document->addStyleSheet('templates/wishlogue/css/style.css');
$document->addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
$document->addScript('components/com_wishlogue/javascript/scroll/jquery.isotope.min.js');
$document->addScript('components/com_wishlogue/javascript/scroll/jquery.infinitescroll.min.js');
$app = JFactory::getApplication();
$config = JFactory::getConfig();
$templateparams = $app->getTemplate(true)->params; // get the tempalte
$sitetitle = $templateparams->get('sitetitle');
if (isset($sitetitle)) {
    $document->setDescription($sitetitle);
    $document->setTitle($sitetitle);
} else {
    $sitetitle = $config->get('sitename');
    $document->setDescription($sitetitle);
    $document->setTitle($sitetitle);
}
$userExist = $this->user_exist;
if ($userExist->block == '1' && $userExist->status == '0') {
    echo "<div id='login_error_msg'> Sorry! This wisher is not available! </div>";
} else {
    $baseurl = JURI::base();
    $user = JFactory::getUser();
    $fBoardId = '';
    $inc = '';
    $totalBoard = $this->totalBoard;

    $dispBoard = $this->displayBoard;
    $pinLikes = $this->getLikes;
    $pincounts = $this->pinCounts;
    $followers = $this->followers;
//    echo "<pre>";print_r($followers);exit;
    if ($followers['0'] != '') {
        $follwercount = count($followers);
    } else {
        $follwercount = '0';
    }

    $followings = $this->FollowingInformation;
    $follower_count = $this->followerInformation;
    if ($follower_count == '') {
        $follower_count = 0;
    }
    if ($followings == '') {
        $followings = 0;
    }
    $users = JRequest::getInt('uid');
    $userLink = '';
//if user exists assign user id
    if (isset($users) && $users != '0') {
        $userLink = '&amp;uid=' . $users;
    }
//Get the follow boards
    if (count($dispBoard) != 0) {
        foreach ($dispBoard as $fboards) {

            if ((count($dispBoard) - 1) == $inc) {
                $fBoardId.= $fboards->board_id;
            } else {
                $fBoardId.= $fboards->board_id . ',';
            }
            $inc++;
        }
    }
    $user_id = $user->id; //stores user id
    ///rgs.
    $getNotifications = $this->getNotifications;
    $getnewNotificationCount = $this->getnewNotificationCount;
    $getNotificationCount = $this->getNotificationCount;
    $getgrantedWishesCount = $this->getgrantedWishesCount;
    ///rgs..

    $profileDetails = $this->user_profile; //stores user details
    $repinactivities = $this->repinactivities; //stores repin activities of user
    if ($user_id)
        $userfollow = $this->follow_user_details; //stores the following user list
    $userfollowuser = $this->userfollowuser;
    $user_result = $this->userprofile; //stores user details
    $userfollowuserCount = count($userfollowuser);
    $reportedUsers = $this->getReportUsers; //print_r($reportedUsers);
    $blockStatus = $this->blockStatus; //echo($blockStatus[0]->status);exit;
    if (empty($user_result[1])) {
        $user_res = $user_result[0]; //pinned by information
        $user_res1 = $user_result[0]; //commenting user information
    } else if ($user_id == $user_result[0]->user_id) {
        $user_res = $user_result[1]; //pinned by information
        $user_res1 = $user_result[0]; //commenting user information
    } else if ($user_result[1]->user_id == $user_id) {
        $user_res = $user_result[0]; //pinned by information
        $user_res1 = $user_result[1]; //commenting user information
    }
    if (!JRequest::getVar('page')) {
        ?>

        <div id="profile-header">
            <div class="fixedcontainer row clearfix">
                <div class="info">
                    <?php
                    foreach ($profileDetails as $profileDetails) {
                        if (!$profileDetails->user_image) {
                            $srcPath = "components/com_wishlogue/images/no_user.png";
                        } else {
                            $userImageDetails = pathinfo($profileDetails->user_image);
                            $userProfileImage = $userImageDetails['filename'] . '_o.' . $userImageDetails['extension'];
                            $srcPath = "images/wishlogue/avatars/" . $userProfileImage;
                        }
                        ?>
                        <a target="_blank" href="<?php echo JURI::base() . $srcPath ?>" class="profileimage" >
							
							<?php
							$img_Res = wishlogueModelnotifications::getImageResolution(JURI::base() . $srcPath, 450, 160); ?>
							<img src="<?php echo $srcPath; ?>" height="<?php echo $img_Res['height']; ?>" width="<?php echo $img_Res['width']; ?>" alt="User Profile">
                        </a>
                        <div class="content">
                            <h1 id="name"><?php echo $profileDetails->first_name . ' ' . $profileDetails->last_name; ?></h1>
                            <p class="colormuted"><?php echo $profileDetails->about; ?></p>
                            <ul id="profilelinks" class="icons">
                                <?php if ($profileDetails->facebook_profile_id) { ?>
                                    <li>
                                        <a href="http://facebook.com/profile.php?id=<?php echo $profileDetails->facebook_profile_id; ?>" class="icon facebook" target="_blank"></a>
                                    </li>
                                    <?php
                                }
                                if ($profileDetails->location != '') {
                                    ?>
                                    <span class="icon website" ></span>
                                    <li>
                                        <?php echo $profileDetails->location; ?>
                                    </li><?php
                                    }
                                    if ($profileDetails->website != '') {
                                        if (!strstr($profileDetails->website, 'http') && !strstr($profileDetails->website, 'https')) {
                                            $website = "http://" . $profileDetails->website;
                                        }
                                        else
                                            $website = $profileDetails->website;
                                        ?>
                                    <li>
                                        <a href="<?php echo $website; ?>" class="icon location" target="_blank"></a>
                                    </li>
            <?php } ?>

                                <?php
                                ///rgs.
                                $RGS_uid = JRequest::getInt('uid', 0);
                                $RGS_user = JFactory::getUser()->id;

                                if ($RGS_uid == $RGS_user || $RGS_uid == 0) {
                                    ?>
                                    <li>
                                        <a href='<?php echo JRoute::_('index.php?option=com_wishlogue&view=profile') ?>'><input type='button' value='<?php echo JText::_('COM_WISHLOGUE_EDIT_PROFILE'); ?>'></a>
                                    </li>
                <?php
            }
            ///rgs..
            ?>

                            </ul>
                                <?php if ($users != $user->id && $users != '' && $user->id != '') { ?>
                                <span class="flag" style="cursor:pointer;" onmouseout="bloguserhide();"  onmouseover="bloguser();">&nbsp;</span>
                                <?php
                            }
                        }
                        ?>
                        <div id="blogdialogbox" class="report-user shadow-dropdown" onmouseover="bloguser();" onmouseout="bloguserhide();"  style="display: none;">
                            <div class="arrow up"></div>
                            <div class="section report-head">
        <?php
        $value_receiver = $value_sender = '';
        if (!empty($reportedUsers)) {
            $value_receiver = $reportedUsers[0]->report_receiver;
            $value_sender = $reportedUsers[0]->report_sender;
        }
        $users = JRequest::getInt('uid');
        $user_id = $user->id;
        if ($value_receiver == $users && $value_sender == $user_id) {
            ?>
                                    <div class="reported" id="reported">
                                        <h2 style="color:black;"><?php echo JText::_('COM_WISHLOGUE_REPORTED'); ?></h2>
                                    <?php echo JText::_('COM_WISHLOGUE_YOU_REPORTED_START'); ?><?php echo ' ' . $profileDetails->first_name . ' ' . $profileDetails->last_name; ?><?php echo JText::_('COM_WISHLOGUE_YOU_REPORTED_END'); ?>
                                    </div>
                                    <?php } else {
                                        ?>
                                    <div class="unreported" id="unreported">
                                        <h2 style="color:black;"><?php echo JText::_('COM_WISHLOGUE_YOU_REPORT'); ?> <?php echo ' ' . $profileDetails->first_name . ' ' . $profileDetails->last_name; ?></h2>
                                    </div>
        <?php } ?>
                            </div>
                            <ul class="report-type">
                                <li id="report_action_nudity" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_NUDITY'); ?>');" class="first"><a report_type="nudity"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_NUDITY'); ?></a></li>
                                <li id="report_action_attacks" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORST_TYPE_ATTACKS'); ?>');" class=""><a report_type="attacks"><?php echo JText::_('COM_WISHLOGUE_REPORST_TYPE_ATTACKS'); ?></a></li>
                                <li id="report_action_graphic-violence" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_GRAPHIC_VIOLENCE'); ?>');" class=""><a report_type="graphic-violence"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_GRAPHIC_VIOLENCE'); ?></a></li>
                                <li id="report_action_hate-speech" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_HATEFUL_SPEECH'); ?>');" class=""><a report_type="hate-speech"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_HATEFUL_SPEECH'); ?></a></li>
                                <li id="report_action_self-harm" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_SELF_HARM'); ?>');" class=""><a report_type="self-harm"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_SELF_HARM'); ?></a></li>
                                <li id="report_action_spam"  onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_SPAM'); ?>');" class=""><a report_type="spam"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_SPAM'); ?></a></li>
                                <li id="report_action_other" onclick="Modal.show('userreport');
                                        blocktype('<?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_OTHER'); ?>');" class=""><a report_type="other"><?php echo JText::_('COM_WISHLOGUE_REPORT_TYPE_OTHER'); ?></a></li>
                            </ul>
                            <div class="section block-head">
                                <h3>
                                    <div id="userblock" style="color: #000;text-transform: capitalize;"></div>

        <?php if ($user_id != $users && $user_id != '' && $user_id != '0') { ?>
                                        <div id="category_user_follow<?php echo $user_id; ?>" style="padding-right: 5px;" >
                                        <?php if (!empty($blockStatus[0]) && $blockStatus[0]->status == '0') { ?>
                                                <input type="button" name="followuser" id="textdisplay" style="float:right;cursor: pointer;" value="<?php echo 'Block'; ?>" class="Button Button13 RedButton clickable blockuserbutton" onclick="bloguserfully();">

                                            <?php } else if (!empty($blockStatus[0]) && $blockStatus[0]->status == '1') { ?>
                                                <input type="button" style="float:right;cursor: pointer;" id="textdisplay"   value="<?php echo 'Unblock' ?>"class="Button Button13 RedButton clickable blockuserbutton" onclick="unblock('<?php echo $user_id; ?>', '<?php echo $user_res->user_id; ?>');"  />

                                            <?php } else if (empty($blockStatus[0])) { ?>
                                                <input type="button" name="followuser" id="textdisplay" style="float:right;cursor: pointer;" value="<?php echo 'Block'; ?>" class="Button Button13 RedButton clickable blockuserbutton" onclick="bloguserfully();">

                                            <?php } ?>
                                            <input type="button" name="followuser" id="nameuser" style="display:none;" value="<?php echo $profileDetails->first_name . ' ' . $profileDetails->last_name; ?>" class="Button Button13 RedButton clickable blockuserbutton" >
                                        </div>
                                        <?php } if ($user_id == $users) { ?>
                                        <input type="button" name="followuser" id="textdisplay" style="float:right;cursor: pointer;" value="" class="Button Button13 RedButton clickable blockuserbutton" >
                                        <input type="button" name="followuser" id="nameuser" style="display:none;" value="" class="Button Button13 RedButton clickable blockuserbutton" >

        <?php } ?>

                                </h3>
                                <h3 class="report-user" id="blockUnblockUsermessagefirst"></h3>
                                <h3 class="report-user" id="blockUnblockUsermessagesecond"></h3>
                            </div>
                        </div>
                    </div>
                </div>
				
				<!--
                <div class="repins">
                    <h3><?php //echo JText::_('COM_WISHLOGUE_YOU_REPINS_FROM'); ?></h3>
                    <ul>
        <?php
        // foreach ($repinactivities as $test) {
            // $resultmodrepin = wishlogueModelnotifications::getModRepinpinUserdetails($test->pin_repin_id);
            // foreach ($resultmodrepin as $named) {
                // if (!$named->user_image) {
                    // $srcPath = "components/com_wishlogue/images/no_user.png";
                // } else {
                    // $userImageDetails = pathinfo($named->user_image);
                    // $userProfileImage = $userImageDetails['filename'] . '_o.' . $userImageDetails['extension'];
                    // $srcPath = "images/wishlogue/avatars/" . $userProfileImage;
                // }
                ?>
                                <li>
                                    <a href="<?php //echo JRoute::_('index.php?option=com_wishlogue&view=cataloguedisplay&uid=' . $named->pin_user_id); ?>">
                                        <img src="<?php //echo $srcPath; ?>"><strong class="user-pin"><?php //echo $named->username; ?></strong></a>
                                </li>
            <?php //}
       // }
        ?>
                    </ul>
                </div>
				-->
				
				
            </div>

        <?php
        ///rgs.
        $RGS_uid = JRequest::getInt('uid', 0);
        $RGS_user = JFactory::getUser()->id;

        if ($RGS_uid == $RGS_user || $RGS_uid == 0)
		{
        ?>
			<div id="BoardTitle">
				<p align="right">
					<b>
						<a href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=family#show_family') ?>" >
							<?php echo JText::_('COM_WISHLOGUE_SWITCH_TO_GRANT_WISHES_MODE'); ?> >>
						</a>
					</b>
				</p>
		<?php
				echo '<h1>' . JText::_('COM_WISHLOGUE_MODE_MAKE_WISHES') . '</h1>';
		?>
			</div>
		<?php
        }
        ///rgs..
        ?>


            <div id="ContextBar" class="clearfix">
                <div id="fixed_container">
                    <ul>
                        <li><a id='show_catalogues' href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=cataloguedisplay' . $userLink . '#show_catalogues') ?>">
        <?php
        if ($totalBoard > 1)
            echo $totalBoard . ' ' . JText::_('COM_WISHLOGUE_BOARDS');
        else
            echo $totalBoard . ' ' . JText::_('COM_WISHLOGUE_BOARD');
        ?>
                            </a>
                        </li>
                        <li>
                            <a id='show_wishes' href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=wishdisplay' . $userLink . '#show_wishes') ?>">
        <?php
        if ($pincounts > 1)
            echo $pincounts . ' ' . JText::_('COM_WISHLOGUE_PINS');
        else
            echo $pincounts . ' ' . JText::_('COM_WISHLOGUE_PIN');
        ?></a>
                        </li>
                        <li>
                            <a id='show_likes' href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=likes' . $userLink . '#show_catalogues') ?>">
                                <?php
                                if ($pinLikes > 1)
                                    echo $pinLikes . ' ' . JText::_('COM_WISHLOGUE_LIKES');
                                else
                                    echo $pinLikes . ' ' . JText::_('COM_WISHLOGUE_LIKE');
                                ?></a>
                        </li>
                        <!-- rgs. -->
                        <?php
                        $RGS_uid = JRequest::getInt('uid', 0);
                        $RGS_user = JFactory::getUser()->id;
                        $RGS_link = '';
                        if ($RGS_uid != 0) {
                            $RGS_link = '&uid=' . $RGS_uid;
                        }

                        if ($RGS_uid == $RGS_user || $RGS_uid == 0) {
                            ?>
                            <li>
                                <a id='show_grantedwishes' href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=grantedwishes#show_grantedwishes') ?>">
                                    <label id="DIVGrantedWishCount">
                                        <?php
                                        echo $getgrantedWishesCount;
                                        ?>
                                    </label>
                                    <label id="DIVGrantedWishCountText">
                                        <?php
                                        if ($getgrantedWishesCount > 1) {
                                            echo ' ' . JText::_('COM_WISHLOGUE_GRANTED_WISHES');
                                        } else {
                                            echo ' ' . JText::_('COM_WISHLOGUE_GRANTED_WISH');
                                        }
                                        ?>
                                        </span>
                                </a>
                            </li>
                            <li>
                                <a id='show_notifications' href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=notifications#show_notifications') ?>"  class="selected">
                                    <label id="DIVNotificationCount">
            <?php
            echo $getNotificationCount;
            ?>
                                    </label>
                                    <label id="DIVNotificationCountText">
            <?php
            if ($getNotificationCount > 1) {
                echo ' ' . JText::_('COM_WISHLOGUE_NOTIFICATIONS');
            } else {
                echo ' ' . JText::_('COM_WISHLOGUE_NOTIFICATION');
            }
            ?>
                                    </label>
                                        <?php
                                        if ($getnewNotificationCount > 0) {
                                            echo '<span class="new_notify_count">' . $getnewNotificationCount . '</span>';
                                        }
                                        ?>
                                </a>
                            </li>
                                <?php } ?>
                        <!-- rgs. -->
                        <li>
                        <?php
                        if (JRequest::getInt('uid')) {
                            $userId = JRequest::getInt('uid');
                            ?>
                                <a id='show_followings' href="<?php echo JRoute::_("index.php?option=com_wishlogue&view=follow&follower=1&uid=" . $userId . '#show_followings', false); ?>" ><?php echo $followings . ' ' . JText::_('COM_WISHLOGUE_FOLLOWING_CAPS'); ?></a>
                                <?php
                            } else {
                                ?>
                                <a id='show_followings' href="<?php echo JRoute::_("index.php?option=com_wishlogue&view=follow&follower=1#show_followings", false); ?>" ><?php echo $followings . ' ' . JText::_('COM_WISHLOGUE_FOLLOWING_CAPS'); ?></a>
                                <?php
                            }
                            ?>
                        </li>
                        <li>
                            <?php
                            if (JRequest::getInt('uid')) {
                                $userId = JRequest::getInt('uid');
                                ?>
                                <a id='show_followers' href="<?php echo JRoute::_("index.php?option=com_wishlogue&view=follow&follower=0&uid=" . $userId . '#show_followers', false); ?>" ><?php echo $follower_count . ' ' . JText::_('COM_WISHLOGUE_FOLLOWERS_CAPS'); ?></a>
                                <?php
                            } else {
                                ?>
                                <a id='show_followers' href="<?php echo JRoute::_("index.php?option=com_wishlogue&view=follow&follower=0#show_followers", false); ?>" ><?php echo $follower_count . ' ' . JText::_('COM_WISHLOGUE_FOLLOWERS_CAPS'); ?></a>
                                <?php
                            }
                            ?>
                        </li>
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
        </div>
                            <?php
                        }
                        ?>


    <?php
    if (count($getNotifications) <= 0) {
        ?>
        <div align="center" class="error message" id="login_error_msg">
            <ul>
                <li><?php echo JText::_('COM_WISHLOGUE_SORRY_NO_NOTIFICATIONS'); ?></li>
            </ul>
        </div>
        <?php
    }
    ?>





    <div id="container" class="notificationview">
        <div class="board_display">
    <?php
    if (count($getNotifications) > 0) {
        foreach ($getNotifications as $notification) {
            ?>
                    <div class="pin" id="pin_div_<?php echo $notification->notify_id; ?>">
                        <div class="board_pin_title">
                            <h3 class="board-title">
            <?php
            $notify_for = '';
            $pin_image = '';
            $pin_description = '';
            if ($notification->notify_for == 'anonymously_granted' || $notification->notify_for == 'accept_granted') {
                $getPinDetails = wishlogueModelnotifications::getPinDetails($notification->notification_id);
                $pin_image = $getPinDetails->pin_image;
                $pin_description = $getPinDetails->wish_item;

                if ($getPinDetails->link_type == 'youtube' || $getPinDetails->link_type == 'vimeo') {
                    $pin_image = $getPinDetails->pin_image;
                } else {
                    $pin_image = "images/wishlogue/wish_medium/" . rawurlencode($getPinDetails->pin_image);
                }
            }
            switch ($notification->notify_for) {
                case 'anonymously_granted':
                    $notify_for = JText::_('COM_WISHLOGUE_ANAONYMOUSLY_GRANTED');
                    break;
                case 'accept_granted':
                    $notify_for = JText::_('COM_WISHLOGUE_GRANT_WISH_APPROVED');
                    break;
                case 'invite_family':
                    $notify_for = JText::_('COM_WISHLOGUE_ADD_TO_FAMILY_REQUEST');
                    break;
                case 'invite_friends':
                    $notify_for = JText::_('COM_WISHLOGUE_ADD_TO_FRIEND_REQUEST');
                    break;
                case 'confirm_family':
                    $notify_for = JText::_('COM_WISHLOGUE_FAMILY_REQUEST_ACCEPTED');
                    break;
                case 'confirm_friends':
                    $notify_for = JText::_('COM_WISHLOGUE_FRIEND_REQUEST_ACCEPTED');
                    break;
            }

            if (strlen($notify_for) > 25) {
                echo JHTML::_('string.truncate', ($notify_for), 25);
            } else {
                echo $notify_for;
            }
            ?>
                            </h3>
                        </div>

                        <div class="board_pin">
                            <div class="images pin_no_img b-edit1">
                                <?php
                                if (!$notification->user_image) {
                                    $srcPath = "components/com_wishlogue/images/no_user.png";
                                } else {
                                    $userImageDetails = pathinfo($notification->user_image);
                                    $userProfileImage = $userImageDetails['filename'] . '_o.' . $userImageDetails['extension'];
                                    $srcPath = "images/wishlogue/avatars/" . $userProfileImage;
                                }
                                if ($notification->notify_for != 'anonymously_granted') {
                                    ?>
                                <div class="user-img-name clearfix">
                                    <a target="_blank" href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=cataloguedisplay&uid=' . $notification->from_id); ?>" class="profileimage" >
                                        <?php $img_Res = wishlogueModelnotifications::getImageResolution($srcPath, 45, 60); ?>
										<img src="<?php echo $srcPath; ?>" height="<?php echo $img_Res['height']; ?>" width="<?php echo $img_Res['width']; ?>" alt="User Profile">
										<?php
											echo '<p class="user-name">' . ucwords($notification->first_name) . ' ' . ucwords($notification->last_name) . '</p>';
										?>
                                    </a>
                                </div>
                                    <?php
                                }
                                if ($pin_image != '') {
                                    ?>
                                <div class="user-img-name clearfix">
                                    <a class="new-img" href="<?php echo JRoute::_('index.php?option=com_wishlogue&view=wish&pinid=' . $notification->notification_id); ?>">
                                        <?php
										$img_Res = wishlogueModelnotifications::getImageResolution($pin_image, 45, 60); ?>
										<img height="<?php echo $img_Res['height']; ?>" width="<?php echo $img_Res['width']; ?>" src="<?php echo $pin_image; ?>" alt="" />
                                        <?php echo '<p class="user-name">' . $pin_description . '</p>'; ?>
                                    </a>
                                </div>
                                
                                    
                <?php
                if ($notification->notify_for == 'anonymously_granted') {
                ?>

								<div id='grant_manage_<?php echo $notification->notify_id; ?>'>
									<div class="buttons-wish">
									<?php
									echo '<p>' . JText::_('COM_WISHLOGUE_ANAONYMOUSLY_CONGRATS_GRANTED4') . '</p>';
									?>
									<input type='button' value='Yes' onclick='confirmationBoxShowHide("accept_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>", "grant_manage_<?php echo $notification->notify_id; ?>"); return false;'>

									<?php if ( wishlogueModelnotifications::canDisplayDeclineGranted($notification->notification_id) != 'success' ) { ?>
									<input type='button' value='No' onclick='confirmationBoxShowHide("decline_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>", "grant_manage_<?php echo $notification->notify_id; ?>"); return false;'>
									<?php } ?>
								
								</div>
							</div>

							<!-- decline granted wish confirmation box -->
							<div class="decline_grantedwish_confirmation_box_notifications" id="decline_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>" style='display: none;'>
								<p><?php echo JText::_('COM_WISHLOGUE_ANAONYMOUSLY_NOTIFY_APPROVE_DECLINE'); ?></p>
								<input class='yes' onclick='manageGWFN("declineGrantedWish", "<?php echo $notification->notify_id; ?>", "<?php echo $notification->notification_id; ?>", "<?php echo $notification->from_id; ?>")' type="button" name="decline-grant-wish" id="decline-grant-wish" value="Yes"/>
								<input class='no' type="button" onclick="confirmationBoxShowHide('grant_manage_<?php echo $notification->notify_id; ?>','decline_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>'); return false;" name="not-decline-grant-wish" id="not-decline-grant-wish" value="No"/>
							</div>

							<!-- accept granted wish confirmation box -->
							<div class='accept_grantedwish_confirmation_box_notifications' id="accept_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>" style='display: none;'>
								<p><?php echo JText::_('COM_WISHLOGUE_ANAONYMOUSLY_NOTIFY_APPROVE_ACCEPT'); ?></p>
								<input class='yes' onclick='manageGWFN("acceptGrantedWish", "<?php echo $notification->notify_id; ?>", "<?php echo $notification->notification_id; ?>", "<?php echo $notification->from_id; ?>")' type="button" name="accept-grant-wish" id="accept-grant-wish" value="Yes"/>
								<input class='no' type="button" onclick="confirmationBoxShowHide('grant_manage_<?php echo $notification->notify_id; ?>' ,'accept_grantedwish_confirmation_box_<?php echo $notification->notify_id; ?>'); return false;" name="not-accept-grant-wish" id="not-accept-grant-wish" value="No"/>
							</div>

							<!-- rgs..  -->

                                        <?php
                                    }
                                    ?>

                                        <?php
                                    } else if ($notification->notify_for == 'invite_family') {
                                        ?>
                                    <div class="buttons-wish">
                                    <div id='family_manage_<?php echo $notification->notify_id; ?>'>
                                        <input type="button" id="acceptfriend" onclick="managefamilyFromNotifications('<?php echo $notification->notify_id; ?>', '<?php echo $notification->from_id; ?>', 'family', 'acceptRequest')" value="<?php echo JText::_('COM_WISHLOGUE_FAMILY_CONFIRM_REQUEST'); ?>" />
                                        <input type="button" id="declinefriend" onclick="managefamilyFromNotifications('<?php echo $notification->notify_id; ?>', '<?php echo $notification->from_id; ?>', 'family', 'declineRequest')" value="<?php echo JText::_('COM_WISHLOGUE_FAMILY_DECLINE_REQUEST'); ?>" />
                                    </div>
                                    </div>
                                        <?php
                                    } else if ($notification->notify_for == 'invite_friends') {
                                        ?>
                                                                <div class="buttons-wish">
                                    <div id='family_manage_<?php echo $notification->notify_id; ?>'>
                                        <input type="button" id="acceptfriend" onclick="managefamilyFromNotifications('<?php echo $notification->notify_id; ?>', '<?php echo $notification->from_id; ?>', 'friends', 'acceptRequest')" value="<?php echo JText::_('COM_WISHLOGUE_FAMILY_CONFIRM_REQUEST'); ?>" />
                                        <input type="button" id="declinefriend" onclick="managefamilyFromNotifications('<?php echo $notification->notify_id; ?>', '<?php echo $notification->from_id; ?>', 'friends', 'declineRequest')" value="<?php echo JText::_('COM_WISHLOGUE_FAMILY_DECLINE_REQUEST'); ?>" />
                                    </div>
                                                                    </div>
                                    <?php
                                }
                                echo '<p class="date">' . date('d-M-Y h:i A', strtotime($notification->notify_date)) . '</p>';
                                ?>
                            </div>
                            <div class="followBoard">
                                <div id='remove_from_notification_<?php echo $notification->notify_id; ?>'>
                                <?php
                                if ($notification->notify_for == 'anonymously_granted') {
                                    ?>
										<a href="javascript: removeFromNotifications('<?php echo $notification->notify_id; ?>')" class="Button13 Button WhiteButton"><strong><?php echo JText::_('COM_WISHLOGUE_NOTIFICATION_DELETE'); ?></strong></a>
                                    <?php
									} else if ($notification->notify_for == 'invite_family') {
                                    ?>
                                        <a href="javascript: managefamilyFromNotifications('<?php echo $notification->notify_id; ?>', '<?php echo $notification->from_id; ?>', 'family', 'declineRequest')" class="Button13 Button WhiteButton"><strong><?php echo JText::_('COM_WISHLOGUE_NOTIFICATION_DECLINE_DELETE') . '<br>' . JText::_('COM_WISHLOGUE_NOTIFICATION_DELETE'); ?></strong></a>
                                    <?php
                                } else if ($notification->notify_for == 'invite_friends') {
                                    ?>
                                        <a href="javascript: managefamilyFromNotifications('<?php echo $notification->notify_id; ?>','<?php echo $notification->from_id; ?>', 'friends', 'declineRequest')" class="Button13 Button WhiteButton"><strong><?php echo JText::_('COM_WISHLOGUE_NOTIFICATION_DECLINE_DELETE') . '<br>' . JText::_('COM_WISHLOGUE_NOTIFICATION_DELETE'); ?></strong></a>
                <?php
            } else {
                ?>
                                        <a href="javascript: removeFromNotifications('<?php echo $notification->notify_id; ?>')" class="Button13 Button WhiteButton"><strong><?php echo JText::_('COM_WISHLOGUE_NOTIFICATION_DELETE'); ?></strong></a>
                                    <?php
                                }
                                ?>
                                </div>
                            </div>
                        </div>
                    </div>
                                    <?php
                                }
                            }
                            ?>
        </div>
    </div>


    <div id="userreport" class="ModalContainer">
        <div class="modal wide PostSetup" id="reportuser">
            <div id="postsetup">
                <div id="outputs"></div>
                <h2><?php echo JText::_('COM_WISHLOGUE_YOU_REPORT'); ?> <?php echo $profileDetails->first_name . ' ' . $profileDetails->last_name; ?></h2>
                <a class="closebutton" onclick="javascript:document.getElementById('outputs').innerHTML = '';
                                    Modal.close('userreport');"></a>
                <p id="ReportLabel"><?php echo JText::_('COM_WISHLOGUE_CONFIRM_REPORT_START') . $profileDetails->first_name . ' ' . $profileDetails->last_name; ?> ?</p>
                <p style="font-size: 18px;font-weight: bold;display:none;"><?php echo JText::_('COM_WISHLOGUE_YOU_REASON'); ?><input type="text" value="" readonly id="inputBlocktype" style="width:50%;margin-left:30px;font-size: 18px;font-weight: bold;" name="blocktype"></p>
                <div id="reportbutton"><input type="button" style="float: left;" id="report_btn" onclick="reportUser();
                                    return false"  data-form="ReportModal" value="<?php echo JText::_('COM_WISHLOGUE_YOU_REPORT'); ?>" /></div>
                <input type="button"  style="float: left;margin-left: 5px;" id="report_sbumit_btn" onclick="reportUser();
                                    block('<?php echo $user_id; ?>', '<?php echo $user_res->user_id; ?>');"  data-form="ReportModal" value="<?php echo JText::_('COM_WISHLOGUE_YOU_REPORT_BLOCK');
        ;
        ?>" />
                <input type="button" class="closefollow" id="report_submitwhite_btn" onclick="javascript:document.getElementById('outputs').innerHTML = '';
                                    Modal.close('userreport');
                                    return false"  data-form="ReportModal" value="<?php echo JText::_('COM_WISHLOGUE_YOU_DONT_REPORT');
        ;
        ?>" />
            </div>
        </div>
        <div class="overlay" style="opacity: 1.0;"></div>
    </div>
    <div id="blogdisplay" class="ModalContainer">
        <div class="modal wide PostSetup" id="blogdisplaymodal">
            <div id="postsetup">
                <h2><?php echo JText::_('COM_WISHLOGUE_YOU_BLOCK'); ?> <?php echo $profileDetails->first_name . ' ' . $profileDetails->last_name; ?></h2>
                <a class="closebutton"  onclick="javascript:document.getElementById('outputs').innerHTML = '';
                                    Modal.close('blogdisplay');"></a>
                <form name="report1" id="report1" action="#" method="post" class="Form FancyForm">
                    <div id="outputs"></div>
                    <p id="ReportLabelblock"><?php echo JText::_('COM_WISHLOGUE_YOU_REPORTED_MESSAGE_START') . $profileDetails->first_name . ' ' . $profileDetails->last_name . JText::_('COM_WISHLOGUE_YOU_REPORTED_MESSAGE_END'); ?> </p>
                    <p style="font-size: 18px;font-weight: bold;display:none;">Reason :<input type="text" value="" readonly id="inputBlocktype" style="width:50%;margin-left:30px;font-size: 18px;font-weight: bold;" name="blocktype"></p>
                    <input type="button" style="float: left;" id="report_sbumit_btn" onclick="block('<?php echo $user_id; ?>', '<?php echo $user_res->user_id; ?>');"  data-form="ReportModal" value="<?php echo JText::_('COM_WISHLOGUE_YOU_BLOCK') . '  ' . $profileDetails->first_name . ' ' . $profileDetails->last_name; ?>"/>
                    <input type="button"  id="report_submitwhite_btn" onclick="Modal.close('blogdisplay');"  data-form="ReportModal" value="<?php echo JText::_('COM_WISHLOGUE_YOU_DONT_BLOCK'); ?>" />
                </form>
            </div>
        </div>
        <div class="overlay" style="opacity: 1.0;"></div>
    </div>
    <div id="followBlockreport" class="ModalContainer">
        <div class="modal wide PostSetup" id="followblockreportmodal" >
            <div id="postsetup">
                <a class="closebutton" onclick="javascript:document.getElementById('outputs').innerHTML = '';
                                    Modal.close('followBlockreport');"></a>
                <h2><p id="ReportLabel"> <?php echo JText::_('COM_WISHLOGUE_REPORT_BLOCK_BOARD') . ' ' . $profileDetails->first_name . ' ' . $profileDetails->last_name; ?>.</p></h2>
                <input type="button" value="Close" style="float: left;" id="report_sbumit_btn" onclick="Modal.close('userReport');
                                    location.reload();" />
            </div>
        </div>
        <div class="overlay" style="opacity: 0.95;"></div>
    </div>


    <nav id="page-nav">
        <a id="navpage" href="<?php echo $this->baseurl ?>/index.php/component/wishlogue/?view=notifications&amp;page=1"></a>
    </nav>

    <script>
                    var scr = jQuery.noConflict();
                    scr(document).ready(function($) {

                        var $container = scr('.board_display');
                        $container.imagesLoaded(function() {
                            $container.masonry({
                                itemSelector: '.pin',
                                isFitWidth: true,
                                isResizable: true,
                                columnWidth: 222,
                                gutterWidth: 15
                            });

                        });
                        $container.find('div.pin').filter('div.pin').each(function()
                        {
                            var pin = scr(this);

                            var pinHeight = pin.height();

                            function checkSize()
                            {
                                var currHeight = pin.height();

                                if (pinHeight != currHeight) {
                                    $container.masonry('reload', function() {
                                        pinHeight = currHeight;
                                        setTimeout(checkSize, 50);
                                    });
                                } else {
                                    setTimeout(checkSize, 100);
                                }
                            }

                            checkSize();
                        });


                        $container.infinitescroll({
                            navSelector: '#page-nav', // selector for the paged navigation
                            nextSelector: '#page-nav a', // selector for the NEXT link (to page 2)
                            itemSelector: '#container div.pin', // selector for all items you'll retrieve

                            // extraScrollPx: 500,
                            loading: {
                                msgText: "<em><?php echo JText::_('COM_WISHLOGUE_LOADING_NEXT_NOTIFICATIONS'); ?></em>",
                                finishedMsg: "<?php echo JText::_('COM_WISHLOGUE_NO_MORE_NOTIFICATIONS'); ?>",
                                img: '<?php echo JURI::base(); ?>/components/com_wishlogue/images/loading.gif'
                            }
                        },
                        // trigger Masonry as a callback
                        function(newElements) {
                            // hide new items while they are loading
                            var $newElems = scr(newElements).css({opacity: 0});
                            // ensure that images load before adding to masonry layout
                            $newElems.imagesLoaded(function() {
                                // show elems now they're ready
                                $newElems.animate({opacity: 1});

                                $container.masonry('appended', $newElems, true);
                            });
                        }
                        );

                    });


		function confirmationBoxShowHide(sh, hid)
		{
			document.getElementById(sh).style.display = '';
			document.getElementById(hid).style.display = 'none';
		}

    </script>

    <?php
}
?>