本文整理汇总了PHP中Unit::get_number_of_unit_pages方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::get_number_of_unit_pages方法的具体用法?PHP Unit::get_number_of_unit_pages怎么用?PHP Unit::get_number_of_unit_pages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::get_number_of_unit_pages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<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: foreach
/**
* 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">
//.........这里部分代码省略.........