<?php
/*----------------------------------------------------------------------------------|  www.vdm.io  |----/
				Lmskaran 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.77
	@build			6th April, 2022
	@created		22nd July, 2020
	@package		Moojla
	@subpackage		default_sections.php
	@author			Lmskaran <http://Lmskaran.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____  _____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \(  _  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/ )(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__)  (_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

?>

<!--[JCBGUI.template.template.8.$$$$]-->
<div class="uk-container uk-container-center lmskaran_course_tab">
    <div>
      <div class="lmskaran_summary_course">
        <?php echo $this->course->summary; ?>
      </div>
      <ul uk-accordion="multiple: true">
        <?php if(is_array($this->course->sections)): ?>
          <?php foreach ($this->course->sections as $section_key => $section_value): ?>
            <?php if($section_value->section != 0 || !empty($section_value->modules)): ?>
              <li class="">
                <a class="uk-accordion-title" href="#"><?php echo $section_value->name; ?></a>
                <div class="uk-accordion-content lmskaran_accordion_content">
                  <p><?php echo $section_value->summary; ?></p>
                  <?php if(property_exists($section_value, 'availableflag')):?>
                    <?php if($section_value->availableflag == 0):?>
                      <?php echo ""; ?>
                    <?php elseif($section_value->availableflag == 1):?>
                      <?php echo property_exists($section_value, 'availabilityinfo')? $section_value->availabilityinfo : ''; ?>
                    <?php elseif($section_value->availableflag == 2):?>
                      <?php // echo JText::_('COM_MOOJLA_ENROLMENT_REQUIRED')?>
                    <?php elseif($section_value->availableflag == 3):?>
                      <?php // echo JText::_('COM_MOOJLA_ENROLMENT_REQUIRED') . '<br>';
                        echo property_exists($section_value, 'availabilityinfo')? $section_value->availabilityinfo : ''; ?>
                    <?php endif;?>
                  <?php endif;?>
                  <?php foreach ($section_value->modules as $module_key => $module_value): ?>
									
                    <?php 
                      $downloadurl = '#';
                      $hasfile = false;
                      if($module_value->availableflag == 0 && !empty($module_value->content))
                      {
												if(property_exists($module_value->content[0], 'mimetype'))
												{
                          $mimetype = substr($module_value->content[0]->mimetype, 0, 5);
                          $downloadurl = $module_value->content[0]->fileurl;
                          if($mimetype == 'video' && $this->course->videodownload == 1)
                          {
                            $downloadurl = '#';
                            // $module_value->availableflag = 1;
                            $module_value->availableclass = 'availablity-enroled-notvisible';
                          }
                          if($mimetype == 'audio' && $this->course->audiodownload == 1)
                          {
                            $downloadurl = '#';
                            // $module_value->availableflag = 1;
                            $module_value->availableclass = 'availablity-enroled-notvisible';
                          }
                          $hasfile = true;
												}
                      }
                    ?>
    
                    <!-- <div class="lmskaran-sections-in-accordion-counters"> -->
										<?php if($module_value->availableflag != 1 || property_exists($module_value, 'availabilityinfo')):?>
                    <div class="lmskaran-sections-in-accordion">
                      <!-- <div class="lmskaran-course-download"> -->
                      <div class="lmskaran-info_course_file_counters">
                        <?php if($module_value->availableflag == 1):?>
														<?php if(property_exists($module_value, 'availabilityinfo')):?>
															<div class="lmskaran_counters_section_course lock-course"></div>
														<?php endif;?>
                          <?php elseif($module_value->availableflag == 3):?>
                            <div class="lmskaran_counters_section_course lock-course"></div>
                        <?php endif;?>
                        <div class="lmskaran-info_course_file">
													
                            <?php if($module_value->availableflag == 0):?>
                              <div class="lmskaran-file-course t-1"><?php echo '<img src="'.$module_value->modicon.'" style="width: 32px;"> '; ?> 
                                <?php echo $module_value->name; ?>
                              </div>	
                            <?php elseif($module_value->availableflag == 1):?>
															<?php //dump($module_value, '$module_value');?>
															<?php if(property_exists($module_value, 'availabilityinfo')):?>
																<p class="lmskaran-info_course_file warning-registered-course">
																	<?php echo $module_value->availabilityinfo;?>
																	<div class="lmskaran-file-course t-2"><?php echo '<img src="'.$module_value->modicon.'" style="width: 32px;"> '; ?> 
																	<?php echo "دسترسی محدود شده است.برای راهنمایی بیشتر با پشتیبانی درس ارتباط بگیرید." ?>
																</p>	
                              </div>	
															<?php else:?>
															<?php endif;?>
                              
                            <?php elseif($module_value->availableflag == 2):?>
															<p class="lmskaran-info_course_file warning-registered-course">
																<?php echo JText::_('COM_MOOJLA_ENROLMENT_REQUIRED') ?>
															</p>
                              <div class="lmskaran-file-course t-3"><?php echo '<img src="'.$module_value->modicon.'" style="width: 32px;"> '; ?> 
                                <?php echo $module_value->name; ?>
                              </div>	
                            <?php elseif($module_value->availableflag == 3):?>
															<p class="lmskaran-info_course_file warning-registered-course">
																<?php echo JText::_('COM_MOOJLA_ENROLMENT_REQUIRED') . '<br>';
																//echo property_exists($module_value, 'availabilityinfo')? $module_value->availabilityinfo : ''; ?>
																<div class="lmskaran-file-course need-to-register"><?php echo '<img src="'.$module_value->modicon.'" style="width: 32px;"> '; ?> 
															</p>
                                <?php echo $module_value->name; ?>
                              </div>	
                            <?php endif;?>
                        </div>
                      </div>											
                      <?php if(isset($module_value->content[0]) && $module_value->content[0]->fileurl && $hasfile):?>
                        <div class="lmskaran-download-course <?php echo $module_value->availableclass; ?>" style="z-index:1;"><a href="<?php echo $downloadurl;?>"><i class="fas fa-download"></i></a>
                        </div>
                      <?php endif;?>
                    <!-- </div> -->
                    </div>
										<?php endif;?>
                    <!-- </div> -->
      
                  <?php endforeach; ?>
                </div>
              </li>
            <?php endif; ?>
          <?php endforeach; ?>
        <?php endif; ?>
      </ul>
    </div>
</div><!--[/JCBGUI$$$$]-->

