本文整理汇总了PHP中CUser::GetUserGroupArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::GetUserGroupArray方法的具体用法?PHP CUser::GetUserGroupArray怎么用?PHP CUser::GetUserGroupArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetUserGroupArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserGroups
/**
* @return array
*/
public function getUserGroups()
{
if ($this->groups) {
return $this->groups;
}
$ids = $this->user->GetUserGroupArray();
$res = array();
$dbRes = \CGroup::GetList($by = null, $order = null, array('ID' => implode('|', $ids)));
while ($item = $dbRes->Fetch()) {
$res[] = $item['STRING_ID'];
}
$this->groups = array_filter($res);
return $this->groups;
}
示例2: getEdit
public static function getEdit(Order $order, \CUser $user, $showCancel, $showSaveButton)
{
$data = self::prepareData($order);
if ($showCancel) {
$bUserCanCancelOrder = \CSaleOrder::CanUserCancelOrder($order->getId(), $user->GetUserGroupArray(), $user->GetID());
} else {
$bUserCanCancelOrder = false;
}
$result = '
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="adm-detail-content-table edit-table">
<tbody>
<tr>
<td class="adm-detail-content-cell-l" width="40%">' . Loc::getMessage("SALE_ORDER_STATUS_CREATED") . ':</td>
<td class="adm-detail-content-cell-r">
<div>' . $data["DATE_INSERT"] . ' <a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $data["CREATOR_USER_ID"] . '">' . htmlspecialcharsbx($data["CREATOR_USER_NAME"]) . '</a>
</div>
</td>
</tr>
<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_LAST_MODIF") . ':</td>
<td class="adm-detail-content-cell-r"><div>' . $data["DATE_UPDATE"] . '</div></td>
</tr>
<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_SITE") . ':</td>
<td class="adm-detail-content-cell-r"><div>' . htmlspecialcharsbx(\Bitrix\Sale\Helpers\Admin\OrderEdit::getSiteName($order->getSiteId())) . '</div></td>
</tr>';
if (strlen($data['SOURCE_NAME']) > 0) {
$result .= '<tr>' . '<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS_SOURCE") . ':</td>' . '<td class="adm-detail-content-cell-r">' . $data['SOURCE_NAME'] . '</td>' . '</tr>';
}
$result .= '<tr>
<td class="adm-detail-content-cell-l">' . Loc::getMessage("SALE_ORDER_STATUS") . ':</td>
<td class="adm-detail-content-cell-r">' . \Bitrix\Sale\Helpers\Admin\OrderEdit::makeSelectHtml("STATUS_ID", self::getStatusesList($user->GetID(), $data["STATUS_ID"]), $data["STATUS_ID"], false, array("class" => "adm-bus-select", "id" => "STATUS_ID"));
if ($showSaveButton) {
$result .= '
<span id="save_status_button" class="adm-btn" onclick="BX.Sale.Admin.OrderEditPage.onSaveStatusButton(\'' . $order->getId() . '\',\'STATUS_ID\');">
' . Loc::getMessage("SALE_ORDER_STATUS_SAVE") . '
</span>';
}
$result .= '</td>
</tr>';
if ($showCancel && $bUserCanCancelOrder) {
$result .= self::getCancelBlockHtml($order, $data);
}
$result .= '</tbody>
</table>
';
return $result;
}
示例3: countTrueEvents
//.........这里部分代码省略.........
}
break;
case "CondIBDateCreate":
$date = isset($this->_fields["DATE_CREATE"]) ? $this->_fields["DATE_CREATE"] : $this->_fields["~DATE_CREATE"];
if (CFoodclubEventCompare::compareDates($date, $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBDetailText":
if (CFoodclubEventCompare::compare($this->_fields["DETAIL_TEXT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBPreviewText":
if (CFoodclubEventCompare::compare($this->_fields["PREVIEW_TEXT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBSort":
if (CFoodclubEventCompare::compare($this->_fields["SORT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBDateActiveTo":
if (CFoodclubEventCompare::compareDates($this->_fields["ACTIVE_TO"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBDateActiveFrom":
if (CFoodclubEventCompare::compareDates($this->_fields["ACTIVE_FROM"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBActive":
if (CFoodclubEventCompare::compare($this->_fields["ACTIVE"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBName":
if (CFoodclubEventCompare::compare($this->_fields["NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBXmlID":
if (CFoodclubEventCompare::compare($this->_fields["XML_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBCode":
if (CFoodclubEventCompare::compare($this->_fields["CODE"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondGroup":
//Проверяем группу условий
if (CFoodclubEventUtils::recursive_array_search("CondQuantityValue", $child["CHILDREN"]) !== false) {
//check child event elements with property value
if (self::checkQuantityCond($child)) {
self::increas();
}
} else {
//check child event elements
if (self::checkChildCond($child)) {
self::increas();
}
}
break;
case "CondUserGroup":
//Проверяем группу пользователя
if (CFoodclubEventCompare::compareArrayValue(CUser::GetUserGroupArray(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBElement":
if (CFoodclubEventCompare::compare($this->_fields["ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBSection":
//Проверяем группу пользователя
if (CFoodclubEventCompare::compare($this->_fields["SECTION_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondIBIBlock":
//Проверяем группу пользователя
if (CFoodclubEventCompare::compare($this->_fields["IBLOCK_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
case "CondUser":
//Проверяем пользователя
if (CFoodclubEventCompare::compare(CUser::GetID(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
self::increas();
}
break;
}
}
}
}
示例4: explode
<?php
$module_id = "devtm.begateway";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$module_id}/include.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/{$module_id}/prolog.php";
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
$gr = explode("|", \Bitrix\Main\Config\Option::get($module_id, "group_ids"));
$in = array_intersect($gr, CUser::GetUserGroupArray());
$has_access = false;
if (!empty($in)) {
$has_access = true;
}
\Bitrix\Main\Loader::includeModule("sale");
\Bitrix\Main\Config\Option::set("main", "~sale_converted_15", "N");
//Костыль из - за совместимости битрикс с ядром D7
try {
$ID = (int) $ID;
if ($ID <= 0) {
throw new Exception(Loc::getMessage("DEVTM_BEGATEWAY_NOT_CORRECT_ID"));
}
$ps_id = (int) \Bitrix\Main\Config\Option::get($module_id, "payment_system_id");
if ($ps_id <= 0) {
throw new Exception(Loc::getMessage("DEVTM_BEGATEWAY_PS_NOT_FOUND"));
}
$order = CSaleOrder::GetList(array("ID" => "ASC"), array("ID" => $ID, "PAY_SYSTEM_ID" => $ps_id), false, false, array("ID", "USER_ID", "PS_STATUS_DESCRIPTION", "PRICE", "CURRENCY"))->Fetch();
if ($order["ID"] <= 0) {
throw new Exception(Loc::getMessage("DEVTM_BEGATEWAY_ORDER_NOT_FOUND"));
}
if (strlen($order["PS_STATUS_DESCRIPTION"]) <= 0) {
示例5: array
{
$dbGroup = CGroup::GetList(($by="c_sort"), ($order="asc"), array("ACTIVE" => "Y"));
while($arGroup = $dbGroup->Fetch())
{
$arResult["GROUPS_CAN_EDIT"][$arGroup["ID"]] = $arGroup;
$arGroupsCanEditID[] = $arGroup["ID"];
}
}
elseif($USER->CanDoOperation('edit_subordinate_users'))
{
if (array_key_exists("SONET_SUBORD_GROUPS_BY_USER_ID", $GLOBALS) && array_key_exists($GLOBALS["USER"]->GetID(), $GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"]))
$arUserSubordinateGroups = $GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"][$GLOBALS["USER"]->GetID()];
else
{
$arUserSubordinateGroups = Array(2);
$arUserGroups_u = CUser::GetUserGroupArray();
for ($j = 0,$len = count($arUserGroups_u); $j < $len; $j++)
{
$arSubordinateGroups = CGroup::GetSubordinateGroups($arUserGroups_u[$j]);
$arUserSubordinateGroups = array_merge($arUserSubordinateGroups, $arSubordinateGroups);
}
$arUserSubordinateGroups = array_unique($arUserSubordinateGroups);
if (!array_key_exists("SONET_SUBORD_GROUPS_BY_USER_ID", $GLOBALS))
$GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"] = array();
$GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"][$GLOBALS["USER"]->GetID()] = $arUserSubordinateGroups;
}
$arGroupsCanEditID = $arUserSubordinateGroups;
示例6: checkUserGroup
function checkUserGroup($user_group_array = array(), $logic, $value)
{
if (empty($user_group_array)) {
$user_group_array = CUser::GetUserGroupArray();
}
switch ($logic) {
case 'Equal':
return in_array($value, $user_group_array) ? true : false;
break;
default:
return !in_array($value, $user_group_array) ? true : false;
break;
}
}