
<?php
	$document = JFactory::getDocument();
	$document->addStyleSheet('/modules/mod_moojlacourseslider/assets/css/course_flex.css');
	$document->addScript('/modules/mod_moojlacourseslider/assets/js/course_flex.js');

	$backgroundcolor=$params->get('lmskaran_backgroundcolor_flex');

	JFactory::getDocument()->addScriptOptions('width_static', $params->get('width_static', 360));

	// background footer course flex
    $background_footer_course_flex = [
        'background-color :' . $params->get('lmskaran_color')   
    ];
    $background_footer_course_flex = implode(';', $background_footer_course_flex);

    // price color
    $cost_color = [
        'color :' . $params->get('price_color')   
    ];
    $cost_color = implode(';', $cost_color);


    $teahcer_color = [
        'color :' . $params->get('text_color')   
    ];
    $teahcer_color = implode(';', $teahcer_color);

?>

	<div class="lmskaran_row_lmskaran_flex_card">
        <?php foreach($courses as $course): ?>
                <div class="lmskaran_flex_card">
                    <div class="lmskaran_flex_card__side lmskaran_flex_card__side--front">
                        <div class="lmskaran_flex_card__title lmskaran_flex_card__title">
							<?php if(!$course->summary_files):?>
								<img class="card_img_front" src="https://www.w3schools.com/w3css/img_lights.jpg" class="lmskaran_flex_card_img_front">
							<?php else:?>
								<a href="<?php echo JRoute::_('index.php?option=com_moojla&view=coursedetail&id='.$course->remoteid); ?>">
									<img class="card_img_front" src="<?php echo $course->summary_files; ?>" class="lmskaran_flex_card_img_front">
								</a>
							<?php endif;?>
                        </div>

                        <div class="lmskaran_flex_card__details">

							<div class="lmskaran_flex_card__price-box">
								<h4 class="lmskaran_flex_card__heading"><?php echo $course->shortname; ?></h4>
								<div class="lmskaran_flex_card__cta">
									<a href="<?php echo JRoute::_('index.php?option=com_moojla&view=coursedetail&id='.$course->remoteid); ?>" class="btn--white">رفتن به دوره</a>
								</div>
							</div>
						</div>
						<div style="<?php echo $background_footer_course_flex; ?>" class="lmskaran_lay-course-flex-footer-card">
							<div style="<?php echo $teahcer_color; ?>"  class="teachers_lay_course-flex">
								<?php if(count($course->teachers) == 0) : ?>
								<span>این درس استاد ندارد !</span>
								<?php else:?>
								<span><?php echo $course->teachers[0]->name; ?></span>
								<?php endif; ?>
							</div>
							
							<div style="<?php echo $cost_color; ?>" class="cost-course_lay_course_flex">
								<p class="lmskaran_flex_card__price-value"><?php if($course->cost > 0 ) { echo $course->cost; } else {echo "رایگان";} ?></p>
							</div>
						</div>
                    </div>
                </div>
        <?php endforeach; ?>
	</div>
