function get_member_childs() { $mem_id = array_var($_GET, 'member'); $offset = array_var($_REQUEST, 'offset', 0); $limit = array_var($_REQUEST, 'limit', 100); $new_limit = $limit + 1; if (function_exists('logged_user') && logged_user() instanceof Contact && ContactMemberPermissions::contactCanAccessMemberAll(implode(',', logged_user()->getPermissionGroupIds()), $mem_id, logged_user(), ACCESS_LEVEL_READ)) { $mem = Members::getMemberById($mem_id); if ($mem instanceof Member) { //Do not use contact member cache for superadmins if (!logged_user()->isAdministrator()) { //use the contact member cache $dimension = $mem->getDimension(); $params = array("dimension" => $dimension, "contact_id" => logged_user()->getId(), "parent_member_id" => $mem->getId(), "extra_condition" => " AND m.archived_by_id=0 ", "start" => $offset, "limit" => $new_limit, "order" => '`name`', "order_dir" => 'ASC'); $childs = $member_cache_list = ContactMemberCaches::getAllMembersWithCachedParentId($params); } else { $childs = Members::getSubmembers($mem, false, "", null, null, $offset, $new_limit); } $more_nodes_left = false; if (count($childs) > $limit) { $more_nodes_left = true; array_pop($childs); } // filter $childs by other dimension associations $context = active_context(); $filter_by_members = array(); foreach ($context as $selection) { if ($selection instanceof Member) { $filter_by_members[] = $selection; } } // build resultant member list $members = $this->buildMemberList($childs, $mem->getDimension(), null, null, null, null); ajx_extra_data(array("members" => $members, "dimension" => $mem->getDimensionId(), "member_id" => $mem->getId(), "more_nodes_left" => $more_nodes_left)); } } ajx_current("empty"); }
function active_context_members($full = true ) { $ctxMembers = array (); if (is_array(active_context())) { foreach (active_context() as $ctx) { if ( $ctx instanceof Member ) { /* @var Dimension $ctx */ $ctxMembers[$ctx->getId()] = $ctx->getId() ; if($full){ foreach ( Members::getSubmembers($ctx, 1) as $sub ) { $ctxMembers[$sub->getId()] = $sub->getId() ; } } } if ( $full && $ctx instanceof Dimension ) { /// @var Dimension $ctx foreach ($ctx->getAllMembers() as $member) { $ctxMembers[$member->getId()] = $member->getId() ; foreach ( Members::getSubmembers($member, 1) as $sub ) { $ctxMembers[$sub->getId()] = $sub->getId() ; } } } } } return $ctxMembers ; }