本文整理匯總了PHP中Unit::change_status方法的典型用法代碼示例。如果您正苦於以下問題:PHP Unit::change_status方法的具體用法?PHP Unit::change_status怎麽用?PHP Unit::change_status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Unit
的用法示例。
在下文中一共展示了Unit::change_status方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: die
//an error occured
}
/* }else{
die( __( 'You don\'t have right permissions for the requested action', 'cp' ) );
} */
}
}
if (isset($_GET['preview_redirect_url']) && $_GET['preview_redirect_url'] !== '') {
wp_redirect(trailingslashit(get_permalink($unit_id)) . 'page/' . (isset($unit_page_num) ? $unit_page_num : 1));
exit;
}
if (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['new_status']) && isset($_GET['unit_id']) && is_numeric($_GET['unit_id'])) {
$unit = new Unit($_GET['unit_id']);
$unit_object = $unit->get_unit();
if (CoursePress_Capabilities::can_change_course_unit_status($course_id, $unit_id)) {
$unit->change_status($_GET['new_status']);
}
}
// cp_write_log(' preview redir: ' . $_POST['preview_redirect'] );
$preview_redirect = isset($_REQUEST['preview_redirect']) ? $_REQUEST['preview_redirect'] : 'no';
?>
<div class='wrap mp-wrap nocoursesub unit-details cp-wrap' id='cp-unit-details-holder'>
<div id="undefined-sticky-wrapper" class="sticky-wrapper">
<div class="sticky-slider visible-small visible-extra-small"><i class="fa fa-chevron-circle-right"></i></div>
<ul id="sortable-units" class="mp-tabs" style="">
<?php
// $units = $course->get_units();
// $course_id = isset( $course ) && isset( $course->details ) && ! empty( $course->details->ID ) ? $course->details->ID : 0;
$units = Unit::get_units_from_course($course_id, 'any', false);
$units = !empty($units) ? $units : array();
示例2: Unit
function update_unit()
{
global $user_id;
if (isset($_POST['action']) && $_POST['action'] == 'update_unit') {
if (wp_verify_nonce($_REQUEST['_wpnonce'], 'unit_details_overview_' . $user_id)) {
$unit = new Unit($_POST['unit_id']);
if (current_user_can('manage_options') || current_user_can('coursepress_create_course_unit_cap') || current_user_can('coursepress_update_course_unit_cap') || current_user_can('coursepress_update_my_course_unit_cap') || current_user_can('coursepress_update_all_courses_unit_cap')) {
$new_post_id = $unit->update_unit(isset($_POST['unit_id']) ? $_POST['unit_id'] : 0);
}
if (isset($_POST['unit_state'])) {
if (current_user_can('manage_options') || current_user_can('coursepress_change_course_unit_status_cap') || current_user_can('coursepress_change_my_course_unit_status_cap') || current_user_can('coursepress_change_all_courses_unit_status_cap')) {
$unit = new Unit($new_post_id);
$unit->change_status($_POST['unit_state']);
}
}
}
echo 'RESPONSE!';
}
}