/** * Returns the HTML for a Bootstrap Panel of the user's teams. * * @return string */ public function renderChooseTeamsPanelHtml() { $teams = $this->get_teams(); ?> <div class="panel panel-default"> <div class="panel-heading" role="tab" id=""> <h3 class="panel-title"> <?php esc_html_e('Choose teams', 'buoy'); ?> </h3> </div> <div class="panel-body"> <table class="table" summary="<?php esc_attr_e('Your teams with responders', 'buoy'); ?> "> <thead> <tr> <th></th> <th><?php esc_html_e('Team name', 'buoy'); ?> </th> <th><?php esc_html_e('Responders', 'buoy'); ?> </th> </tr> </thead> <tbody> <?php foreach ($teams as $team_id) { $team = new WP_Buoy_Team($team_id); if (!$team->has_responder()) { continue; } ?> <tr> <td> <input type="checkbox" id="<?php print esc_attr(self::$prefix); ?> _team-<?php print esc_attr($team_id); ?> " name="<?php print esc_attr(self::$prefix); ?> _teams[]" <?php checked($team->is_default()); ?> value="<?php print esc_attr($team_id); ?> " /> </td> <td> <label for="<?php print esc_attr(self::$prefix); ?> _team-<?php print esc_attr($team_id); ?> "> <?php print esc_html($team->wp_post->post_title); ?> </label> </td> <td> <?php print esc_html(count($team->get_confirmed_members())); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php }
/** * Customizes the post row actions in the "My Teams" admin UI. * * @link https://developer.wordpress.org/reference/hooks/post_row_actions/ * * @uses WP_Buoy_Team::is_default() * @uses WP_Buoy_Team::has_responder() * * @param array $items * @param WP_Post $post * * @return array $items */ public static function postRowActions($items, $post) { $team = new WP_Buoy_Team($post->ID); if (!$team->is_default() && $team->has_responder() && 'publish' === $post->post_status) { $url = admin_url('post.php?post=' . $post->ID . '&action=make_default'); $items['default'] = '<a href="' . esc_attr($url) . '">' . __('Make default', 'buoy') . '</a>'; } unset($items['inline hide-if-no-js']); // the "Quick Edit" link return $items; }