Class lispa\amos\cwh\utility\CwhUtil

Inheritancelispa\amos\cwh\utility\CwhUtil

Class CwhUtil

Public Methods

Hide inherited methods

MethodDescriptionDefined By
createCwhView() Create cwh nodi view if not exists or regenerate it regenerate the table cwh nodi (materialization of the view Cwh nodi view contains all network records based on the queries of cwh config table. lispa\amos\cwh\utility\CwhUtil
deleteNetworkContents() Delete the contents published in the specified network scope. lispa\amos\cwh\utility\CwhUtil
getDomainNames() Given the list of CwhNodes id (as array o string with comma separator), get the list as domains name separeted by comma lispa\amos\cwh\utility\CwhUtil
getNetworkContents() Get the contents published for the specified network as an array structure array[configContentInfo] => ContentModel[] - config content info to use as array key is configurable with parameter $arrayKeyFromConfigContentsField array key not present if no content of that content type has been published for the network lispa\amos\cwh\utility\CwhUtil
getNetworkCwhRuleIds() This method returns an array with the cwh publication rule ids for all users in network and all users with tag in network. lispa\amos\cwh\utility\CwhUtil
getPlatformCwhRuleIds() This method returns an array with the cwh publication rule ids for all users and all users with tag. lispa\amos\cwh\utility\CwhUtil
getPublicationRuleLabel() lispa\amos\cwh\utility\CwhUtil
getPublicationRulesQuery() Query for publication rules enabled for logged user lispa\amos\cwh\utility\CwhUtil
getTagNames() lispa\amos\cwh\utility\CwhUtil
getUserNetworkQuery() Query for network models in user network, given the network type configuration. lispa\amos\cwh\utility\CwhUtil
setCwhAuthAssignments() Given a user_network_mm record set the correct cwh auth assignment permission for content models enabled in cwh Specify $modelClassName if only permissions for specified content model type must be set lispa\amos\cwh\utility\CwhUtil

Method Details

createCwhView() public static method

Create cwh nodi view if not exists or regenerate it regenerate the table cwh nodi (materialization of the view Cwh nodi view contains all network records based on the queries of cwh config table.

public static void createCwhView ( )
deleteNetworkContents() public static method

Delete the contents published in the specified network scope.

In case more more scopes are set, only the specified network publication scope is deleted, not the content itself.

public static void deleteNetworkContents ( $configId, $networkId )
$configId
$networkId integer
  • record if of the network in its own table (eg. community->id)
getDomainNames() public static method

Given the list of CwhNodes id (as array o string with comma separator), get the list as domains name separeted by comma

public static string getDomainNames ( $cwhNodeIds )
$cwhNodeIds mixed
getNetworkContents() public static method

Get the contents published for the specified network as an array structure array[configContentInfo] => ContentModel[] - config content info to use as array key is configurable with parameter $arrayKeyFromConfigContentsField array key not present if no content of that content type has been published for the network

public static array getNetworkContents ( $configId, $networkId, $arrayKeyFromConfigContentsField 'tablename' )
$configId
$networkId integer
  • record if of the network in its own table (eg. community->id)
$arrayKeyFromConfigContentsField string
  • field of CwhConfigContents to use as array key. Default is tablename
return array

Eg.or returned array [ ['news'] => News[], ['documenti'] => Documenti[] ]

getNetworkCwhRuleIds() public static method

This method returns an array with the cwh publication rule ids for all users in network and all users with tag in network.

public static array getNetworkCwhRuleIds ( )
getPlatformCwhRuleIds() public static method

This method returns an array with the cwh publication rule ids for all users and all users with tag.

public static array getPlatformCwhRuleIds ( )
getPublicationRuleLabel() public static method

public static string getPublicationRuleLabel ( $publicationRuleId )
$publicationRuleId integer
return string
  • publication rule label in translation
getPublicationRulesQuery() public static method

Query for publication rules enabled for logged user

public static lispa\amos\cwh\models\query\CwhRegolePubblicazioneQuery|mixed getPublicationRulesQuery ( )
return lispa\amos\cwh\models\query\CwhRegolePubblicazioneQuery|mixed

$publicationRulesQuery

getTagNames() public static method

public static string getTagNames ( $tagIds )
$tagIds array|string
  • array of tag ids or string containing tag ids separated by ','
return string
  • list of tag names separated by ','
getUserNetworkQuery() public static method

Query for network models in user network, given the network type configuration.

public static yii\db\ActiveQuery|null getUserNetworkQuery ( $cwhConfigId, $userId null, $checkActive true )
$cwhConfigId integer
  • id of network configuration (table cwh_config)
$userId integer|null
  • if null logged userId is considered
$checkActive boolean|true
  • if true check for only ACTIVE status in network-user relation table
return yii\db\ActiveQuery|null

$networksQuery

setCwhAuthAssignments() public static method

Given a user_network_mm record set the correct cwh auth assignment permission for content models enabled in cwh Specify $modelClassName if only permissions for specified content model type must be set

public static void setCwhAuthAssignments ( $network null, $networkUserMmRow, $delete false, $modelClassName null, $cwhConfig null )
$network lispa\amos\cwh\base\ModelNetworkInterface|null
  • the network record , if left null, specify $cwhConfig
$networkUserMmRow
  • record on user-network-mm table
$delete boolean|false
  • set to true if it is a deletion process
$modelClassName string|null
$cwhConfig lispa\amos\cwh\models\CwhConfig|null