 <?php

    Yii::app()->setLanguage(isset(Yii::app()->session['lang']) ? Yii::app()->session['lang'] : 'ar');
    $lang = Yii::app()->getLanguage();

    ?>
 <section class="news">
     <section class="news-section1">
         <div class="container">
             <div class="row row1">
                 <div class="col-sm-offset-1 col-xs-offset-0 col-sm-10 col-xs-12">
                     <div class="page-follower">
                         <?php //echo $model->getBreadcrumb();
                            ?>
                         <span class="head-title">
                             <?php //echo ($lang=='en'?$model->en_title:$model->title)  
                                ?>
                             <!--بنك البركة يوقع اتفاقيات تعاون مع جمعية غراس-->
                         </span>
                     </div>
                 </div>
             </div>
             <div class="row row2">
                 <?php if ($model->image != null) { ?>
                     <div class="col-sm-offset-1 col-xs-offset-0 col-sm-10 col-xs-12">
                         <div id="myCarousel" data-interval="false" class="carousel slide" data-ride="carousel">
                             <!-- Wrapper for slides -->
                             <div class="carousel-inner ">
                                 <div class="item active">
                                     <center> <img src="<?php echo Yii::app()->request->baseUrl . "/uploads/Article/" . $model->image ?>" alt="<?php echo 'slider-img' . $model->id; ?>" class="width75"></center>
                                     <div class="carousel-caption">
                                     </div>
                                 </div>
                                 <?php foreach ($model->albumImages as $image) : ?>
                                     <?php
                                        $alt = 0;
                                        $base_dir = Yii::app()->params['uploadUrl'] . get_class($image) . '/';
                                        $thumb_dir = Yii::app()->params['uploadUrl'] . get_class($image) . '/thumb/';
                                        ?>
                                     <div class="item">
                                         <img src="<?php echo $base_dir . $image->image; ?>" alt="<?php echo "slider - img" . $alt ?>" class="full-width">
                                         <div class="carousel-caption">
                                         </div>
                                     </div>
                                 <?php $alt++;
                                    endforeach; ?>

                             </div>
                             <?php if (sizeOf($model->albumImages) > 0) { ?>
                                 <!-- Left and right controls -->
                                 <a class="left carousel-control" href="#myCarousel" data-slide="prev">
                                     <img class="icon-slider" src="<?php echo Yii::app()->request->baseUrl . "/images/carousel-prev1.png" ?>" alt="image">
                                     <span class="sr-only">Previous</span>
                                 </a>
                                 <a class="right carousel-control" href="#myCarousel" data-slide="next">
                                     <img class="icon-slider" src="<?php echo Yii::app()->request->baseUrl . "/images/carousel-next1.png" ?>" alt="image">
                                     <span class="sr-only">Next</span>
                                 </a>
                             <?php } ?>
                         </div>
                     </div>
                 <?php } ?>
             </div>
         </div>
     </section>
     <!-- end section1-news-->
     <!-------------------------------------------------------------------------->
     <!-- start section2-news-->
     <section class="news-section2">
         <div class="container">
             <div class="row row3">
                 <div class="col-sm-offset-1 col-xs-offset-0 col-xs-12 col-sm-8">
                     <div class="head-title">

                         <?php
                            echo ($lang == 'en' ? $model->en_title : $model->title);

                            //echo CHtml::link(CHtml::encode($model->title), array('/article/view', 'slug' => $model->slug)); 
                            ?>
                     </div>
                 </div>
                 <div class="col-xs-12 col-sm-2 text-left">
                     <div class="date-text">
                         <?php //echo Yii::app()->dateFormatter->formatDateTime($model->create_datetime, 'medium', null); 
                            $ar_mont[1] = "كانون الثاني";
                            $ar_mont[2] = "شباط";
                            $ar_mont[3] = "آذار";
                            $ar_mont[4] = "نيسان";
                            $ar_mont[5] = "أيار";
                            $ar_mont[6] = "حزيران";
                            $ar_mont[7] = "تموز";
                            $ar_mont[8] = "آب";
                            $ar_mont[9] = "أيلول";
                            $ar_mont[10] = "تشرين الأول";
                            $ar_mont[11] = "تشرين الثاني";
                            $ar_mont[12] = "كانون الأول ";
                            ?>
                         <span class="day"><?php //echo date('d',strtotime($model->create_datetime))
                                            ?></span>
                         <span class="month"><?php
                                                // if($lang=="en")
                                                // echo date('F',$model->create_datetime);
                                                // else
                                                //  echo $ar_mont[date('m',$model->create_datetime)*1];
                                                ?>
                         </span>
                         <!--\ -->
                         <span class="year"><?php //echo date('Y',$model->create_datetime)
                                            ?></span>
                     </div>
                 </div>
             </div>
             <div class="row row4">
                 <div class="col-sm-offset-1 col-xs-offset-0 col-xs-12 col-sm-10">
                     <div class="main-text">
                         <?php
                            $purify = new CHtmlPurifier();
                            if ($lang == "en")
                                echo $purify->purify($model->en_content);
                            else
                                echo $purify->purify($model->content);
                            //echo $model->content;
                            ?>
                     </div>
                 </div>
             </div>
             <?php
                if ($model->attachment_title != null) { ?>
                 <div class="row">
                     <div class="col-sm-offset-1 col-sm-10 col-xs-offset-0 col-xs-12">
                         <?php //echo ($lang=='ar'?'للمزيد من المعلومات ':'for more information') 
                            ?>
                         <a href="<?php echo Yii::app()->request->baseUrl . "/uploads/Article/files/" . $model->attachment_title; ?>" class="article-view"><?php echo ($lang == 'ar' ? 'اضغط هنا' : 'Click here'); ?>
                         </a>
                     </div>
                 </div>
             <?php } ?>

         </div>

     </section>
     <!--end section2-news-->
     <!-------------------------------------------------------------------------->
     <!-- start section3-news-->
     <section class="news-section3">
         <div class="container">
             <div class="row">
                 <div class="col-xs-offset-0 col-sm-offset-1 col-sm-10 col-xs-12">
                     <div class="social-media-share">
                         <div class="head-title">
                             <?php echo ($lang == 'en' ? 'Share article' : 'شارك المقال') ?>

                         </div>

                         <?php $currpage = strpos(Yii::app()->request->url, '?lang') ? (substr(Yii::app()->request->url, 0, strpos(Yii::app()->request->url, '?lang'))) : (Yii::app()->request->url);
                            $str = substr($currpage, 1);
                            $server_name = "";
                            $server_port = $_SERVER['SERVER_PORT'];
                            if ($server_port == 443) {
                                $server_name = "https://" . $_SERVER['SERVER_NAME'];
                            } else if ($server_port != 80) {
                                $server_name = "http://" . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
                            } else {
                                $server_name = "http://" . $_SERVER['SERVER_NAME'];
                            }
                            $str = $server_name . "/" . $str
                            ?>

                         <div class="social-media-links">

                             <span class="social-media-container">
                                 <!-- LinkedIn -->
                                 <a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $str; ?>">
                                     <img class="img-responsive" src="<?php echo Yii::app()->request->baseUrl; ?>/images/linked-icon.png" alt="linkedIn icon" target="_blank">
                                 </a>
                             </span>

                             <span class="social-media-container">
                                 <!-- Google+ -->
                                 <a href="https://plus.google.com/share?url=<?php echo $str; ?>" target="_blank">
                                     <!--<a href="#">-->
                                     <img class="img-responsive" src="<?php echo Yii::app()->request->baseUrl; ?>/images/google-icon.png" alt="google plus icon">
                                 </a>
                             </span>
                             <span class="social-media-container">
                                 <a href="http://twitter.com/share?url=<?php echo $str; ?>&text=<?php echo $model->title; ?>" target="_blank">
                                     <!--<a href="#">-->
                                     <img class="img-responsive" src="<?php echo Yii::app()->request->baseUrl; ?>/images/tweet-icon.png" alt="twitter icon">
                                 </a>
                             </span>
                             <span class="social-media-container">


                                 <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $str; ?>" target="_blank">
                                     <!--<div id="shareBtn">-->
                                     <img class="img-responsive" src="<?php echo Yii::app()->request->baseUrl; ?>/images/face-icon.png" alt="facebook icon">
                                 </a>
                             </span>
                         </div>
                     </div>
                 </div>
             </div>

         </div>

     </section>
     <!-- end section3-news-->


 </section>