Пример #1
0
    /**
     * Shows a professor a list of all student comments.
     *
     * @uses ClassBlogs_Plugins_StudentBlogList to get student blog URLs
     *
     * @access private
     * @since 0.2
     */
    public function _admin_page()
    {
        global $blog_id;
        $current_blog_id = $blog_id;
        // Create a lookup table of student data keyed by blog ID for multisite mode
        $students = array();
        if (ClassBlogs_Utils::is_multisite()) {
            foreach (ClassBlogs_Students::get_student_blogs() as $student_id => $blog) {
                $user_data = get_userdata($student_id);
                $students[$blog->blog_id] = array('blog_url' => $blog->url, 'name' => sprintf('%s %s', $user_data->first_name, $user_data->last_name));
            }
        }
        // Paginate the comment data
        $comments = $this->get_sitewide_comments(false);
        $paginator = new ClassBlogs_Paginator($comments, self::COMMENTS_PER_ADMIN_PAGE);
        $current_page = array_key_exists('paged', $_GET) ? absint($_GET['paged']) : 1;
        ?>
		<div class="wrap">

			<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
			<h2><?php 
        _e('Student Comments', 'classblogs');
        ?>
</h2>

			<p>
				<?php 
        _e("This page allows you to view all of the comments that have been left on yours students' blogs.", 'classblogs');
        ?>
			</p>

			<?php 
        $paginator->show_admin_page_links($current_page);
        ?>

			<table class="widefat cb-cw-comments-table" id="cb-sw-student-comments-list">

				<thead>
					<tr>
						<th class="author"><?php 
        _e('Author', 'classblogs');
        ?>
</th>
						<th class="content"><?php 
        _e('Comment', 'classblogs');
        ?>
</th>
						<th class="post"><?php 
        _e('Post', 'classblogs');
        ?>
</th>
						<?php 
        if (ClassBlogs_Utils::is_multisite()) {
            ?>
							<th class="student"><?php 
            _e('Student Blog', 'classblogs');
            ?>
</th>
						<?php 
        }
        ?>
						<th class="status"><?php 
        _e('Status', 'classblogs');
        ?>
</th>
						<th class="posted"><?php 
        _e('Date', 'classblogs');
        ?>
</th>
					</tr>
				</thead>

				<tfoot>
					<tr>
						<th class="author"><?php 
        _e('Author', 'classblogs');
        ?>
</th>
						<th class="content"><?php 
        _e('Comment', 'classblogs');
        ?>
</th>
						<th class="post"><?php 
        _e('Post', 'classblogs');
        ?>
</th>
						<?php 
        if (ClassBlogs_Utils::is_multisite()) {
            ?>
							<th class="student"><?php 
            _e('Student Blog', 'classblogs');
            ?>
</th>
						<?php 
        }
        ?>
						<th class="status"><?php 
        _e('Status', 'classblogs');
        ?>
</th>
						<th class="posted"><?php 
        _e('Date', 'classblogs');
        ?>
</th>
					</tr>
				</tfoot>

				<tbody>
					<?php 
        foreach ($paginator->get_items_for_page($current_page) as $comment) {
            ClassBlogs_NXTClass::switch_to_blog($comment->cb_sw_blog_id);
            $status = nxt_get_comment_status($comment->comment_ID);
            ?>
						<tr class="<?php 
            echo $status;
            ?>
">
							<td class="author">
									<?php 
            printf('%s <strong>%s</strong> <br /> <a href="mailto:%s">%s</a>', get_avatar($comment->comment_author_email, 32), esc_html($comment->comment_author), esc_attr($comment->comment_author_email), esc_html($comment->comment_author_email));
            ?>
							</td>
							<td class="content">
								<?php 
            comment_text($comment->comment_ID);
            ?>
							</td>
							<td class="post">
								<strong>
									<?php 
            printf('<a href="%s">%s</a>', esc_url(ClassBlogs_NXTClass::get_blog_permalink($comment->cb_sw_blog_id, $comment->comment_post_ID)), esc_html($comment->post_title));
            ?>
								</strong>
							</td>
							<?php 
            if (ClassBlogs_Utils::is_multisite()) {
                ?>
								<td class="student">
									<strong>
										<?php 
                if (array_key_exists($comment->cb_sw_blog_id, $students)) {
                    $blog = $students[$comment->cb_sw_blog_id];
                    printf('<a href="%s">%s</a>', esc_url($blog['blog_url']), esc_html($blog['name']));
                }
                ?>
									</strong>
								</td>
							<?php 
            }
            ?>
							<td class="status">
								<?php 
            if ($status == 'approved') {
                _e('Approved', 'classblogs');
            } elseif ($status == 'deleted' || $status == 'trash') {
                _e('Deleted', 'classblogs');
            } elseif ($status == 'spam') {
                _e('Spam', 'classblogs');
            } elseif ($status == 'unapproved') {
                _e('Unapproved', 'classblogs');
            } else {
                _e('Unknown', 'classblogs');
            }
            ?>
							</td>
							<td class="posted">
								<?php 
            printf('<span class="date">%s</span> <span class="time">%s</span>', mysql2date(get_option('date_format'), $comment->comment_date), mysql2date(get_option('time_format'), $comment->comment_date));
            ?>
							</td>
						</tr>
					<?php 
        }
        ClassBlogs_Utils::restore_blog($current_blog_id);
        ?>
				</tbody>

			</table>

			<?php 
        $paginator->show_admin_page_links($current_page, 'bottom');
        ?>

		</div>
<?php 
    }
Пример #2
0
    /**
     * Displays the plugin's admin page.
     *
     * @access private
     * @since 0.2
     */
    public function _admin_page()
    {
        // Change the state of sitewide commenting if switching
        if ($_POST) {
            check_admin_referer($this->get_uid());
            $this->update_option('comments_disabled', $_POST['comment_status'] === 'disabled');
            ClassBlogs_Admin::show_admin_message(__('Your sitewide commenting options have been updated', 'classblogs'));
        }
        ?>
		<div class="wrap">

			<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
			<h2><?php 
        _e('Disable Commenting', 'classblogs');
        ?>
</h2>

			<p>
				<?php 
        _e('This page allows you to disable commenting on every blog on this site, which includes both the root blog and the student blogs.  Any new posts will have commenting disabled by default, and all existing posts will not be able to receive comments.', 'classblogs');
        ?>
			</p>

			<form method="post" action="">

					<table class="form-table">
						<tr valign="top">
							<th scope="row"><?php 
        _e('Commenting on All Blogs is', 'classblogs');
        ?>
</th>
							<td>
								<input type="radio" name="comment_status" value="enabled" id="comments-enabled" <?php 
        if (!$this->get_option('comments_disabled')) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
								<label for="comments-enabled"><?php 
        _e('Enabled', 'classblogs');
        ?>
</label>
								<input type="radio" name="comment_status" value="disabled" id="comments-disabled" <?php 
        if ($this->get_option('comments_disabled')) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
								<label for="comments-disabled"><?php 
        _e('Disabled', 'classblogs');
        ?>
</label>
							</td>
						</tr>
					</table>

				<?php 
        nxt_nonce_field($this->get_uid());
        ?>
				<p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php 
        _e('Update Commenting Status', 'classblogs');
        ?>
" /></p>
			</form>
		</div>
<?php 
    }
Пример #3
0
    /**
     * Handles the admin page for the plugin.
     *
     * @access private
     * @since 0.2
     */
    public function _admin_page()
    {
        // Update the plugin options
        if ($_POST) {
            check_admin_referer($this->get_uid());
            $this->update_option('title', ClassBlogs_Utils::sanitize_user_input($_POST['widget_title']));
            $this->update_option('links', $this->_parse_link_list($_POST));
            ClassBlogs_Admin::show_admin_message(__('Your links have been updated.', 'classblogs'));
        }
        ?>
		<div class="wrap">

			<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
			<h2><?php 
        _e('Student Blog Links', 'classblogs');
        ?>
</h2>

			<p>
				<?php 
        _e("This plugin lets you display links of your choosing in the first widgetized area of every student's blog. You can use this to have a link back to the main blog appear on every student's blog, for example.", 'classblogs');
        ?>
			</p>

			<form method="post" action="">

				<h3><?php 
        _e('Options', 'classblogs');
        ?>
</h3>

					<table class="form-table">
						<tr valign="top">
							<th scope="row"><?php 
        _e('Widget Title', 'classblogs');
        ?>
</th>
							<td>
								<input type="text" name="widget_title" id="widget-title" value="<?php 
        echo esc_attr($this->get_option('title'));
        ?>
" /><br />
								<label for="widget-title"><?php 
        _e('The title for the the list of links.', 'classblogs');
        ?>
</label>
							</td>
						</tr>
					</table>

				<h3><?php 
        _e('Links', 'classblogs');
        ?>
</h3>
					<table class="form-table" id="student-blog-links">
						<tfoot>
							<th scope="row">
								<a href="#add-link" class="add-link"><?php 
        _e('Add another link', 'classblogs');
        ?>
</a>
							</th>
							<td></td>
						</tfoot>
						<tbody>
						<?php 
        $link_count = max(count($this->get_option('links')), 1);
        for ($i = 0; $i < $link_count; $i++) {
            $url_id = 'link_url_' . $i;
            $title_id = 'link_title_' . $i;
            $links = $this->get_option('links');
            $link = $links[$i];
            ?>

						<tr valign="top" class="link">
							<th scope="row"><?php 
            _e('Link', 'classblogs');
            ?>
</th>
							<td>
								<label for="<?php 
            echo esc_attr($title_id);
            ?>
"><?php 
            _e('Title', 'classblogs');
            ?>
</label>
								<input type="text" name="<?php 
            echo esc_attr($title_id);
            ?>
" id="<?php 
            echo esc_attr($title_id);
            ?>
" value="<?php 
            echo esc_attr($link['title']);
            ?>
" />
								<label style="margin-left: 2em;" for="<?php 
            echo esc_attr($url_id);
            ?>
"><?php 
            _e('URL', 'classblogs');
            ?>
</label>
								<input size="40" type="text" name="<?php 
            echo esc_attr($url_id);
            ?>
" id="<?php 
            echo esc_attr($url_id);
            ?>
" value="<?php 
            echo esc_url($link['url']);
            ?>
" />
								<a href="#delete-link" class="delete-link"><?php 
            _e('Delete', 'classblogs');
            ?>
</a>
							</td>
						</tr>

						<?php 
        }
        ?>
						</tbody>
					</table>

				<?php 
        nxt_nonce_field($this->get_uid());
        ?>
				<p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php 
        _e('Update Links', 'classblogs');
        ?>
" /></p>
			</form>
		</div>
	<?php 
    }
Пример #4
0
    /**
     * Handles the logic to display the admin page for the plugin.
     *
     * @access private
     * @since 0.2
     */
    public function _admin_page()
    {
        // Update the plugin options
        if ($_POST) {
            check_admin_referer($this->get_uid());
            $this->update_option('required_weekly_words', absint(ClassBlogs_Utils::sanitize_user_input($_POST['required_weekly_words'])));
            ClassBlogs_Admin::show_admin_message(__('Your word-counter options been updated.', 'classblogs'));
        }
        ?>

	<div class="wrap">
		<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
		<h2><?php 
        _e('Student Word Counts', 'classblogs');
        ?>
</h2>
<?php 
        // Show the word-count table if we have word counts
        $word_counts = $this->_get_weekly_word_counts();
        $student_ids = ClassBlogs_Students::get_student_user_ids();
        if (!empty($word_counts)) {
            // Compute the total word counts for each student
            $total_counts = array();
            foreach ($student_ids as $student_id) {
                $total_counts[$student_id] = 0;
                foreach ($word_counts as $week_counts) {
                    $total_counts[$student_id] += $week_counts['user_counts'][$student_id];
                }
            }
            // Precompute each student's name
            $student_names = array();
            foreach ($student_ids as $student_id) {
                $user_data = get_userdata($student_id);
                $student_names[$student_id] = $user_data->display_name;
            }
            ?>
		<h3><?php 
            _e('Word Counts by Week', 'classblogs');
            ?>
</h3>

		<p id="student-word-counts-instructions">
			<?php 
            _e('The table below shows the word counts for each student, drawn from any posts and comments that they have written, broken down by the week for which those counts are calculated.  The date displayed in the "Week of" column is for the Monday that started that week.', 'classblogs');
            ?>
		</p>

		<div id="student-word-counts-wrap">
			<table id="student-word-counts">

				<thead>
					<tr>
						<th class="week"><?php 
            _e('Week of', 'classblogs');
            ?>
</th>
						<?php 
            // Show each student's name in the header
            foreach ($student_ids as $student_id) {
                printf('<th>%s</th>', esc_html($student_names[$student_id]));
            }
            ?>
					</tr>
				</thead>

				<tfoot>
					<th><?php 
            _e('Totals', 'classblogs');
            ?>
</th>
					<?php 
            // Display each student's total words in the footer
            foreach ($student_ids as $student_id) {
                printf('<td title="%s">%s</td>', esc_attr($student_names[$student_id]), number_format($total_counts[$student_id]));
            }
            ?>
				</tfoot>

				<tbody>
					<?php 
            // Show each week and every student's total words for that week
            $required_words = $this->get_option('required_weekly_words');
            foreach ($word_counts as $week_counts) {
                echo "<tr>";
                $verbose_date = date_i18n('M j, Y', (int) $week_counts['week_start']->format('U'));
                printf('<th class="week">%s</th>', $verbose_date);
                $counter = 0;
                foreach ($student_ids as $student_id) {
                    $classes = array();
                    $count = $week_counts['user_counts'][$student_id];
                    if (!$count) {
                        $classes[] = 'null';
                    } else {
                        if ($count < $required_words) {
                            $classes[] = 'under';
                        } else {
                            if ($count >= $required_words) {
                                $classes[] = 'over';
                            }
                        }
                    }
                    $classes[] = $counter % 2 ? 'even' : 'odd';
                    $counter++;
                    printf('<td title="%s" class="%s">%s</td>', esc_attr(sprintf(__('%1$s on %2$s'), $student_names[$student_id], $verbose_date)), implode(' ', $classes), number_format($count));
                }
                echo "</tr>";
            }
            ?>
				</tbody>

			</table>
		</div>

		<?php 
        }
        ?>

		<h3><?php 
        _e('Options', 'classblogs');
        ?>
</h3>

		<form method="post" action="">

			<table class="form-table">
				<tr valign="top">
					<th scope="row"><?php 
        _e('Required Weekly Words', 'classblogs');
        ?>
</th>
					<td>
						<input type="text" name="required_weekly_words" id="required-weekly-words" value="<?php 
        echo esc_attr($this->get_option('required_weekly_words'));
        ?>
" /><br />
						<label for="required-weekly-words"><?php 
        _e('The number of words a student must write per week.', 'classblogs');
        ?>
</label>
					</td>
				</tr>
			</table>

			<?php 
        nxt_nonce_field($this->get_uid());
        ?>
			<p class="submit"><input type="submit" class="button-primary" name="Submit" value="<?php 
        _e('Update Required Word Count', 'classblogs');
        ?>
" /></p>
		</form>

	</div>

<?php 
    }
Пример #5
0
    /**
     * Shows a professor a list of student posts.
     *
     * @uses ClassBlogs_Plugins_StudentBlogList to get student blog URLs
     *
     * @access private
     * @since 0.2
     */
    public function _posts_admin_page()
    {
        // Create a lookup table for student names and blogs keyed by user ID
        $students = array();
        foreach (ClassBlogs_Students::get_student_blogs() as $student_id => $blog) {
            $user_data = get_userdata($student_id);
            $students[$student_id] = array('blog_url' => $blog->url, 'name' => sprintf('%s %s', $user_data->first_name, $user_data->last_name));
        }
        // Paginate the data, restricting the data set to student-only posts
        $student_posts = array();
        foreach ($this->get_sitewide_posts() as $post) {
            if (array_key_exists($post->post_author, $students)) {
                $student_posts[] = $post;
            }
        }
        $paginator = new ClassBlogs_Paginator($student_posts, self::POSTS_PER_ADMIN_PAGE);
        $current_page = array_key_exists('paged', $_GET) ? absint($_GET['paged']) : 1;
        ?>
		<div class="wrap">

			<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
			<h2><?php 
        _e('Student Posts', 'classblogs');
        ?>
</h2>

			<p>
				<?php 
        _e('This page allows you to view all of the posts that your students have published.', 'classblogs');
        ?>
			</p>

			<?php 
        $paginator->show_admin_page_links($current_page);
        ?>

			<table class="widefat" id="cb-sw-student-posts-list">

				<thead>
					<tr>
						<th class="student"><?php 
        _e('Student', 'classblogs');
        ?>
</th>
						<th class="post"><?php 
        _e('Post', 'classblogs');
        ?>
</th>
						<th class="excerpt"><?php 
        _e('Excerpt', 'classblogs');
        ?>
</th>
						<th class="posted"><?php 
        _e('Posted', 'classblogs');
        ?>
</th>
					</tr>
				</thead>

				<tfoot>
					<tr>
						<th class="student"><?php 
        _e('Student', 'classblogs');
        ?>
</th>
						<th class="post"><?php 
        _e('Post', 'classblogs');
        ?>
</th>
						<th class="excerpt"><?php 
        _e('Excerpt', 'classblogs');
        ?>
</th>
						<th class="posted"><?php 
        _e('Posted', 'classblogs');
        ?>
</th>
					</tr>
				</tfoot>

				<tbody>
					<?php 
        foreach ($paginator->get_items_for_page($current_page) as $post) {
            ?>
						<tr>
							<td class="student">
								<strong>
									<?php 
            echo get_avatar($post->post_author, 32) . ' ';
            printf('<a href="%s">%s</a>', $students[$post->post_author]['blog_url'], $students[$post->post_author]['name']);
            ?>
								</strong>
							</td>
							<td class="post">
								<strong>
									<?php 
            printf('<a href="%s">%s</a>', ClassBlogs_NXTClass::get_blog_permalink($post->cb_sw_blog_id, $post->ID), $post->post_title);
            ?>
								</strong>
							</td>
							<td class="excerpt"><?php 
            echo ClassBlogs_Utils::make_post_excerpt($post->post_content, 25);
            ?>
</td>
							<td class="posted">
								<?php 
            echo mysql2date(get_option('date_format'), $post->post_date);
            ?>
							</td>
						</tr>
					<?php 
        }
        ?>
				</tbody>

			</table>

			<?php 
        $paginator->show_admin_page_links($current_page, 'bottom');
        ?>

		</div>
<?php 
    }
Пример #6
0
    /**
     * Handles the logic to display the pseudonym admin page to a student.
     *
     * @access private
     * @since 0.1
     */
    public function _admin_page()
    {
        // Get information on the user and their blog URL
        $current_user = nxt_get_current_user();
        $username = $current_user->user_login;
        $blog_url = home_url();
        // Validate the pseudonym
        $username_valid = true;
        if ($_POST) {
            // Apply the pseudonym to the user and their blog if the username
            // does not conflict with an existing user or blog
            check_admin_referer($this->get_uid());
            $username = ClassBlogs_Utils::sanitize_user_input($_POST['new_username']);
            $username_valid = $this->_validate_username($username);
            if ($username_valid) {
                global $blog_id;
                $current_user = nxt_get_current_user();
                $this->_apply_pseudonym($current_user->ID, $blog_id, $username);
                // Display the updated information to the user
                $blog_url = home_url();
                $message = array(__('You successfully changed your username.  Your new user information is as follows.', 'classblogs'), '<p>');
                $message[] = sprintf('<strong>%s</strong><br />%s<br /><br />', __('Username', 'classblogs'), esc_html($username));
                if (ClassBlogs_Utils::is_multisite()) {
                    $message[] = sprintf('<strong>%s</strong><br />%s<br /><br />', __('Blog URL', 'classblogs'), sprintf('<a href="%1$s">%1$s</a>', esc_url($blog_url)));
                }
                $message[] = '</p>';
                ClassBlogs_Admin::show_admin_message(implode("\n", $message));
            } else {
                if (!$username) {
                    $error = __('You cannot have a blank username.', 'classblogs');
                } else {
                    $error = sprintf(__('The username %s is invalid or conflicts with another user or blog.  Please choose a different username.', 'classblogs'), '<strong>' . esc_html($username) . '</strong>');
                }
                ClassBlogs_Admin::show_admin_error($error);
            }
        }
        ?>

	<div class="wrap">

		<div id="icon-users" class="icon32"></div>
		<h2><?php 
        _e('Change Username', 'classblogs');
        ?>
</h2>

		<p id="student-pseudonym-instructions">
			<?php 
        _e('If you have already changed your display name but still wish for there to be no trace of your actual identity on the blog, you can use this page to change the username that you use to log in to the blog.', 'classblogs');
        ?>
		</p>

		<form method="post" action="" id="cb-username-form">

			<table class="form-table">
				<tr valign="top">
					<th scope="row"><?php 
        _e('New Username', 'classblogs');
        ?>
</th>
					<td>
						<input type="text" name="new_username" id="new-username" /><br />
						<label for="new-username"><?php 
        _e('Changing this will change the username that you use to access your blog and the URL at which it can be found.', 'classblogs');
        ?>
</label>
						<hr />
						<label for="new-username">
							<?php 
        printf(__('Your current username is %s', 'classblogs'), '<strong>' . esc_html($current_user->user_login) . '</strong>');
        ?>
						</label><br />
						<?php 
        if (ClassBlogs_Utils::is_multisite()) {
            ?>
							<label for="new-username">
								<?php 
            printf(__('Your current blog URL is %s', 'classblogs'), sprintf('<a href="%1$s">%1$s</a>', esc_url($blog_url)));
            ?>
							</label>
						<?php 
        }
        ?>
					</td>
				</tr>
			</table>

			<?php 
        nxt_nonce_field($this->get_uid());
        ?>
			<p class="submit"><input class="button-primary" type="submit" name="Submit" value="<?php 
        _e('Change Username', 'classblogs');
        ?>
" /></p>
			<strong style="color: #a00">You will only be able to change your username once</strong>

		</form>

		<script type="text/javascript">
			jQuery("#cb-username-form").submit(function() {
				return confirm( "<?php 
        _e('You can only change your username once.  Are you sure that you wish to change it now?', 'classblogs');
        ?>
" );
			});
		</script>

	</div>
<?php 
    }
Пример #7
0
 /**
  * Return an instance of the admin class, instantiating one if it doesn't exist.
  *
  * @return object an instance of a ClassBlogs_Admin class
  *
  * @since 0.1
  */
 public static function get_admin()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new ClassBlogs_Admin();
     }
     return self::$_instance;
 }
Пример #8
0
    /**
     * Handles the admin page logic for the plugin.
     *
     * @access private
     * @since 0.1
     */
    public function _admin_page()
    {
        // Perform an update action of some sort
        if ($_POST) {
            check_admin_referer($this->get_uid());
            // If we're just refreshing the sitewide data, do so now
            if (array_key_exists('Refresh', $_POST)) {
                $synced = $this->_create_tables();
                if (!$synced) {
                    $this->_sync_tables();
                }
                ClassBlogs_Admin::show_admin_message(__('The sitewide data has been refreshed.', 'classblogs'));
            } else {
                $this->update_option('excluded_blogs', $this->_parse_excluded_blog_list($_POST));
                $this->update_option('aggregation_enabled', $_POST['aggregation_enabled'] == 'enabled');
                $this->_sync_tables();
                ClassBlogs_Admin::show_admin_message(__('Your options have been updated.', 'classblogs'));
            }
        }
        ?>
		<div class="wrap">

			<?php 
        ClassBlogs_Admin::show_admin_icon();
        ?>
			<h2><?php 
        _e('Student Data Options', 'classblogs');
        ?>
</h2>

			<p>
				<?php 
        _e("This page allows you to manage the options for collecting data on posts, comments and tags from your students' blogs.", 'classblogs');
        ?>
			</p>

			<form method="post" action="">

				<h3><?php 
        _e('Data Sources', 'classblogs');
        ?>
</h3>

				<table class="form-table">

					<tr valign="top">
						<th scope="row"><?php 
        _e('Aggregation Enabled', 'classblogs');
        ?>
</th>
						<td>
							<input type="radio" name="aggregation_enabled" id="aggregation-enabled" value="enabled" <?php 
        if ($this->get_option('aggregation_enabled')) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
							<label for="aggregation-enabled"><?php 
        _e('Enabled', 'classblogs');
        ?>
</label>
							<input style="margin-left: 1em;" type="radio" name="aggregation_enabled" id="aggregation-disabled" value="disabled" <?php 
        if (!$this->get_option('aggregation_enabled')) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
							<label for="aggregation-disabled"><?php 
        _e('Disabled', 'classblogs');
        ?>
</label>
						</td>
					</tr>

					<tr valign="top">
						<th scope="row"><?php 
        _e('Excluded Blogs', 'classblogs');
        ?>
</th>
						<td>
							<ul>
<?php 
        // Display a checkbox for every blog, selecting it if the blog is
        // currently on the exclusion blacklist
        $excluded_blogs = $this->get_option('excluded_blogs');
        foreach (ClassBlogs_Utils::get_all_blog_ids() as $blog_id) {
            $details = get_blog_details($blog_id, true);
            printf('<li><input type="checkbox" id="%1$s" name="%1$s" %2$s /> <label for="%1$s"><strong>%3$s</strong> ( <a href="%4$s">%4$s</a> )</label></li>', 'exclude_blog_' . $blog_id, array_search($blog_id, $excluded_blogs) !== false ? 'checked="checked"' : "", $details->blogname, esc_url($details->siteurl));
        }
        ?>
							</ul>
						</td>
					</tr>

				</table>

				<h3><?php 
        _e('Refresh Student Data', 'classblogs');
        ?>
</h3>

				<p><?php 
        _e(sprintf('If you find that the student data does not accurately reflect the data in each blog, you can click the %1$s button below to rebuild the student data tables.', '<strong>' . __('Refresh Student Data', 'classblogs') . '</strong>'), 'classblogs');
        ?>
</p>

				<?php 
        nxt_nonce_field($this->get_uid());
        ?>
				<p class="submit">
					<input type="submit" class="button-primary" name="Submit" value="<?php 
        _e('Update Sudent Data Options', 'classblogs');
        ?>
" />
					<input type="submit" name="Refresh" value="<?php 
        _e('Refresh Student Data', 'classblogs');
        ?>
" />
				</p>

			</form>
		</div>
<?php 
    }
Пример #9
0
 /**
  * Enables a possible admin page associated with a child plugin.
  *
  * This simply provides a shortcut for any child plugins to register an admin
  * page that is part of the class blogs menu group.  A child plugin can override
  * the `enable_admin_page` method called by this to register an admin page.
  *
  * @access private
  * @since 0.1
  */
 public function _maybe_enable_admin_page()
 {
     if (ClassBlogs_Utils::on_root_blog_admin()) {
         $admin = ClassBlogs_Admin::get_admin();
         $this->enable_admin_page($admin);
     }
 }