<?php
$ModuleItems = new UlpModuleItems($courseId);
$course = new UlpCourse($courseId);
?>
<div class="ulp-display-none" <?php if ($isTab) echo 'id="ulp_single_course_curriculum_page" '; ?> >
<div class="ulp-singl-course-content-curriculum">
<!-- LIST OF MODULES -->
<?php if ($ModuleItems->has_modules()):?>
<div class="ulp-public-the-modules-wrapper">
  <div class="ulp-h3-title"><?php _e('Section Agenda and Actions', 'ulp');?></div>
<?php while ($ModuleItems->have_modules()):?>
<div class="ulp-public-the-module">
     <?php if ($ModuleItems->has_children()):?>
 <div class="ulp-public-the-module-title">
         <h3><?php echo $ModuleItems->Name();?></h3>
         <span class="ulp-module-details"> <span><?php echo $ModuleItems->countLessons();?></span><?php _e(' Lessons', 'ulp');?> / <span><?php echo $ModuleItems->countQuizes();?></span><?php _e(' Quizzes', 'ulp');?></span>
         </div>
 <div class="ulp-public-the-module-content">
     <?php while ($ModuleItems->have_children()):?>
       <div  class="ulp-public-the-module-content-element">
         <?php if ($ModuleItems->ChildType()=='ulp_lesson'):?>
           <!-- LESSON -->
           <!-- Title + Permalink -->
           <?php $lesson = new UlpLesson($ModuleItems->ChildId(), true, $courseId);?>
           <?php if ($course->IsEntrolled()):?>
               <!-- ENROLLED STUDENTS -->
               <?php if (!$course->can_access_any_item() && !$lesson->is_completed() && $ModuleItems->ChildId()!=$ModuleItems->FirstChildId()):?>
                   <span title="<?php echo __(' (Not available yet)', 'ulp');?>">
                     <?php if ( $lesson->isVideo() ):?>
                        <i class="fa-ulp fa-video-ulp"></i>
                     <?php else :?>
                     <i class="fa-ulp fa-curr_lesson"></i>
                     <?php endif;?>
                     <?php echo $lesson->Title();?></span>
               <?php else:?>
                   <a href="<?php echo $lesson->Permalink();?>" <?php  echo($lesson->is_completed() ? 'class="ulp-lesson-link-completed"' : '')?>>
                     <?php if ( $lesson->isVideo() ):?>
                        <i class="fa-ulp fa-video-ulp"></i>
                     <?php else :?>
                     <i class="fa-ulp fa-curr_lesson"></i>
                     <?php endif;?>
                     <?php echo $lesson->Title();?></a>
               <?php endif;?>
               <!-- /Title + Permalink -->
               <?php if ($lesson->is_completed()):?>
                                     <span class="ulp-lesson-status-completed">
                   <i class="fa-ulp fa-curr_lesson_completed"></i>
                                     </span>
               <?php endif;?>
           <?php else:?>
               <!-- NON ENROLLED USERS -->
               <?php if ($lesson->hasPreview()):?>
                   <a href="<?php echo $lesson->Permalink();?>">
                     <?php if ( $lesson->isVideo() ):?>
                        <i class="fa-ulp fa-video-ulp"></i>
                     <?php else :?>
                     <i class="fa-ulp fa-curr_lesson"></i>
                     <?php endif;?>
                     <?php echo $lesson->Title();?></a><span class="ulp-lesson-preview"><?php echo __(' Preview', 'ulp');?></span>
               <?php else:?>
                   <span title="<?php echo __(' (Not available yet)', 'ulp');?>">
                     <?php if ( $lesson->isVideo() ):?>
                        <i class="fa-ulp fa-video-ulp"></i>
                     <?php else :?>
                     <i class="fa-ulp fa-curr_lesson"></i>
                     <?php endif;?>
                     <?php echo $lesson->Title(); ?></span>
               <?php endif;?>
           <?php endif;?>
         <span class="ulp-public-the-module-content-element-rightside">
                          <?php if($lesson->RewardPoints()): ?>
                           <span class="ulp-module-content-points"><?php echo $lesson->RewardPoints(). ' '.__('points','ulp');?></span>
                         <?php endif; ?>
                         <?php if($lesson->Duration()): ?>
                           <span class="ulp-module-content-time"><?php echo $lesson->Duration().$lesson->DurationType();?></span>
                         <?php endif; ?>
                         </span>
         <div class="ulp-clear"></div>
                           <!-- / LESSON -->
         <?php else:?>
           <!--QUIZ-->
           <?php $quiz = new UlpQuiz($ModuleItems->ChildId(), true, $courseId);?>
           <?php if ($course->IsEntrolled()):?>
               <!-- Title + Permalink -->
               <?php if (!$course->can_access_any_item() && !$quiz->has_grade() && $ModuleItems->ChildId()!=$ModuleItems->FirstChildId()):?>
                   <span title="<?php echo __(' (Not available yet)', 'ulp');?>"><i class="fa-ulp fa-curr_quiz"></i><?php echo $quiz->Title();?></span>
               <?php else:?>
                   <a href="<?php echo $quiz->Permalink();?>" <?php echo ($quiz->has_grade() ? 'class="ulp-quiz-link-completed"' : '');?>><i class="fa-ulp fa-curr_quiz"></i><?php echo $quiz->Title();?></a>
               <?php endif;?>
               <!-- /Title + Permalink -->
           <?php else:?>
               <span title="<?php echo __(' (Not available yet)', 'ulp');?>"><i class="fa-ulp fa-curr_quiz"></i><?php echo $quiz->Title();?></span>
           <?php endif;?>
             <?php if ($quiz->has_grade()!==FALSE):?>
                 <?php if ($quiz->is_passed()):?>
                   <span class="ulp-quiz-status-passed"><?php _e("Passed ", 'ulp'); echo '(' . $quiz->Grade() . ')';?></span>
                 <?php else:?>
                   <span class="ulp-quiz-status-failed"><?php _e("Failed ", 'ulp'); echo '(' . $quiz->Grade() . ')';?></span>
                 <?php endif;?>
             <?php endif;?>
                                 <span class="ulp-public-the-module-content-element-rightside">
                <?php if($quiz->RewardPoints()): ?>
                                       <span class="ulp-module-content-points"><?php echo $quiz->RewardPoints(). ' '.__('points','ulp');?></span>
                                   <?php endif; ?>
                                   <?php if($quiz->Duration()): ?>
                                       <span class="ulp-module-content-time"><?php echo $quiz->Duration().'m';?></span>
                                   <?php endif; ?>
                                   </span>
                                   <div class="ulp-clear"></div>
             <!--/QUIZ-->
         <?php endif;?>
       </div>
     <?php endwhile;?>
 </div>
 <?php endif;?>
</div>
<?php endwhile;?>
<?php if ($ModuleItems->hasPagination()):?>
<?php echo $ModuleItems->Pagination();?>
<?php endif;?>
</div>
<?php endif;?>
<!-- LIST OF MODULES -->
</div>
</div>
