Пример #1
0
 function add_meta_boxes()
 {
     // ========= register WP-rendered metaboxes ============
     $post_type = pp_find_post_type();
     if (!current_user_can('pp_assign_roles') || apply_filters('pp_disable_exception_ui', false, 'post', 0, $post_type)) {
         return;
     }
     $hidden_types = apply_filters('pp_hidden_post_types', array());
     if (!empty($hidden_types[$post_type])) {
         return;
     }
     if (!in_array($post_type, pp_get_enabled_post_types())) {
         if (!in_array($post_type, array('revision')) && pp_get_option('display_hints')) {
             $type_obj = get_post_type_object($post_type);
             if ($type_obj->public) {
                 if (!in_array($post_type, apply_filters('pp_unfiltered_post_types', array()))) {
                     add_meta_box("pp_enable_type", __('Press Permit Settings', 'pp'), array(&$this, 'draw_settings_ui'), $post_type, 'advanced', 'default', array());
                 }
             }
         }
         return;
     }
     //if ( ! $this->_roles_editable( $src_name, $object_type ) )
     //	return;
     $ops = _pp_can_set_exceptions('read', $post_type, array('via_item_source' => 'post', 'for_item_source' => 'post')) ? array('read' => true) : array();
     $operations = apply_filters('pp_item_edit_exception_ops', $ops, 'post', $post_type);
     foreach (array_keys($operations) as $op) {
         if ($op_obj = pp_get_op_object($op, $post_type)) {
             // $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null
             add_meta_box("pp_{$op}_{$post_type}_exceptions", sprintf(__('%s Exceptions', 'pp'), $op_obj->noun_label), array(&$this, 'draw_exceptions_ui'), $post_type, 'advanced', 'default', array('op' => $op));
         }
     }
 }
 function add_meta_boxes()
 {
     // ========= register WP-rendered metaboxes ============
     global $typenow;
     $taxonomy = isset($_REQUEST['taxonomy']) ? pp_sanitize_key($_REQUEST['taxonomy']) : '';
     if (!in_array($taxonomy, pp_get_enabled_taxonomies())) {
         return;
     }
     $tt_id = !empty($_REQUEST['tag_ID']) ? pp_termid_to_ttid((int) $_REQUEST['tag_ID'], $taxonomy) : 0;
     $post_type = !empty($_REQUEST['pp_universal']) ? '' : $typenow;
     $hidden_types = apply_filters('pp_hidden_post_types', array());
     $hidden_taxonomies = apply_filters('pp_hidden_taxonomies', array());
     if (!empty($hidden_taxonomies[$taxonomy]) || $post_type && !empty($hidden_types[$post_type])) {
         return;
     }
     //TODO: selectively enable role assignment by non-administrator
     if (!current_user_can('pp_assign_roles') || apply_filters('pp_disable_exception_ui', false, 'term', $tt_id, $post_type)) {
         return;
     }
     //if ( ! $this->_roles_editable( $src_name, $object_type ) )
     //	return;
     $tx = get_taxonomy($taxonomy);
     $type_obj = get_post_type_object($post_type);
     $register_type = $post_type ? $post_type : 'post';
     $ops = _pp_can_set_exceptions('read', $post_type, array('via_item_source' => 'term', 'via_item_type' => $taxonomy, 'for_item_source' => 'post')) ? array('read' => true) : array();
     $operations = apply_filters('pp_item_edit_exception_ops', $ops, 'post', $taxonomy, $post_type);
     $boxes = array();
     foreach (array_keys($operations) as $op) {
         if ($op_obj = pp_get_op_object($op, $post_type)) {
             if ('assign' == $op) {
                 $title = $post_type ? sprintf(__('%1$s %2$s %3$s Exceptions', 'pp'), $type_obj->labels->singular_name, $tx->labels->singular_name, $op_obj->noun_label) : sprintf(__('%1$s %2$s Exceptions (all post types)', 'pp'), $tx->labels->singular_name, $op_obj->noun_label);
             } elseif (in_array($op, array('read', 'edit'))) {
                 $title = $post_type ? sprintf(__('%1$s %2$s Exceptions (all post statuses)', 'pp'), $type_obj->labels->singular_name, $op_obj->noun_label) : sprintf(__('%1$s Exceptions (all post types, statuses)', 'pp'), $op_obj->noun_label);
             } else {
                 $title = $post_type ? sprintf(__('%1$s %2$s Exceptions', 'pp'), $type_obj->labels->singular_name, $op_obj->noun_label) : sprintf(__('%1$s Exceptions (all post types)', 'pp'), $op_obj->noun_label);
             }
             pp_set_array_elem($boxes, array($op, "pp_{$op}_{$post_type}_exceptions"));
             $boxes[$op]["pp_{$op}_{$post_type}_exceptions"]['for_item_type'] = $post_type;
             $boxes[$op]["pp_{$op}_{$post_type}_exceptions"]['title'] = $title;
         }
     }
     $boxes = apply_filters('pp_term_exceptions_metaboxes', $boxes, $taxonomy, $post_type);
     foreach ($boxes as $op => $boxes) {
         foreach ($boxes as $box_id => $_box) {
             // $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null
             add_meta_box($box_id, $_box['title'], array(&$this, 'draw_exceptions_ui'), $register_type, 'normal', 'default', array('for_item_type' => $_box['for_item_type'], 'op' => $op));
         }
     }
 }
Пример #3
0
 function flt_manage_posts_custom_column($column_name, $id)
 {
     if ('pp_exceptions' == $column_name) {
         if (!empty($this->exceptions[$id])) {
             global $typenow;
             $op_names = array();
             foreach ($this->exceptions[$id] as $op) {
                 if ($op_obj = pp_get_op_object($op, $typenow)) {
                     $op_names[] = isset($op_obj->abbrev) ? $op_obj->abbrev : $op_obj->label;
                 }
             }
             uasort($op_names, 'strnatcasecmp');
             echo implode(", ", $op_names);
         }
     }
 }
Пример #4
0
 function custom_column($val, $column_name, $id)
 {
     if ('pp_exceptions' != $column_name) {
         return;
     }
     static $got_data;
     if (empty($got_data)) {
         $this->log_term_data();
         $got_data = true;
     }
     global $taxonomy;
     $id = pp_termid_to_ttid($id, $taxonomy);
     if (!empty($this->exceptions[$id])) {
         global $typenow;
         $op_names = array();
         foreach ($this->exceptions[$id] as $op) {
             if ($op_obj = pp_get_op_object($op, $typenow)) {
                 $op_names[] = $op_obj->label;
             }
         }
         uasort($op_names, 'strnatcasecmp');
         echo implode(", ", $op_names);
     }
 }
Пример #5
0
function _ppc_count_assigned_exceptions($agent_type, $args = array())
{
    global $wpdb;
    $defaults = array('query_agent_ids' => false, 'join_groups' => true);
    extract(array_merge($defaults, $args), EXTR_SKIP);
    $item_types = array_merge(pp_get_enabled_post_types(), pp_get_enabled_taxonomies(), pp_get_group_types(array('editable' => true)));
    $type_clause = "AND e.for_item_type IN ('','" . implode("','", $item_types) . "')";
    $type_clause .= " AND e.via_item_type IN ('','" . implode("','", $item_types) . "')";
    $ops_clause = "AND operation IN ('" . implode("','", pp_get_operations()) . "')";
    $count = array();
    $agent_type = pp_sanitize_key($agent_type);
    if ('user' == $agent_type && $join_groups) {
        $results = array();
        foreach (pp_get_group_types(array(), 'object') as $group_type => $gtype_obj) {
            global $wpdb;
            if (!empty($gtype_obj->schema['members'])) {
                extract($gtype_obj->schema['members']);
                // members_table, col_group, col_user
            } else {
                $members_table = $wpdb->pp_group_members;
                $col_member_group = 'group_id';
                $col_member_user = '******';
            }
            $agent_clause = $query_agent_ids ? "AND gm.{$col_member_user} IN ('" . implode("','", (array) $query_agent_ids) . "')" : '';
            if ('groups_only' === $join_groups || 'pp_group' != $group_type) {
                $agent_type_clause = "( e.agent_type = '{$group_type}' AND gm.{$col_member_group} = e.agent_id )";
            } else {
                $agent_type_clause = "( e.agent_type = 'user' AND gm.user_id = e.agent_id ) OR ( e.agent_type = 'pp_group' AND gm.group_id = e.agent_id )";
            }
            $_results = $wpdb->get_results("SELECT gm.{$col_member_user} as qry_agent_id, e.exception_id, e.for_item_source, e.for_item_type, e.via_item_type, e.operation, COUNT(DISTINCT i.exception_id, i.item_id) AS exc_count FROM {$wpdb->ppc_exception_items} AS i INNER JOIN {$wpdb->ppc_exceptions} AS e ON i.exception_id = e.exception_id INNER JOIN {$members_table} AS gm ON ( {$agent_type_clause} ) WHERE i.inherited_from = '0' {$ops_clause} {$type_clause} {$agent_clause} GROUP BY qry_agent_id, e.for_item_source, e.for_item_type, e.operation");
            $results = array_merge($results, $_results);
        }
    } else {
        $agent_clause = $query_agent_ids ? "AND e.agent_id IN ('" . implode("','", (array) $query_agent_ids) . "')" : '';
        $results = $wpdb->get_results("SELECT e.agent_id AS qry_agent_id, e.exception_id, e.for_item_source, e.for_item_type, e.operation, e.via_item_type, COUNT(DISTINCT i.exception_id, i.item_id) AS exc_count FROM {$wpdb->ppc_exception_items} AS i INNER JOIN {$wpdb->ppc_exceptions} AS e ON i.exception_id = e.exception_id WHERE i.inherited_from = '0' AND e.agent_type = '{$agent_type}' {$ops_clause} {$type_clause} {$agent_clause} GROUP BY qry_agent_id, e.for_item_source, e.for_item_type, e.operation");
    }
    foreach ($results as $row) {
        if (!$row->for_item_type) {
            $type_label = '';
        } else {
            if (!($type_obj = pp_get_type_object($row->for_item_source, $row->for_item_type))) {
                continue;
            }
            $type_label = $type_obj->labels->singular_name;
        }
        if ($op_obj = pp_get_op_object($row->operation, $row->for_item_type)) {
            if ('assign' == $row->operation) {
                if ($tx_obj = get_taxonomy($row->via_item_type)) {
                    $lbl = str_replace('Term', $tx_obj->labels->singular_name, $op_obj->label);
                } else {
                    $lbl = $op_obj->label;
                }
                //$lbl = sprintf( __('%2$s: %1$s', 'pp'), $op_lbl, $type_label );
            } elseif (isset($op_obj->abbrev)) {
                $lbl = $op_obj->abbrev;
            } else {
                $lbl = sprintf(__('%1$s %2$s', 'pp'), $op_obj->label, $type_label);
            }
        } else {
            $lbl = $type_label;
        }
        if (!isset($count[$row->qry_agent_id]['exceptions'][$lbl])) {
            $count[$row->qry_agent_id]['exceptions'][$lbl] = 0;
        }
        $count[$row->qry_agent_id]['exceptions'][$lbl] += $row->exc_count;
        if (!isset($count[$row->qry_agent_id]['exc_count'])) {
            $count[$row->qry_agent_id]['exc_count'] = 0;
        }
        $count[$row->qry_agent_id]['exc_count'] += $row->exc_count;
    }
    return $count;
}
Пример #6
0
    public static function _current_exceptions_ui($exc_results, $args = array())
    {
        global $pp_admin, $pp_role_defs, $pp_data_sources;
        $defaults = array('read_only' => false, 'class' => 'pp-group-roles', 'item_links' => false, 'caption' => '', 'link' => '', 'agent_type' => '');
        $args = array_merge($defaults, $args);
        extract($args);
        if (!$exc_results) {
            return;
        }
        if (!$caption) {
            $caption = 'user' == $agent_type ? sprintf(__('Exceptions %1$s(for user)%2$s', 'pp'), '<small>', '</small>') : __('Exceptions', 'pp');
        }
        require_once PPC_ABSPATH . '/lib/ancestry_lib_pp.php';
        $can_assign = current_user_can('pp_assign_roles') && pp_bulk_roles_enabled();
        $exceptions = array_fill_keys(array_merge(array('term', 'post'), pp_get_group_types()), array());
        $item_paths = array_fill_keys(array_keys($exceptions), array(__('(none)', 'pp')));
        // support imported include exception with no items included
        $post_types = pp_get_enabled_post_types(array(), 'names');
        $taxonomies = pp_get_enabled_taxonomies(array('object_type' => false), 'names');
        foreach ($exc_results as $row) {
            // object_type not strictly necessary here, included for consistency with term role array
            switch ($row->via_item_source) {
                case 'term':
                    if ($row->item_id) {
                        $taxonomy = '';
                        $term_id = (int) pp_ttid_to_termid($row->item_id, $taxonomy);
                        if ($row->item_id) {
                            $item_paths['term'][$row->item_id] = PP_Ancestry::get_term_path($term_id, $taxonomy);
                        }
                        $via_type = $taxonomy;
                    } else {
                        $via_type = $row->via_item_type;
                    }
                    break;
                case 'post':
                    if ($row->item_id) {
                        $item_paths['post'][$row->item_id] = PP_Ancestry::get_post_path($row->item_id);
                    }
                    // no break
                // no break
                default:
                    if (pp_group_type_exists($row->via_item_source)) {
                        static $groups_by_id;
                        if (!isset($groups_by_id)) {
                            $groups_by_id = array();
                        }
                        if (!isset($groups_by_id[$row->via_item_source])) {
                            $groups_by_id[$row->via_item_source] = array();
                            foreach (pp_get_groups($row->via_item_source, array('skip_meta_types' => 'wp_role')) as $group) {
                                $groups_by_id[$row->via_item_source][$group->ID] = $group->name;
                            }
                        }
                        if (isset($groups_by_id[$row->via_item_source][$row->item_id])) {
                            $item_paths[$row->via_item_source][$row->item_id] = $groups_by_id[$row->via_item_source][$row->item_id];
                        }
                        $via_type = $row->via_item_source;
                    } else {
                        $via_type = $row->via_item_type ? $row->via_item_type : $row->for_item_type;
                    }
            }
            if (!isset($exceptions[$row->via_item_source][$via_type])) {
                $exceptions[$row->via_item_source][$via_type] = array();
            }
            if (!isset($exceptions[$row->via_item_source][$via_type][$row->for_item_type])) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type] = array();
            }
            if (!isset($exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation])) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation] = array();
            }
            if (!isset($exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type])) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type] = array();
            }
            if (!isset($exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status])) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status] = array();
            }
            if (!isset($exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status][$row->item_id])) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status][$row->item_id] = array();
            }
            $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status][$row->item_id][$row->assign_for] = $row->eitem_id;
            if (!empty($row->inherited_from)) {
                $exceptions[$row->via_item_source][$via_type][$row->for_item_type][$row->operation][$row->mod_type][$row->for_item_status][$row->item_id]['inherited_from'] = $row->inherited_from;
            }
        }
        echo '<div style="clear:both;"></div>' . "<div id='pp_current_exceptions' class='pp-group-box {$class}'>" . '<h3>';
        if ($link) {
            echo "<a href='{$link}'>{$caption}</a>";
        } else {
            echo $caption;
        }
        echo '</h3>';
        echo '<div>';
        echo '<div id="pp_current_exceptions_inner">';
        //ksort( $type_roles );
        if (empty($_REQUEST['all_types']) && !empty($exceptions['post'])) {
            $all_types = array_fill_keys(array_merge($post_types, $taxonomies, array('')), true);
            $all_types = array_diff_key($all_types, array('topic' => true, 'reply' => true));
            // hide topic, reply assignments even if they are somehow saved/imported without inherited_from value
            $exceptions['post'] = array_intersect_key($exceptions['post'], $all_types);
            foreach (array_keys($exceptions['post']) as $key) {
                $exceptions['post'][$key] = array_intersect_key($exceptions['post'][$key], $all_types);
            }
        }
        foreach (array_keys($exceptions) as $via_src) {
            ksort($exceptions[$via_src]);
            foreach (array_keys($exceptions[$via_src]) as $via_type) {
                if ($via_type_obj = pp_get_type_object($via_src, $via_type)) {
                    $via_type_caption = $via_type_obj->labels->singular_name;
                } else {
                    continue;
                }
                $any_redundant = false;
                echo "<div id='pp_current_{$via_src}_{$via_type}_roles' class='pp-current-exceptions'>";
                /*
                if ( 'term' == $via_src )
                	echo '<h4>' . __( 'Per-Term:', 'pp' ) . '</h4>';
                else {
                	if ( $object_type )
                		echo '<h4>' . sprintf( __( 'Per-%s:', 'pp' ), $type_caption ) . '</h4>';
                	else
                		echo '<h4>' . sprintf( __( 'Per-object:', 'pp' ), $type_caption ) . '</h4>';
                }
                
                echo '<h4>' . sprintf( __( '%s Exceptions', 'pp' ), $via_type_caption ) . '</h4>';
                */
                ksort($exceptions[$via_src][$via_type]);
                foreach (array_keys($exceptions[$via_src][$via_type]) as $for_type) {
                    if (pp_group_type_exists($for_type)) {
                        $for_src = $for_type;
                    } else {
                        $for_src = taxonomy_exists($for_type) || !$for_type ? 'term' : 'post';
                    }
                    if (!$for_type) {
                        $for_type_obj = (object) array('labels' => (object) array('singular_name' => __('(all post types)', 'pp')));
                    } elseif (!($for_type_obj = pp_get_type_object($for_src, $for_type))) {
                        continue;
                    }
                    foreach (array_keys($exceptions[$via_src][$via_type][$for_type]) as $operation) {
                        if (!($operation_obj = pp_get_op_object($operation, $for_type))) {
                            continue;
                        }
                        if ('assign' == $operation) {
                            $op_caption = $for_type ? sprintf(__('%1$s (%2$s: %3$s)', 'pp'), $operation_obj->label, $for_type_obj->labels->singular_name, $via_type_caption) : sprintf(__('%1$s %2$s %3$s', 'pp'), $operation_obj->label, $via_type_caption, $for_type_obj->labels->singular_name);
                        } elseif (in_array($operation, array('manage', 'associate'))) {
                            $op_caption = sprintf(__('%1$s %2$s', 'pp'), $operation_obj->label, $via_type_caption);
                        } else {
                            $op_caption = sprintf(__('%1$s %2$s', 'pp'), $operation_obj->label, $for_type_obj->labels->singular_name);
                        }
                        echo "<div class='type-roles-wrapper'>";
                        echo '<h4>' . $op_caption . '</h4>';
                        echo "<div class='pp-current-type-roles'>";
                        echo '<div class="pp-current-roles-tbl-wrapper"><table>';
                        // fill table body (item assignments for each role)
                        echo '<tbody>';
                        foreach (array_keys($exceptions[$via_src][$via_type][$for_type][$operation]) as $mod_type) {
                            if (!($mod_type_obj = pp_get_mod_object($mod_type))) {
                                continue;
                            }
                            foreach (array_keys($exceptions[$via_src][$via_type][$for_type][$operation][$mod_type]) as $status) {
                                if ($status) {
                                    $_status = explode(':', $status);
                                    if (count($_status) > 1) {
                                        $attrib = $_status[0];
                                        $_status = $_status[1];
                                    } else {
                                        $attrib = 'post_status';
                                        $_status = $status;
                                    }
                                    if ('post_status' == $attrib) {
                                        if ($status_obj = get_post_status_object($_status)) {
                                            $status_label = $status_obj->label;
                                        } elseif ('{unpublished}' == $_status) {
                                            // @todo: API
                                            $status_label = __('unpublished', 'pp');
                                        } else {
                                            $status_label = $status;
                                        }
                                    } else {
                                        $status_label = $status;
                                    }
                                    $mod_caption = sprintf(__('%1$s (%2$s)', 'pp'), $mod_type_obj->label, $status_label);
                                } else {
                                    $mod_caption = $mod_type_obj->label;
                                }
                                if ('exclude' == $mod_type && !empty($exceptions[$via_src][$via_type][$for_type][$operation]['include'])) {
                                    $tr_class = ' class="pp_faded"';
                                    $mod_caption = sprintf(__('* %s', 'pp'), $mod_caption);
                                    $any_faded = true;
                                } else {
                                    $tr_class = '';
                                }
                                echo "<tr{$tr_class}><td class='pp_item_role_caption'>{$mod_caption}</td>";
                                echo '<td>';
                                //if ( $item_links ) {
                                //	if ( 'term' != $scope )
                                //		$edit_url_base = $pp_data_sources->member_property( $item_source, '_edit_link' );
                                //}
                                echo "<div class='pp-role-terms-wrapper pp-role-terms-{$via_type}'>";
                                if ('term' == $via_src && !in_array($operation, array('manage', 'associate'))) {
                                    if (taxonomy_exists($via_type)) {
                                        // "Categories:"
                                        $tx_obj = get_taxonomy($via_type);
                                        $tx_caption = $tx_obj->labels->name;
                                    } else {
                                        $tx_caption = '';
                                    }
                                    echo '<div class="pp-taxonomy-caption">' . sprintf(__('%s:', 'pp'), $tx_caption) . '</div>';
                                    //$edit_url_base = ( isset($tx_obj->_edit_link) ) ? $tx_obj->_edit_link : '';
                                }
                                echo '<div class="pp-role-terms">';
                                $tx_item_paths = array_intersect_key($item_paths[$via_src], $exceptions[$via_src][$via_type][$for_type][$operation][$mod_type][$status]);
                                uasort($tx_item_paths, 'strnatcasecmp');
                                // sort by array values, but maintain keys );
                                foreach ($tx_item_paths as $item_id => $item_path) {
                                    //$assignment = $roles[$scope][$role_name][$item_source][$item_type][$item_id];
                                    $assignment = $exceptions[$via_src][$via_type][$for_type][$operation][$mod_type][$status][$item_id];
                                    $classes = array();
                                    if (isset($assignment['children'])) {
                                        if (isset($assignment['item'])) {
                                            $ass_id = $assignment['item'] . ',' . $assignment['children'];
                                            $classes[] = 'role_both';
                                            $any_both = true;
                                        } else {
                                            $ass_id = '0,' . $assignment['children'];
                                            $classes[] = 'role_ch';
                                            $any_child_only = true;
                                        }
                                    } else {
                                        $ass_id = $assignment['item'];
                                    }
                                    $class = $classes ? "class='" . implode(' ', $classes) . "'" : '';
                                    if ($read_only) {
                                        if ($item_links) {
                                            //$item_edit_url = sprintf($edit_url_base, $item_id);
                                            $item_edit_url = '';
                                            echo "<div><a href='{$item_edit_url}' {$class}>{$item_path}</a></div>";
                                        } else {
                                            echo "<div><span {$class}>{$item_path}</span></div>";
                                        }
                                    } else {
                                        $cb_id = 'pp_edit_exception_' . str_replace(',', '_', $ass_id);
                                        if (!empty($assignment['inherited_from'])) {
                                            $classes[] = 'inherited';
                                            $classes[] = "from_{$assignment['inherited_from']}";
                                        }
                                        if ($tr_class) {
                                            // apply fading for redundantly stored exclusions
                                            $classes[] = $tr_class;
                                        }
                                        $lbl_class = $classes ? "class='" . implode(' ', $classes) . "'" : '';
                                        if ('term' == $via_src) {
                                            $edit_url = admin_url("edit-tags.php?taxonomy={$via_type}&action=edit&tag_ID=" . pp_ttid_to_termid($item_id, $via_type) . "&post_type={$for_type}");
                                        } else {
                                            $edit_url = admin_url("post.php?post={$item_id}&action=edit");
                                        }
                                        echo "<div><label for='{$cb_id}' {$lbl_class}><input id='{$cb_id}' type='checkbox' name='pp_edit_exception[]' value='{$ass_id}' {$class}> " . $item_path . '</label><a href="' . $edit_url . '">' . __('edit') . '</a></div>';
                                    }
                                }
                                // end foreach item
                                if (count($tx_item_paths) > 3 && !$read_only) {
                                    $cb_id = "pp_check_all_{$via_src}_{$via_type}_{$for_type}_{$operation}_{$status}";
                                    echo "<div><label for='{$cb_id}'><input type='checkbox' id='{$cb_id}' class='pp_check_all'> " . __('(all)', 'pp') . '</label></div>';
                                }
                                echo '</div></div>';
                                // pp-role-terms, pp-role-terms-wrapper
                                echo '</td></tr>';
                            }
                            // end foreach status
                        }
                        // end foreach mod_type
                        echo '</tbody>';
                        echo '</table></div>';
                        // pp-current-roles-tbl-wrapper
                        echo '<div class="pp-exception-bulk-edit" style="display:none">';
                        echo "<select><option value=''>" . __ppw('Bulk Actions', 'pp') . "</option><option value='remove'>" . __ppw('Remove', 'pp') . '</option>';
                        if ('post' == $via_src && (!$via_type || $via_type_obj->hierarchical)) {
                            echo "<option value='propagate'>" . sprintf(__('Assign for selected and sub-%s', 'pp'), $via_type_obj->labels->name) . '</option>';
                            echo "<option value='unpropagate'>" . sprintf(__('Assign for selected %s only', 'pp'), $via_type_obj->labels->singular_name) . '</option>';
                            echo "<option value='children_only'>" . sprintf(__('Assign for sub-%s only', 'pp'), $via_type_obj->labels->name) . '</option>';
                        } elseif ('term' == $via_src && $via_type_obj->hierarchical) {
                            echo "<option value='propagate'>" . __('Assign for selected and sub-terms', 'pp') . '</option>';
                            echo "<option value='unpropagate'>" . __('Assign for selected term only', 'pp') . '</option>';
                            echo "<option value='children_only'>" . __('Assign for sub-terms only', 'pp') . '</option>';
                        }
                        echo '</select>';
                        //submit_button( __ppw('Apply'), 'button-secondary submit-edit-item-exception', '', false );
                        ?>
						<input type="submit" name="" class="button submit-edit-item-exception" value="<?php 
                        _e('Apply', 'pp');
                        ?>
" />
						<?php 
                        echo '<img class="waiting" style="display:none;" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" alt="" />';
                        echo '</div>';
                        // pp-exception-bulk-edit
                        echo '</div></div>';
                        // type-roles-wrapper, pp-current-type-roles
                    }
                    // end foreach operation
                }
                // end foreach for_type
                if ($any_redundant) {
                    echo '<div class="pp-current-roles-note">' . __('* = exceptions redundant due to a corresponding &quot;only these&quot; entry', 'pp') . '</div>';
                }
                if (!empty($via_type_obj->hierarchical)) {
                    $_caption = strtolower($via_type_obj->labels->name);
                    if (!empty($any_both) || !empty($any_child_only)) {
                        ?>
						<div class="pp-current-roles-note">

						<?php 
                        if (!empty($any_both)) {
                            echo '<span class="role_both" style="padding-right:20px">' . sprintf(__('... = assigned for %1$s and sub-%1$s', 'pp'), $_caption) . '</span>';
                        }
                        if (!empty($any_child_only)) {
                            echo '<span>' . sprintf(__('* = assigned for sub-%s only', 'pp'), $_caption) . '</span>';
                        }
                        ?>
						</div>
					<?php 
                    }
                    $show_all_url = esc_url(add_query_arg('show_propagated', '1', $_SERVER['REQUEST_URI']));
                    $show_all_link = "&nbsp;&nbsp;<a href='{$show_all_url}'>";
                    if (empty($_REQUEST['show_propagated'])) {
                        if ('term' == $via_src) {
                            echo '<div class="pp-current-roles-note">' . sprintf(__('note: Exceptions inherited from parent %1$s are not displayed. %2$sshow all%3$s', 'pp'), $_caption, $show_all_link, '</a>') . '</div>';
                        } else {
                            echo '<div class="pp-current-roles-note">' . sprintf(__('note: Exceptions inherited from parent %1$s or terms are not displayed. %2$sshow all%3$s', 'pp'), $_caption, $show_all_link, '</a>') . '</div>';
                        }
                    }
                }
                echo '</div>';
                // pp-current-exceptions
            }
            // end foreach via_type
        }
        // end foreach via_src
        echo '</div>';
        // pp_current_exceptions_inner
        echo '</div>';
        // no class
        echo '</div>';
        // pp_current_exceptions
    }