本文整理汇总了PHP中group::getGroupsOwnedBy方法的典型用法代码示例。如果您正苦于以下问题:PHP group::getGroupsOwnedBy方法的具体用法?PHP group::getGroupsOwnedBy怎么用?PHP group::getGroupsOwnedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group
的用法示例。
在下文中一共展示了group::getGroupsOwnedBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/*********************************************************
* Fetch all of the info for all of the sites and slots
* that the user is an editor or owner for, so we don't have
* to get them again.
*********************************************************/
// this should include all sites that the user owns as well.
$userOwnedSlots = slot::getSlotInfoWhereUserOwner($_GET['user']);
if (!array_key_exists($_GET['user'], $userOwnedSlots)) {
$userOwnedSlots[$_GET['user']] = array();
$userOwnedSlots[$_GET['user']]['slot_name'] = $_GET['user'];
$userOwnedSlots[$_GET['user']]['slot_type'] = 'personal';
$userOwnedSlots[$_GET['user']]['slot_owner'] = $_GET['user'];
$userOwnedSlots[$_GET['user']]['site_exits'] = false;
}
// Add any user-owned groups that aren't already in the slot list
$userOwnedGroups = group::getGroupsOwnedBy($_GET['user']);
foreach ($userOwnedGroups as $classSiteName) {
if (!isset($userOwnedSlots[$classSiteName])) {
$userOwnedSlots[$classSiteName] = array();
$userOwnedSlots[$classSiteName]['slot_name'] = $classSiteName;
$userOwnedSlots[$classSiteName]['slot_type'] = 'class';
$userOwnedSlots[$classSiteName]['slot_owner'] = $_GET['user'];
$userOwnedSlots[$classSiteName]['site_exits'] = false;
}
}
$siteLevelEditorSites = segue::getSiteInfoWhereUserIsSiteLevelEditor($_GET['user']);
if (!is_array($siteLevelEditorSites)) {
$siteLevelEditorSites = array();
}
// $anyLevelEditorSites = segue::getSiteInfoWhereUserIsEditor($_GET['user']);
$allSlots = array_merge($userOwnedSlots, $userOwnedGroups, $siteLevelEditorSites);
示例2: allSitesSlots
/**
* Build an array of all of the sites and slots that the user
* is either the owner of or an editor (has permission add, edit, and delete) of
*/
function allSitesSlots($user)
{
global $classes, $usersFutureClasses;
$allsites = array();
// The user's personal site
if ($user == slot::getOwner($user) || !slot::exists($user)) {
$allsites[$user] = array();
$allsites[$user]['slot_name'] = $user;
$allsites[$user]['slot_type'] = 'personal';
$allsites[$user]['owner_uname'] = $user;
$allsites[$user]['site_exits'] = false;
}
// Add slots that the user is an owner of.
// This will include all of the created sites as well
$allsites = array_merge($allsites, $slots);
// Add the sites that the user is a Site-Level Editor for.
$allsites = array_merge($allsites, segue::getSiteInfoWhereUserIsSiteLevelEditor($user));
$sitesEditorOf = segue::getSiteInfoWhereUserIsSiteLevelEditor($user);
$usersAllClasses = array();
if ($_SESSION[atype] == 'prof') {
foreach ($classes as $n => $v) {
$usersAllClasses[] = $n;
}
foreach ($usersFutureClasses as $n => $v) {
$usersAllClasses[] = $n;
}
}
printpre($allsites);
printpre($usersAllClasses);
printpre($sitesEditorOf);
printpre($sitesOwnerOf);
printpre($slots);
$allsites = array_unique(array_merge($allsites, $usersAllClasses, $sitesOwnerOf, $sitesEditorOf, $slots));
$allGroups = group::getGroupsOwnedBy($user);
$sitesInGroups = array();
foreach ($allGroups as $n => $g) {
$sitesInGroups = array_unique(array_merge($sitesInGroups, group::getClassesFromName($g)));
}
foreach ($allsites as $n => $site) {
if (!in_array($site, $sitesInGroups)) {
$allsites2[] = $site;
}
}
$allsites = array_merge($allsites2, $allGroups);
asort($allsites);
/* print "<pre>"; print_r($usersAllClasses); print "</pre>"; */
$sites = array();
$slots = array();
foreach ($allsites as $n => $site) {
$siteObj =& new site($site);
$exists = $siteObj->fetchFromDB();
if ($exists) {
$sites[] = $site;
} else {
$slots[] = $site;
}
}
return array($sites, $slots);
}