当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetGroup::getByID方法代码示例

本文整理汇总了PHP中CSocNetGroup::getByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetGroup::getByID方法的具体用法?PHP CSocNetGroup::getByID怎么用?PHP CSocNetGroup::getByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetGroup的用法示例。


在下文中一共展示了CSocNetGroup::getByID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move

 /**
  *
  * Moves the source task before/after the target task;
  * @param array $data
  * @return false|array
  */
 public function move($data)
 {
     global $USER;
     if (!$USER->isAuthorized()) {
         $this->errors->add("AUTH_REQUIRED", Loc::getMessage("TASKS_SORTING_AUTH_REQUIRED"));
         return false;
     }
     $sourceId = isset($data["sourceId"]) ? intval($data["sourceId"]) : 0;
     $targetId = isset($data["targetId"]) ? intval($data["targetId"]) : 0;
     $before = isset($data["before"]) && ($data["before"] === true || $data["before"] === "true") ? true : false;
     $newGroupId = isset($data["newGroupId"]) ? intval($data["newGroupId"]) : null;
     $newParentId = isset($data["newParentId"]) ? intval($data["newParentId"]) : null;
     $currentGroupId = isset($data["currentGroupId"]) ? intval($data["currentGroupId"]) : 0;
     $userId = $USER->getId();
     if ($sourceId === $targetId || $sourceId < 1) {
         return array();
     }
     $sourceTask = new \CTaskItem($sourceId, $userId);
     if (!$sourceTask->checkCanRead()) {
         $this->errors->add("SOURCE_TASK_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_SOURCE_TASK"));
         return false;
     }
     if ($currentGroupId) {
         $group = \CSocNetGroup::getByID($currentGroupId);
         $canEdit = \CSocNetFeaturesPerms::currentUserCanPerformOperation(SONET_ENTITY_GROUP, $currentGroupId, "tasks", "edit_tasks");
         if (!$group || !$canEdit) {
             $this->errors->add("GROUP_PERMS_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_GROUP_PERMISSIONS"));
             return false;
         }
     }
     /*
     GROUP_ID and PARENT_ID could be changed after drag&drop manipulations.
     Target task is not required. Example: We want to move Task 1 after Project. In this case a target task is undefined.
     	Task 1
     	Project (without tasks)
     */
     $newTaskData = array();
     if ($newGroupId !== null) {
         $newTaskData["GROUP_ID"] = $newGroupId;
     }
     if ($newParentId !== null) {
         $newTaskData["PARENT_ID"] = $newParentId;
     }
     if (count($newTaskData)) {
         $sourceTask->update($newTaskData);
     }
     //But it's required for sorting
     if ($targetId < 1) {
         return array();
     }
     $targetTask = new \CTaskItem($targetId, $userId);
     if (!$targetTask->checkCanRead()) {
         $this->errors->add("TARGET_TASK_NOT_FOUND", Loc::getMessage("TASKS_SORTING_WRONG_TARGET_TASK"));
         return false;
     }
     SortingTable::setSorting($userId, $currentGroupId, $sourceId, $targetId, $before);
     return array();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:64,代码来源:sorting.php

示例2: getGroup

 private function getGroup()
 {
     if ($this->group !== null) {
         return $this->group;
     }
     if (!Loader::includeModule('socialnetwork')) {
         return null;
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $this->group = \CSocNetGroup::getByID($this->entityId);
     if (!is_array($this->group)) {
         $this->group = array();
     }
     return $this->group;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:15,代码来源:group.php

示例3: getDestinations

 protected function getDestinations()
 {
     $isExtranetInstalled = Loader::includeModule("extranet");
     $members = array();
     if ($this->blogPostData["HAS_SOCNET_ALL"] != "Y") {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $perm = \CBlogPost::getSocnetPermsName($this->entityId);
         foreach ($perm as $type => $v) {
             foreach ($v as $vv) {
                 if ($type == "SG") {
                     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                     if ($socNetGroup = \CSocNetGroup::getByID($vv["ENTITY_ID"])) {
                         $name = $socNetGroup["~NAME"];
                         $link = \CComponentEngine::makePathFromTemplate($this->getPathToGroup(), array("group_id" => $vv["ENTITY_ID"]));
                         $groupSiteID = false;
                         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                         $queryGroupSite = \CSocNetGroup::getSite($vv["ENTITY_ID"]);
                         while ($groupSite = $queryGroupSite->fetch()) {
                             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                             if (!$isExtranetInstalled || $groupSite["LID"] != \CExtranet::getExtranetSiteID()) {
                                 $groupSiteID = $groupSite["LID"];
                                 break;
                             }
                         }
                         if ($groupSiteID) {
                             /** @noinspection PhpDynamicAsStaticMethodCallInspection */
                             $tmp = \CSocNetLogTools::processPath(array("GROUP_URL" => $link), $this->getUser()->getId(), $groupSiteID);
                             // user_id is not important parameter
                             $link = strlen($tmp["URLS"]["GROUP_URL"]) > 0 ? $tmp["URLS"]["GROUP_URL"] : $link;
                         }
                         $isExtranet = is_array($GLOBALS["arExtranetGroupID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]);
                         $members[] = array("NAME" => $name, "LINK" => $link, 'AVATAR_SRC' => Ui\Avatar::getGroup($socNetGroup['IMAGE_ID']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
                     }
                 } elseif ($type == "U") {
                     if (in_array("US" . $vv["ENTITY_ID"], $vv["ENTITY"])) {
                         array_unshift($members, array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N"));
                     } else {
                         $name = \CUser::formatName('#NAME# #LAST_NAME#', array("NAME" => $vv["~U_NAME"], "LAST_NAME" => $vv["~U_LAST_NAME"], "SECOND_NAME" => $vv["~U_SECOND_NAME"], "LOGIN" => $vv["~U_LOGIN"], "NAME_LIST_FORMATTED" => ""), false);
                         $isExtranet = is_array($GLOBALS["arExtranetUserID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetUserID"]);
                         $members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $vv["ENTITY_ID"])), 'AVATAR_SRC' => Ui\Avatar::getPerson($vv['U_PERSONAL_PHOTO']), "IS_EXTRANET" => $isExtranet ? "Y" : "N");
                     }
                 } elseif ($type == "DR") {
                     $members[] = array("NAME" => $vv["EL_NAME"], "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
                 }
             }
         }
     } else {
         $members[] = array("NAME" => Loc::getMessage('DISK_UF_BLOG_POST_CONNECTOR_MEMBERS_ALL'), "LINK" => null, 'AVATAR_SRC' => Ui\Avatar::getDefaultGroup(), "IS_EXTRANET" => "N");
     }
     return $members;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:blogpostconnector.php

示例4: getUsersFromUserGroup

 public static function getUsersFromUserGroup($group, $documentId)
 {
     if (substr($documentId, 0, 8) == "STORAGE_") {
         $storageId = self::getStorageIdByType($documentId);
     } else {
         if (is_array($documentId)) {
             $documentId = intval($documentId[2]);
         }
         /** @var File $file */
         $file = File::loadById($documentId);
         if (!$file) {
             return array();
         }
         $storageId = $file->getStorageId();
     }
     if (strtolower($group) == "author") {
         $documentId = intval($documentId);
         if ($documentId <= 0) {
             return array();
         }
         /** @var File $file */
         $file = File::loadById($documentId);
         if (!$file) {
             return array();
         }
         return array($file->getCreatedBy());
     }
     if ($storageId) {
         $storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
         if ($storage->getProxyType() instanceof ProxyType\Group) {
             $entityId = $storage->getEntityId();
             $group = strtoupper($group);
             if (Loader::includeModule("socialnetwork")) {
                 $listUserGroup = array();
                 if ($group == SONET_ROLES_OWNER) {
                     $listGroup = \CSocNetGroup::getByID($entityId);
                     if ($listGroup) {
                         $listUserGroup[] = $listGroup["OWNER_ID"];
                     }
                 } elseif ($group == SONET_ROLES_MODERATOR) {
                     $dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_MODERATOR, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
                     while ($res = $dbRes->fetch()) {
                         $listUserGroup[] = $res["USER_ID"];
                     }
                 } elseif ($group == SONET_ROLES_USER) {
                     $dbRes = \CSocNetUserToGroup::getList(array(), array("GROUP_ID" => $entityId, "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
                     while ($res = $dbRes->fetch()) {
                         $listUserGroup[] = $res["USER_ID"];
                     }
                 }
                 return $listUserGroup;
             }
         }
     }
     $group = intval($group);
     if ($group <= 0) {
         return array();
     }
     $userIds = array();
     $filter = array("ACTIVE" => "Y");
     if ($group != 2) {
         $filter["GROUPS_ID"] = $group;
     }
     $query = \CUser::getList($b = "ID", $o = "ASC", $filter);
     while ($user = $query->fetch()) {
         $userIds[] = $user["ID"];
     }
     return $userIds;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:69,代码来源:bizprocdocument.php

示例5: getGroupBySection

 private function getGroupBySection(array $sectionData)
 {
     if (empty($sectionData['SOCNET_GROUP_ID'])) {
         //todo implement search
         return array();
     }
     $group = \CSocNetGroup::getByID($sectionData['SOCNET_GROUP_ID']);
     return empty($group) ? array() : $group;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:invitedispatcher.php

示例6: GetPermissions

 public static function GetPermissions($Params = array())
 {
     global $USER;
     $type = isset($Params['type']) ? $Params['type'] : self::$type;
     $ownerId = isset($Params['ownerId']) ? $Params['ownerId'] : self::$ownerId;
     $userId = isset($Params['userId']) ? $Params['userId'] : self::$userId;
     $bView = true;
     $bEdit = true;
     $bEditSection = true;
     if ($type == 'user' && $ownerId != $userId) {
         $bEdit = false;
         $bEditSection = false;
     }
     if ($type == 'group') {
         if (!$USER->CanDoOperation('edit_php')) {
             $keyOwner = 'SG' . $ownerId . '_A';
             $keyMod = 'SG' . $ownerId . '_E';
             $keyMember = 'SG' . $ownerId . '_K';
             $arCodes = array();
             $rCodes = CAccess::GetUserCodes($userId);
             while ($code = $rCodes->Fetch()) {
                 $arCodes[] = $code['ACCESS_CODE'];
             }
             if (CModule::IncludeModule("socialnetwork")) {
                 $group = CSocNetGroup::getByID($ownerId);
                 if (!empty($group['CLOSED']) && $group['CLOSED'] === 'Y' && \Bitrix\Main\Config\Option::get('socialnetwork', 'work_with_closed_groups', 'N') === 'N') {
                     self::$isArchivedGroup = true;
                 }
             }
             if (in_array($keyOwner, $arCodes)) {
                 $bEdit = true;
                 $bEditSection = true;
             } elseif (in_array($keyMod, $arCodes) && !self::$isArchivedGroup) {
                 $bEdit = true;
                 $bEditSection = true;
             } elseif (in_array($keyMember, $arCodes) && !self::$isArchivedGroup) {
                 $bEdit = true;
                 $bEditSection = false;
             } else {
                 $bEdit = false;
                 $bEditSection = false;
             }
         }
     }
     if ($type != 'user' && $type != 'group') {
         $bView = CCalendarType::CanDo('calendar_type_view', $type);
         $bEdit = CCalendarType::CanDo('calendar_type_edit', $type);
         $bEditSection = CCalendarType::CanDo('calendar_type_edit_section', $type);
     }
     if ($Params['setProperties'] !== false) {
         self::$perm['view'] = $bView;
         self::$perm['edit'] = $bEdit;
         self::$perm['section_edit'] = $bEditSection;
     }
     return array('view' => $bView, 'edit' => $bEdit, 'section_edit' => $bEditSection);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:56,代码来源:calendar.php


注:本文中的CSocNetGroup::getByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。