コード例 #1
0
																						<label><?php 
            _e('There are currently no units to display', 'cp');
            ?>
</label>
																					</li>
																				</ol>
																			<?php 
        } else {
            ?>
																				<ol>
																					<?php 
            // Cheking for inhertited "show" status and forces a save.
            $section_dirty = false;
            foreach ($units as $unit) {
                $unit_class = new Unit($unit->ID);
                $unit_pages = $unit_class->get_number_of_unit_pages();
                $unit_pagination = cp_unit_uses_new_pagination($unit->ID);
                if ($unit_pagination) {
                    $unit_pages = coursepress_unit_pages($unit->ID, $unit_pagination);
                } else {
                    $unit_pages = coursepress_unit_pages($unit->ID);
                }
                $modules = Unit_Module::get_modules($unit->ID);
                ?>

																						<li class="<?php 
                echo $unit->post_status == 'publish' ? 'enabled_unit' : 'disabled_unit';
                ?>
">

																							<label for="unit_<?php 
コード例 #2
0
        /**
         * Renders the course structure.
         *
         * Used in shortcodes on the front end to render the course hierarchy.
         *
         * @param string $try_title
         * @param bool $show_try
         * @param bool $hide_title
         * @param bool $echo
         */
        function course_structure_front($try_title = '', $show_try = true, $hide_title = false, $echo = true)
        {
            $show_unit = $this->details->show_unit_boxes;
            $preview_unit = $this->details->preview_unit_boxes;
            $show_page = $this->details->show_page_boxes;
            $preview_page = $this->details->preview_page_boxes;
            $units = $this->get_units();
            $content = '';
            if (!$echo) {
                ob_start();
            }
            echo $hide_title ? '' : '<label>' . $this->details->post_title . '</label>';
            ?>

			<ul class="tree">
				<li>
					<ul>
						<?php 
            foreach ($units as $unit) {
                $unit_class = new Unit($unit->ID);
                $unit_pages = $unit_class->get_number_of_unit_pages();
                //					$modules = Unit_Module::get_modules( $unit->ID );
                if (isset($show_unit[$unit->ID]) && $show_unit[$unit->ID] == 'on' && $unit->post_status == 'publish') {
                    ?>

								<li>

									<label for="unit_<?php 
                    echo $unit->ID;
                    ?>
" class="course_structure_unit_label">
										<div class="tree-unit-left"><?php 
                    echo $unit->post_title;
                    ?>
</div>
										<div class="tree-unit-right">

											<?php 
                    if ($this->details->course_structure_time_display == 'on') {
                        ?>
												<span><?php 
                        echo $unit_class->get_unit_time_estimation($unit->ID);
                        ?>
</span>
											<?php 
                    }
                    ?>

											<?php 
                    if (isset($preview_unit[$unit->ID]) && $preview_unit[$unit->ID] == 'on') {
                        ?>
												<a href="<?php 
                        echo Unit::get_permalink($unit->ID);
                        ?>
?try" class="preview_option"><?php 
                        if ($try_title == '') {
                            _e('Try Now', 'cp');
                        } else {
                            echo $try_title;
                        }
                        ?>
</a>
											<?php 
                    }
                    ?>
										</div>
									</label>

									<ul>
										<?php 
                    for ($i = 1; $i <= $unit_pages; $i++) {
                        if (isset($show_page[$unit->ID . '_' . $i]) && $show_page[$unit->ID . '_' . $i] == 'on') {
                            ?>

												<li class="course_structure_page_li">
													<?php 
                            $pages_num = 1;
                            $page_title = $unit_class->get_unit_page_name($i);
                            ?>

													<label for="page_<?php 
                            echo $unit->ID . '_' . $i;
                            ?>
">
														<div class="tree-page-left">
															<?php 
                            echo isset($page_title) && $page_title !== '' ? $page_title : __('Untitled Page', 'cp');
                            ?>
														</div>
														<div class="tree-page-right">
															<?php 
                            if ($this->details->course_structure_time_display == 'on') {
                                ?>
																<span><?php 
                                echo $unit_class->get_unit_page_time_estimation($unit->ID, $i);
                                ?>
</span>
															<?php 
                            }
                            ?>
															<?php 
                            if (isset($preview_page[$unit->ID . '_' . $i]) && $preview_page[$unit->ID . '_' . $i] == 'on') {
                                ?>
																<a href="<?php 
                                echo Unit::get_permalink($unit->ID);
                                ?>
page/<?php 
                                echo $i;
                                ?>
?try" class="preview_option"><?php 
                                if ($try_title == '') {
                                    _e('Try Now', 'cp');
                                } else {
                                    echo $try_title;
                                }
                                ?>
</a>
															<?php 
                            }
                            ?>

														</div>
													</label>

													<?php 
                            ?>
												</li>
												<?php 
                        }
                    }
                    //page visible
                    ?>

									</ul>
								</li>
								<?php 
                }
                //unit visible
                if (!$echo) {
                    trim(ob_get_clean());
                }
            }
            ?>

					</ul>
					<?php 
        }