本文整理汇总了PHP中Groups::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::get方法的具体用法?PHP Groups::get怎么用?PHP Groups::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_user
public function is_user($user)
{
if (is_null($user)) {
$user = Session::get_user();
}
if ($this->get_parentid()) {
$parent = Groups::get($this->get_parentid());
}
$result = DigiplayDB::select("* FROM usersgroups WHERE (groupid = " . $this->get_id() . ") AND userid = '" . $user->get_id() . "'");
if ($result) {
return true;
} else {
if (isset($parent)) {
return $parent->is_user($user);
}
}
return false;
}
示例2: makeOrderRecalc
public function makeOrderRecalc()
{
$obj = new Groups();
$obj->isRecalc = false;
$groups = $obj->get();
$orderArr = $atLast = [];
foreach ($groups as $gr) {
if ($gr->order_id == null) {
$atLast[] = $gr->id;
} else {
$orderArr[$gr->order_id] = $gr->id;
}
}
ksort($orderArr);
$newOrderArr = array_values($orderArr);
$finalOrderArr = array_merge($newOrderArr, $atLast);
foreach ($finalOrderArr as $orderId => $id) {
$obj->update(['id' => $id], ['order_id' => $orderId]);
}
}
示例3: getGroupsOrder
public function getGroupsOrder()
{
$groupsObj = new Groups();
$groups = $groupsObj->get();
$start = 0;
$finish = count($groups) - 1;
$ordered = [];
foreach ($groups as $gr) {
$ordered[$gr->order_id] = $gr;
}
if (count($ordered)) {
ksort($ordered);
}
foreach ($ordered as $key => $gr) {
?>
<div class="sg-controls" id="sg-group-<?php
echo $gr->id;
?>
">
<a class="sg-delete sg-red" href="#" onclick="if (confirm('<?php
_e('Будут удалены все значения в этой группе. Действительно удалить? ');
?>
')) {sgDeleteGroup(<?php
echo $gr->id;
?>
, '<?php
echo wp_create_nonce('sg-delete-group');
?>
)}; return false;">×</a>
<?php
if ($gr->order_id == $start) {
?>
<span class="sg-array">↑</span>
<a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php
echo $gr->id;
?>
, 'down', '<?php
echo wp_create_nonce('sg-change-group-order');
?>
' ); return false;">↓</a>
<?php
} elseif ($gr->order_id == $finish) {
?>
<a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php
echo $gr->id;
?>
, 'up', '<?php
echo wp_create_nonce('sg-change-group-order');
?>
'); return false;">↑</a>
<span class="sg-array">↓</span>
<?php
} else {
?>
<a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php
echo $gr->id;
?>
, 'up', '<?php
echo wp_create_nonce('sg-change-group-order');
?>
'); return false;">↑</a>
<a class="sg-array" href="#" onclick="sgChangeGroupOrder(<?php
echo $gr->id;
?>
, 'down', '<?php
echo wp_create_nonce('sg-change-group-order');
?>
'); return false;">↓</a>
<?php
}
?>
<a class="sg-name" href="#" onclick="sgChangeGroupName(<?php
echo $gr->id;
?>
, '<?php
echo wp_create_nonce('sg-edit-group-by-id');
?>
'); return false;"><?php
echo $gr->name;
?>
</a>
</div>
<?php
}
}
示例4: sgChangeGroupOrder
public function sgChangeGroupOrder()
{
$this->checkPermissions($_POST['_wpnonce'], 'sg-change-group-order');
$groupsObj = new Groups();
$groupsObj->isRecalc = false;
$groupsObj->returnMessages = true;
$newGroupsObj = new Groups();
$newGroupsObj->isRecalc = false;
$current = $newGroupsObj->get(['id' => $_POST['id']], ['order_id']);
if ($_POST['direction'] == 'up' && $newGroupsObj->update(['order_id' => $current[0]->order_id - 1], ['order_id' => $current[0]->order_id])) {
$output = $groupsObj->update(['id' => $_POST['id']], ['order_id' => $current[0]->order_id - 1]);
$output['messages'] = $output['messages']['error'];
} elseif ($_POST['direction'] == 'down' && ($val = $newGroupsObj->update(['order_id' => $current[0]->order_id + 1], ['order_id' => $current[0]->order_id]))) {
$output = $groupsObj->update(['id' => $_POST['id']], ['order_id' => $current[0]->order_id + 1]);
$output['messages'] = $output['messages']['error'];
} else {
$output['result'] = 0;
$output['messages'] = [];
}
echo json_encode($output, JSON_UNESCAPED_UNICODE);
die;
}
示例5: viewGroupLinks
public function viewGroupLinks()
{
$groups = new Groups();
$groupArr = $groups->get();
$orderedGroups = [];
foreach ($groupArr as $gr) {
$orderedGroups[$gr->order_id] = $gr;
}
if (count($orderedGroups)) {
ksort($orderedGroups);
}
$newQuery = ['page' => 'setget'];
if ($this->currentGroup) {
$queryViewAll = $newQuery;
$queryViewAll['group'] = 0;
echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($queryViewAll) . '">Все</a>';
foreach ($orderedGroups as $group) {
if ($this->currentGroup == $group->id) {
echo '<span class="sg-group-link">' . $group->name . '</span>';
} else {
$newQuery['group'] = $group->id;
echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($newQuery) . '">' . $group->name . '</a>';
}
}
} else {
echo '<span class="sg-group-link" >Все</span>';
foreach ($orderedGroups as $group) {
$newQuery['group'] = $group->id;
echo '<a class="sg-group-link" href="' . $_SERVER['PHP_SELF'] . '?' . http_build_query($newQuery) . '">' . $group->name . '</a>';
}
}
}