$agent_name )
// $sorted_roles[$agent_id] = $roles[$agent_id];
foreach( $roles as $agent_id => $val ) {
if ( $limitation_type = $val['date_limited'] + ( 2 * $val['content_date_limited'] ) )
$date_limits[ $agent_id ] = $val;
if ( is_array($val) && ! empty($val['inherited_from']) )
$role_propagated[$agent_id] = true;
if ( is_array($val) && ( 'both' == $val['assign_for'] ) )
$agent_grouping[$limitation_type][ASSIGN_FOR_BOTH_RS] [$agent_id]= $agent_names[$agent_id];
elseif ( is_array($val) && ( 'children' == $val['assign_for'] ) )
$agent_grouping[$limitation_type][ASSIGN_FOR_CHILDREN_RS] [$agent_id]= $agent_names[$agent_id];
else
$agent_grouping[$limitation_type][ASSIGN_FOR_ENTITY_RS] [$agent_id]= $agent_names[$agent_id];
}
// display for_entity assignments first, then for_both, then for_children
$assign_for_order = array( 'entity', 'both', 'children');
$use_agents_csv = scoper_get_option("{$role_basis}_role_assignment_csv");
foreach ( array_keys($agent_grouping) as $limitation_type ) {
foreach ( $assign_for_order as $assign_for ) {
if ( ! isset($agent_grouping[$limitation_type][$assign_for]) )
continue;
// sort each assign_for grouping alphabetically
uasort($agent_grouping[$limitation_type][$assign_for], 'strnatcasecmp');
foreach ( $agent_grouping[$limitation_type][$assign_for] as $agent_id => $agent_name ) {
// surround rolename with bars to indicated it was inherited
$pfx = ( isset($role_propagated[$agent_id]) ) ? '{' : '';
$sfx = '';
if ( $checkbox_base_id ) {
if ( $use_agents_csv )
$js_call = "agp_append('{$role_basis}_csv', ', $agent_name');";
else
$js_call = "agp_check_it('{$checkbox_base_id}{$agent_id}');";
$link_end = " href='javascript:void(0)' onclick=\"$js_call\">";
$sfx = '';
}
// surround rolename with braces to indicated it was inherited
if ( $pfx )
$sfx .= '}';
$limit_class = '';
$limit_style = '';
$link_class = 'rs-link_plain';
$title_text = '';
if ( $limitation_type ) {
ScoperAdminUI::set_agent_formatting( $date_limits[$agent_id], $title_text, $limit_class, $link_class, $limit_style );
$title = "title='$title_text'";
} else
$title = "title='select'";
switch ( $assign_for ) {
case ASSIGN_FOR_BOTH_RS:
//roles which are assigned for entity and children will be bolded in list
$link = ( $link_end ) ? "" . $link . $agent_names[$agent_id] . $sfx . '';
break;
case ASSIGN_FOR_ENTITY_RS:
$link = ( $link_end ) ? "" . $agent_list[$limitation_type][$assign_for] . '';
} // end foreach assign_for
$agent_list[$limitation_type] = implode(', ', $agent_list[$limitation_type]);
}
if ( $agent_list )
return implode(', ', $agent_list);
}
function taxonomy_scroll_links($tx, $terms, $admin_terms = '') {
$max_terms = ( defined( 'SCOPER_MAX_TAXONOMY_SCROLL_LINKS' ) ) ? SCOPER_MAX_TAXONOMY_SCROLL_LINKS : 100;
if ( empty($terms) || ( is_array($admin_terms) && empty($admin_terms) ) || ( count($terms) > $max_terms ) )
return;
echo '' . __('Scroll to current settings:','scoper') . '
';
if ( $admin_terms && ! is_array($admin_terms) )
$admin_terms = '';
global $scoper;
$tx_src = $scoper->data_sources->get( $tx->source );
$col_id = $tx_src->cols->id;
$col_name = $tx_src->cols->name;
$col_parent = ( ! empty($tx_src->cols->parent) ) ? $tx_src->cols->parent : '';
$font_ems = 1.2;
$text = '';
$term_num = 0;
$parent_id = 0;
$last_id = -1;
$last_parent_id = -1;
$parents = array();
$depth = 0;
foreach( $terms as $term ) {
$term_id = $term->$col_id;
if ( isset($term->$col_parent) )
$parent_id = $term->$col_parent;
if ( ! $admin_terms || ! empty($admin_terms[$term_id]) ) {
if ( $parent_id != $last_parent_id ) {
if ( ($parent_id == $last_id) && $last_id ) {
$parents[] = $last_id;
$depth++;
} elseif ($depth) {
do {
array_pop($parents);
$depth--;
} while ( $parents && ( end($parents) != $parent_id ) && $depth);
}
$last_parent_id = $parent_id;
}
//echo "term {$term->$col_name}: depth $depth, current parents: ";
//dump($parents);
if ( $term_num )
$text .= ( $parent_id ) ? ' - ' : ' . ';
if ( ! $parent_id )
$depth = 0;
$color_level_b = ($depth < 4) ? 220 - (60 * $depth) : 0;
$hexb = dechex($color_level_b);
if ( strlen($hexb) < 2 )
$hexb = "0" . $hexb;
$color_level_g = ($depth < 4) ? 80 + (40 * $depth) : 215;
$hexg = dechex($color_level_g);
$font_ems = ($depth < 5) ? 1.2 - (0.12 * $depth) : 0.6;
$text .= "{$term->$col_name}";
}
$last_id = $term_id;
$term_num++;
}
$text .= '
';
return $text;
}
function display_date_limit_inputs( $role_duration = true, $content_date_limits = true ) {
echo '
';
}
function display_touch_time( $stamp, $date, $id_prefix = '', $class = 'curtime', $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0, $suppress_hidden_inputs = true, $suppress_current_inputs = true, $use_js = false, $empty_month_option = true ) { // todo: move to $args array, default suppress to false
if ( $use_js ) {
echo '';
printf($stamp, $date);
echo '';
echo ' ';
$class = 'hide_if_js ';
} else
$class = '';
echo '