本文整理汇总了PHP中getGroup函数的典型用法代码示例。如果您正苦于以下问题:PHP getGroup函数的具体用法?PHP getGroup怎么用?PHP getGroup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getGroup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroup
function getGroup($id)
{
global $db;
$query_select = $db->query("SELECT * FROM catalog_groups WHERE `id`='{$id}'");
$res = $db->fetch_assoc($query_select);
if ($res["parent"] == 0) {
$result[$res['id']] = $res;
} else {
$result = getGroup($res["parent"]);
}
return $result;
}
示例2: createGroup
function createGroup($params)
{
if (is_array($error = secureRequest($params, TRUE))) {
return $error;
}
global $groupEnforceGroupPerms, $requestingAgent, $uuidZero, $groupDBCon;
$groupID = $params["GroupID"];
$name = addslashes($params["Name"]);
$charter = addslashes($params["Charter"]);
$insigniaID = $params["InsigniaID"];
$founderID = $params["FounderID"];
$membershipFee = $params["MembershipFee"];
$openEnrollment = $params["OpenEnrollment"];
$showInList = $params["ShowInList"];
$allowPublish = $params["AllowPublish"];
$maturePublish = $params["MaturePublish"];
$ownerRoleID = $params["OwnerRoleID"];
$everyonePowers = $params["EveryonePowers"];
$ownersPowers = $params["OwnersPowers"];
// Create group
$sql = "INSERT INTO osgroup\n (GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, AllowPublish, MaturePublish, OwnerRoleID)\n VALUES\n ('{$groupID}', '{$name}', '{$charter}', '{$insigniaID}', '{$founderID}', {$membershipFee}, {$openEnrollment}, {$showInList}, {$allowPublish}, {$maturePublish}, '{$ownerRoleID}')";
if (!mysql_query($sql, $groupDBCon)) {
return array('error' => "Could not successfully run query ({$sql}) from DB: " . mysql_error(), 'params' => var_export($params, TRUE));
}
// Create Everyone Role
// NOTE: FIXME: This is a temp fix until the libomv enum for group powers is fixed in OpenSim
$result = _addRoleToGroup(array('GroupID' => $groupID, 'RoleID' => $uuidZero, 'Name' => 'Everyone', 'Description' => 'Everyone in the group is in the everyone role.', 'Title' => "Member of {$name}", 'Powers' => $everyonePowers));
if (isset($result['error'])) {
return $result;
}
// Create Owner Role
$result = _addRoleToGroup(array('GroupID' => $groupID, 'RoleID' => $ownerRoleID, 'Name' => 'Owners', 'Description' => "Owners of {$name}", 'Title' => "Owner of {$name}", 'Powers' => $ownersPowers));
if (isset($result['error'])) {
return $result;
}
// Add founder to group, will automatically place them in the Everyone Role, also places them in specified Owner Role
$result = _addAgentToGroup(array('AgentID' => $founderID, 'GroupID' => $groupID, 'RoleID' => $ownerRoleID));
if (isset($result['error'])) {
return $result;
}
// Select the owner's role for the founder
$result = _setAgentGroupSelectedRole(array('AgentID' => $founderID, 'RoleID' => $ownerRoleID, 'GroupID' => $groupID));
if (isset($result['error'])) {
return $result;
}
// Set the new group as the founder's active group
$result = _setAgentActiveGroup(array('AgentID' => $founderID, 'GroupID' => $groupID));
if (isset($result['error'])) {
return $result;
}
return getGroup(array("GroupID" => $groupID));
}
示例3: isUserInRole
function isUserInRole($group)
{
$g = getGroup();
if ($group == 'admin') {
return $g == 'admin';
}
if ($group == 'user') {
return $g == 'admin' || $g == 'user';
}
if ($group == 'guest') {
return $g == 'admin' || $g == 'user' || $g == 'guest';
}
return false;
}
示例4: getUsersGroups
function getUsersGroups($mysqli, $userId)
{
if (doesUserExist($mysqli, $userId)) {
if ($stmt = $mysqli->prepare("SELECT group_id FROM members_groups WHERE member_id = ?")) {
$stmt->bind_param("i", $userId);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($groupId);
$result = array();
while ($stmt->fetch()) {
$group = getGroup($mysqli, $groupId);
if (is_array($group)) {
array_push($result, $group);
}
}
return $result;
} else {
return "Faulty MYSQLI Statement";
}
} else {
return "User does not exist";
}
}
示例5: getUser
$user = getUser($R_user['user_id'], true);
echo ' <tr>' . chr(10);
echo ' <td>' . '<a href="user.php?user_id=' . $user['user_id'] . '">' . iconHTML('user') . ' ' . $user['user_name'] . '</a>' . '</td>' . chr(10);
echo ' <td>' . $user['user_name_short'] . '</td>' . chr(10);
echo ' <td>';
$area_user = getArea($user['user_area_default']);
if (!count($area_user)) {
$area_user['area_name'] = '';
}
echo $area_user['area_name'];
echo '</td>' . chr(10);
echo ' </tr>' . chr(10) . chr(10);
}
echo '</table>' . chr(10);
} else {
$group = getGroup($_GET['gid']);
if (count($group)) {
echo '<b>Viser brukergruppen ' . $group['group_name'] . '</b><br />' . chr(10);
echo '<a href="telefonliste.php?gid=' . $group['group_id'] . '">Vis som telefonliste</a><br />';
if (!count($group['users'])) {
echo '<i>Ingen brukere på denne listen</i>';
} else {
echo '<table class="prettytable">';
echo ' <tr>' . chr(10);
echo ' <th>Navn</th>' . chr(10);
echo ' <th>Telefon</th>' . chr(10);
echo ' <th>Stilling</th>' . chr(10);
echo ' </tr>' . chr(10);
foreach ($group['users'] as $user) {
$user = getUser($user);
if (count($user) && !$user['deactivated']) {
示例6: getGroup
?>
<b
class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="profile.php"><i class="fa fa-fw fa-user"></i> Profile</a>
</li>
<li class="divider"></li>
<li>
<a href="logout.php"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
</li>
</ul>
</li>
</ul>
<?php
$data = getGroup($_SESSION["login_user"]);
?>
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">
<a href="dashboard.php"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
</li>
<li>
<a href="javascript:" data-toggle="collapse" data-target="#demo"><i
class="fa fa-fw fa-arrows-v"></i> My Groups <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="collapse">
<?php
foreach ($data as $oneGroup) {
//echo "<li><form action='grouppage.php' method='post'><input type='submit' name='groupname' value='$oneGroup[0]'/></form></li>";
示例7: getUsersForDataFileName
/**
* Usage: Look for a certain file (param filename) for all users of this group.
* Return a list of users that have this file
* 1. Get the group the user is a member of
* 2a. User is in a group
* - search all users if the have the file (param filename)
* 2b. User is not in a group
* - search for the file for this user only (param user)
* @param type $user Example 'John'
* @param type $excludeRequestingUser exclude the requesting user (example 'John') from the returned result
* @param type $fileName Example: '2013-03-18.gpx'
* @return string String containing all found user names separated by a newline char
* (every line contains one user)
*/
function getUsersForDataFileName($user, $fileName, $excludeRequestingUser)
{
if (!writeAllGpxFromCsvForGroup($user)) {
return '';
}
$users = '';
$group = getGroup($user);
if ($group == '') {
if (!isNullOrEmptyString($excludeRequestingUser)) {
if ($user == $excludeRequestingUser) {
return $users;
}
}
$dataFile = USER_DIR . DIRECTORY_SEPARATOR . $user . DIRECTORY_SEPARATOR . $fileName;
if (is_file($dataFile)) {
$users = $user;
}
} else {
if ($handle = opendir(USER_DIR)) {
while (false !== ($entry = readdir($handle))) {
if ($entry == $excludeRequestingUser) {
continue;
}
$userDir = USER_DIR . DIRECTORY_SEPARATOR . $entry;
if (is_dir($userDir)) {
$groupFile = $userDir . DIRECTORY_SEPARATOR . GROUP_FILE;
if (is_file($groupFile)) {
$foundGroup = file_get_contents($groupFile);
if ($foundGroup == $group) {
$userDataFile = $userDir . DIRECTORY_SEPARATOR . $fileName;
if (is_file($userDataFile)) {
if (!isNullOrEmptyString($users)) {
$users .= PHP_EOL;
}
$users .= $entry;
}
}
}
}
}
closedir($handle);
}
}
return $users;
}
示例8: die
die('Direct access not permitted');
}
?>
<body>
<main>
<?php
include "header.inc";
?>
<div class="content">
<!-- make sure theyre in a group -->
<?php
if ($group == 0) {
echo "<h2>You're not in a group yet!</h2>";
} else {
$myGroup = getGroup($db, $group);
?>
<h1><?php
echo getGroupName($group, $db);
?>
</h1>
<h2 class="subtitle">
<?php
echo getGroupDescription($group, $db) . "<br>" . getGroupType($group, $db) . "<br>" . sizeof($myGroup);
?>
members</h2>
<br>
<?php
if ($groupLeader == 1) {
?>
示例9: adminmsg
} else {
adminmsg('operate_success', "{$basename}");
}
/* 勋章管理-勋章编辑 */
} elseif ($type == 'edit') {
S::gp(array('id'));
$id = (int) $id;
if ($id < 1) {
adminmsg('operate_error', "{$basename}");
}
$medal = $medalService->getMedal($id);
//获取medal信息
if ($medal['type'] == 0) {
adminmsg('medal_system_is_not_edit', "{$basename}");
}
$creategroup = getGroup($medal['allow_group']);
//获取用户组
$openMedal = $medalService->getAllOpenAutoMedals();
//获取所有开启的勋章
$openMedal = getMedalJson($openMedal);
require_once PrintApp('admin_medal_add');
/* 勋章管理-勋章编辑操作 */
} elseif ($type == 'editdo') {
S::gp(array('name', 'image', 'descrip', 'day', 'confine', 'allow_group', 'id'));
$id = (int) $id;
if ($id < 1) {
adminmsg('operate_error', "{$basename}&type=add");
}
if ($name == '') {
adminmsg('勋章名称不得为空', "{$basename}&type=add");
}
示例10: Table
/**
* 初始化推广单元
*/
$conn = new Table("local189");
$conn->query("TRUNCATE TABLE `tianyunzi`.`baidu_group`");
$id = 0;
while (1) {
$jihuaArr = $conn->findAll("select * from tianyunzi.baidu_jihua where id > '{$id}' order by id asc limit 100");
if (empty($jihuaArr)) {
exit("所有计划已经过完\n");
}
foreach ($jihuaArr as $value) {
$id = $value["id"];
/* 获取当前计划下单元信息 */
$groupArr = getGroup($value["id"]);
if (empty($groupArr) || !isset($groupArr["body"]["data"])) {
echo "计划 " . $value["name"] . " 下没有获取到单元信息\n";
continue;
}
foreach ($groupArr["body"]["data"] as $value1) {
echo "新增计划[" . $value["name"] . "],单元[" . $value1["adgroupName"] . "]\n";
$conn->insert(array("id" => $value1["adgroupId"], "groupname" => $value1["adgroupName"], "jihuaId" => $value1["campaignId"], "jihuaname" => $value["name"], "status" => 31), "tianyunzi.baidu_group");
continue;
}
}
}
function getGroup($jihuaId)
{
$data = array("header" => array("token" => "1f888ce6fb38730a14a6afe7437fc3b4", "username" => "郑州悉知", "password" => "GCWgcd7232275"), "body" => array("adgroupFields" => array("adgroupId", "campaignId", "adgroupName", "status"), "ids" => array($jihuaId), "idType" => 3));
$ch = curl_init();
示例11: print_r
if (!$statement->execute()) {
print_r($statement->errorInfo());
return false;
} else {
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
}
?>
<h2>Students</h2>
<div class="scrollContainer">
<table>
<tr> <th>Name</th> <th>Area of Expertise</th> <th>Actions</th> </tr>
<?php
// start looping through group members
foreach (getGroup($db, $group) as $a) {
?>
<tr>
<td>
<a href="/?page=viewProfile&id=<?php
echo $a['id'];
?>
">
<?php
if ($a['displayName'] == "") {
echo $a['name'];
} else {
echo $a['displayName'];
}
?>
</a>
示例12: getDebateViewingStats
/**
* Return an object with the Debate viewing stats.
*
* @param nodeid the nodeid of the Issue node to get the viewing stats for.
* @param style, the style of node to return - how much data it has (defaults to 'mini' can also be 'long' or 'short')
* @return debateviewingstats class containing properties: groupmembercount, viewingmembercount.
* or an Error.
*/
function getDebateViewingStats($nodeid, $groupid)
{
$group = getGroup($groupid);
$userset = $group->members;
$members = $userset->users;
$memberscount = count($members);
$node = getNode($nodeid, 'shortactivity');
$activitySet = $node->activity;
$activities = $activitySet->activities;
$count = count($activities);
$userCheck = array();
for ($i = 0; $i < $count; $i++) {
$next = $activities[$i];
if ($next->type == 'View') {
if (isset($next->userid) && $next->userid != "" && !in_array($next->userid, $userCheck)) {
array_push($userCheck, $next->userid);
}
}
}
class debateviewingstats
{
public $groupmembercount = 0;
public $viewingmembercount = 0;
}
$stats = new debateviewingstats();
$stats->groupmembercount = $memberscount;
$stats->viewingmembercount = count($userCheck);
return $stats;
}
示例13: getGroup
<form method="post" action="#" enctype="multipart/form-data">
<?php
$results = getGroup();
?>
<table>
<tr>
<td>
Group:
</td>
<td>
<select name="address_id">
<?php
foreach ($results as $row) {
?>
<option value="<?php
echo $row['address_group_id'];
?>
">
<?php
echo $row['address_group'];
?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
First Name:
示例14: PDO
$servername = "104.236.200.134";
$d_username = "buddy";
$d_password = "";
$db_name = "studybuddyplus";
$db_handle = new PDO("mysql:host={$servername};dbname={$db_name}", "{$d_username}", "{$d_password}");
$search_stmt = $db_handle->prepare("SELECT * FROM login WHERE username=?;");
$search_stmt->bindParam(1, $user);
$search_stmt->execute();
$userinfo = $search_stmt->fetchAll();
$firstname = $userinfo[0]['firstname'];
$lastname = $userinfo[0]['lastname'];
$count_stmt = $db_handle->prepare("SELECT COUNT(*) FROM posts WHERE student=?;");
$count_stmt->bindParam(1, $user);
$count_stmt->execute();
$count = $count_stmt->fetchAll();
$groups = getGroup($user);
?>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-info-circle fa-fw"></i>Your Information</h3>
</div>
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item">
<i class="fa fa-fw fa-user"></i> Username: <?php
echo $userinfo[0]['username'];
?>
</a>
<a href="#" class="list-group-item">
<i class="fa fa-fw fa-male"></i> Your real name: <?php
示例15: session_start
<?php
session_start();
include "conn/conn.php";
include "inc/func.php";
$sqlstr = "select id,u_name,u_depart,is_on from tb_users where u_user = '" . $_POST[username] . "' and u_pwd = '" . $_POST[pwd] . "'";
$result = mysql_query($sqlstr, $conn);
$record = mysql_fetch_row($result);
if ($record != "" and $record[3] == 1) {
if (getGroup($conn, $record[1], $_POST[u_group])) {
$_SESSION["id"] = $record[0];
$_SESSION["u_name"] = $_POST[username];
$_SESSION["u_depart"] = read_field($conn, "tb_depart", "d_name", $record[2]);
$_SESSION["u_group"] = read_field($conn, "tb_group", "u_group", $_POST[u_group]);
w_log($_POST[action]);
echo "<script>alert('��ӭ����');location='pub_main.php';</script>";
} else {
echo "<script>alert('�û������������');history.go(-1);</script>";
}
} else {
echo "<script>alert('�û������������');history.go(-1);</script>";
}