// get the current user and see if they're a teacher
        $user_type = get_user_meta(get_current_user_id(), 'rpr_user_type', true);
        // set $is_teacher if admin or if user_type === Teacher
        $is_teacher = false;
        if ($user_type === 'Teacher' || current_user_can('manage_options')) {
            $is_teacher = true;
        }
        if ($is_teacher) {
            the_content();
            $teacher_groups = get_user_meta(get_current_user_id(), 'gd_teacher_groups', true);
            if (!empty($teacher_groups) && class_exists('CTXPS_Queries')) {
                $students = array();
                echo '<h1 class="teacher-groups-header">' . $teacher_user->display_name . '\'s class overview:</h1>';
                echo '<div id="teacher-groups">';
                foreach ($teacher_groups as $group_id) {
                    $group_members = CTXPS_Queries::get_group_members($group_id);
                    $group_info = CTXPS_Queries::get_group_info($group_id);
                    $team_page_id = get_option('gd_team_page_id');
                    $team_page_permalink = get_permalink($team_page_id);
                    // A button that will clear a team's progress (delete their posts and the progress they've made)
                    $clear_progress = '<button class="button" id="clear-team-progress" data-teamid="' . $group_id . '">Clear Team Progress</button>';
                    ?>
                                    <div id="<?php 
                    echo $group_info->ID;
                    ?>
" class="gd-tdash-group">
                                        <p><a href="<?php 
                    echo $team_page_permalink;
                    ?>
?team_id=<?php 
                    echo $group_info->ID;
Пример #2
0
 /**
  * Returns html for tbody element of group member list.
  *
  * @global wpdb $wpdb
  *
  * @param int $group_id The id of the group we need a member list for.
  * @return string Html to go inside tbody.
  */
 public static function render_member_list($group_id)
 {
     global $wpdb;
     $members = CTXPS_Queries::get_group_members($group_id);
     if (count($members) === 0) {
         return '<td colspan="4">' . __('No users have been added to this group.', 'contexture-page-security') . '</td>';
     }
     $countmembers = '';
     $alternatecss = ' class="alternate" ';
     $html = '<tr id="inline-edit" class="inline-edit-row inline-options-row-page inline-edit-page quick-edit-row quick-edit-row-page inline-edit-page" style="display: none"><td colspan="4">
             <h4>' . __('MEMBERSHIP DETAILS', 'contexture-page-security') . '</h4>
             <fieldset class="inline-edit-col-left">
                 <label>
                     <span class="title">' . __('User', 'contexture-page-security') . '</span>
                     <span class="input-text-wrap username" style="color:silver;">
                         username
                     </span>
                 </label>
                 <label>&nbsp;</label>
             </fieldset>
             <fieldset class="inline-edit-col-right">
                 <label>
                     <span class="title">' . __('Expires', 'contexture-page-security') . '</span>
                     <span class="input-text-wrap">
                         <input type="checkbox" value="" name="membership_permanent"/>
                     </span>
                 </label>
                 <label>
                     <span class="title">' . __('End Date', 'contexture-page-security') . '</span>
                 </label>
                 <div class="inline-edit-date">
                     <div class="timestamp-wrap">
                         <select tabindex="4" name="mm" disabled="disabled">
                             <option value="01">Jan</option>
                             <option value="02">Feb</option>
                             <option value="03">Mar</option>
                             <option value="04">Apr</option>
                             <option value="05">May</option>
                             <option value="06">Jun</option>
                             <option value="07">Jul</option>
                             <option value="08">Aug</option>
                             <option value="09">Sep</option>
                             <option value="10">Oct</option>
                             <option value="11">Nov</option>
                             <option value="12">Dec</option>
                         </select>
                         <input type="text" autocomplete="off" tabindex="4" maxlength="2" size="2" value="" name="jj" disabled="disabled">,
                         <input type="text" autocomplete="off" tabindex="4" maxlength="4" size="4" value="" name="aa" disabled="disabled">
                     </div>
                 </div>
             </fieldset>
             <p class="submit inline-edit-save">
                 <a class="button-secondary cancel alignleft" title="Cancel" href="#inline-membership" accesskey="c">' . __('Cancel', 'contexture-page-security') . '</a>
                 <a class="button-primary save alignright" title="Update" href="#inline-membership" accesskey="s">' . __('Update', 'contexture-page-security') . '</a>
                 <img alt="" src="' . admin_url('/images/wpspin_light.gif') . '" style="display:none;" class="waiting"/>
             </p>
             </td></tr>';
     foreach ($members as $member) {
         $fname = get_user_meta($member->ID, 'first_name', true);
         $lname = get_user_meta($member->ID, 'last_name', true);
         $rawdate = strtotime($member->grel_expires);
         $jj = !empty($rawdate) ? date('d', $rawdate) : '';
         //Day
         $mm = !empty($rawdate) ? date('m', $rawdate) : '';
         //Month
         $aa = !empty($rawdate) ? date('Y', $rawdate) : '';
         //Year
         if (!empty($rawdate) && $rawdate < time()) {
             $displaydate = 'Expired';
         } else {
             $displaydate = empty($rawdate) ? 'Never' : sprintf('%s-%s-%s', $mm, $jj, $aa);
         }
         $html .= sprintf('
     <tr id="user-%1$s" %2$s>
         <td class="username column-username">
             <a href="%8$suser-edit.php?user_id=%1$s&wp_httpd_referer=%9$s"><strong>%3$s</strong></a>
             <div class="row-actions">
                 <span class="membership"><a href="#" class="editmembership" title="Change membership options">' . __('Membership', 'contexture-page-security') . '</a> | </span>
                 <span class="trash"><a class="row-actions" href="%8$s?page=ps_groups_edit&groupid=%6$s&action=rmvusr&usrid=%1$s&relid=%7$s&usrname=%3$s">' . __('Unenroll', 'contexture-page-security') . '</a> | </span>
                 <span class="view"><a href="%8$suser-edit.php?user_id=%1$s&wp_httpd_referer=%9$s" title="View User">' . __('View', 'contexture-page-security') . '</a></span>
             </div>
             <div id="inline_%1$s" class="hidden">
                 <div class="username">%3$s</div>
                 <div class="jj">%11$s</div>
                 <div class="mm">%12$s</div>
                 <div class="aa">%13$s</div>
                 <div class="grel">%7$s</div>
             </div>
         </td>
         <td class="name column-name">%4$s</td>
         <td class="email column-email"><a href="mailto:%5$s">%5$s</a></td>
         <td class="expires column-expires">%10$s</td>
     </tr>', $member->ID, $alternatecss, $member->user_login, $fname . ' ' . $lname, $member->user_email, $_REQUEST['groupid'], $member->grel_id, admin_url(), admin_url('users.php?page=ps_groups_edit&groupid=' . $_REQUEST['groupid']), $displaydate, $jj, $mm, $aa);
         //Alternate css style for odd-numbered rows
         $alternatecss = $alternatecss != '' ? '' : ' class="alternate" ';
     }
     return $html;
 }
Пример #3
0
            ?>
</h1>
                        <p><?php 
            echo $current_group->group_description;
            ?>
</p>
                    </div>

                    <!-- team members -->
                    <div id="team-<?php 
            echo $team_id;
            ?>
-members" class="team-members">
                        <h2>Team Members:</h2>
                        <?php 
            $members = CTXPS_Queries::get_group_members($team_id);
            $team_members_ids = array();
            // used below in a WP Query
            if (!empty($members)) {
                $roles = get_option('gd-team-roles');
                foreach ($members as $member) {
                    array_push($team_members_ids, $member->ID);
                    $user_info = get_userdata($member->ID);
                    $name = get_the_author_meta('display_name', $member->ID);
                    // Display team role
                    $user_role = (int) get_user_meta($member->ID, 'gd-team-role', true);
                    ?>
                                <div id="member-<?php 
                    echo $member->ID;
                    ?>
" class="team-member">