 <?php

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

<section class="FAQ">
    <section class="FAQ-section1">
        <div class="container">
            <div class="row">
                <div class="col-sm-offset-1 col-sm-10 col-xs-offset-0 col-xs-12">
                 
                </div>
            </div>
            <div class="row">
                <div class="col-sm-offset-1 col-sm-10 col-xs-offset-0 col-xs-12">
                    <div class="panel-group" id="accordion">
                    <!--qestion block-->
                    <?php
                        $i=1;
                        $faqResults=Faq::model()->findAll(array('order'=>'sort ASC'));
                                        
                        foreach($faqResults as $faqResult)
                        {
                            ?>
                                <div class="panel panel-default">
                                <?php echo '
                                    <div class="panel-heading collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapse'.$i.'" >'?>
                                        <h4 class="panel-title">
                                            <a >
                                            <li class="caret-icon"></li>
                                            <span class="question-text">
                                        <?php echo ($lang=="ar"?$faqResult->question:$faqResult->en_question) ?>
                                            </span>
                                            </a>
                                        </h4>
                                    </div>
                                    <?php echo '
                                    <div id="collapse'.$i.'" class="panel-collapse collapse">'?>
                                        <div class="panel-body"> 
                                   <?php   echo($lang=='ar'?$faqResult->answer:$faqResult->en_answer) ?>
                                        </div>
                                    </div>
                                </div>
                   <?php     $i++;         
                     } 
                 ?>
                    </div>
                </div>
            </div>
        </div>
    </section>
</section>
<script  type="application/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/script.js"></script>
<script>
// $(document).ready(function(){ 
//     $('.FAQ-section1 .panel-default>.panel-heading').click(function(){
//       $( ".FAQ-section1 .panel-default").each(function() { 
//             $(this).removeClass('border-style');  
//         });   
//         if($(this).hasClass('collapsed') == true){
//              var ParentPanel =$(this).parent(); 
//           $(ParentPanel).toggleClass('border-style'); 
//         } 
//     }); 
// });
</script>