本文整理汇总了PHP中get_current_user_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_user_ID函数的具体用法?PHP get_current_user_ID怎么用?PHP get_current_user_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_user_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hide
/**
* When the user decides to not have this show again save user meta to make it so.
*
* @param array $data Sanitized data to use for saving.
*
* @returns bool Always returns true
*/
public function hide($data)
{
$user_id = get_current_user_ID();
update_user_meta($user_id, 'lasso_hide_tour', true);
do_action('lasso_tour_hidden', $user_id);
return true;
}
示例2: hide
/**
* Stores user's preference to hide the submit message via AJAX
*/
function hide()
{
check_ajax_referer($this->parent->slug_ . '_hide_submit', '_ajax_nonce-' . $this->parent->slug . '-hide-submit');
//note: option will be global
update_user_option(get_current_user_ID(), 'infinite-scroll-hide-submit', true, true);
die(1);
}
示例3: create
/**
* Creates a gallery
*
* @since 0.9.2
*
* @param array $data Sanitized data to use for saving.
*
* @return array|bool On success an array containing "message" or on failure false.
*/
public function create($data)
{
//@todo adapt auth callbacks to work with args.
if (!lasso_user_can('publish_posts')) {
return false;
}
$gallery_ids = isset($data['gallery_ids']) ? $data['gallery_ids'] : false;
// bail if no gallery ids
if (empty($gallery_ids)) {
return false;
}
$postid = isset($data['postid']) ? (int) $data['postid'] : false;
$type = isset($data['gallery_type']) ? $data['gallery_type'] : false;
// insert a new gallery
$args = array('post_title' => $postid . '-' . rand(), 'post_status' => 'publish', 'post_type' => 'ai_galleries');
$postid = wp_insert_post(apply_filters('lasso_insert_gallery_args', $args));
// update gallery ids
if ($gallery_ids) {
update_post_meta($postid, '_ase_gallery_images', $gallery_ids);
}
// update the gallery type
if (!empty($type)) {
update_post_meta($postid, 'aesop_gallery_type', $type);
}
do_action('lasso_gallery_published', $postid, $gallery_ids, get_current_user_ID());
return array('message' => 'gallery-created');
}
示例4: delete
/**
* Delete the post thumbnail when deleted from front end
*
* @since 0.1
*
* @param array $data Sanitized data to use for saving.
*
* @return bool Always returns true.
*/
public function delete($data)
{
$postid = isset($data['postid']) ? $data['postid'] : false;
delete_post_thumbnail($postid);
do_action('lasso_featured_image_deleted', $postid, get_current_user_ID());
return true;
}
示例5: post
/**
* Process title update
*
* @since 0.9.2
*
* @param array $data Sanitized data to use for saving.
*
* @return bool Always returns true.
*/
public function post($data)
{
$postid = isset($data['postid']) ? $data['postid'] : false;
$title = isset($data['title']) ? $data['title'] : false;
$args = array('ID' => (int) $postid, 'post_title' => wp_strip_all_tags($title));
wp_update_post(apply_filters('lasso_title_updated_args', $args));
do_action('lasso_title_updated', $postid, $title, get_current_user_ID());
return true;
}
示例6: post
/**
* Process the post object
*
* @params array $data Sanitized data to use for saving.
*
* @since 1.0
*/
public function post($data)
{
$title = $data['story_title'];
$object = is_null($data['object']) ? false : $data['object'];
// insert a new post
$args = array('post_title' => $title, 'post_status' => 'draft', 'post_type' => $object, 'post_content' => apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')));
$postid = wp_insert_post(apply_filters('lasso_insert_object_args', $args));
do_action('lasso_new_object', $postid, $object, $title, get_current_user_ID());
return array('postlink' => get_permalink($postid));
}
示例7: post
/**
* Process the post delete
*
* @since 1.0
*/
public function post($data)
{
$postid = isset($data['postid']) ? $data['postid'] : false;
// bail out if teh current user can't publish posts
if (!lasso_user_can('delete_post', $postid)) {
return;
}
$args = array('ID' => (int) $postid, 'post_status' => 'trash');
wp_update_post(apply_filters('lasso_object_deleted_args', $args));
do_action('lasso_object_deleted', $postid, get_current_user_ID());
return true;
}
示例8: publish_content
/**
* Process the post save
*
* @since 0.9.2
*
* @param array $data Sanitized data to use for saving.
*
* @return bool Always returns true.
*/
public function publish_content($data)
{
$save_to_post_disabled = $this->save_to_post_disables();
$postid = (int) $data['post_id'];
$content = $data['content'];
if ('off' == $save_to_post_disabled || empty($save_to_post_disabled)) {
$args = array('ID' => $postid, 'post_content' => $content, 'post_status' => 'publish');
wp_update_post(apply_filters('lasso_object_publish_args', $args));
}
do_action('lasso_post_published', $postid, $content, get_current_user_ID());
return true;
}
示例9: post
/**
* Process the post update
*
* @since 0.9.2
*
* @param array $data Sanitized data to use for saving.
*
* @return bool Always returns true.
*/
public function post($data)
{
$status = isset($data['status']) ? $data['status'] : false;
$postid = isset($data['postid']) ? $data['postid'] : false;
$slug = isset($data['story_slug']) ? $data['story_slug'] : false;
$args = array('ID' => (int) $postid, 'post_name' => $slug, 'post_status' => $status);
wp_update_post(apply_filters('lasso_object_status_update_args', $args));
// update categories
$cats = isset($data['story_cats']) ? $data['story_cats'] : false;
self::set_post_terms($postid, $cats, 'category');
// update tags
$tags = isset($data['story_tags']) ? $data['story_tags'] : false;
self::set_post_terms($postid, $tags, 'post_tag');
do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID());
return true;
}
示例10: process_vote_down
/**
*
* Process the form submission
*
*/
function process_vote_down()
{
check_ajax_referer('idea_factory', 'nonce');
if (isset($_POST['post_id'])) {
$postid = $_POST['post_id'];
// get vote statuses
$has_public_voted = idea_factory_has_public_voted($postid);
$has_private_voted = idea_factory_has_private_voted($postid);
// get votes
$votes = get_post_meta($postid, '_idea_votes', true);
$total_votes = get_post_meta($postid, '_idea_total_votes', true);
// public voting enabled
$public_can_vote = idea_factory_get_option('if_public_voting', 'if_settings_main');
if (is_user_logged_in()) {
$userid = get_current_user_ID();
} elseif (!is_user_logged_in() && $public_can_vote) {
$userid = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 0;
}
// if the public can vote and the user has already voted or they are logged in and have already voted then bail out
if ($public_can_vote && $has_public_voted || $has_private_voted) {
echo 'already-voted';
die;
}
// increase votes
update_post_meta($postid, '_idea_votes', intval($votes) - 1);
update_post_meta($postid, '_idea_total_votes', intval($total_votes) + 1);
// update user meta so they can't vote on this again
if (!is_user_logged_in() && $public_can_vote) {
$args = array('postid' => $postid);
idea_factory_add_public_vote($args);
} elseif (is_user_logged_in()) {
// update user meta so they can't vote on this again
update_user_meta($userid, '_idea' . $postid . '_has_voted', true);
}
do_action('idea_factory_vote_down', $postid, $userid);
echo 'success';
}
die;
}
示例11: process_entry
/**
*
* Process the form submission
*
*/
function process_entry()
{
$public_can_vote = idea_factory_get_option('if_public_voting', 'if_settings_main');
$title = isset($_POST['idea-title']) ? $_POST['idea-title'] : null;
$desc = isset($_POST['idea-description']) ? $_POST['idea-description'] : null;
$must_approve = 'on' == idea_factory_get_option('if_approve_ideas', 'if_settings_main') ? 'pending' : 'publish';
if (isset($_POST['action']) && $_POST['action'] == 'process_entry') {
// only run for logged in users or if public is allowed
if (!is_user_logged_in() && 'on' !== $public_can_vote) {
return;
}
// ok security passes so let's process some data
if (wp_verify_nonce($_POST['nonce'], 'if-entry-nonce')) {
// bail if we dont have rquired fields
if (empty($title) || empty($desc)) {
printf('<div class="error">%s</div>', __('Whoopsy! Looks like you forgot the Title and/or description.', 'idea-factory'));
} else {
if (is_user_logged_in()) {
$userid = get_current_user_ID();
} elseif (!is_user_logged_in() && $public_can_vote) {
$userid = apply_filters('idea_factory_default_public_author', 1);
}
// create an ideas post type
$post_args = array('post_title' => wp_strip_all_tags($title), 'post_content' => idea_factory_media_filter($desc), 'post_status' => $must_approve, 'post_type' => 'ideas', 'post_author' => (int) $userid);
$entry_id = wp_insert_post($post_args);
update_post_meta($entry_id, '_idea_votes', 0);
update_post_meta($entry_id, '_idea_total_votes', 0);
do_action('idea_factory_entry_submitted', $entry_id, $userid);
_e('Thanks for your entry!', 'idea-factory');
if ($must_approve == 'pending') {
echo "<br/>";
_e('You suggestion is awaiting moderation.', 'idea-factory');
}
}
}
}
exit;
// ajax
}
示例12: scripts
public function scripts()
{
if (lasso_user_can('edit_posts')) {
wp_enqueue_style('lasso-style', LASSO_URL . '/public/assets/css/lasso.css', LASSO_VERSION, true);
wp_enqueue_script('jquery-ui-autocomplete');
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-slider');
// media uploader
wp_enqueue_media();
// url for json api
$home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false;
$article_object = lasso_editor_get_option('article_class', 'lasso_editor');
$article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object;
$featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor');
$titleClass = lasso_editor_get_option('title_class', 'lasso_editor');
$toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor');
$objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor');
// post id reference
$postid = get_the_ID();
$strings = array('save' => __('Save', 'lasso'), 'saving' => __('Saving...', 'lasso'), 'saved' => __('Saved!', 'lasso'), 'adding' => __('Adding...', 'lasso'), 'added' => __('Added!', 'lasso'), 'loading' => __('Loading...', 'lasso'), 'loadMore' => __('Load More', 'lasso'), 'noPostsFound' => __('No more posts found', 'lasso'), 'galleryCreated' => __('Gallery Created!', 'lasso'), 'galleryUpdated' => __('Gallery Updated!', 'lasso'), 'justWrite' => __('Just write...', 'lasso'), 'chooseImage' => __('Choose an image', 'lasso'), 'updateImage' => __('Update Image', 'lasso'), 'insertImage' => __('Insert Image', 'lasso'), 'selectImage' => __('Select Image', 'lasso'), 'removeFeatImg' => __('Remove featured image?', 'lasso'), 'updateSelectedImg' => __('Update Selected Image', 'lasso'), 'chooseImages' => __('Choose images', 'lasso'), 'editImage' => __('Edit Image', 'lasso'), 'addImages' => __('Add Images', 'lasso'), 'addNewGallery' => __('Add New Gallery', 'lasso'), 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), 'useSelectedImages' => __('Use Selected Images', 'lasso'), 'publishPost' => __('Publish Post?', 'lasso'), 'publishYes' => __('Yes, publish it!', 'lasso'), 'deletePost' => __('Trash Post?', 'lasso'), 'deleteYes' => __('Yes, trash it!', 'lasso'), 'warning' => __('Oh snap!', 'laso'), 'cancelText' => __('O.K. got it!', 'lasso'), 'missingClass' => __('It looks like we are missing the Article CSS class. Lasso will not function correctly without this CSS class.', 'lasso'), 'missingConfirm' => __('Update Settings', 'lasso'), 'helperText' => __('one more letter', 'lasso'), 'editingBackup' => __('You are currently editing a backup copy of this post.'));
$api_url = trailingslashit(home_url()) . 'lasso-internal-api';
$gallery_class = new gallery();
$gallery_nonce_action = $gallery_class->nonce_action;
$gallery_nonce = wp_create_nonce($gallery_nonce_action);
// localized objects
$objects = array('ajaxurl' => esc_url($api_url), 'editor' => 'lasso--content', 'article_object' => $article_object, 'featImgClass' => $featImgClass, 'titleClass' => $titleClass, 'strings' => $strings, 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), 'post_status' => get_post_status($postid), 'postid' => $postid, 'permalink' => get_permalink(), 'edit_others_pages' => current_user_can('edit_others_pages') ? 'true' : 'false', 'edit_others_posts' => current_user_can('edit_others_posts') ? 'true' : 'false', 'userCanEdit' => current_user_can('edit_post', $postid), 'can_publish_posts' => current_user_can('publish_posts'), 'can_publish_pages' => current_user_can('publish_pages'), 'author' => is_user_logged_in() ? get_current_user_ID() : false, 'nonce' => wp_create_nonce('lasso_editor'), 'handle' => lasso_editor_settings_toolbar(), 'toolbar' => lasso_editor_text_toolbar(), 'toolbarHeadings' => $toolbar_headings, 'component_modal' => lasso_editor_component_modal(), 'component_sidebar' => lasso_editor_component_sidebar(), 'components' => lasso_editor_components(), 'wpImgEdit' => lasso_editor_wpimg_edit(), 'featImgControls' => lasso_editor_image_controls(), 'featImgNonce' => $gallery_nonce, 'getGallImgNonce' => $gallery_nonce, 'createGallNonce' => $gallery_nonce, 'swapGallNonce' => $gallery_nonce, 'titleNonce' => wp_create_nonce('lasso_update_title'), 'wpImgNonce' => wp_create_nonce('lasso_update_wpimg'), 'deletePost' => wp_create_nonce('lasso_delete_post'), 'searchPosts' => wp_create_nonce('lasso_search_posts'), 'component_options' => lasso_editor_options_blob(), 'newPostModal' => lasso_editor_newpost_modal(), 'allPostModal' => lasso_editor_allpost_modal(), 'mapFormFooter' => lasso_map_form_footer(), 'refreshRequired' => lasso_editor_refresh_message(), 'objectsNoSave' => $objectsNoSave, 'supportedNoSave' => lasso_supported_no_save(), 'postCategories' => lasso_get_objects('category'), 'postTags' => lasso_get_objects('tag'), 'noResultsDiv' => lasso_editor_empty_results(), 'noRevisionsDiv' => lasso_editor_empty_results('revision'), 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), 'revisionModal' => lasso_editor_revision_modal());
// wp api client
wp_enqueue_script('wp-api-js', LASSO_URL . '/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true);
$settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json'));
wp_localize_script('wp-api-js', 'WP_API_Settings', $settings);
$postfix = defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script('lasso', LASSO_URL . "/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true);
wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects));
}
}
示例13: selected
<option value="<?php
echo $course->ID;
?>
" <?php
selected($meta_course_id, $course->ID);
?>
><?php
echo $course->post_title;
?>
</option>
<?php
$available_course_options++;
}
} else {
//check for update capabilities
if (current_user_can('manage_options') || current_user_can('coursepress_update_notification_cap') || current_user_can('coursepress_update_my_notification_cap') && $notification_details->post_author == get_current_user_ID()) {
?>
<option value="<?php
echo $course->ID;
?>
" <?php
selected($meta_course_id, $course->ID);
?>
><?php
echo $course->post_title;
?>
</option>
<?php
$available_course_options++;
}
}
示例14: process_entry
/**
*
* Process the form submission
*
*/
function process_entry()
{
$public_can_vote = avfr_get_option('avfr_public_voting', 'avfr_settings_main');
$allowed_type = explode(",", avfr_get_option('avfr_allowed_file_types', 'avfr_settings_features'));
$allowed_size = avfr_get_option('avfr_max_file_size', 'avfr_settings_features');
$title = isset($_POST['avfr-title']) ? $_POST['avfr-title'] : null;
$desc = isset($_POST['avfr-description']) ? $_POST['avfr-description'] : null;
$uploadajx = isset($_POST['avfr-upload']) ? $_POST['avfr-upload'] : null;
$uploadOk = 1;
$must_approve = '1' == avfr_get_option('avfr_approve_features', 'avfr_settings_main') ? 'pending' : 'publish';
session_start();
if (isset($_POST['action']) && $_POST['action'] == 'process_entry') {
// only run for logged in users or if public is allowed
if (!is_user_logged_in() && 'on' !== $public_can_vote) {
return;
}
// OK security passes so let's process some data
if (wp_verify_nonce($_POST['nonce'], 'avfr-entry-nonce')) {
// bail if we don't have required fields
if (empty($title) || empty($desc)) {
printf('<div class="error">%s</div>', __('Whoops! Looks like you forgot the Title and/or description.', 'feature-request'));
} else {
if ('on' == avfr_get_option('avfr_disable_captcha', 'avfr_settings_main') || isset($_POST["captcha"]) && $_POST["captcha"] != "" && $_SESSION["code"] == $_POST["captcha"]) {
if (is_user_logged_in()) {
$userid = get_current_user_ID();
} elseif (!is_user_logged_in() && $public_can_vote) {
$userid = apply_filters('avfr_default_public_author', 1);
}
//get array of inserted tags in front-end
$tags = str_replace(array('[', ']', '"', '\\'), '', $_POST['avfr-tags']);
$groups = $_POST['group'];
$tags_array = explode(',', $tags);
// create an feature-request post type
$post_args = array('post_title' => wp_strip_all_tags($title), 'post_content' => avfr_content_filter($desc), 'the_post_thumbnail' => avfr_image_filter($uploadajx), 'post_status' => $must_approve, 'post_type' => 'avfr', 'post_author' => (int) $userid);
if (!is_user_logged_in()) {
$email = $_POST['avfr-email'];
if (!is_email($email)) {
$response_array = array('success' => 'false', 'message' => __('<span class="dashicons dashicons-warning"></span>' . 'Please enter a valid email address.', 'feature-request'));
echo json_encode($response_array);
die;
}
}
if ($_FILES) {
$convert_byte_kb = $allowed_size * 1024;
if ($_FILES["avfr-upload"]["size"] > $convert_byte_kb) {
$response_array = array('success' => 'false', 'message' => __('<span class="dashicons dashicons-warning"></span>' . ' Your image size is greater than acceptable !', 'feature-request'));
echo json_encode($response_array);
die;
}
if (in_array($_FILES["avfr-upload"]["type"], $allowed_type)) {
//continue
} else {
$response_array = array('success' => 'false', 'message' => __('<span class="dashicons dashicons-warning"></span>' . ' Please upload acceptable image format !', 'feature-request'));
echo json_encode($response_array);
die;
}
if ($_FILES['avfr-upload']['error'] !== UPLOAD_ERR_OK) {
$response_array = array('success' => 'false', 'message' => __('<span class="dashicons dashicons-dismiss"></span>' . ' upload error :' . $_FILES['avfr-upload']['error'], 'feature-request'));
echo json_encode($response_array);
die;
} else {
$entry_id = wp_insert_post($post_args);
$attach_id = media_handle_upload('avfr-upload', $entry_id);
update_post_meta($entry_id, '_thumbnail_id', $attach_id);
}
} else {
$entry_id = wp_insert_post($post_args);
}
$entry_groups = wp_set_object_terms($entry_id, $groups, 'groups');
$entry_avfrtags = wp_set_object_terms($entry_id, $tags_array, 'featureTags');
update_post_meta($entry_id, '_avfr_votes', 0);
update_post_meta($entry_id, '_avfr_total_votes', 0);
update_post_meta($entry_id, '_avfr_status', 'open');
update_post_meta($entry_id, '_flag', 0);
if (!is_user_logged_in()) {
update_post_meta($entry_id, '_avfr_author_email', $email);
}
do_action('avfr_entry_submitted', $entry_id, $userid);
$response_array = array('success' => 'true', 'message' => __('<span class="dashicons dashicons-yes"></span>' . ' Thanks for your entry!', 'feature-request'));
echo json_encode($response_array);
if ($must_approve == 'pending') {
echo "<br/>";
$response_array = array('success' => 'true', 'message' => __('<span class="dashicons dashicons-flag"></span>' . ' You suggestion is awaiting moderation.', 'feature-request'));
echo json_encode($response_array);
}
} else {
$response_array = array('success' => 'false', 'message' => __('<span class="dashicons dashicons-warning"></span>' . ' Captcha code is not correct!', 'feature-request'));
echo json_encode($response_array);
}
}
}
}
exit;
// Ajax
}
示例15: student_workbook_table
function student_workbook_table($args)
{
ob_start();
extract(shortcode_atts(array('module_column_title' => __('Element', 'cp'), 'title_column_title' => __('Title', 'cp'), 'submission_date_column_title' => __('Submitted', 'cp'), 'response_column_title' => __('Answer', 'cp'), 'grade_column_title' => __('Grade', 'cp'), 'comment_column_title' => __('Comment', 'cp'), 'module_response_description_label' => __('Description', 'cp'), 'comment_label' => __('Comment', 'cp'), 'view_link_label' => __('View', 'cp'), 'view_link_class' => 'assessment-view-response-link button button-units', 'comment_link_class' => 'assessment-view-response-link button button-units', 'pending_grade_label' => __('Pending', 'cp'), 'unit_unread_label' => __('Unit Unread', 'cp'), 'unit_read_label' => __('Unit Read', 'cp'), 'single_correct_label' => __('Correct', 'cp'), 'single_incorrect_label' => __('Incorrect', 'cp'), 'non_assessable_label' => __('**'), 'table_class' => 'widefat shadow-table assessment-archive-table', 'table_labels_th_class' => 'manage-column'), $args));
$module_column_title = sanitize_text_field($module_column_title);
$title_column_title = sanitize_text_field($title_column_title);
$submission_date_column_title = sanitize_text_field($submission_date_column_title);
$response_column_title = sanitize_text_field($response_column_title);
$grade_column_title = sanitize_text_field($grade_column_title);
$comment_column_title = sanitize_text_field($comment_column_title);
$module_response_description_label = sanitize_text_field($module_response_description_label);
$comment_label = sanitize_text_field($comment_label);
$view_link_label = sanitize_text_field($view_link_label);
$view_link_class = sanitize_html_class($view_link_class);
$comment_link_class = sanitize_html_class($comment_link_class);
$pending_grade_label = sanitize_text_field($pending_grade_label);
$unit_unread_label = sanitize_text_field($unit_unread_label);
$unit_read_label = sanitize_text_field($unit_read_label);
$non_assessable_label = sanitize_text_field($non_assessable_label);
$table_class = sanitize_html_class($table_class);
$table_labels_th_class = sanitize_html_class($table_labels_th_class);
$single_correct_label = sanitize_text_field($single_correct_label);
$single_incorrect_label = sanitize_text_field($single_incorrect_label);
$columns = array("title" => $title_column_title, "submission_date" => $submission_date_column_title, "response" => $response_column_title, "grade" => $grade_column_title, "comment" => $comment_column_title);
$col_sizes = array('45', '15', '10', '13', '5');
?>
<table cellspacing="0" class="<?php
echo $table_class;
?>
">
<thead>
<tr>
<?php
$n = 0;
foreach ($columns as $key => $col) {
?>
<th class="<?php
echo $table_labels_th_class;
?>
column-<?php
echo $key;
?>
" width="<?php
echo $col_sizes[$n] . '%';
?>
" id="<?php
echo $key;
?>
" scope="col"><?php
echo $col;
?>
</th>
<?php
$n++;
}
?>
</tr>
</thead>
<?php
$user_object = new Student(get_current_user_ID());
$modules = Unit_Module::get_modules(get_the_ID());
$input_modules_count = 0;
foreach ($modules as $mod) {
$class_name = $mod->module_type;
if (class_exists($class_name)) {
if (constant($class_name . '::FRONT_SAVE')) {
$input_modules_count++;
}
}
}
$current_row = 0;
$style = '';
foreach ($modules as $mod) {
$class_name = $mod->module_type;
if (class_exists($class_name)) {
if (constant($class_name . '::FRONT_SAVE')) {
$response = call_user_func($class_name . '::get_response', $user_object->ID, $mod->ID);
$visibility_class = count($response) >= 1 ? '' : 'less_visible_row';
if (count($response) >= 1) {
$grade_data = Unit_Module::get_response_grade($response->ID);
}
if (isset($_GET['ungraded']) && $_GET['ungraded'] == 'yes') {
if (count($response) >= 1 && !$grade_data) {
$general_col_visibility = true;
} else {
$general_col_visibility = false;
}
} else {
$general_col_visibility = true;
}
$style = isset($style) && 'alternate' == $style ? '' : ' alternate';
?>
<tr id='user-<?php
echo $user_object->ID;
?>
' class="<?php
echo $style;
echo 'row-' . $current_row;
?>
//.........这里部分代码省略.........