<?php

 Yii::app()->setLanguage(isset(Yii::app()->session['lang']) ? Yii::app()->session['lang'] : 'ar'); 
 $lang=Yii::app()->getLanguage();
 
?>
<?php 
$issue_number=option::model()->findByAttributes(array('key'=>'ISSUE_NUMBER' )); 
$issue_date=option::model()->findByAttributes(array('key'=>'ISSUE_DATE' ));  
$issue_time=option::model()->findByAttributes(array('key'=>'ISSUE_TIME' ));
$issue_AmPmtime=option::model()->findByAttributes(array('key'=>'ISSUE_AM_PM_TIME' ));
?>

<section class="exchange-rate">
    <section class="exchange-rate-section1">
        <div class="container">
            <div class="row">
                <div class="flex-container">
                    <div class="col-sm-4 col-xs-6 col-xs-offset-0 first-col">
                        <h3 class="exchange-rate-text">نشرة أسعار صرف العملات الأجنبية</h3>
                        
                        <h3 class="exchange-rate-text">رقم الإصدار: <span class="report-num"><?php if($issue_number!=NULL){ echo $issue_number->value; } ?></span></h3>
                        
                        <h3 class="exchange-rate-text">تاريخ النشرة: <span class="report-date"><?php if($issue_date!=NULL){ echo $issue_date->value; } ?></span></h3>
                    </div>
                    <div class="col-sm-4 col-xs-6 col-xs-offset-0 second-col">
                        <h3 class="exchange-rate-text">Foreign Exchange Quotation</h3>
                        <h3 class="exchange-rate-text">Quotation List No <span class="report-num"><?php if($issue_number!=NULL){ echo $issue_number->value; } ?></span></h3>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-offset-2 col-sm-8 col-xs-12">
                    <h3 class="exchange-rate-head-line">
                    <?php echo($lang=='ar'?'نشرة أسعار الصرف الرائجة الصادرة عن بنك البركة سورية بتاريخ':'Exchange rate bulletin issued by Albaraka Bank of Syria on') ?>
                     <span class="exchange-rate-date"> <?php if($issue_date!=NULL){ echo $issue_date->value; }  ?> </span>
                     <?php echo($lang=='ar'?'السارية اعتباراً من الساعة':'which is effective from') ?>
                       <span class="exchange-rate-time"> <?php echo $issue_time->value;?>
                    <?php 
                    if($issue_AmPmtime!=NULL){
                            if($issue_AmPmtime->value=='am')
                            {
                                echo ($lang=='en'?$issue_AmPmtime->value:'ص'); 
                            }elseif($issue_AmPmtime->value=='pm')
                            {
                                echo ($lang=='en'?$issue_AmPmtime->value:'م' );
                            } 
                    }
                        ?>
                        </span> <?php  echo($lang=='ar'?'وحتى إشعار اَخر':'till further notice')  ?> </h3>
                </div>
            </div>

  <?php 
//   $intro=Htmlblock::model()->findByAttributes(array('slug'=>'currency'));
//   if($intro!=null)
//         echo ($lang=='en'?$intro->content_en:$intro->content);
  ?>
  
                <div class="row">
                <div class="col-sm-offset-2 col-sm-8 col-xs-12 ">
                 <div class="table-responsive currency">          
                        <table class="table table-striped">
                            <thead>
                        <tr>
                            <th><?php echo ($lang=='en'?'Currency Code':'رمز العملة')?></th>
                            <th><?php echo ($lang=='en'?'Currency':'العملة')?></th>
                            <th><?php echo ($lang=='en'?'Minimum':'الحد الأدنى')?></th>
                            <th><?php echo ($lang=='en'?'Maximum':'الحد الأعلى')?></th> 
                        </tr>
                        </thead>
                        <tbody> 
                            <?php 
                                $currencies=Currency::model()->findAll();
                                foreach($currencies as $currency){
                            ?> 
                        <tr>
                            <td> <?php echo $currency->symbol_code ?></td> 
                            <td><?php echo ($lang=='en'?$currency->en_title:$currency->title) ?></td>
                            <td><?php echo $currency->Buy_rate ?></td>
                            <td><?php echo $currency->Sell_rate ?></td> 
                        </tr>
                            <?php }?>
                        </tbody>
                    </table>
                    </div>
                </div></div>
               
        </div>
    </section>
</section>
