本文整理汇总了PHP中Unit::get_unit方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::get_unit方法的具体用法?PHP Unit::get_unit怎么用?PHP Unit::get_unit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::get_unit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Unit
function get_unit_name()
{
if (!isset($this->details->unit_id) || $this->details->unit_id == '') {
return __('General', 'cp');
} else {
$unit_obj = new Unit($this->details->unit_id);
$unit = $unit_obj->get_unit();
return $unit->post_title;
}
}
示例2: get_unit_availability_status
public static function get_unit_availability_status($unit_id)
{
$unit_details = false;
$unit = new Unit((int) $unit_id);
$unit_details = $unit->get_unit();
$unit_available_date = get_post_meta($unit_id, 'unit_availability', true);
/* Not filtering date format as it could cause conflicts. Only filter date on display. */
$current_date = date('Y-m-d', current_time('timestamp', 0));
/* Check if previous has conditions */
$previous_unit_id = self::get_previous_unit_from_the_same_course($unit->course_id, $unit_id);
$force_current_unit_completion = !empty($previous_unit_id) ? get_post_meta($previous_unit_id, 'force_current_unit_completion', true) : '';
$force_current_unit_successful_completion = !empty($previous_unit_id) ? get_post_meta($previous_unit_id, 'force_current_unit_successful_completion', true) : '';
$available = true;
$student_id = get_current_user_id();
$mandatory_done = Student_Completion::is_mandatory_complete($student_id, $unit->course_id, $previous_unit_id);
$unit_completed = Student_Completion::is_unit_complete($student_id, $unit->course_id, $previous_unit_id);
$unit->status['mandatory_required']['enabled'] = !empty($force_current_unit_completion) && 'on' == $force_current_unit_completion;
$unit->status['mandatory_required']['result'] = $mandatory_done;
$unit->status['completion_required']['enabled'] = !empty($force_current_unit_successful_completion) && 'on' == $force_current_unit_successful_completion;
$unit->status['completion_required']['result'] = $unit_completed;
$available = $unit->status['mandatory_required']['enabled'] ? $unit->status['mandatory_required']['result'] : $available;
$available = $unit->status['completion_required']['enabled'] ? $unit->status['completion_required']['result'] : $available;
$unit->status['date_restriction']['result'] = $current_date >= $unit_available_date;
if (!$unit->status['date_restriction']['result'] || !$available) {
$available = false;
} else {
$available = true;
}
/**
* Perform action if unit is available.
*
* @since 1.2.2
* */
do_action('coursepress_unit_availble', $available, $unit_id);
/**
* Return filtered value.
*
* Can be used by other plugins to filter unit availability.
*
* @since 1.2.2
* */
$available = apply_filters('coursepress_filter_unit_availability', $available, $unit_id);
$status = $unit->status;
$status['available'] = $available;
return $status;
}
示例3: isset
global $coursepress, $wpdb;
$page = $_GET['page'];
$s = isset($_GET['s']) ? $_GET['s'] : '';
/* * **************************GENERATING REPORT******************************** */
if (isset($_POST['units']) && isset($_POST['users'])) {
$course_id = (int) $_POST['course_id'];
$course = new Course($course_id);
$course_units = $course->get_units();
$course_details = $course->get_course();
$units_filter = $_POST['units'];
$assessable_answers = 0;
if (is_numeric($units_filter)) {
$course_units = array();
$unit = new Unit($units_filter);
$course_units[0] = $unit->get_unit();
}
$report_title = $course_details->post_title;
if (isset($_POST['classes'])) {
$report_classes = $_POST['classes'];
if ($report_classes == '') {
$report_classes = __('Default Class', 'cp');
} else {
$report_classes .= __(' Class', 'cp');
}
} else {
$report_classes = __('All Classes', 'cp');
}
$report_title = $report_title .= ' | ' . $report_classes;
ob_end_clean();
ob_start();
示例4: isset
?>
" />
<input type="hidden" name="unit_page_num" id="unit_page_num" value="1" />
<input type="hidden" name="unit_pagination" class="unit_pagination" value="<?php
echo $unit_pagination;
?>
" />
<input type="hidden" name="action" value="update_unit" />
<input type="hidden" name="active_element" id="active_element" value="<?php
echo isset($_GET['active_element']) ? (int) $_GET['active_element'] : 1;
?>
" />
<?php
$unit = new Unit($unit_id);
$unit_object = $unit->get_unit();
$unit_id = isset($unit_object->ID) && $unit_object->ID !== '' ? $unit_object->ID : '';
$can_publish = CoursePress_Capabilities::can_change_course_unit_status($course_id, $unit_id);
$data_nonce = wp_create_nonce('toggle-' . $unit_id);
?>
<div class='section static'>
<div class='unit-detail-settings'>
<h3><i class="fa fa-cog"></i> <?php
_e('Unit Settings', 'cp');
?>
<div class="unit-state">
<?php
$control_position = 'off';
if ($unit_id > 0 && $unit_object && 'publish' == $unit_object->post_status) {
$control_position = 'on';
示例5: refresh_module_completion
public static function refresh_module_completion($unit_id, $module_id, $module_type, $meta)
{
$unit_object = new Unit($unit_id);
$unit = $unit_object->get_unit();
$course_id = $unit->post_parent;
$students = Course::get_course_students_ids($course_id);
foreach ($students as $idx => $student_id) {
// Did the student answer it?
$response = call_user_func($module_type . '::get_response', $student_id, $module_id, 'inherit', -1, true);
// Yes
if (!empty($response)) {
if ('yes' == $meta['mandatory_answer']) {
self::record_mandatory_answer($student_id, $course_id, $unit_id, $module_id);
//cp_write_log( 'Record mandatory answer: Module: ' . $module_id );
}
if ('yes' == $meta['gradable_answer']) {
foreach ($response as $answer) {
$result = Unit_Module::get_response_grade($answer);
if (0 < $result['grade']) {
self::record_gradable_result($student_id, $course_id, $unit_id, $module_id, $result['grade']);
}
//cp_write_log( 'Record gradable result: Module: ' . $module_id . ' Result: ' . $result['grade'] );
}
}
}
// End responses
}
}