本文整理汇总了PHP中CSocNetGroup::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetGroup::GetList方法的具体用法?PHP CSocNetGroup::GetList怎么用?PHP CSocNetGroup::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetGroup
的用法示例。
在下文中一共展示了CSocNetGroup::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
/**
* <p>Метод удаляет тему рабочих групп. Если есть группы с этой темой, то тема удалена не будет.</p>
*
*
* @param int $id Код темы.</bod
*
* @return bool <p>True в случае успешного удаления и false - в противном случае.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetgroupsubject/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
global $DB, $CACHE_MANAGER;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
$bCanDelete = true;
$dbResult = CSocNetGroup::GetList(array(), array("SUBJECT_ID" => $ID));
if ($arResult = $dbResult->Fetch()) {
$bCanDelete = false;
}
if (!$bCanDelete) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GS_NOT_EMPTY_SUBJECT"), "NOT_EMPTY_SUBJECT");
return false;
}
$bSuccess = $DB->Query("DELETE FROM b_sonet_group_subject_site WHERE SUBJECT_ID = " . $ID . "", true);
if ($bSuccess) {
$bSuccess = $DB->Query("DELETE FROM b_sonet_group_subject WHERE ID = " . $ID . "", true);
}
if (CACHED_b_sonet_group_subjects != false) {
$CACHE_MANAGER->CleanDir("b_sonet_group_subjects");
}
return $bSuccess;
}
示例2: __wd_get_root_section
function __wd_get_root_section($IBLOCK_ID, $object, $object_id)
{
$result = CIBlockWebdavSocnet::GetSectionID($IBLOCK_ID, $object, $object_id);
if (intval($result) > 0) {
return $result;
} else {
__wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]);
$arFields = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N");
if ($object == "user") {
$dbUser = CUser::GetByID($object_id);
$arUser = $dbUser->Fetch();
$arFields["NAME"] = trim($arUser['LAST_NAME'] . " " . $arUser['FIRST_NAME']);
$arFields["NAME"] = trim(!empty($arFields["NAME"]) ? $arFields["NAME"] : $arUser['LOGIN']);
$arFields['CREATED_BY'] = $arUser['ID'];
$arFields['MODIFIED_BY'] = $arUser['ID'];
if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
$arTasks = CWebDavIblock::GetTasks();
$arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'U' . $object_id, 'TASK_ID' => $arTasks['X']));
}
} else {
/* $res = CSocNetGroup::GetByID($arResult["VARIABLES"]["group_id"]);
if (!$res)
{
$arParams["ERROR_MESSAGE"] = GetMessage("SONET_GROUP_NOT_EXISTS");
return 0;
} */
$arFields["SOCNET_GROUP_ID"] = $object_id;
//$arGroup = CSocNetGroup::GetByID($object_id);
$arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $object_id;
$dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $object_id), false, false, array("ID", "SITE_ID", "NAME"));
if ($arGroup = $dbGroup->Fetch()) {
$arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"];
}
if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
$arTasks = CWebDavIblock::GetTasks();
$arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W']));
}
}
if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
\Bitrix\Disk\Driver::getInstance()->addGroupStorage($arFields["SOCNET_GROUP_ID"]);
}
$GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $IBLOCK_ID . "_SECTION", $arFields);
$bs = new CIBlockSection();
$sectionID = $bs->Add($arFields);
if (!$sectionID) {
$arParams["ERROR_MESSAGE"] = $bs->LAST_ERROR;
return 0;
}
WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list"));
return true;
/*
if ($ob->workflow == 'bizproc')
{
__wd_create_default_bp_user_and_groups($arBizProcParameters);
}
*/
}
}
示例3: onBeforeConfirmNotify
public static function onBeforeConfirmNotify($module, $tag, $value, $arNotify)
{
global $USER;
$userId = $USER->getId();
if ($module == 'webdav' && $userId) {
$tagData = explode('|', $tag);
$folderInviteId = intval($tagData[2]);
if ($tagData[0] == "WEBDAV" && $tagData[1] == "INVITE" && $folderInviteId > 0 && $userId == $tagData[3]) {
if (\Bitrix\Main\Loader::includeModule('im')) {
CIMNotify::DeleteByTag(\Bitrix\Webdav\FolderInviteTable::getNotifyTag(array('ID' => $folderInviteId, 'INVITE_USER_ID' => $userId)));
}
//decline
if ($value === 'N') {
\Bitrix\Webdav\FolderInviteTable::delete($folderInviteId);
return false;
}
$targetSectionData = CWebDavIblock::getRootSectionDataForUser($userId);
if (!$targetSectionData) {
return false;
}
$folderInviteData = \Bitrix\Webdav\FolderInviteTable::getRowById($folderInviteId);
if (!$folderInviteData) {
return false;
}
$sectionToShare = CIBlockSection::getList(array(), array('ID' => $folderInviteData['SECTION_ID'], 'IBLOCK_ID' => $folderInviteData['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'), false, array('NAME', 'SOCNET_GROUP_ID'))->fetch();
if (empty($sectionToShare['NAME']) || empty($sectionToShare['SOCNET_GROUP_ID'])) {
return false;
}
if (\Bitrix\Main\Loader::includeModule('socialnetwork')) {
$group = CSocNetGroup::GetList(array(), array('ID' => $sectionToShare['SOCNET_GROUP_ID']), false, false, array('NAME'))->fetch();
}
if (empty($group)) {
return false;
}
$groupId = $sectionToShare['SOCNET_GROUP_ID'];
$dispatcher = new \Bitrix\Webdav\InviteDispatcher();
$attachObjectType = CWebDavSymlinkHelper::ENTITY_TYPE_GROUP;
$attachObjectId = (int) $groupId;
$inviteComponentParams = array('attachObject' => array('id' => $attachObjectId, 'type' => $attachObjectType), 'attachToUserId' => $folderInviteData['INVITE_USER_ID'], 'inviteFromUserId' => $folderInviteData['USER_ID'], 'canEdit' => $folderInviteData['CAN_EDIT']);
$response = $dispatcher->processActionConnect($inviteComponentParams);
if ($response['status'] == $dispatcher::STATUS_SUCCESS) {
\Bitrix\Webdav\FolderInviteTable::update($folderInviteId, array('IS_APPROVED' => true, 'LINK_SECTION_ID' => $response['sectionId']));
}
return $response['status'] == $dispatcher::STATUS_SUCCESS;
}
}
}
示例4: IntVal
$idTmp = CSocNetGroupSubject::Add($arGroupSubject);
if ($idTmp) {
$arGroupSubjectsId[$ind] = IntVal($idTmp);
} else {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage .= $e->GetString();
}
}
}
}
if (StrLen($errorMessage) <= 0) {
$pathToImages = WIZARD_SERVICE_ABSOLUTE_PATH . "/images/";
$arGroupsId = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0);
$arGroups = array(0 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_0"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_0"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[1], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_0"), "IMAGE_ID" => array("name" => "0.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/0.jpg", "error" => "0", "size" => @filesize($pathToImages . "/0.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "E", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 1 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_1"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_1"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[0], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_1"), "IMAGE_ID" => array("name" => "1.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/1.jpg", "error" => "0", "size" => @filesize($pathToImages . "/1.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "E", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 2 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_2"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_2"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[0], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_2"), "IMAGE_ID" => array("name" => "2.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/2.jpg", "error" => "0", "size" => @filesize($pathToImages . "/2.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "SPAM_PERMS" => "N", "INITIATE_PERMS" => "E", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 3 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_3"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_3"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "Y", "SUBJECT_ID" => $arGroupSubjectsId[4], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_3"), "IMAGE_ID" => array("name" => "3.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/3.jpg", "error" => "0", "size" => @filesize($pathToImages . "/3.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "SPAM_PERMS" => "N", "INITIATE_PERMS" => "K", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 4 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_4"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_4"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[2], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_4"), "IMAGE_ID" => array("name" => "4.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/4.jpg", "error" => "0", "size" => @filesize($pathToImages . "/4.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "SPAM_PERMS" => "N", "INITIATE_PERMS" => "E", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 5 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_5"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_5"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[2], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_5"), "IMAGE_ID" => array("name" => "5.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/5.jpg", "error" => "0", "size" => @filesize($pathToImages . "/5.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "E", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 6 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_6"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_6"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "Y", "SUBJECT_ID" => $arGroupSubjectsId[4], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_6"), "IMAGE_ID" => array("name" => "6.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/6.jpg", "error" => "0", "size" => @filesize($pathToImages . "/6.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "SPAM_PERMS" => "N", "INITIATE_PERMS" => "K", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 7 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_7"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_7"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "Y", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[1], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_7"), "IMAGE_ID" => array("name" => "7.jpg", "type" => "image/jpeg", "tmp_name" => $pathToImages . "/7.jpg", "error" => "0", "size" => @filesize($pathToImages . "/7.jpg"), "MODULE_ID" => "socialnetwork"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "E", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 8 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_8"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_8"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "N", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[3], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_8"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "A", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 9 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_9"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_9"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "N", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[3], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_9"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "A", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()), 10 => array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_NAME_10"), "DESCRIPTION" => GetMessage("SONET_GROUP_DESCRIPTION_10"), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "ACTIVE" => "Y", "VISIBLE" => "N", "OPENED" => "N", "SUBJECT_ID" => $arGroupSubjectsId[3], "OWNER_ID" => 1, "KEYWORDS" => GetMessage("SONET_GROUP_KEYWORDS_10"), "NUMBER_OF_MEMBERS" => 1, "INITIATE_PERMS" => "A", "SPAM_PERMS" => "N", "=DATE_ACTIVITY" => $GLOBALS["DB"]->CurrentTimeFunction()));
foreach ($arGroups as $ind => $arGroup) {
$dbSubject = CSocNetGroup::GetList(array(), array("NAME" => $arGroup["NAME"], "SITE_ID" => WIZARD_SITE_ID));
if (!$dbSubject->Fetch()) {
$idTmp = CSocNetGroup::Add($arGroup);
if ($idTmp) {
if (CModule::IncludeModule("disk")) {
\Bitrix\Disk\Driver::getInstance()->addGroupStorage($idTmp);
}
$arGroupsId[$ind] = IntVal($idTmp);
} else {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage .= $e->GetString();
}
}
}
}
}
示例5: NotifyGroup
public static function NotifyGroup($arFields)
{
if (!CModule::IncludeModule("im")) {
return;
}
if (!is_array($arFields["GROUP_ID"])) {
$arFields["GROUP_ID"] = array($arFields["GROUP_ID"]);
}
if (empty($arFields["GROUP_ID"])) {
return;
}
if (empty($arFields["EXCLUDE_USERS"])) {
$arFields["EXCLUDE_USERS"] = array();
}
if (intval($arFields["LOG_ID"]) > 0) {
$rsUnFollower = CSocNetLogFollow::GetList(array("CODE" => "L" . intval($arFields["LOG_ID"]), "TYPE" => "N"), array("USER_ID"));
while ($arUnFollower = $rsUnFollower->Fetch()) {
$arFields["EXCLUDE_USERS"][] = $arUnFollower["USER_ID"];
}
$arFields["EXCLUDE_USERS"] = array_unique($arFields["EXCLUDE_USERS"]);
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "sonet_group_event", "NOTIFY_TAG" => "SONET|EVENT|" . (intval($arFields["LOG_ID"]) > 0 ? $arFields["LOG_ID"] : rand()));
if (intval($arFields["FROM_USER_ID"]) > 0) {
$arMessageFields["FROM_USER_ID"] = $arFields["FROM_USER_ID"];
}
$arUserToSend = array();
$arUserIDToSend = array();
$arGroupID = array();
$arCodes = array();
foreach ($arFields["GROUP_ID"] as $group_id) {
$arCodes[] = "SG" . $group_id;
}
$rsSubscriber = CSocNetSubscription::GetList(array(), array("CODE" => $arCodes), false, false, array("USER_ID", "CODE"));
while ($arSubscriber = $rsSubscriber->Fetch()) {
if (!in_array($arSubscriber["USER_ID"], $arFields["EXCLUDE_USERS"]) && !in_array($arSubscriber["USER_ID"], $arUserIDToSend)) {
if (preg_match('/^SG(\\d+)$/', $arSubscriber["CODE"], $matches)) {
$arUserToSend[] = array("USER_ID" => $arSubscriber["USER_ID"], "GROUP_ID" => $matches[1]);
$arUserIDToSend[] = $arSubscriber["USER_ID"];
$arGroupID[] = $matches[1];
}
}
}
$rsGroup = CSocNetGroup::GetList(array(), array("ID" => $arGroupID), false, false, array("ID", "NAME", "OWNER_ID"));
while ($arGroup = $rsGroup->GetNext()) {
$arGroups[$arGroup["ID"]] = $arGroup;
}
$workgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID);
$groupUrlTemplate = COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", SITE_ID);
$groupUrlTemplate = "#GROUPS_PATH#" . substr($groupUrlTemplate, strlen($workgroupsPage), strlen($groupUrlTemplate) - strlen($workgroupsPage));
foreach ($arUserToSend as $arUser) {
$arMessageFields["TO_USER_ID"] = $arUser["USER_ID"];
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arFields["URL"], "GROUP_URL" => str_replace(array("#group_id#", "#GROUP_ID#"), $arUser["GROUP_ID"], $groupUrlTemplate)), $arUser["USER_ID"]);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
$groupUrl = $serverName . $arTmp["URLS"]["GROUP_URL"];
$group_name = array_key_exists($arUser["GROUP_ID"], $arGroups) ? $arGroups[$arUser["GROUP_ID"]]["NAME"] : "";
$arMessageFields["NOTIFY_MESSAGE"] = str_replace(array("#URL#", "#url#", "#group_name#", "#GROUP_ID#", "#group_id#"), array($url, $url, "<a href=\"" . $groupUrl . "\" class=\"bx-notifier-item-action\">" . $group_name . "</a>", $arUser["GROUP_ID"], $arUser["GROUP_ID"]), $arFields["MESSAGE"]);
$arMessageFields["NOTIFY_MESSAGE_OUT"] = str_replace(array("#URL#", "#url#", "#group_name#"), array($serverName . $url, $serverName . $url, $group_name), $arFields["MESSAGE_OUT"]);
$arMessageFields2Send = $arMessageFields;
if (!is_set($arMessageFields2Send["FROM_USER_ID"]) || intval($arMessageFields2Send["FROM_USER_ID"]) <= 0) {
$arMessageFields2Send["NOTIFY_TYPE"] = IM_NOTIFY_SYSTEM;
$arMessageFields2Send["FROM_USER_ID"] = 0;
}
CIMNotify::Add($arMessageFields2Send);
}
}
示例6: GetNames
public static function GetNames($arCodes)
{
$arID = array();
foreach ($arCodes as $code) {
if (preg_match('/^SG([0-9]+)_[A-Z]$/', $code, $match)) {
$arID[] = $match[1];
}
}
if (!empty($arID)) {
$arResult = array();
$rsGroups = CSocNetGroup::GetList(array(), array("ID" => $arID));
while ($arGroup = $rsGroups->Fetch()) {
$arResult["SG" . $arGroup["ID"] . "_A"] = array("provider" => GetMessage("authprov_sg_socnet_group"), "name" => $arGroup["NAME"] . ": " . GetMessage("authprov_sg_a"));
$arResult["SG" . $arGroup["ID"] . "_E"] = array("provider" => GetMessage("authprov_sg_socnet_group"), "name" => $arGroup["NAME"] . ": " . GetMessage("authprov_sg_e"));
$arResult["SG" . $arGroup["ID"] . "_K"] = array("provider" => GetMessage("authprov_sg_socnet_group"), "name" => $arGroup["NAME"] . ": " . GetMessage("authprov_sg_k"));
}
return $arResult;
}
return false;
}
示例7: array
$arGroupID = $arCacheVars["arGroupID"];
}
else
{
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE"))
{
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U".$GLOBALS["USER"]->GetID());
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
}
$rsGroup = CSocNetGroup::GetList(
array(),
array("CHECK_PERMISSIONS" => $GLOBALS["USER"]->GetID()),
false,
false,
array("ID")
);
while($arGroup = $rsGroup->Fetch())
$arGroupID[] = $arGroup["ID"];
$arCacheData = array(
"arGroupID" => $arGroupID
);
$cache->EndDataCache($arCacheData);
if(defined("BX_COMP_MANAGED_CACHE"))
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
foreach($arDestinations as $key => $arDestination)
示例8: array
@set_time_limit(0);
$DB->StartTransaction();
if (!CSocNetGroup::Delete($ID)) {
$DB->Rollback();
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("SONET_DELETE_ERROR"), $ID);
}
}
$DB->Commit();
break;
}
}
}
$dbResultList = CSocNetGroup::GetList(array($by => $order), $arFilter, false, false, array("ID", "SUBJECT_ID", "NAME", "SITE_ID", "OWNER_ID"));
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->AddHeaders($arHeaders);
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("SONET_GROUP_NAV")));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$arSubjects = array();
$arSubjectsBySite = array();
$dbSitesList = CSite::GetList($b = "sort", $o = "asc");
while ($arSite = $dbSitesList->Fetch()) {
$dbSubjectsList = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "ID" => "DESC"), array("SITE_ID" => $arSite["LID"]));
while ($arSubject = $dbSubjectsList->Fetch()) {
$str = "[" . $arSite["LID"] . "] " . $arSubject["NAME"];
$arSubjectsBySite[$arSite["LID"]][$arSubject["ID"]] = $str;
if (!array_key_exists($arSubject["ID"], $arSubjects)) {
$arSubjects[$arSubject["ID"]] = $str;
示例9: array
}
}
if (!$bSkipUpdatesCount) {
$arResult['UPDATES_COUNT'] = CTasks::GetUpdatesCount($arViewedDates);
}
if (!$bSkipGroupsDataFetch) {
// collect groups with tasks
$arResult['GROUPS'] = array(0 => array('ID' => 0, 'NAME' => GetMessage('MB_TASKS_TASKS_LIST_PSEUDO_GROUP_NAME'), 'META:TASKS_IN_GROUP' => $arGroupsStat[0]['TASKS_IN_GROUP'], 'META:TASKS_STATUSES' => $arGroupsStat[0]['STATUSES'], 'META:TASKS_PRIORITIES' => $arGroupsStat[0]['PRIORITIES']));
// List of groups to be fetched from DB
$arGroupsIdsToBeFetched = array();
// Fetch data about all needed groups only if we show list of groups
if (count($arGroupsStat)) {
$arGroupsIdsToBeFetched = array_keys($arGroupsStat);
}
if (!empty($arGroupsIdsToBeFetched)) {
$rsGroups = CSocNetGroup::GetList(array(), array('ID' => $arGroupsIdsToBeFetched));
while ($arGroup = $rsGroups->Fetch()) {
$arGroup['META:TASKS_IN_GROUP'] = $arGroupsStat[(int) $arGroup['ID']]['TASKS_IN_GROUP'];
$arGroup['META:TASKS_STATUSES'] = $arGroupsStat[(int) $arGroup['ID']]['STATUSES'];
$arGroup['META:TASKS_PRIORITIES'] = $arGroupsStat[(int) $arGroup['ID']]['PRIORITIES'];
$arResult['GROUPS'][$arGroup['ID']] = $arGroup;
}
}
// Get name for selected group
$arResult['SELECTED_GROUP_NAME'] = false;
if ($arParams['GROUP_ID'] !== false) {
if (isset($arResult['GROUPS'][$arParams['GROUP_ID']]['NAME'])) {
$arResult['SELECTED_GROUP_NAME'] = $arResult['GROUPS'][$arParams['GROUP_ID']]['NAME'];
} else {
$arResult['SELECTED_GROUP_NAME'] = 'Oops... Programmer mistakes.';
}
示例10: CPHPCache
} else {
// get tagged cached available groups and intersect
$cache = new CPHPCache();
$groupCacheID = $userID;
$groupCacheDir = "/sonet/groups_available/{$userID}/";
if ($cache->InitCache($arParams['CACHE_TIME'], $groupCacheID, $groupCacheDir)) {
$arCacheVars = $cache->GetVars();
$arGroupID = $arCacheVars['arGroupID'];
} else {
$cache->StartDataCache($arParams['CACHE_TIME'], $groupCacheID, $groupCacheDir);
if ($isManagedCacheEnabled) {
$cacheManager->StartTagCache($groupCacheDir);
$cacheManager->RegisterTag("sonet_user2group_U{$userID}");
$cacheManager->RegisterTag('sonet_group');
}
$rsGroup = CSocNetGroup::GetList(array(), array('CHECK_PERMISSIONS' => $userID), false, false, array('ID'));
while ($arGroup = $rsGroup->Fetch()) {
$arGroupID[] = $arGroup['ID'];
}
$arCacheData = array('arGroupID' => $arGroupID);
if ($isManagedCacheEnabled) {
$cacheManager->EndTagCache();
}
$cache->EndDataCache($arCacheData);
}
$GLOBALS['SONET_GROUPS_ID_AVAILABLE'] = $arGroupID;
}
foreach ($arResult['FEED_DESTINATION']['HIDDEN_GROUPS'] as $group_code => $arBlogSPerm) {
if (!in_array($group_code, $arGroupID)) {
$arResult['FEED_DESTINATION']['HIDDEN_GROUPS'][$group_code]['NAME'] = GetMessage('CRM_SL_EVENT_EDIT_HIDDEN_GROUP');
}
示例11: __GetFields
private static function __GetFields()
{
$arTaskPriority = array(0, 1, 2);
foreach ($arTaskPriority as $k => $v) {
$arTaskPriority[$v] = GetMessage("TASK_PRIORITY_" . $v);
}
$arGroups = array(GetMessage("TASK_EMPTY_GROUP"));
if (CModule::IncludeModule("socialnetwork")) {
$db = CSocNetGroup::GetList(array("NAME" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME"));
while ($ar = $db->GetNext()) {
$arGroups[$ar["ID"]] = "[" . $ar["ID"] . "]" . $ar["NAME"];
}
}
$arFields = array("TITLE" => array("Name" => GetMessage("BPTA1A_TASKNAME"), "Type" => "S", "Filterable" => true, "Editable" => true, "Required" => true, "Multiple" => false, "BaseType" => "string"), "CREATED_BY" => array("Name" => GetMessage("BPTA1A_TASKCREATEDBY"), "Type" => "S:UserID", "Filterable" => true, "Editable" => true, "Required" => true, "Multiple" => false, "BaseType" => "user"), "RESPONSIBLE_ID" => array("Name" => GetMessage("BPTA1A_TASKASSIGNEDTO"), "Type" => "S:UserID", "Filterable" => true, "Editable" => true, "Required" => true, "Multiple" => false, "BaseType" => "user"), "ACCOMPLICES" => array("Name" => GetMessage("BPTA1A_TASKACCOMPLICES"), "Type" => "S:UserID", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => true, "BaseType" => "user"), "START_DATE_PLAN" => array("Name" => GetMessage("BPTA1A_TASKACTIVEFROM"), "Type" => "S:DateTime", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "datetime"), "END_DATE_PLAN" => array("Name" => GetMessage("BPTA1A_TASKACTIVETO"), "Type" => "S:DateTime", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "datetime"), "DEADLINE" => array("Name" => GetMessage("BPTA1A_TASKDEADLINE"), "Type" => "S:DateTime", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "datetime"), "DESCRIPTION" => array("Name" => GetMessage("BPTA1A_TASKDETAILTEXT"), "Type" => "T", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "text"), "PRIORITY" => array("Name" => GetMessage("BPTA1A_TASKPRIORITY"), "Type" => "L", "Options" => $arTaskPriority, "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "select"), "GROUP_ID" => array("Name" => GetMessage("BPTA1A_TASKGROUPID"), "Type" => "L", "Options" => $arGroups, "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "select"), "ALLOW_CHANGE_DEADLINE" => array("Name" => GetMessage("BPTA1A_CHANGE_DEADLINE"), "Type" => "B", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "bool"), "ALLOW_TIME_TRACKING" => array("Name" => GetMessage("BPTA1A_ALLOW_TIME_TRACKING"), "Type" => "B", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "bool"), "TASK_CONTROL" => array("Name" => GetMessage("BPTA1A_CHECK_RESULT"), "Type" => "B", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "bool"), "ADD_IN_REPORT" => array("Name" => GetMessage("BPTA1A_ADD_TO_REPORT"), "Type" => "B", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => false, "BaseType" => "bool"), "AUDITORS" => array("Name" => GetMessage("BPTA1A_TASKTRACKERS"), "Type" => "S:UserID", "Filterable" => true, "Editable" => true, "Required" => false, "Multiple" => true, "BaseType" => "user"));
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("TASKS_TASK", 0, LANGUAGE_ID);
foreach ($arUserFields as $field) {
$arFields[$field["FIELD_NAME"]] = array("Name" => $field["EDIT_FORM_LABEL"], "Type" => $field["USER_TYPE_ID"], "Filterable" => true, "Editable" => true, "Required" => $field["MANDATORY"] == "Y", "Multiple" => $field["MULTIPLE"] == "Y", "BaseType" => $field["USER_TYPE_ID"], "UserField" => $field);
}
return $arFields;
}
示例12: array
}
}
}
}
}
$arResult["PostToShow"]["FEED_DESTINATION"]["HIDDEN_GROUPS"] = array();
$arHiddenGroups = array();
if (!empty($arResult["PostToShow"]["FEED_DESTINATION"]["SELECTED"])) {
foreach ($arResult["PostToShow"]["FEED_DESTINATION"]["SELECTED"] as $gID => $value) {
if ($value == "sonetgroups" && empty($arResult["PostToShow"]["FEED_DESTINATION"]["SONETGROUPS"][$gID])) {
$arHiddenGroups[] = substr($gID, 2);
}
}
}
if (!empty($arHiddenGroups)) {
$rsGroup = CSocNetGroup::GetList(array(), array("ID" => $arHiddenGroups), false, false, array("ID", "NAME"));
while ($arGroup = $rsGroup->Fetch()) {
$arResult["PostToShow"]["FEED_DESTINATION"]["HIDDEN_GROUPS"][$arGroup["ID"]] = array("ID" => $arGroup["ID"], "NAME" => $arGroup["NAME"]);
}
if (!CSocNetUser::IsCurrentUserModuleAdmin() && is_object($GLOBALS["USER"])) {
$arGroupID = CSocNetLogTools::GetAvailableGroups($arResult["bExtranetUser"] ? "Y" : "N", $arResult["bExtranetSite"] ? "Y" : "N");
foreach ($arResult["PostToShow"]["FEED_DESTINATION"]["HIDDEN_GROUPS"] as $group_code => $arBlogSPerm) {
if (!in_array($group_code, $arGroupID)) {
$arResult["PostToShow"]["FEED_DESTINATION"]["HIDDEN_GROUPS"][$group_code]["NAME"] = GetMessage("B_B_HIDDEN_GROUP");
}
}
}
}
// intranet structure
$arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true));
$arResult["PostToShow"]["FEED_DESTINATION"]['DEPARTMENT'] = $arStructure['department'];
示例13: executeComponent
public function executeComponent()
{
global $APPLICATION;
$APPLICATION->SetTitle(GetMessage('TASKS_TITLE_TASKS'));
if (!CModule::IncludeModule('tasks')) {
ShowError(GetMessage('TASKS_MODULE_NOT_FOUND'));
return 0;
}
if (!CModule::IncludeModule('socialnetwork')) {
return 0;
}
$this->arResult['PROJECTS'] = array();
$this->processParams();
// prepare arResult
if (!($this->arResult['LOGGED_IN_USER'] >= 1)) {
return 0;
}
$isAccessible = $this->arParams['USER_ID'] == $this->arResult['LOGGED_IN_USER'];
if (!$isAccessible) {
ShowError(GetMessage('TASKS_PROJECTS_ACCESS_DENIED'));
return 0;
}
// Get groups where user is member
$arGroupsIds = array();
$rsGroupMembers = CSocNetUserToGroup::GetList(array(), array('USER_ID' => $this->arParams['USER_ID']), false, false, array('GROUP_ID'));
while ($arGroupMembers = $rsGroupMembers->getNext()) {
$arGroupsIds[] = (int) $arGroupMembers['GROUP_ID'];
}
$arGroupsIds = array_unique(array_filter($arGroupsIds));
$cntAll = $cntInWork = $cntComplete = 0;
// totals
if (!empty($arGroupsIds)) {
$arCounters = $this->getCounts($arGroupsIds);
// Get extra data for groups
$rsGroup = CSocNetGroup::GetList(array('NAME' => 'ASC'), array('ID' => $arGroupsIds, 'ACTIVE' => 'Y', 'CLOSED' => 'N'), false, false, array('ID', 'NAME', 'IMAGE_ID', 'NUMBER_OF_MEMBERS', 'CLOSED'));
while ($arGroup = $rsGroup->getNext()) {
$groupId = (int) $arGroup['ID'];
$arGroupCounters = $arCounters[$groupId];
// Skip groups without tasks
if ($arGroupCounters['ALL'] == 0) {
continue;
}
$groupPath = CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_GROUP'], array('group_id' => $groupId));
$groupTasksPath = CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_GROUP_TASKS'], array('group_id' => $groupId));
if (strpos($groupTasksPath, '?') !== false) {
$groupTasksPath .= '&';
} else {
$groupTasksPath .= '?';
}
$groupTasksPath .= 'F_CANCEL=Y&F_FILTER_SWITCH_PRESET=';
$cntAll += $arGroupCounters['ALL'];
$cntInWork += $arGroupCounters['IN_WORK'];
$cntComplete += $arGroupCounters['COMPLETE'];
$this->arResult['PROJECTS'][$groupId] = array('ID' => $groupId, 'TITLE' => $arGroup['NAME'], '~TITLE' => $arGroup['~NAME'], 'IMAGE_ID' => $arGroup['IMAGE_ID'], 'COUNTERS' => $arGroupCounters, 'NUMBER_OF_MEMBERS' => $arGroup['NUMBER_OF_MEMBERS'], 'PATHES' => array('TO_GROUP' => $groupPath, 'ALL' => $groupTasksPath . CTaskFilterCtrl::STD_PRESET_ALL_MY_TASKS, 'IN_WORK' => $groupTasksPath . CTaskFilterCtrl::STD_PRESET_ACTIVE_MY_TASKS, 'COMPLETE' => $groupTasksPath . CTaskFilterCtrl::STD_PRESET_COMPLETED_MY_TASKS), 'MEMBERS' => array());
}
// Get members of groups
$rsGroupMembers = CSocNetUserToGroup::GetList(array(), array('GROUP_ID' => $arGroupsIds), false, false, array('GROUP_ID', 'USER_ID', 'ROLE', 'GROUP_OWNER_ID', 'USER_LAST_NAME', 'USER_NAME', 'USER_SECOND_NAME', 'USER_PERSONAL_PHOTO', 'USER_LOGIN', 'USER_PERSONAL_PHOTO', 'USER_WORK_POSITION'));
while ($arGroupMember = $rsGroupMembers->getNext()) {
$groupId = (int) $arGroupMember['GROUP_ID'];
if (!isset($this->arResult['PROJECTS'][$groupId])) {
continue;
}
$memberId = (int) $arGroupMember['USER_ID'];
$bGroupOwner = $memberId == $arGroupMember['GROUP_OWNER_ID'];
$bGroupModerator = $arGroupMember['ROLE'] == SONET_ROLES_MODERATOR;
$this->arResult['PROJECTS'][$groupId]['MEMBERS'][] = array('ID' => $memberId, 'IS_GROUP_OWNER' => $bGroupOwner ? 'Y' : 'N', 'IS_GROUP_MODERATOR' => $bGroupModerator ? 'Y' : 'N', 'PHOTO_ID' => $arGroupMember['USER_PERSONAL_PHOTO'], 'USER_NAME' => $arGroupMember['USER_NAME'], '~USER_NAME' => $arGroupMember['~USER_NAME'], 'USER_LAST_NAME' => $arGroupMember['USER_LAST_NAME'], '~USER_LAST_NAME' => $arGroupMember['~USER_LAST_NAME'], 'USER_SECOND_NAME' => $arGroupMember['USER_SECOND_NAME'], '~USER_SECOND_NAME' => $arGroupMember['~USER_SECOND_NAME'], 'USER_LOGIN' => $arGroupMember['USER_LOGIN'], '~USER_LOGIN' => $arGroupMember['~USER_LOGIN'], 'WORK_POSITION' => (string) $arGroupMember['USER_WORK_POSITION'], '~WORK_POSITION' => (string) $arGroupMember['~USER_WORK_POSITION'], 'HREF' => CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_USER'], array('user_id' => $memberId)), 'USER_GENDER' => $arGroupMember['USER_PERSONAL_GENDER'], 'FORMATTED_NAME' => $f = $this->getFormattedUserName($memberId, $arGroupMember['~USER_NAME'], $arGroupMember['~USER_SECOND_NAME'], $arGroupMember['~USER_LAST_NAME'], $arGroupMember['~USER_LOGIN']));
}
}
$this->arResult['TOTALS'] = array('ALL' => $cntAll, 'IN_WORK' => $cntInWork, 'COMPLETE' => $cntComplete);
$this->IncludeComponentTemplate();
}
示例14: array
$arResult["ALLOW_CREATE_GROUP"] = false;
if ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["Urls"]["GroupCreate"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_CREATE"], array("user_id" => $GLOBALS["USER"]->GetID()));
$arResult["ALLOW_CREATE_GROUP"] = CSocNetUser::IsCurrentUserModuleAdmin() || $GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array(SITE_ID, false)) >= "K";
}
$arResult["SEARCH_RESULT"] = array();
$arNavParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bDescPageNumbering" => false);
$arNavigation = CDBResult::GetNavParams($arNavParams);
$arFilterTmp = array("SITE_ID" => SITE_ID, "ACTIVE" => "Y");
if (!CSocNetUser::IsCurrentUserModuleAdmin()) {
$arFilterTmp["CHECK_PERMISSIONS"] = $GLOBALS["USER"]->GetID();
}
if ($arParams["SUBJECT_ID"] > 0) {
$arFilterTmp["SUBJECT_ID"] = $arParams["SUBJECT_ID"];
}
$dbGroups = CSocNetGroup::GetList(array("NAME" => "ASC"), $arFilterTmp, false, $arNavParams, array("ID", "NAME", "DESCRIPTION", "DATE_ACTIVITY", "IMAGE_ID", "NUMBER_OF_MEMBERS", "SUBJECT_NAME", "CLOSED"));
while ($arGroup = $dbGroups->GetNext()) {
$arGroup["TITLE_FORMATED"] = $arGroup["NAME"];
$arGroup["BODY_FORMATED"] = $arGroup["DESCRIPTION"];
$arGroup["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arGroup["ID"]));
if (intval($arGroup["IMAGE_ID"]) <= 0) {
$arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 100, "/bitrix/images/socialnetwork/nopic_group_100.gif", 100, $arGroup["URL"], true);
$arGroup["IMAGE_FILE"] = $arImage["FILE"];
$arGroup["IMAGE_IMG"] = $arImage["IMG"];
$arGroup["FULL_DATE_CHANGE_FORMATED"] = date($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arGroup["DATE_ACTIVITY"], CSite::GetDateFormat("FULL")));
$arGroup["ARCHIVE"] = $arGroup["CLOSED"];
$arResult["SEARCH_RESULT"][] = $arGroup;
}
$arResult["NAV_STRING"] = $dbGroups->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C2411_NAV"), "", false);
示例15: GetAvailableGroups
function GetAvailableGroups($isExtranetUser = false, $isExtranetSite = false)
{
static $arSonetGroupIDAvailable = false;
if (is_array($arSonetGroupIDAvailable)) {
return $arSonetGroupIDAvailable;
} else {
$arSonetGroupIDAvailable = array();
if (!$isExtranetUser) {
$isExtranetUser = CModule::IncludeModule("extranet") && !CExtranet::IsIntranetUser() ? "Y" : "N";
}
if (!$isExtranetSite) {
$isExtranetSite = CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite() ? "Y" : "N";
}
$cache = new CPHPCache();
$cache_time = 31536000;
$cache_id = $GLOBALS["USER"]->GetID() . ($isExtranetUser == "Y" ? "_ex" : "");
$cache_path = "/sonet/groups_available/" . $GLOBALS["USER"]->GetID() . "/";
if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arSonetGroupIDAvailable = $arCacheVars["arGroupID"];
} else {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
}
$arFilter = array("CHECK_PERMISSIONS" => $GLOBALS["USER"]->GetID());
if ($isExtranetUser == "Y" && $isExtranetSite == "Y" && CModule::IncludeModule("extranet")) {
$arFilter["SITE_ID"] = CExtranet::GetExtranetSiteID();
}
$rsGroup = CSocNetGroup::GetList(array(), $arFilter, false, false, array("ID"));
while ($arGroup = $rsGroup->Fetch()) {
$arSonetGroupIDAvailable[] = $arGroup["ID"];
}
$arCacheData = array("arGroupID" => $arSonetGroupIDAvailable);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
$cache->EndDataCache($arCacheData);
}
return $arSonetGroupIDAvailable;
}
}