PHP Class Newscoop\Service\Implementation\ThemeManagementServiceLocal

The implementation relays on the local structure, this means that this service will use also the file system and Doctrine for synchronizing with the database.
Inheritance: extends ThemeServiceLocalFileSystem, implements Newscoop\Service\IThemeManagementService
Show file Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Property Type Description
$articleTypeService Newscoop\Service\IArticleTypeService
$em Doctrine\ORM\EntityManager
$outputService Newscoop\Service\IOutputService
$outputSettingIssueService Newscoop\Service\IOutputSettingIssueService
$syncResourceService Newscoop\Service\ISyncResourceService

Public Methods

Method Description
assignArticleTypes ( $articleTypes, Theme $theme ) : string Adds new mapping in the theme xml
assignOutputSetting ( OutputSettings $outputSettings, Theme $theme )
assignTheme ( Theme $theme, Publication $publication, $cli = false )
copyToUnassigned ( Theme $theme )
exportTheme ( $theme, $p_errorMsg = '' ) * ---------------------------------------------------------------
findOutputSetting ( Theme $theme, Output $output )
getArticleTypeService ( ) : Newscoop\Service\IArticleTypeService Provides the article type service.
getArticleTypes ( Theme $theme ) : object
getCountThemes ( $publication, SearchTheme $search = NULL )
getCountUnassignedThemes ( Search $search = NULL ) : integer Provides the count of the entities that can be associated with the provided search.
getOutputSettings ( Theme $theme )
getTemplates ( $theme )
getThemePublication ( Theme $theme, Output $output = null ) : Publication Get the publication of a theme, and optionally output
getThemes ( $publication, SearchTheme $search = NULL, $offset, $limit )
getUnassignedThemes ( SearchTheme $search = NULL, $offset, $limit )
installTheme ( $filePath )
removeTheme ( $theme )
updateTheme ( Theme $theme )

Protected Methods

Method Description
copy ( string $src, string $dst ) Copies recursivelly the folder content from src to destination.
filterThemesConfigPathsInSameFolder ( string $config, array $allConfigs ) : array Filter from the provided configs array all the configs that are located under the same folder.
getManager ( ) : Doctrine\ORM\EntityManager Provides the dictrine entity manager.
getNewThemeFolder ( str $inFolder ) : str Provides a new folder (Automatically created) to place a new theme.
getOutputService ( ) : Newscoop\Service\IOutputService Provides the ouput service.
getOutputSettingIssueService ( ) : Newscoop\Service\IOutputSettingIssueService Provides the Output setting issue service.
getRelativePath ( Resource $rsc, string $themePath ) : string Provides the relative path of the resource based on the provided theme path.
getSyncResourceService ( ) : Newscoop\Service\ISyncResourceService Provides the sync resource service.
loadOutputResource ( SimpleXMLElement $parent, string $tagName, string $themePath ) : Resource Reads the resources from an output tag.
loadOutputSetting ( SimpleXMLElement $nodeOutput, string $themePath ) : OutputSettings Load the output setting from the provided xml node.
loadOutputSettings ( string $themePath ) : array Load all the output settings from the specified path.
rrmdir ( string $dir ) Deletes recursivelly the folder content from dir.
syncOutputSettings ( OutputSettings $to, OutputSettings $from ) Copies from the from output settings to the to output settings all the pages (front, article .

Private Methods

Method Description
getThemesData ( $publication, SearchTheme $search = NULL )
getUnassignedThemesData ( SearchTheme $search = NULL ) * ---------------------------------------------------------------

Method Details

assignArticleTypes() public method

Adds new mapping in the theme xml
public assignArticleTypes ( $articleTypes, Theme $theme ) : string
$articleTypes an array of mapping new values to old ones [ oldTypeName => [ name : newTypeName, ignore : boolean, fields' : [ OldFieldName : [ name : new/oldType, parentType : existingSysType, ignore : boolean ], [...] ] ] , [...] ] parentType => existingSysType will be used for getting it's other props from db
$theme Newscoop\Entity\Theme
return string the generated xml

assignOutputSetting() public method

public assignOutputSetting ( OutputSettings $outputSettings, Theme $theme )
$outputSettings Newscoop\Entity\OutputSettings
$theme Newscoop\Entity\Theme

assignTheme() public method

public assignTheme ( Theme $theme, Publication $publication, $cli = false )
$theme Newscoop\Entity\Theme
$publication Newscoop\Entity\Publication

copy() protected method

Copies recursivelly the folder content from src to destination.
protected copy ( string $src, string $dst )
$src string The source folder, *(not null not empty).
$dst string the destination folder, *(not null not empty).

copyToUnassigned() public method

public copyToUnassigned ( Theme $theme )
$theme Newscoop\Entity\Theme

exportTheme() public method

* ---------------------------------------------------------------
public exportTheme ( $theme, $p_errorMsg = '' )

filterThemesConfigPathsInSameFolder() protected method

For instance if the config is in a publication folder than this method will return all the configs for that publicatio.
protected filterThemesConfigPathsInSameFolder ( string $config, array $allConfigs ) : array
$config string The config path to be searched for, not null.
$allConfigs array
return array The array containing as key the id of the theme config (index) and as a value the relative path of the theme configuration XML file for all configurations that are iun the same folder, not null can be empty.

findOutputSetting() public method

public findOutputSetting ( Theme $theme, Output $output )
$theme Newscoop\Entity\Theme
$output Newscoop\Entity\Output

getArticleTypeService() public method

Provides the article type service.
public getArticleTypeService ( ) : Newscoop\Service\IArticleTypeService
return Newscoop\Service\IArticleTypeService

getArticleTypes() public method

Author: mihaibalaceanu
public getArticleTypes ( Theme $theme ) : object
$theme Newscoop\Entity\Theme
return object

getCountThemes() public method

public getCountThemes ( $publication, SearchTheme $search = NULL )
$search Newscoop\Service\Model\SearchTheme

getCountUnassignedThemes() public method

Provides the count of the entities that can be associated with the provided search.
public getCountUnassignedThemes ( Search $search = NULL ) : integer
$search Newscoop\Service\Model\Search\Search The search criteria, not null.
return integer The entities count.

getManager() protected method

Provides the dictrine entity manager.
protected getManager ( ) : Doctrine\ORM\EntityManager
return Doctrine\ORM\EntityManager The doctrine entity manager.

getNewThemeFolder() protected method

Provides a new folder (Automatically created) to place a new theme.
protected getNewThemeFolder ( str $inFolder ) : str
$inFolder str The folder wehere to place the new theme folder, this has to be relative to the themes folder.
return str The relative theme path.

getOutputService() protected method

Provides the ouput service.
protected getOutputService ( ) : Newscoop\Service\IOutputService
return Newscoop\Service\IOutputService The service service to be used.

getOutputSettingIssueService() protected method

Provides the Output setting issue service.
protected getOutputSettingIssueService ( ) : Newscoop\Service\IOutputSettingIssueService
return Newscoop\Service\IOutputSettingIssueService The output setting issue service to be used by this controller.

getOutputSettings() public method

public getOutputSettings ( Theme $theme )
$theme Newscoop\Entity\Theme

getRelativePath() protected method

This method also checks if the resource path is compatible with the theme path meaning that the resource needs to be placed in the theme.
protected getRelativePath ( Resource $rsc, string $themePath ) : string
$rsc Newscoop\Entity\Resource The resource to extract the relative path from, not null.
$themePath string The theme path, not null.
return string The relative [path in regards with the theme path for the resource.

getSyncResourceService() protected method

Provides the sync resource service.
protected getSyncResourceService ( ) : Newscoop\Service\ISyncResourceService
return Newscoop\Service\ISyncResourceService The sync resource service to be used.

getTemplates() public method

public getTemplates ( $theme )

getThemePublication() public method

Get the publication of a theme, and optionally output
public getThemePublication ( Theme $theme, Output $output = null ) : Publication
$theme Newscoop\Entity\Theme
$output Newscoop\Entity\Output
return Newscoop\Entity\Publication

getThemes() public method

public getThemes ( $publication, SearchTheme $search = NULL, $offset, $limit )
$search Newscoop\Service\Model\SearchTheme

getUnassignedThemes() public method

public getUnassignedThemes ( SearchTheme $search = NULL, $offset, $limit )
$search Newscoop\Service\Model\SearchTheme

installTheme() public method

public installTheme ( $filePath )

loadOutputResource() protected method

Reads the resources from an output tag.
protected loadOutputResource ( SimpleXMLElement $parent, string $tagName, string $themePath ) : Resource
$parent SimpleXMLElement The parent output node to read the resources from, *(not null not empty).
$tagName string The tag name containing the resource, *(not null not empty).
$themePath string The theme path to construct the resource path based on, *(not null not empty).
return Newscoop\Entity\Resource The obtained resource, not null.

loadOutputSetting() protected method

Load the output setting from the provided xml node.
protected loadOutputSetting ( SimpleXMLElement $nodeOutput, string $themePath ) : OutputSettings
$nodeOutput SimpleXMLElement The node from which to load, *(not null not empty).
$themePath string The theme path to construct the resource path based on, *(not null not empty).
return Newscoop\Entity\OutputSettings The loaded output setting, not null.

loadOutputSettings() protected method

Load all the output settings from the specified path.
protected loadOutputSettings ( string $themePath ) : array
$themePath string The theme path from where to load the output settings, *(not null not empty).
return array The array containing all the found output settings, not null.

removeTheme() public method

public removeTheme ( $theme )

rrmdir() protected method

Deletes recursivelly the folder content from dir.
protected rrmdir ( string $dir )
$dir string The floder to be deleted, *(not null not empty).

syncOutputSettings() protected method

..).
protected syncOutputSettings ( OutputSettings $to, OutputSettings $from )
$to Newscoop\Entity\OutputSettings The output setting to copy to, *(not null not empty).
$from Newscoop\Entity\OutputSettings The output setting to copy from, *(not null not empty).

updateTheme() public method

public updateTheme ( Theme $theme )
$theme Newscoop\Entity\Theme

Property Details

$articleTypeService protected property

protected IArticleTypeService,Newscoop\Service $articleTypeService
return Newscoop\Service\IArticleTypeService

$em protected property

protected Doctrine\ORM\EntityManager $em
return Doctrine\ORM\EntityManager

$outputService protected property

protected IOutputService,Newscoop\Service $outputService
return Newscoop\Service\IOutputService

$outputSettingIssueService protected property

protected IOutputSettingIssueService,Newscoop\Service $outputSettingIssueService
return Newscoop\Service\IOutputSettingIssueService

$syncResourceService protected property

protected ISyncResourceService,Newscoop\Service $syncResourceService
return Newscoop\Service\ISyncResourceService