Class lispa\amos\community\utilities\CommunityUtil
Inheritance | lispa\amos\community\utilities\CommunityUtil |
---|
Class CommunityUtil
Public Methods
Method Details
public static boolean canDeleteCommunity ( $community ) | ||
$community | lispa\amos\community\models\Community |
Method useful to confirm a community manager. The method return true only if it found the manager in the to confirm state and the update goes fine.
public static boolean confirmCommunityManager ( $communityId, $userId, $managerRole ) | ||
$communityId | integer | |
$userId | integer | |
$managerRole | string |
This method return a string array of community context classnames present in the community table.
public static array getAllCommunityContexts ( ) |
This method return a string array of community managers of all community contexts.
public static array getAllCommunityManagerRoles ( ) |
public static lispa\amos\community\models\Community[] getAllValidatedCommunity ( ) |
public static lispa\amos\community\models\Community[]|integer[]|yii\db\ActiveQuery getCommunitiesByRoleAndUserId ( $userId, $role, $onlyIds = false, $returnQuery = false, $ignoreValidatedOnce = false ) | ||
$userId | integer | |
$role | string | |
$onlyIds | boolean | |
$returnQuery | boolean | IF true return the ActiveQuery object |
$ignoreValidatedOnce | boolean | |
throws | lispa\amos\community\exceptions\CommunityException |
---|
This method return an array of Community objects representing all the communities of a specific user.
The list includes the communities validated at least once in the generic context (Community) and the user must have the active status in CommunityUserMm.
public static lispa\amos\community\models\Community[]|integer[]|yii\db\ActiveQuery getCommunitiesByUserId ( $userId, $onlyIds = false, $returnQuery = false, $ignoreValidatedOnce = false ) | ||
$userId | integer | |
$onlyIds | boolean | |
$returnQuery | boolean | |
$ignoreValidatedOnce | ||
throws | lispa\amos\community\exceptions\CommunityException |
---|
public static lispa\amos\community\models\Community[]|integer[]|yii\db\ActiveQuery getCommunitiesManagedByUserId ( $userId, $onlyIds = false, $returnQuery = false, $ignoreValidatedOnce = false ) | ||
$userId | integer | |
$onlyIds | boolean | |
$returnQuery | boolean | IF true return the ActiveQuery object |
$ignoreValidatedOnce | boolean | |
throws | lispa\amos\community\exceptions\CommunityException |
---|
public static lispa\amos\community\models\Community[]|integer[]|yii\db\ActiveQuery getCommunitiesParticipateByUserId ( $userId, $onlyIds = false, $returnQuery = false, $ignoreValidatedOnce = false ) | ||
$userId | integer | |
$onlyIds | boolean | |
$returnQuery | boolean | IF true return the ActiveQuery object |
$ignoreValidatedOnce | boolean | |
throws | lispa\amos\community\exceptions\CommunityException |
---|
public static integer[] getCommunityAndSubcommunitiesIds ( $community ) | ||
$community | lispa\amos\community\models\Community |
public static integer[] getCommunityAndSubcommunitiesIdsRecursive ( $community ) | ||
$community | lispa\amos\community\models\Community |
Return CommunityUserMms of current community
public static yii\db\ActiveQuery getCurrentCommunityMembers ( ) |
Get the list of communities of which the user has permission to create subcommunities
public static array getParentList ( $userId = null, $parentId = null ) | ||
$userId | integer|null |
|
$parentId | integer|null |
|
return | array | [communityId] = community->name |
---|
public static boolean hasRole ( $model ) | ||
$model | Community |
public static void isLoggedCommunityManager ( ) |
public boolean isManagerLoggedUser ( $model ) | ||
$model | lispa\amos\community\models\Community |
This method checks if the logged user is a community manager for the community in param.
public static boolean loggedUserIsCommunityManager ( $communityId ) | ||
$communityId | integer |
This method checks if the logged user is a participant for the community in param.
public static boolean loggedUserIsParticipant ( $communityId ) | ||
$communityId | integer | |
throws | lispa\amos\community\exceptions\CommunityException |
---|
This method translate the array values.
public static array translateArrayValues ( $arrayValues ) | ||
$arrayValues | array |
This method checks if the logged user is a community manager for the community in param.
public static boolean userIsCommunityManager ( $communityId, $userId ) | ||
$communityId | integer | |
$userId | integer |
This method checks if the logged user is a participant for the community in param.
public static boolean userIsParticipant ( $communityId, $userId ) | ||
$communityId | integer | |
$userId | integer | |
throws | lispa\amos\community\exceptions\CommunityException |
---|
public static boolean userIsSignedUp ( $communityId, $userId ) | ||
$communityId | integer | |
$userId | integer |