Documentation

ViewManager

View Manager class View Manager and Themes management functions

Tags
subpackage

core_viewmanager

author

Cloudrexx Development Team info@cloudrexx.com

copyright

CLOUDREXX CMS - CLOUDREXX AG

access

public

version
3.1.1

Table of Contents

Constants

EDIT_THEMES_ACCESS_ID  = 47
Access id to add/edit themes
ENABLE_THEMES_ACCESS_ID  = 46
Access id to activate/deactivate themes
TEMPLATE_EDITOR_ACCESS_ID  = 204
Access id to use template editor
THEMES_IMPORT_EXPORT_ACCESS_ID  = 102
Access id to import and export themes
VIEW_MANAGER_ACCESS_ID  = 21
Access id to view the viewManager section

Properties

$_archiveTempPath  : string
Temporary archive location, absolute path
$_parentPath  : string
Path to the parent directory of the theme
$_themeDir  : string
Name of the theme directory
$arrWebPaths  : mixed
$compulsoryFiles  : array<string|int, mixed>
$directories  : array<string|int, mixed>
Required directories
$fileextensions  : array<string|int, mixed>
File extenstions to display in filelist
$filenames  : array<string|int, mixed>
$getAct  : mixed
$getPath  : mixed
$pageTitle  : string
Title of the active page
$path  : mixed
$strErrMessage  : string
Error message
$strOkMessage  : unknown_type
Success message
$subDirs  : array<string|int, mixed>
Subdirectores and contents of selected theme
$webPath  : mixed
$websitePath  : mixed
$websiteThemesPath  : mixed
$act  : mixed
$cx  : Cx
$em  : EntityManager
The doctrine entity manager
$fileSystem  : ViewManagerFileSystem
$themeRepository  : mixed
$themeZipPath  : mixed

Methods

__construct()  : mixed
getComponentFilePath()  : bool|string
Get the component's file path
getPage()  : void
Gets the requested page
getThemeRelativePath()  : string
Get the relative path of a file
getUploadedFileFromUploader()  : bool|string
Get uploaded zip file by using uploader id
isFileTypeComponent()  : bool
check the given path is component file
replaceComponentFolderByItsType()  : mixed
sortThemesByDefault()  : int
Sorts the themes by default value. that means, the themes which have been set as default for a theme type, they are listed first.
sortThemesByName()  : int
uploadFinished()  : array<string|int, mixed>
Uploader callback function
viewManager()  : void
Overview page of the view manager
_activate()  : void
Gets the themes assigning page
_cleantmp()  : void
clean tmp folder
_fetchRemoteFile()  : mixed
_getDropdownActivated()  : string
Gets the activated themes dropdown menu
activateFrontendTheme()  : void
Gets the right frontend entity by lang id and channel, updates the theme id (when neccessary) and persists the updated entity
checkUpload()  : bool|string
check fileupload and move uploaded file if it's a valid archive
createDefaultFiles()  : bool
Create default theme files
createdir()  : void
create skin folder
createDirectoryStructure()  : bool
Create the directory structure of the archive contents and set permissions
createZipFolder()  : void
Create the archive file to tmp folder
examples()  : void
Gets the themes example page
extractArchive()  : bool
Extracts the archive to the themes path
formatFileList()  : array<string|int, mixed>
Format the Filesystem files and folders to viewManger format
getDropdownNotInDb()  : string
Gets the dropdown menu of filesystem dirs which are not in the DB
getExportFilePath()  : string
Get the export archive file path
getFileFromPath()  : mixed
Get the file from the given path
getFilesContent()  : null
Gets the themes pages file content
getFilesDropdown()  : void
Sets the drop down content for the files and create overrides tab
getThemesDropdown()  : string
Gets the themes dropdown menu
getThemesFiles()  : array<string|int, mixed>
Get the theme's files using viewmanager filesystem
getUlLi()  : string
Getting the files and folders in a ul li format for the js tree
import()  : void
set up Import page call specific function depending on $_GET
importFile()  : bool
import themes from archive
insertSkinIntoDb()  : mixed
Insert the skin into database
isInLanguageFullMode()  : bool
checks whether this cloudrexx has the possibility to use multi language mode
manage()  : void
Export theme as ZIP archive
newdir()  : void
create skin folder page
overview()  : void
Show the Template Manager (advanced HTML/CSS/JS editor)
parseThemesData()  : void
replaceThemeName()  : void
Replaces remainders of the original theme in a freshly copied theme.
saveLibrarySettings()  : void
Save the library settings which have been done on the overview page
setNavigation()  : void
settings()  : void
Settings section
sortFilesFolders()  : void
Sorting the array recursively
sortThemesByReleaseDate()  : DateTime|int
sorting the theme by its releaseDate
update()  : void
update skin file
validateArchiveStructure()  : bool
check for valid archive structure, put directories into $arrDirectories set errormessage if structure not valid
validateThemeName()  : void

Constants

EDIT_THEMES_ACCESS_ID

Access id to add/edit themes

public mixed EDIT_THEMES_ACCESS_ID = 47

ENABLE_THEMES_ACCESS_ID

Access id to activate/deactivate themes

public mixed ENABLE_THEMES_ACCESS_ID = 46

TEMPLATE_EDITOR_ACCESS_ID

Access id to use template editor

public mixed TEMPLATE_EDITOR_ACCESS_ID = 204

THEMES_IMPORT_EXPORT_ACCESS_ID

Access id to import and export themes

public mixed THEMES_IMPORT_EXPORT_ACCESS_ID = 102

VIEW_MANAGER_ACCESS_ID

Access id to view the viewManager section

public mixed VIEW_MANAGER_ACCESS_ID = 21

Properties

$_archiveTempPath

Temporary archive location, absolute path

public string $_archiveTempPath

$_parentPath

Path to the parent directory of the theme

public string $_parentPath = ''

$compulsoryFiles

public array<string|int, mixed> $compulsoryFiles = array('index.html', 'content.html', 'home.html', 'component.yml')

List of files that every theme needs to have to be valid

$directories

Required directories

public array<string|int, mixed> $directories = array('images/')

$fileextensions

File extenstions to display in filelist

public array<string|int, mixed> $fileextensions = array('htm', 'shtml', 'html', 'txt', 'css', 'js', 'php', 'java', 'tpl', 'xml')

$filenames

public array<string|int, mixed> $filenames = array('style.css', 'navbar.html', 'navbar2.html', 'navbar3.html', 'subnavbar.html', 'subnavbar2.html', 'subnavbar3.html', 'sidebar.html', 'shopnavbar.html', 'shopnavbar2.html', 'shopnavbar3.html', 'headlines.html', 'headlines2.html', 'headlines3.html', 'headlines4.html', 'headlines5.html', 'headlines6.html', 'headlines7.html', 'headlines8.html', 'headlines9.html', 'headlines10.html', 'headlines11.html', 'headlines12.html', 'headlines13.html', 'headlines14.html', 'headlines15.html', 'headlines16.html', 'headlines17.html', 'headlines18.html', 'headlines19.html', 'headlines20.html', 'events.html', 'events2.html', 'events3.html', 'events4.html', 'events5.html', 'events6.html', 'events7.html', 'events8.html', 'events9.html', 'events10.html', 'events11.html', 'events12.html', 'events13.html', 'events14.html', 'events15.html', 'events16.html', 'events17.html', 'events18.html', 'events19.html', 'events20.html', 'javascript.js', 'buildin_style.css')

Well known theme file names

$subDirs

Subdirectores and contents of selected theme

public array<string|int, mixed> $subDirs = array()

Methods

getComponentFilePath()

Get the component's file path

public static getComponentFilePath(string $path[, mixed $loadFromComponentDir = true ]) : bool|string
Parameters
$path : string
$loadFromComponentDir : mixed = true
Return values
bool|string

getPage()

Gets the requested page

public getPage() : void
Tags
global

\Cx\Core\Html\Sigma

getThemeRelativePath()

Get the relative path of a file

public static getThemeRelativePath(string $path) : string
Parameters
$path : string

absolute path of a file

Return values
string

relative path to the file

getUploadedFileFromUploader()

Get uploaded zip file by using uploader id

public getUploadedFileFromUploader(string $uploaderId) : bool|string
Parameters
$uploaderId : string

Uploader id

Return values
bool|string

File path when file exists, false otherwise

isFileTypeComponent()

check the given path is component file

public static isFileTypeComponent(string $path) : bool
Parameters
$path : string
Return values
bool

replaceComponentFolderByItsType()

public static replaceComponentFolderByItsType(mixed $path) : mixed
Parameters
$path : mixed

sortThemesByDefault()

Sorts the themes by default value. that means, the themes which have been set as default for a theme type, they are listed first.

public sortThemesByDefault(Theme $a, Theme $b) : int
Parameters
$a : Theme

theme 1

$b : Theme

theme 2

Return values
int

sortThemesByName()

public sortThemesByName(mixed $a, mixed $b) : int
Parameters
$a : mixed
$b : mixed
Return values
int

uploadFinished()

Uploader callback function

public static uploadFinished(string $tempPath, string $tempWebPath, array<string|int, mixed> $data, string $uploadId, array<string|int, mixed> $fileInfos, object $response) : array<string|int, mixed>

This is called as soon as uploads have finished.

Parameters
$tempPath : string

Path to the temporary directory containing the files at this moment

$tempWebPath : string

Points to the same folder as tempPath, but relative to the webroot

$data : array<string|int, mixed>

Data given to setData() when creating the uploader

$uploadId : string

upload id

$fileInfos : array<string|int, mixed>

uploaded file informations

$response : object

Upload api response object

Return values
array<string|int, mixed>

$tempPath and $tempWebPath

viewManager()

Overview page of the view manager

public viewManager() : void
Tags
global

array $_ARRAYLANG

global

type $objTemplate

global

type $objDatabase

_activate()

Gets the themes assigning page

protected _activate() : void
Tags
access

private

global

ADONewConnection

global

array

global

\Cx\Core\Html\Sigma

_fetchRemoteFile()

protected _fetchRemoteFile(mixed $URL) : mixed
Parameters
$URL : mixed

_getDropdownActivated()

Gets the activated themes dropdown menu

protected _getDropdownActivated(mixed $selectedTheme) : string
Parameters
$selectedTheme : mixed
Return values
string

$atdm

activateFrontendTheme()

Gets the right frontend entity by lang id and channel, updates the theme id (when neccessary) and persists the updated entity

protected activateFrontendTheme(mixed $langId, mixed $channel, mixed $themeId) : void
Parameters
$langId : mixed
$channel : mixed
$themeId : mixed

checkUpload()

check fileupload and move uploaded file if it's a valid archive

protected checkUpload() : bool|string
Return values
bool|string

File path when the uploaded file copied to archieveTempPath, false otherwise

createDefaultFiles()

Create default theme files

protected createDefaultFiles(Theme $theme[, bool $createAllFiles = false ]) : bool

\Cx\Core\View\Model\Entity\Theme $theme

Parameters
$theme : Theme
$createAllFiles : bool = false
Return values
bool

createDirectoryStructure()

Create the directory structure of the archive contents and set permissions

protected createDirectoryStructure(mixed $themeDirectory, mixed $arrDirectories) : bool
Parameters
$themeDirectory : mixed
$arrDirectories : mixed
Return values
bool

createZipFolder()

Create the archive file to tmp folder

protected createZipFolder(object $archive, array<string|int, mixed> $themeFilesArray[, string $folder = '/' ]) : void
Parameters
$archive : object

Contains the PclZip archive object

$themeFilesArray : array<string|int, mixed>

Themes files in array

$folder : string = '/'

Folder name

extractArchive()

Extracts the archive to the themes path

protected extractArchive(object $archive, object $theme, string $themeDirectoryFromArchive) : bool
Parameters
$archive : object

pclZip Object $archive

$theme : object

\Cx\Core\View\Model\Entity\Theme $theme

$themeDirectoryFromArchive : string
Return values
bool

formatFileList()

Format the Filesystem files and folders to viewManger format

protected formatFileList(array<string|int, mixed> $filesList[, bool $real = false ]) : array<string|int, mixed>

This pretents that the folders "modules" and "core_modules" are named "module" and "core_module" unless $real is set to true.

Parameters
$filesList : array<string|int, mixed>

List of files as returned by FileSystem::getFileList()

$real : bool = false

(optional) If set to true, filesystem names are used

Return values
array<string|int, mixed>

Simple list of files. Folder names are indexes containing an array in the same format.

getDropdownNotInDb()

Gets the dropdown menu of filesystem dirs which are not in the DB

protected getDropdownNotInDb() : string
Tags
global

ADONewConnection

Return values
string

$nadm

getExportFilePath()

Get the export archive file path

protected getExportFilePath(Theme $theme) : string
Parameters
$theme : Theme
Return values
string

path to the created archive

getFileFromPath()

Get the file from the given path

protected getFileFromPath(Theme $theme, string $filePath, bool $isComponentFile) : mixed
Parameters
$theme : Theme
$filePath : string
$isComponentFile : bool
Return values
mixed

ViewManagerFile instance or null

getFilesDropdown()

Sets the drop down content for the files and create overrides tab

protected getFilesDropdown(object $theme, string $themesPage, bool $isComponentFile) : void
Parameters
$theme : object

active theme's object (\Cx\Core\View\Model\Entity\Theme)

$themesPage : string

Currently active themes page

$isComponentFile : bool

request made for type component file or theme file

getThemesDropdown()

Gets the themes dropdown menu

protected getThemesDropdown([string $selectedTheme = null ][, bool $selectDefault = true ]) : string
Parameters
$selectedTheme : string = null

the currently selected theme

$selectDefault : bool = true

pre select default theme if no theme is selected yet

Return values
string

$tdm the html code for the drop down

getThemesFiles()

Get the theme's files using viewmanager filesystem

protected getThemesFiles(Theme $theme[, bool $real = false ]) : array<string|int, mixed>

This pretents that the folders "modules" and "core_modules" are named "module" and "core_module" unless $real is set to true.

Parameters
$theme : Theme

Theme to fetch files for

$real : bool = false

(optional) If set to true, filesystem names are used

Return values
array<string|int, mixed>

Simple list of files. Folder names are indexes containing an array in the same format.

getUlLi()

Getting the files and folders in a ul li format for the js tree

protected getUlLi(array<string|int, mixed> $folder, string $path, string $block, string $themesPage[, mixed $theme = null ]) : string
Parameters
$folder : array<string|int, mixed>

array of files and folders

$path : string

current path of the $folder array

$block : string

type of the folder array (theme or applicationTheme)

$themesPage : string

selected file in the ul li

$theme : mixed = null

Currently selected theme

Return values
string

formatted ul and li for the js tree

import()

set up Import page call specific function depending on $_GET

protected import() : void

importFile()

import themes from archive

protected importFile() : bool
Return values
bool

insertSkinIntoDb()

Insert the skin into database

protected insertSkinIntoDb(Theme $theme) : mixed
Parameters
$theme : Theme

the template object

Return values
mixed

integer on success | false on error

isInLanguageFullMode()

checks whether this cloudrexx has the possibility to use multi language mode

protected isInLanguageFullMode() : bool
Return values
bool

is this cloudrexx in multi language mode

overview()

Show the Template Manager (advanced HTML/CSS/JS editor)

protected overview() : void

parseThemesData()

protected parseThemesData(type $theme, mixed $subType) : void
Parameters
$theme : type
$subType : mixed
Tags
global

type $objTemplate

replaceThemeName()

Replaces remainders of the original theme in a freshly copied theme.

protected replaceThemeName(string $org, string $copy, mixed $path) : void

(links to stylesheets, js, images etc.) CAUTION: as this is intended for subroutine-use, no validation or escaping of given parameters is done.

Parameters
$org : string

original theme name

$copy : string

copied theme name

$path : mixed
Tags
see
skins::createDir()

saveLibrarySettings()

Save the library settings which have been done on the overview page

protected saveLibrarySettings(Theme $theme) : void
Parameters
$theme : Theme

the template object

settings()

Settings section

protected settings() : void
Tags
global

array $_ARRAYLANG

global

type $objTemplate

sortFilesFolders()

Sorting the array recursively

protected sortFilesFolders(array<string|int, mixed> &$mergedFiles) : void
Parameters
$mergedFiles : array<string|int, mixed>
  • merged array

sortThemesByReleaseDate()

sorting the theme by its releaseDate

protected sortThemesByReleaseDate(Theme $a, Theme $b) : DateTime|int
Parameters
$a : Theme
$b : Theme
Return values
DateTime|int

validateArchiveStructure()

check for valid archive structure, put directories into $arrDirectories set errormessage if structure not valid

protected validateArchiveStructure(array<string|int, mixed> $content, string &$themeDirectory, string &$themeDirectoryFromArchive, string &$themeName, array<string|int, mixed> &$arrDirectories, string $archiveFile) : bool
Parameters
$content : array<string|int, mixed>

File and directory list

$themeDirectory : string

Theme directory

$themeDirectoryFromArchive : string

Theme directory from archive

$themeName : string

Theme name

$arrDirectories : array<string|int, mixed>

Array directories

$archiveFile : string

Archive File

Return values
bool

validateThemeName()

protected validateThemeName(mixed &$themeName[, mixed $dbField = 'themesname' ]) : void
Parameters
$themeName : mixed
$dbField : mixed = 'themesname'

        
On this page

Search results