本文整理匯總了PHP中Group::getGroupById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::getGroupById方法的具體用法?PHP Group::getGroupById怎麽用?PHP Group::getGroupById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::getGroupById方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editForm
public function editForm($id)
{
$group = Group::getGroupById($id);
$template = new Template('admin/security/ui.groupForm.tpl');
$template->group = $group;
$template->action = "/groupage/update/" . $group->id;
return $template->parse();
}
示例2: isAdmin
public function isAdmin()
{
if ($this->id == User::ADMIN) {
return true;
}
$group = Group::getGroupById(Group::ADMINS);
return $group->hasMember($this);
}
示例3: getMeetingById
static function getMeetingById($id)
{
$pdo = db::getPDO();
$st = $pdo->prepare("SELECT * FROM meetings WHERE\n MeetingId = :meetingId");
$st->execute(array(':meetingId' => $id));
$result = $st->fetch();
$group = Group::getGroupById($result['UserGroup']);
$meeting = new Meeting($result['MeetingId'], $result['Room'], $group, $result['Day'], $result['Hour']);
return $meeting;
}
示例4: getAllMeetingsOfUser
static function getAllMeetingsOfUser($mtrklnr)
{
$pdo = db::getPDO();
$st = $pdo->prepare("SELECT m.* FROM meetings AS m\n WHERE UserGroup in\n (SELECT g.Id FROM user_in_group AS uig\n LEFT JOIN groups AS g ON uig.groupId = g.Id\n LEFT JOIN users AS u ON uig.userId = u.MtklNr\n WHERE g.Id IN (SELECT groupId FROM user_in_group AS uig WHERE uig.userId = :mtklNr))");
$st->execute(array(':mtklNr' => $mtrklnr));
$result = $st->fetchAll();
$meetings = array();
for ($i = 0; $i < count($result); $i++) {
$group = Group::getGroupById($result[$i]['UserGroup']);
$meetings[] = new Meeting($result[$i]['MeetingId'], $result[$i]['Room'], $group, $result[$i]['Day'], $result[$i]['Hour']);
}
return $meetings;
}
示例5: checkAccess
public function checkAccess(User $user)
{
if ($user->isAdmin()) {
return Acl::ADMINISTRATOR;
}
$perms = $this->permissions;
if (array_key_exists($user->id, $perms['users'])) {
return $perms['users'][$user->id];
}
$groups = $perms['groups'];
$prms = array(0);
foreach ($groups as $group => $role) {
$oGroup = Group::getGroupById($group);
if ($oGroup->hasMember($user)) {
$prms[] = $role;
}
}
return max($prms);
}
示例6: htmlspecialchars
<?php
include "../assets/_header_in.php";
include "../assets/_header_tasks.php";
require_once "../classes/group.php";
$id_group = htmlspecialchars($_GET["id_group"]);
$name_group = Group::getGroupById($id_group);
$name_group = $name_group['g_name'];
?>
<h2>Creating a task</h2>
<form action="save_task.php" method="post">
<p>
<label>
<?php
echo "<a href='../groups/index.php?id_group=" . $id_group . "'>" . $name_group . "</a>";
?>
<br></label>
<input readonly size=5 name="group" type="text" value=<?php
echo $id_group;
?>
>
</p>
<p>
<label>Name:<br></label>
<input name="name" type="text" size="50" maxlength="50">
</p>
<p>
<label>Description:<br></label>
<textarea name="desc" maxlength="500" type="text"></textarea>
</p>
<p>
示例7: htmlspecialchars
<?php
include "../assets/_header_in.php";
include "../assets/_header_groups.php";
$id_group = htmlspecialchars($_GET["id_group"]);
require_once "../classes/group.php";
$mygroup = Group::getGroupById($id_group);
$users_of_group = Group::getUsersByIdGroup($id_group);
echo "Name: " . $mygroup["g_name"];
echo "<br>";
echo "Creator: " . $mygroup["u_name"];
echo "<br>";
echo "Count of users: " . count($users_of_group);
echo "<br>";
echo "<table>";
for ($i = 0; $i < count($users_of_group); $i++) {
echo "<tr><td>" . $i . "</td><td>" . $users_of_group[$i]["name"] . "</td></tr>";
}
echo "</table>";
echo "Count of all tasks: " . Group::getCountTaskByIdGroup($id_group);
echo "<br>";
echo "<a href='end_task.php?id_group=" . $id_group . "'>Finished tasks: </a>" . Group::getCountEndTaskByIdGroup($id_group);
echo "<br>";
echo "<a href='start_task.php?id_group=" . $id_group . "'>Started tasks: </a>" . Group::getCountStartTaskByIdGroup($id_group);
if (Group::checkCreator($id_group, $_SESSION['login_user'])) {
echo "<br>";
echo "<a href='../tasks/create_task_for_group.php?id_group=" . $id_group . "'>Create a task</a>";
} else {
if (!Group::checkGroupForUser($id_group, $_SESSION['login_user'])) {
echo "<br>";
echo "<a href='add_user_to_group.php?id_group=" . $id_group . "'>Sign up in this group</a>";
示例8: getTemplate
private function getTemplate(Module $module)
{
$template = new Template('admin/security/ui.moduleForm.tpl');
$permsTpl = new Template('admin/security/ui.permissions.tpl');
$perms = $module->permissions;
$users = '';
$groups = '';
foreach ($perms['users'] as $userID => $role) {
$user = User::getUserById($userID);
$permsTpl->id = $user->id;
$permsTpl->type = 'users';
$permsTpl->name = sprintf("%s %s", $user->name, $user->surname);
$permsTpl->options = $this->getOptions($role);
$users .= $permsTpl->parse();
}
foreach ($perms['groups'] as $groupID => $role) {
$group = Group::getGroupById($groupID);
$permsTpl->type = 'groups';
$permsTpl->id = $group->id;
$permsTpl->name = $group->name;
$permsTpl->options = $this->getOptions($role);
$groups .= $permsTpl->parse();
}
$template->users = $users;
$template->groups = $groups;
$template->module = $module;
return $template;
}
示例9: foreach
$groupOwner = $group->owner;
if ($group->owner == $user) {
$groupOwner = $postArray['owner'];
$tmpMembers = $postArray['users'];
foreach ($tmpMembers as $tmpmember) {
$member = get_object_vars($tmpmember);
$members[] = new User($member['mtklNr'], '', '', '');
}
$groupUsers = $members;
}
$group = new Group($args['id'], $postArray['name'], $groupOwner, $groupUsers, $postArray['groupImage']);
$group->update();
echo json_encode($group);
} else {
echo json_encode(false);
}
});
$app->delete('/groups/{id}', function ($request, $response, $args) {
$group = Group::getGroupById($args['id']);
$server_params = $request->getServerParams();
if (preg_match("/Basic\\s+(.*)\$/i", $server_params["REDIRECT_HTTP_AUTHORIZATION"], $matches)) {
list($user, $password) = explode(":", base64_decode($matches[1]));
}
if ($group->owner == $user) {
$deleted = Group::deleteGroupById($args['id']);
echo json_encode($deleted);
} else {
echo json_encode(false);
}
});
$app->run();
示例10: stored
public function stored(Request $request)
{
session_start();
$html = "";
$vecesenelgrupo = 0;
$creadormiembro = 0;
if ($request->ajax()) {
$group = Group::getGroupById($_SESSION['group']);
$user = User::getUserById($request->usuario);
$vecesenelgrupo = $group->users()->where('owner', 0)->where('user_id', $user->id)->where('group_id', $group->id)->count();
$creadormiembro = $group->users()->where('owner', 1)->where('user_id', $user->id)->where('group_id', $group->id)->count();
if ($vecesenelgrupo < 1 && $creadormiembro < 1) {
$group->users()->save($user, ['owner' => 0]);
$html .= '<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<button style="margin-left: 88%" type="button" class="btn btn-link delMem" data-botonLeaveMember="{{$members->id}}" ><i class="fa fa-remove"></i></button>
<img src="' . asset("img/user.png") . '" class="img-circle img-responsive" alt="owner" width="140" height="140">
<div class="caption">
<h3 style="text-align: center;">Member</h3>
<h4 style="text-align: center;">' . $user->full_name . '</h4>
</div>
</div>
</div>';
} else {
if ($creadormiembro >= 1) {
echo "<script type='text/javascript'>alert('You can not add yourself, you are the owner.');</script>";
} else {
echo "<script type='text/javascript'>alert('The user is already a member of the group..');</script>";
}
}
}
return $html;
}