<?php
use yii\helpers\Html;
use yii\widgets\ListView;
use kartik\widgets\ActiveForm;
use kartik\widgets\FileInput;
use kartik\widgets\Select2;
use yii\helpers\ArrayHelper;
use yii\db\Query;
use common\widgets\Alert;
use yii\helpers\Url;
use frontend\models\CricketComments;
use frontend\assets\AppAsset;

AppAsset::register($this);
$this->registerJsFile('https://www.exploreourindia.com/frontend/web/js/addtoany.js', ['position' => \yii\web\View::POS_END]);

if(Yii::$app->session->getFlash('copmssg') != '') {
$js = <<<JS
	$(document).ready(function(){
		$("#myModal").addClass("show");
		$("#myModal").css({ "display": "block", "background-color": "rgba(0,0,0,0.4)" });
	});
JS;
$this->registerJs($js);
 }
$js = <<<JS
	$('a[href*="#"]').on('click', function (e) {
	e.preventDefault();

	$('html, body').animate({
		scrollTop: $($(this).attr('href')).offset().top
	}, 1000, 'linear');
	});
	$(document).ready(function(){
	 $(document).on('click', '.repplly', function(){
	  var comment_id = $(this).attr("id");
	  $('#comment_id').val(comment_id);
	  $('#comments-name').focus();
	 });
	 $(document).on('click', '.btn-success', function(){
		 $('#myModal').removeClass('show');
		 $("#myModal").css({ "display": "none", "background-color": "none" });
                 window.location.reload();
	 });
	});
JS;
$this->registerJs($js);
/* @var $this yii\web\View */

$this->title = $postQuery->meta_title;

if($postQuery->image != '') {
   $ogimage = 'https://www.exploreourindia.com'. Yii::$app->urlManagerBackend->baseUrl.'/images/cricket/'.$postQuery->image;
} else {
    $ogimage = 'https://www.exploreourindia.com/frontend/web/images/logo.png';
}

\Yii::$app->view->registerMetaTag([
    'name' => 'description',
    'content' => $postQuery->meta_description,
]);
\Yii::$app->view->registerMetaTag([
    'name' => 'keywords',
    'content' => $postQuery->meta_keyword,
]);
$fullurlexp = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$this->registerMetaTag(['property' => 'og:site_name', 'content' => 'Explore Our India'], 'og:site_name');
$this->registerMetaTag(['property' => 'og:title', 'content' => $this->title], 'og:title');
$this->registerMetaTag(['property' => 'og:description', 'content' => $postQuery->meta_description], 'og:description');
$this->registerMetaTag(['property' => 'og:url', 'content' => $fullurlexp], 'og:url');
$this->registerMetaTag(['property' => 'og:image', 'content' => $ogimage], 'og:image');
$this->registerMetaTag(['property' => 'og:type', 'content' => 'Website'], 'og:type');
$this->registerMetaTag(['property' => 'og:locale', 'content' => 'en'], 'og:locale');
$this->registerMetaTag(['property' => 'twitter:title', 'content' => $this->title], 'twitter:title');
$this->registerMetaTag(['property' => 'twitter:description', 'content' => $postQuery->meta_description], 'twitter:description');
$this->registerMetaTag(['property' => 'twitter:image', 'content' => $ogimage], 'twitter:image');
$this->params['schema'] = \yii\helpers\Json::encode([
    '@context' => 'https://schema.org',
	'@type' => 'BlogPosting',
"image" => $ogimage,
	"mainEntityOfPage" => [
		"@type" => "WebPage",
		"@id" => $fullurlexp
	  ],
   "headline" => $this->title,
  "description" => $postQuery->meta_description,
  "author" => [
	"@type" => "Person",
    "url" => $fullurlexp,
	"name" => "Explore Our India Team"
  ],
  "publisher" => [
	"@type" => "Organization",
	"name" => "Explore Our India",
	"logo" => [
	  "@type" => "ImageObject",
	  "url" => $ogimage,
	  "width" => "178",
	  "height" => "57"
	]
  ],
  "datePublished" => date('Y-m-dTh:m:s', strtotime($postQuery->create_on)),
  "dateModified" => date('Y-m-d hTh:m:s', strtotime($postQuery->create_on))
]);
?>
<div role="main" class="main">

<!--<div class="container" style="background:#FFF;">
      <div class="row">
        <div class="col-lg-12" style="margin-bottom:15px; margin-top:15px;">
        <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>

<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="9520896402"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
        </div>
        </div>
        </div>-->

    <section class="page-header page-header-modern bg-color-light-scale-1 page-header-md">
      <div class="container">
        <div class="row">
          <div class="col-md-12 align-self-left order-1">
            <ul class="breadcrumb d-block text-left">
              <li><?=Html::a("Home", ['/site/index'])?></li>
              <li><?=Html::a("Cricket", ['/cricket/index'])?></li>
              <li class="active"><?=$postQuery->heading;?></li>
            </ul>
          </div>
        </div>
      </div>
    </section>
<div class="container">
      <div class="row">
        <div class="col-lg-9 order-lg-1">
		   <div class="blog-posts single-post">
			<article class="post post-large blog-single-post border-0 m-0 p-0">
				<div class="post-image ml-0">
                
                  <?php if($postQuery->image != '') {?>
        <img src="<?=Yii::$app->urlManagerBackend->baseUrl.'/images/cricket/'.$postQuery->image?>" class="img-fluid img-thumbnail img-thumbnail-no-borders rounded-0" alt="<?=$postQuery->heading;?>" />
      <?php } else { ?>
	     <img src="<?=Yii::$app->urlManagerFrontend->baseUrl.'/images/photo-not-availabe.jpg'?>" class="img-fluid img-thumbnail img-thumbnail-no-borders rounded-0" alt="<?=$postQuery->heading;?>" />
	  <?php } ?>
				</div>
                
                
				<!--<div class="post-date ml-0">
					<span class="day"><?=date('d', strtotime($postQuery->create_on))?></span>
					<span class="month"><?=date('M', strtotime($postQuery->create_on))?></span>
				</div>-->
									
				<div class="post-content ml-0">
					<h1 class="font-weight-bold mb-0 text-8"><?=$postQuery->heading;?></h1>
					<div class="post-meta">
						<span><i class="far fa-user"></i> By <a href="#"><?=ucwords($postQuery->createdBy->username);?></a> </span>
						<span><i class="far fa-eye"></i> <a href="#"><?php echo $postQuery->blog_view?></a> </span>
						<span><i class="far fa-comments"></i> <a href="#"><?php echo count($count_all);?> Comments</a></span>
						<span><i class="far fa-calendar"></i> <?=date('M d, Y', strtotime($postQuery->create_on))?></span>
					</div>
                    
                 <!--  <span style="margin:10px 0 10px 0;">
        <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="fluid"
     data-ad-layout-key="-h8-11+3w-8c+9p"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="9659114311"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
       </span>-->
					<?=$postQuery->content;?>	
                    
                    <!-- Google Adsense -->
                  <!--  <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="3270919498"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>-->
                <!-- Google Adsense -->  
                 
                    
                    <?php
$fullurlad = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
?>                    
<div class="a2a_kit a2a_kit_size_32 a2a_default_style" data-a2a-url="<?php echo $fullurlad;?>" data-a2a-title="<?=$postQuery->heading;?>" style="margin-top:10px; margin-bottom:10px;">
<a class="a2a_button_facebook"></a>
<a class="a2a_button_twitter"></a>
<a class="a2a_button_reddit"></a>
<a class="a2a_button_linkedin"></a>
<a class="a2a_button_whatsapp"></a>
<a class="a2a_button_telegram"></a>
<a class="a2a_button_google_gmail"></a>
</div>

                    
                    			
					<div id="comments" class="post-block mt-5 post-comments">
						<h4 class="mb-3">Comments (<?php echo count($count_all);?>)</h4>
					  <?php echo Yii::$app->session->getFlash('copmssg');?>
 <?php if(count($commentalls) != '') { ?>
					   <?php foreach($commentalls as $commentallss) { ?>
						<ul class="comments">
							<li>
								<div class="comment">
									<div class="img-thumbnail img-thumbnail-no-borders d-none d-sm-block">
										<img class="avatar" alt="<?=ucwords($commentallss->name);?>" src="<?=Yii::$app->urlManagerFrontend->baseUrl.'/images/blog/user-blog.jpg';?>">
									</div>
									<div class="comment-block">
										<div class="comment-arrow"></div>
										<span class="comment-by">
											<strong><?=ucwords($commentallss->name);?></strong>
											<span class="float-right">
												<span> <a href="#" class="repplly" id="<?=$commentallss->id?>"><i class="fas fa-reply"></i> Reply</a></span>
											</span>
										</span>
										<p><?=$commentallss->comment?></p>
										<span class="date float-right"><?=date('M d, Y', strtotime($commentallss->create_on))?></span>
									</div>
								</div>
								<ul class="comments reply">
								  <?php $model = new CricketComments();
								     echo $model->get_reply_comment($commentallss->blog_id,$commentallss->id);?>
								 </ul> 
							</li>
						</ul>
						<?php } } ?>
					</div>
                    
                  
                    
                    
							
					<div class="post-block mt-5 post-leave-comment">
						<h4 class="mb-3">Leave a comment</h4>

						 <?php $form = ActiveForm::begin(['id' => 'form-five-contact',
								//'enableAjaxValidation' => true,
								'options' => [
								'class' => 'contact-form p-4 rounded bg-color-grey'
								],
								'fieldConfig' => [
										'template' => "{label}{input}{error}",
									],
								]); ?>			
								<div class="p-2">
									<div class="form-row">
										<div class="form-group col-lg-6">
											<?= $form->field($modelcomment, 'name')->textInput(['class' => 'form-control','placeholder' => $modelcomment->getAttributeLabel('name')]) ?>
										</div>
										<div class="form-group col-lg-6">
											<?= $form->field($modelcomment, 'email')->textInput(['class' => 'form-control','placeholder' => $modelcomment->getAttributeLabel('email')]) ?>
										</div>
									</div>
									<div class="form-row">
										<div class="form-group col">
											<?= $form->field($modelcomment, 'comment')->textArea(['class' => 'form-control','placeholder' => 'Please enter your message.', 'style' => 'width:100%;']) ?>
										</div>
									</div>
									<div class="form-row">
										<div class="form-group col mb-0">
 <?= $form->field($modelcomment, 'parent_id')->hiddenInput(['id' => 'comment_id', 'value' => 0])->label(false) ?>
											<?= Html::submitButton(Yii::t('app', 'Post Comment'), ['class' => 'btn btn-primary btn-modern', 'id' => 'postcommt']) ?>
										</div>
									</div>
								</div>
						<?php ActiveForm::end(); ?>
					</div>

				</div>
			</article>
            <br>
            <!--<article>
            <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="autorelaxed"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="2887776118"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
            </article>-->

		</div>
        
        
		</div>
		<div class="col-lg-3 order-lg-2">
		<aside class="sidebar">
                        
            <div class="hpanel panel-group sidebar" id="accordion" role="tablist" aria-multiselectable="true">
              <aside class="aside bgcolortop">
                <h3 class="aside-title">Related</h3>
              </aside>
              <ul class="simple-post-list">
			  <?php $i=1; foreach($relatedBlog as $relatedBlogg) {?>
                <li>
                  <article>
                    <div class="post-image">
                      <div class="img-thumbnail img-thumbnail-no-borders d-block">
					    <?=Html::a('<img src="'.Yii::$app->urlManagerBackend->baseUrl.'/images/cricket/'.$relatedBlogg->image.'" alt="'.$relatedBlogg->heading.'" class="border-radius-0" width="50" height="50">', ['/cricket/view', 'slug' => $relatedBlogg->slug])?>
					  </div>
                    </div>
                    <div class="post-info">
                      <h2 class="font-weight-normal text-3 mb-0" style="line-height:22px"><?=Html::a($relatedBlogg->heading, ['/cricket/view', 'slug' => $relatedBlogg->slug])?></h2>
                      <p><?php echo $relatedBlogg->limitTextWords(strip_tags($relatedBlogg->content), 30, true, true);?></p>
                    </div>
                  </article>
                </li>
                
               
                  <?php if($i == 1) {?>
               <!-- <li>
                  <article>
                    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-format="fluid"
     data-ad-layout-key="-h8-11+3w-8c+9p"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="9659114311"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
                  </article>
                  </li>-->
                <?php } ?>
                
                <?php if($i == 3) {?>
                <!--<li>
                  <article>
                    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3311269295796373"
     crossorigin="anonymous"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-3311269295796373"
     data-ad-slot="3270919498"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>

                  </article>
                  </li>-->
                <?php } ?>
                
                
                
				<?php $i++; } ?>
                
               
              </ul>
            </div>
            
          </aside>
          
       
          <aside class="sidebar">
                        
            <div class="hpanel panel-group sidebar" id="accordion" role="tablist" aria-multiselectable="true">
              <aside class="aside bgcolortop">
                <h3 class="aside-title">Recent</h3>
              </aside>
              <ul class="simple-post-list">
			  <?php $i=1; foreach($recentBlog as $recentBlogg) {?>
                <li>
                  <article>
                    <div class="post-image">
                      <div class="img-thumbnail img-thumbnail-no-borders d-block">
					    <?=Html::a('<img src="'.Yii::$app->urlManagerBackend->baseUrl.'/images/cricket/'.$recentBlogg->image.'" alt="'.$recentBlogg->heading.'" class="border-radius-0" width="50" height="50">', ['/cricket/view', 'slug' => $recentBlogg->slug])?>
					  </div>
                    </div>
                    <div class="post-info">
                      <h2 class="font-weight-normal text-3 mb-0" style="line-height:22px;"><?=Html::a($recentBlogg->heading, ['/cricket/view', 'slug' => $recentBlogg->slug])?></h2>
                      <p><?php echo $recentBlogg->limitTextWords(strip_tags($recentBlogg->content), 20, true, true);?></p>
                    </div>
                  </article>
                </li>
                
                
                 
				<?php $i++; } ?>
              </ul>
            </div>
            
          </aside>
        </div> 
	</div>
</div>	

