| 1 |
<?php |
| 2 |
/** |
| 3 |
* groups-admin-tree-view.php |
| 4 |
* |
| 5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com |
| 6 |
* |
| 7 |
* This code is released under the GNU General Public License. |
| 8 |
* See COPYRIGHT.txt and LICENSE.txt. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* This header and all notices must be kept intact. |
| 16 |
* |
| 17 |
* @author Karim Rahimpur |
| 18 |
* @package groups |
| 19 |
* @since groups 1.0.0 |
| 20 |
*/ |
| 21 |
|
| 22 |
if ( !defined( 'ABSPATH' ) ) { |
| 23 |
exit; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Tree view : a simple tree view |
| 28 |
*/ |
| 29 |
function groups_admin_tree_view() { |
| 30 |
|
| 31 |
$output = ''; |
| 32 |
|
| 33 |
if ( !Groups_User::current_user_can( GROUPS_ACCESS_GROUPS ) ) { |
| 34 |
wp_die( esc_html__( 'Access denied.', 'groups' ) ); |
| 35 |
} |
| 36 |
|
| 37 |
$output .= '<div class="groups-tree-view">'; |
| 38 |
$output .= '<h1>'; |
| 39 |
$output .= esc_html__( 'Tree of Groups', 'groups' ); |
| 40 |
$output .= '</h1>'; |
| 41 |
|
| 42 |
$tree = Groups_Utility::get_tree(); |
| 43 |
$tree_output = ''; |
| 44 |
$linked = Groups_User::current_user_can( GROUPS_ADMINISTER_GROUPS ); |
| 45 |
Groups_Utility::render_tree( $tree, $tree_output, $linked ); |
| 46 |
$output .= $tree_output; |
| 47 |
|
| 48 |
$output .= '</div>'; // .groups-tree-view |
| 49 |
|
| 50 |
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 51 |
} // function groups_admin_tree_view() |
| 52 |
|