本文整理汇总了PHP中Unit::get_page_count方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::get_page_count方法的具体用法?PHP Unit::get_page_count怎么用?PHP Unit::get_page_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::get_page_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _total_steps_required
private static function _total_steps_required($unit_id)
{
$criteria = Unit::get_module_completion_data($unit_id);
if (empty($criteria)) {
return false;
}
$total_answers = count($criteria['mandatory_modules']);
$total_pages = Unit::get_page_count($unit_id);
return $total_answers + $total_pages;
}
示例2: get_unit_pages
function get_unit_pages($unit)
{
$pages_num = 1;
if (!cp_unit_uses_new_pagination($unit->ID)) {
// Legacy
$modules = $unit->modules;
foreach ($modules as $mod) {
$class_name = $mod->module_type;
if ('page_break_module' == $class_name) {
$pages_num++;
}
}
} else {
// New unit builder 1.2.3.5+
$pages_num = Unit::get_page_count($unit->ID);
}
return $pages_num;
}
示例3: update_course_meta_on_unit_creation
function update_course_meta_on_unit_creation($post_id, $course_id)
{
if (!$course_id) {
$post = get_post($post_id);
$course_id = $post->post_parent;
}
// Update course structure
$structure_option = get_post_meta($course_id, 'course_structure_options', true);
$structure_option = !empty($structure_option) && 'on' == $structure_option ? 'on' : 'off';
$show_unit_boxes = get_post_meta($course_id, 'show_unit_boxes', true);
$keys = array_keys($show_unit_boxes);
// We only want to do this once to prevent accidental override.
if (!in_array($post_id, $keys)) {
$show_unit_boxes[$post_id] = $structure_option;
}
update_post_meta($course_id, 'show_unit_boxes', $show_unit_boxes);
$show_page_boxes = get_post_meta($course_id, 'show_page_boxes', true);
$keys = array_keys($show_page_boxes);
$page_count = Unit::get_page_count($post_id);
for ($i = 1; $i <= $page_count; $i++) {
$key = $post_id . '_' . $i;
// Avoid accidental overrides.
if (!in_array($key, $keys)) {
$show_page_boxes[$key] = $structure_option;
}
}
update_post_meta($course_id, 'show_page_boxes', $show_page_boxes);
}