示例#1
0
 public static function createGroup($arFields)
 {
     if (!is_array($arFields)) {
         throw new Exception('Incorrect input data');
     }
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "~" || substr($key, 0, 1) == "=") {
             unset($arFields[$key]);
         }
     }
     if (isset($arFields["IMAGE_ID"])) {
         unset($arFields["IMAGE_ID"]);
     }
     if (!is_set($arFields, "SITE_ID") || strlen($arFields["SITE_ID"]) <= 0) {
         $arFields["SITE_ID"] = array(SITE_ID);
     }
     if (!is_set($arFields, "SUBJECT_ID") || intval($arFields["SUBJECT_ID"]) <= 0) {
         $rsSubject = CSocNetGroupSubject::GetList(array("SORT" => "ASC"), array("SITE_ID" => $arFields["SITE_ID"]), false, false, array("ID"));
         if ($arSubject = $rsSubject->Fetch()) {
             $arFields["SUBJECT_ID"] = $arSubject["ID"];
         }
     }
     $groupID = CSocNetGroup::CreateGroup($GLOBALS["USER"]->GetID(), $arFields, false);
     if ($groupID <= 0) {
         throw new Exception('Cannot create group');
     }
     return $groupID;
 }
示例#2
0
文件: rest.php 项目: ASDAFF/bxApiDocs
	public static function createGroup($arFields)
	{
		if (!is_set($arFields, "SITE_ID") || strlen($arFields["SITE_ID"]) <= 0)
			$arFields["SITE_ID"] = array(SITE_ID);

		if (!is_set($arFields, "SUBJECT_ID") || intval($arFields["SUBJECT_ID"]) <= 0)
		{
			$rsSubject = CSocNetGroupSubject::GetList(
				array("SORT" => "ASC"),
				array("SITE_ID" => SITE_ID),
				false,
				false,
				array("ID")
			);
			if ($arSubject = $rsSubject->Fetch())
				$arFields["SUBJECT_ID"] = $arSubject["ID"];
		}

		$groupID = CSocNetGroup::CreateGroup($GLOBALS["USER"]->GetID(), $arFields, false);

		if($groupID <= 0)
			throw new Exception('Cannot create group');

		return $groupID;
	}
示例#3
0
 public function Execute()
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
     $users = array_unique(CBPHelper::ExtractUsers($this->Users, $documentId, false));
     $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID"));
     $row = $dbSubjects->fetch();
     if (!$row) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_SUBJECT_ID"));
         return CBPActivityExecutionStatus::Closed;
     }
     $subjectId = $row['ID'];
     unset($dbSubjects, $row);
     $options = array("SITE_ID" => SITE_ID, "NAME" => $this->GroupName, "VISIBLE" => "Y", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $subjectId, "INITIATE_PERMS" => SONET_ROLES_OWNER, "SPAM_PERMS" => SONET_ROLES_USER);
     $groupId = CSocNetGroup::CreateGroup($ownerId, $options);
     if (!$groupId) {
         $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_CREATE_GROUP"));
         return CBPActivityExecutionStatus::Closed;
     }
     $this->GroupId = $groupId;
     foreach ($users as $user) {
         if ($user == $ownerId) {
             continue;
         }
         CSocNetUserToGroup::Add(array("USER_ID" => $user, "GROUP_ID" => $groupId, "ROLE" => SONET_ROLES_USER, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $ownerId, "MESSAGE" => false));
     }
     return CBPActivityExecutionStatus::Closed;
 }
示例#4
0
    $arReplace = array("BLOG_GROUP_ID" => $blogGroupID, "FORUM_ID" => $forumID, "FILES_GROUP_IBLOCK_ID" => $filesGroupIBlockID, "PHOTO_GROUP_IBLOCK_ID" => $photoGroupIBlockID, "PHOTO_FORUM_ID" => $photoForumID, "TASKS_IBLOCK_ID" => $tasksIblockId, "TASKS_FORUM_ID" => $tasksForumId);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", $arReplace);
    $arReplace = array("FILES_GROUP_IBLOCK_ID" => $filesGroupIBlockID, "FILES_USER_IBLOCK_ID" => $filesUserIBlockID);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/docs/index.php", $arReplace);
    $arReplace = array("FILES_GROUP_IBLOCK_ID" => $filesGroupIBlockID, "FILES_USER_IBLOCK_ID" => $filesUserIBlockID, "TASKS_FORUM_ID" => $tasksForumId);
}
if (WIZARD_INSTALL_DEMO_DATA || WIZARD_FIRST_INSTAL !== "Y") {
    $arGroupSubjects = array();
    $arGroupSubjectsId = array();
    for ($i = 0; $i < 5; $i++) {
        $arGroupSubjects[$i] = array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_SUBJECT_" . $i));
        $arGroupSubjectsId[$i] = 0;
    }
    $errorMessage = "";
    foreach ($arGroupSubjects as $ind => $arGroupSubject) {
        $rsSocNetGroupSubject = CSocNetGroupSubject::GetList(array(), $arGroupSubject);
        $idTmp = false;
        if ($arSocNetGroupSubject = $rsSocNetGroupSubject->Fetch()) {
            $arGroupSubjectsId[$ind] = $arSocNetGroupSubject["ID"];
        } else {
            $idTmp = CSocNetGroupSubject::Add($arGroupSubject);
            if ($idTmp) {
                $arGroupSubjectsId[$ind] = IntVal($idTmp);
            } else {
                if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                    $errorMessage .= $e->GetString();
                }
            }
        }
    }
    if (StrLen($errorMessage) <= 0) {
                $arFields["LIST_FILTER_LABEL"][$arLang["LID"]] = GetSocNetMessageLocal("SONET_I_USER_PROP_LFL", $arLang["LID"]);
            }
            $userField = new CUserTypeEntity();
            $userFieldID = $userField->Add($arFields);
            if (!$userFieldID || $userFieldID <= 0) {
                if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                    $errorString .= $e->GetString();
                }
            }
        }
    }
}
// ------------------ GROUPS -------------------------------
if (CModule::IncludeModule("socialnetwork")) {
    $bSonetError = false;
    $cnt = CSocNetGroupSubject::GetList(array(), array("SITE_ID" => $arSite["SITE_ID"]), array());
    if (IntVal($cnt) <= 0) {
        $arGroupSubjects = array();
        $arGroupSubjectsId = array();
        for ($i = 0; $i < 3; $i++) {
            $arGroupSubjects[$i] = array("SITE_ID" => $arSite["SITE_ID"], "NAME" => GetSocNetMessageLocal("SONET_GROUP_SUBJECT_" . $i, $arSite["LANGUAGE_ID"]));
            $arGroupSubjectsId[$i] = 0;
        }
        foreach ($arGroupSubjects as $ind => $arGroupSubject) {
            $idTmp = CSocNetGroupSubject::Add($arGroupSubject);
            if ($idTmp) {
                $arGroupSubjectsId[$ind] = IntVal($idTmp);
            } else {
                if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                    $errorString .= $e->GetString();
                }
示例#6
0
            $arResult["FatalError"] = GetMessage("SONET_C36_NO_USER_ID") . ". ";
        } elseif ($user2Request == $user4Groups) {
            $arResult["FatalError"] = GetMessage("SONET_C36_SELF") . ". ";
        }
    }
}
if (strlen($arResult["FatalError"]) <= 0) {
    if ($arParams["PAGE"] == "groups_list") {
        $arResult["Subjects"] = array();
        $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID", "NAME"));
        while ($arSubject = $dbSubjects->GetNext()) {
            $arResult["Subjects"][$arSubject["ID"]] = $arSubject["NAME"];
        }
    } elseif ($arParams["PAGE"] == "groups_subject" && intval($arResult["filter_subject_id"]) > 0) {
        $arResult["Subjects"] = array();
        $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID, "ID" => intval($arResult["filter_subject_id"])), false, false, array("ID", "NAME"));
        if ($arSubject = $dbSubjects->GetNext()) {
            $arResult["Subject"] = $arSubject;
        }
    }
}
if (StrLen($arResult["FatalError"]) <= 0 && intval($user4Groups) > 0) {
    $dbUser = CUser::GetByID($user4Groups);
    $arResult["User"] = $dbUser->GetNext();
    if (!is_array($arResult["User"])) {
        $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_USER") . ". ";
    }
    if (CModule::IncludeModule('extranet') && !CExtranet::IsProfileViewable($arResult["User"])) {
        return false;
    }
}
示例#7
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (CModule::IncludeModule("socialnetwork")) {
    $arSubjects = array();
    $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID", "NAME"));
    while ($arSubjectTmp = $dbSubjects->GetNext()) {
        $arSubjects[$arSubjectTmp["ID"]] = $arSubjectTmp["NAME"];
    }
    ?>
<div class="rounded-block">
	<div class="corner left-top"></div><div class="corner right-top"></div>
	<div class="block-content">
		<h3>Quick Search</h3>
<div class="filter-box filter-people">
	<form method="get" action="#SITE_DIR#groups/" class="bx-selector-form filter-form">
		<input type="hidden" name="page" value="group_search">
		<?php 
    if ($_REQUEST["how"] == "d") {
        ?>
			<input type="hidden" name="how" value="d">
		<?php 
    }
    ?>
		<div class="filter-item filter-name">
			<label for="filter-name"><span class="required-field">*</span>Search:</label>
			<input type="text" id="filter-name" name="q" class="filter-textbox" value="<?php 
    echo htmlspecialcharsbx(trim($_REQUEST["q"]));
    ?>
示例#8
0
 /**
  * <p>Возвращает параметры темы. Не порождает запросов к базе данных.</p>
  *
  *
  * @param int $id  Код темы.</bod
  *
  * @return array <p>Массив параметров темы. Массив имеет ключи:<br><b>ID</b> - код
  * темы,<br><b>SITE_ID</b> - код сайта,<br><b>NAME</b> - название. </p> <br><br>
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetgroupsubject/GetByID.php
  * @author Bitrix
  */
 public static function GetByID($ID)
 {
     global $DB;
     if (!CSocNetGroup::__ValidateID($ID)) {
         return false;
     }
     $ID = IntVal($ID);
     $dbResult = CSocNetGroupSubject::GetList(array(), array("ID" => $ID));
     if ($arResult = $dbResult->GetNext()) {
         return $arResult;
     }
     return False;
 }
示例#9
0
                $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;
        }
    }
}
while ($arGroup = $dbResultList->NavNext(true, "f_")) {
    $arMembers = array();
    $arResult["Users"] = false;
    $dbRequests = CSocNetUserToGroup::GetList(array("USER_LAST_NAME" => "ASC", "USER_NAME" => "ASC"), array("GROUP_ID" => $arGroup["ID"], "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID", "ROLE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN"));
    while ($arRequests = $dbRequests->Fetch()) {
        $arTmpUser = array("ID" => $arRequests["USER_ID"], "NAME" => $arRequests["USER_NAME"], "LAST_NAME" => $arRequests["USER_LAST_NAME"], "LOGIN" => $arRequests["USER_LOGIN"]);
        $arMembers[$arRequests["USER_ID"]] = CUser::FormatName(GetMessage("USER_NAME_TEMPLATE"), $arTmpUser, true, false);
示例#10
0
 public static function RequestToSonetGroups($arUserId, $arGroupCode, $arGroupName, $bExtranetUser = false)
 {
     $arGroupToAdd = array();
     $strError = false;
     if (!is_array($arUserId)) {
         $arUserId = array($arUserId);
     }
     if (is_array($arGroupCode) && !empty($arGroupCode) && CModule::IncludeModule("socialnetwork")) {
         foreach ($arGroupCode as $group_code) {
             if ($bExtranetUser && preg_match('/^(SGN\\d+)$/', $group_code, $match) && is_array($arGroupName) && isset($arGroupName[$match[1]]) && strlen($arGroupName[$match[1]]) > 0 && CModule::IncludeModule("extranet") && (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false) || $GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array(CExtranet::GetExtranetSiteID(), false)) >= "K")) {
                 // check and create group, for extranet only
                 $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID"));
                 if ($arSubject = $dbSubjects->GetNext()) {
                     $arSocNetGroupFields = array("NAME" => $arGroupName[$match[1]], "DESCRIPTION" => "", "VISIBLE" => "N", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $arSubject["ID"], "INITIATE_PERMS" => "E", "SPAM_PERMS" => "K", "SITE_ID" => array($SITE_ID, CExtranet::GetExtranetSiteID()));
                     if ($group_id = CSocNetGroup::CreateGroup($GLOBALS["USER"]->GetID(), $arSocNetGroupFields, false)) {
                         $arGroupToAdd[] = $group_id;
                     } elseif ($e = $GLOBALS["APPLICATION"]->GetException()) {
                         $strError = $e->GetString();
                     }
                 }
             } elseif (preg_match('/^SG(\\d+)$/', $group_code, $match)) {
                 $group_id = $match[1];
                 if (($arGroup = CSocNetGroup::GetByID($group_id)) && ($arCurrentUserPerms = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arGroup, CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false))) && $arCurrentUserPerms["UserCanInitiate"] && $arGroup["CLOSED"] != "Y") {
                     $arGroupToAdd[] = $group_id;
                 }
             }
         }
         if (!$strError) {
             foreach ($arGroupToAdd as $group_id) {
                 foreach ($arUserId as $user_id) {
                     if (!CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $user_id, $group_id, "", false)) {
                         if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                             $strError .= $e->GetString();
                         }
                     }
                 }
             }
         }
     }
     return $strError;
 }
示例#11
0
                $arBlogSubjectTmp = CSocNetGroupSubject::GetByID($ID);
                if (!CSocNetGroupSubject::Delete($ID)) {
                    $DB->Rollback();
                    if ($ex = $APPLICATION->GetException()) {
                        $lAdmin->AddGroupError($ex->GetString(), $ID);
                    } else {
                        $lAdmin->AddGroupError(GetMessage("SONET_DELETE_ERROR"), $ID);
                    }
                }
                //BXClearCache(True, "/".$arBlogSubjectTmp["SITE_ID"]."/socialnetwork/");
                $DB->Commit();
                break;
        }
    }
}
$dbResultList = CSocNetGroupSubject::GetList(array($by => $order), $arFilter, false, false, array("ID", "SITE_ID", "NAME", "SORT"));
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("SONET_SUBJECT_NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage("SONET_SUBJECT_NAME"), "sort" => "NAME", "default" => true), array("id" => "SITE_ID", "content" => GetMessage('SONET_SUBJECT_SITE_ID'), "sort" => "SITE_ID", "default" => true), array("id" => "SORT", "content" => GetMessage('SONET_SUBJECT_SORT'), "sort" => "SORT", "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$arSites = array();
$dbSitesList = CSite::GetList($b = "sort", $o = "asc");
while ($arSite = $dbSitesList->Fetch()) {
    $arSites[$arSite["LID"]] = "[" . $arSite["LID"] . "]&nbsp;" . $arSite["NAME"];
}
while ($arSubject = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arSubject);
    $row->AddField("ID", '<a href="/bitrix/admin/socnet_subject_edit.php?ID=' . $f_ID . '&lang=' . LANGUAGE_ID . '" title="' . GetMessage("SONET_UPDATE_ALT") . '">' . $f_ID . '</a>');
    $row->AddInputField("NAME", array("size" => "35"));
    $f_SITE_ID = '';
示例#12
0
                        $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->NavText($dbResultList->GetNavPrint(GetMessage("SONET_GROUP_NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage("SONET_GROUP_NAME"), "sort" => "NAME", "default" => true), array("id" => "SUBJECT_ID", "content" => GetMessage('SONET_GROUP_SUBJECT_ID'), "sort" => "SUBJECT_ID", "default" => true), array("id" => "OWNER_ID", "content" => GetMessage('SONET_GROUP_OWNER_ID'), "sort" => "OWNER_ID", "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$arSubjects = array();
$dbSubjectsList = CSocNetGroupSubject::GetList();
while ($arSubject = $dbSubjectsList->Fetch()) {
    $arSubjects[$arSubject["SITE_ID"]][$arSubject["ID"]] = "[" . $arSubject["SITE_ID"] . "]&nbsp;" . $arSubject["NAME"];
}
while ($arGroup = $dbResultList->NavNext(true, "f_")) {
    $arMembers = array();
    $arResult["Users"] = false;
    $dbRequests = CSocNetUserToGroup::GetList(array("USER_LAST_NAME" => "ASC", "USER_NAME" => "ASC"), array("GROUP_ID" => $arGroup["ID"], "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID", "ROLE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN"));
    while ($arRequests = $dbRequests->Fetch()) {
        $arTmpUser = array("ID" => $arRequests["USER_ID"], "NAME" => $arRequests["USER_NAME"], "LAST_NAME" => $arRequests["USER_LAST_NAME"], "LOGIN" => $arRequests["USER_LOGIN"]);
        $arMembers[$arRequests["USER_ID"]] = CUser::FormatName(GetMessage("USER_NAME_TEMPLATE"), $arTmpUser, true, false);
    }
    $row =& $lAdmin->AddRow($f_ID, $arGroup);
    $row->AddField("ID", $f_ID);
    $row->AddInputField("NAME", array("size" => "35"));
    $row->AddSelectField("SUBJECT_ID", $arSubjects[$arGroup["SITE_ID"]], array());
示例#13
0
            if ($arRes = $dbRes->Fetch()) {
                $photoGroupIBlockID = $arRes["ID"];
            }
            $dbRes = CIBlock::GetList(array(), array("SITE_ID" => $default_site_id, "CODE" => "intranet_tasks"));
            if ($arRes = $dbRes->Fetch()) {
                $tasksIblockId = $arRes["ID"];
            }
        }
    }
    $arReplace = array("FILES_USER_IBLOCK_ID" => $filesUserIBlockID, "CALENDAR_USER_IBLOCK_ID" => $calendarUserIBlockID, "PHOTO_USER_IBLOCK_ID" => $photoUserIBlockID, "FILES_GROUP_IBLOCK_ID" => $filesGroupIBlockID, "CALENDAR_GROUP_IBLOCK_ID" => $calendarGroupIBlockID, "PHOTO_GROUP_IBLOCK_ID" => $photoGroupIBlockID, "TASKS_IBLOCK_ID" => $tasksIblockId);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", $arReplace);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/contacts/personal.php", $arReplace);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index.php", $arReplace);
    CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", $arReplace);
}
$cnt = CSocNetGroupSubject::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID), array());
if (IntVal($cnt) > 0) {
    return;
}
$arGroupSubjects = array();
$arGroupSubjectsId = array();
for ($i = 0; $i < 4; $i++) {
    $arGroupSubjects[$i] = array("SITE_ID" => WIZARD_SITE_ID, "NAME" => GetMessage("SONET_GROUP_SUBJECT_" . $i));
    $arGroupSubjectsId[$i] = 0;
}
$errorMessage = "";
foreach ($arGroupSubjects as $ind => $arGroupSubject) {
    $idTmp = CSocNetGroupSubject::Add($arGroupSubject);
    if ($idTmp) {
        $arGroupSubjectsId[$ind] = IntVal($idTmp);
    } else {