本文整理汇总了PHP中Members::getMemberById方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::getMemberById方法的具体用法?PHP Members::getMemberById怎么用?PHP Members::getMemberById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::getMemberById方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lang
if (!isset($parent_sel)) {
$parent_sel = 0;
}
if (!isset($obj_type_sel)) {
$obj_type_sel = 0;
}
if (!isset($member)) {
$member = null;
}
$member_color = 0;
if ($member instanceof Member && !$member->isNew()) {
$memberId = $member->getId();
$member_color = $member->getColor();
} else {
if ($parent_sel > 0) {
$p = Members::getMemberById($parent_sel);
if ($p instanceof Member) {
$member_color = $p->getColor();
}
}
}
$object_type_selected = $obj_type_sel > 0 ? ObjectTypes::findById($obj_type_sel) : null;
if ($member instanceof Member && !$member->isNew()) {
$object_type_name = lang(ObjectTypes::findById($member->getObjectTypeId())->getName());
} else {
$object_type_name = $object_type_selected instanceof ObjectType ? lang($object_type_selected->getName()) : null;
}
if ($member instanceof Member && $member->isNew()) {
$member->setObjectTypeId($obj_type_sel);
}
if ($member instanceof Member && !$member->isNew()) {
示例2: get_members
function get_members()
{
$member_ids = json_decode(array_var($_REQUEST, 'member_ids', null));
if (!is_array($member_ids)) {
$member_ids = null;
} else {
$all_members = array();
$all_members_ids = array();
foreach ($member_ids as $m) {
if (function_exists('logged_user') && logged_user() instanceof Contact && ContactMemberPermissions::contactCanAccessMemberAll(implode(',', logged_user()->getPermissionGroupIds()), $m, logged_user(), ACCESS_LEVEL_READ)) {
$mem = Members::getMemberById($m);
if ($mem instanceof Member) {
$parents = $mem->getAllParentMembersInHierarchy(true);
$all_members[] = $this->buildMemberList($parents, $mem->getDimension(), null, null, null, null);
}
}
}
ajx_extra_data(array("members" => $all_members));
}
ajx_current("empty");
}
示例3: foreach
<?php
}
?>
<?php
foreach (array_var($draw_options, 'show_dimension_cols') as $dim_col) {
if ($dim_col == 0) {
continue;
}
$dim_member_path = json_decode(str_replace("'", '"', $task['memPath']), true);
$dim_mem_path_html = "";
$mem_ids = $dim_member_path[$dim_col];
if (is_array($mem_ids) && count($mem_ids) > 0) {
$sep = '<span class="print-breadcrumb">-</span>';
foreach ($mem_ids as $mem_id) {
$mem = Members::getMemberById($mem_id);
if ($mem instanceof Member) {
$this_mem_path = $mem->getPathToPrint($sep, '<span class="print-breadcrumb">', '</span>');
$this_mem_path .= ($this_mem_path == "" ? "" : $sep) . '<span class="print-breadcrumb wide">' . $mem->getName() . '</span>';
$dim_mem_path_html .= '<span class="member-path real-breadcrumb og-wsname-color-' . $mem->getColor() . '">' . $this_mem_path . '</span>';
}
}
}
?>
<td class='task_name'>
<div class='task-breadcrumb-container'>
<?php
echo $dim_mem_path_html;
?>
</div>
</td>
示例4: list_members
private function list_members($request)
{
$service = $request['srv'];
$start = !empty($request['args']['start']) ? $request['args']['start'] : 0;
$limit = !empty($request['args']['limit']) ? $request['args']['limit'] : null;
$name = !empty($request['args']['name']) ? $request['args']['name'] : "";
$members = array();
$type = ObjectTypes::instance()->findByName($service);
$typeId = $type->getId();
if ($service == "workspace") {
$dimension_id = Dimensions::findByCode('workspaces')->getId();
} else {
$dimension_id = Dimensions::findByCode('customer_project')->getId();
}
$limit_obj = array('offset' => $start, 'limit' => $limit);
$extra_conditions = null;
if ($name != "") {
$extra_conditions = "AND name LIKE '%" . $name . "%'";
}
$params = array('dim_id' => $dimension_id, 'type_id' => $typeId, 'start' => $start, 'limit' => $limit);
$memberController = new MemberController();
$object = $memberController->list_all($params);
foreach ($object["members"] as $m) {
$member = Members::getMemberById($m['id']);
$memberInfo = array('id' => $m['id'], 'name' => $m['name'], 'type' => $service, 'path' => $member->getPath());
$members[] = $memberInfo;
}
return $this->response('json', $members);
}
示例5: view
function view()
{
$id = array_var($_GET, 'id');
$obj = Objects::findObject($id);
if (!$obj) {
$obj = Members::getMemberById($id);
}
if (!$obj instanceof DataObject) {
flash_error(lang('object dnx'));
ajx_current("empty");
return;
}
// if
if (!$obj->canView(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
$object_type = ObjectTypes::findById($obj->getObjectTypeId());
if ($object_type->getType() == 'dimension_object') {
ajx_current("empty");
} elseif ($object_type->getType() == 'dimension_group') {
ajx_current("empty");
} else {
redirect_to($obj->getObjectUrl(), true);
}
}
示例6: get_default_member_permission
function get_default_member_permission($parent, $permission_parameters)
{
//inherit permission from parent
if ($parent != 0 && config_option('inherit_permissions_from_parent_member')) {
$parent_member = Members::getMemberById($parent);
if ($parent_member instanceof Member) {
$parent_permissions = permission_member_form_parameters($parent_member);
$permission_parameters['permission_groups'] = $parent_permissions['permission_groups'];
$permission_parameters['member_permissions'] = $parent_permissions['member_permissions'];
}
}
// Add default permissions for executives, managers and administrators
if (config_option('add_default_permissions_for_users')) {
if ($parent == 0) {
$user_types = implode(',', config_option('give_member_permissions_to_new_users'));
if (trim($user_types) != "") {
$users = Contacts::findAll(array('conditions' => "user_type IN (" . $user_types . ")"));
foreach ($users as $user) {
if (!isset($permission_parameters['member_permissions'][$user->getPermissionGroupId()]) || count($permission_parameters['member_permissions'][$user->getPermissionGroupId()]) == 0) {
$user_pg = array();
foreach ($permission_parameters['allowed_object_types'] as $ot) {
$role_perm = RoleObjectTypePermissions::findOne(array('conditions' => array("role_id=? AND object_type_id=?", $user->getUserType(), $ot->getId())));
$user_pg[] = array('o' => $ot->getId(), 'w' => $role_perm instanceof RoleObjectTypePermission ? $role_perm->getCanWrite() ? 1 : 0 : 0, 'd' => $role_perm instanceof RoleObjectTypePermission ? $role_perm->getCanDelete() ? 1 : 0 : 0, 'r' => $role_perm instanceof RoleObjectTypePermission ? 1 : 0);
}
$permission_parameters['member_permissions'][$user->getPermissionGroupId()] = $user_pg;
}
}
}
}
}
return $permission_parameters;
}
示例7: getMembersToDisplayPath
function getMembersToDisplayPath($member_ids = null, $show_all_members = false, $show_active_context_members = true)
{
$members_info = array();
if (is_null($member_ids)) {
$member_ids = ObjectMembers::getMemberIdsByObject($this->getId());
}
$members = $this->manager()->getCachedMembersInfo($member_ids);
$dimension_options = array();
$member_count = array();
$active_context_ids = active_context_members(false);
$to_display = user_config_option('breadcrumb_member_count');
if (count($members) > 0) {
foreach ($members as $mem) {
$dimension = Dimensions::getDimensionById($mem['dimension_id']);
if (intval($dimension->getOptionValue('showInPaths'))) {
if (!isset($members_info[$mem['dimension_id']])) {
$members_info[$mem['dimension_id']] = array();
}
$active_context_condition = true;
if (!$show_active_context_members) {
$active_context_condition = !in_array($mem['id'], $active_context_ids);
}
if (!$show_all_members && count($members_info[$mem['dimension_id']]) < $to_display && $active_context_condition) {
$members_info[$mem['dimension_id']][$mem['id']] = array('ot' => $mem['object_type_id'], 'c' => Members::getMemberById($mem['id'])->getMemberColor(), 'name' => $mem['name']);
}
if (!isset($member_count[$mem['dimension_id']])) {
$member_count[$mem['dimension_id']] = 1;
} else {
$member_count[$mem['dimension_id']]++;
}
}
}
}
foreach ($member_count as $did => $cant) {
$members_info[$did]['total'] = $cant;
}
return $members_info;
}
示例8: setParentMemberId
function setParentMemberId($value)
{
$parent = Members::getMemberById($value);
if ($parent instanceof Member) {
$parent_type = $parent->getObjectTypeId();
$parents_types = DimensionObjectTypeHierarchies::getAllParentObjectTypeIds($this->getDimensionId(), $this->getObjectTypeId(), false);
if (in_array($parent_type, $parents_types)) {
return parent::setParentMemberId($value);
} else {
//error
Logger::log("Not valid parent member type '{$parent_type}'," . $this->getObjectTypeId());
$errors = array();
$errors[] = "Not valid parent member type";
throw new DAOValidationError($this, $errors);
}
} else {
return parent::setParentMemberId(0);
}
}
示例9: getMembersToDisplayPath
function getMembersToDisplayPath($member_ids = null, $show_all_members = false) {
$members_info = array();
if (is_null($member_ids)) {
$member_ids = ObjectMembers::getMemberIdsByObject($this->getId());
}
$members = $this->manager()->getCachedMembersInfo($member_ids);
$dimension_options = array();
$member_count = array();
$active_context_ids = active_context_members(false);
if(count($members) > 0){
foreach ($members as $mem) {
$options = Dimensions::getDimensionById($mem['dimension_id'])->getOptions(true);
if (isset($options->showInPaths) && $options->showInPaths) {
if (!isset($members_info[$mem['dimension_id']])) $members_info[$mem['dimension_id']] = array();
if (!$show_all_members && count($members_info[$mem['dimension_id']]) < 2 && !in_array($mem['id'], $active_context_ids)) {
$members_info[$mem['dimension_id']][$mem['id']] = array(
'ot' => $mem['object_type_id'],
'c' => Members::getMemberById($mem['id'])->getMemberColor(),
'name' => $mem['name'],
);
}
if (!isset($member_count[$mem['dimension_id']])) $member_count[$mem['dimension_id']] = 1;
else $member_count[$mem['dimension_id']]++;
}
}
}
foreach ($member_count as $did => $cant) {
$members_info[$did]['total'] = $cant;
}
return $members_info;
}