本文整理汇总了PHP中Members::findOneByObjectId方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::findOneByObjectId方法的具体用法?PHP Members::findOneByObjectId怎么用?PHP Members::findOneByObjectId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::findOneByObjectId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPath
public function getPath($asString = true)
{
$member = Members::findOneByObjectId($this->getId());
$parents = array();
foreach ($member->getAllParentMembersInHierarchy(false) as $parent) {
$parents[] = $parent->getName();
}
$parents = array_reverse($parents);
if ($asString) {
if (count($parents)) {
return "(" . implode(" | ", $parents) . ")";
} else {
return "";
}
} else {
return $parents;
}
}
示例2: getIconClass
function getIconClass()
{
$d = Dimensions::findByCode('workspaces');
$m = Members::findOneByObjectId($this->getId(), $d->getId());
return "ico-color" . ($m instanceof Member ? $m->getColor() : '0');
}
示例3: core_dimensions_after_save_member_permissions
function core_dimensions_after_save_member_permissions($member, &$ignored) {
if (!$member instanceof Member || !($member->getId()>0)) return;
$permission_group_ids = array();
$cmp_rows = DB::executeAll("SELECT DISTINCT permission_group_id FROM ".TABLE_PREFIX."contact_member_permissions WHERE member_id = '".$member->getId()."' AND permission_group_id IN (SELECT id FROM ".TABLE_PREFIX."permission_groups WHERE type IN ('permission_groups','user_groups'))");
foreach ($cmp_rows as $row) {
$permission_group_ids[$row['permission_group_id']] = $row['permission_group_id'];
}
$contacts = array();
// users
if (count($permission_group_ids) > 0) {
$contacts = Contacts::findAll(array('conditions' => 'user_type > 0 && permission_group_id IN ('.implode(',', $permission_group_ids).')'));
}
// contacts
$contact_rows = DB::executeAll("SELECT DISTINCT om.object_id FROM ".TABLE_PREFIX."object_members om INNER JOIN ".TABLE_PREFIX."contacts c ON c.object_id=om.object_id
WHERE om.member_id='".$member->getId()."' AND c.user_type=0");
$no_user_ids = array();
if (is_array($contact_rows)) {
foreach ($contact_rows as $row) {
$no_user_ids[] = $row['object_id'];
}
}
$more_contacts = Contacts::findAll(array('conditions' => 'object_id IN ('.implode(',', $no_user_ids).')'));
$contacts = array_merge($contacts, $more_contacts);
$contact_ids = array(0);
$persons_dim = Dimensions::findByCode("feng_persons");
core_dim_remove_contacts_member_associations($member);
foreach ($contacts as $contact) {
$contact_id = $contact->getId();
$contact_member = Members::findOneByObjectId($contact_id, $persons_dim->getId());
if ($contact_member instanceof Member) {
core_dim_add_contact_member_associations($contact_member, $member);
if ($contact instanceof Contact && $contact->isUser()) {
$has_project_permissions = ContactMemberPermissions::instance()->count("permission_group_id = '".$contact->getPermissionGroupId()."' AND member_id = ".$member->getId()) > 0;
if (!$has_project_permissions) {
RoleObjectTypePermissions::createDefaultUserPermissions($contact, $member);
}
}
}
// add user content object to customer member
ObjectMembers::addObjectToMembers($contact_id, array($member));
$contact->addToSharingTable();
$contact_ids[] = $contact_id;
}
// remove contacts whose members are no longer associated to the customer member
$previous_users_in_member = Contacts::instance()->listing(array(
'member_ids' => array($member->getId()),
'ignore_context' => true,
'extra_conditions' => ' AND e.user_type > 0 AND e.object_id NOT IN ('.implode(',', $contact_ids).')',
))->objects;
foreach ($previous_users_in_member as $prev_u) {
ObjectMembers::removeObjectFromMembers($prev_u, logged_user(), array($member), array($member->getId()));
}
// refresh dimensions
evt_add("reload dimension tree", array('dim_id' => $persons_dim->getId(), 'node' => null));
}