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
$directories  : array<string|int, mixed>
Required directories
$fileextensions  : array<string|int, mixed>
File extenstions to display in filelist
$filenames  : array<string|int, mixed>
Required files
$getAct  : mixed
$getPath  : mixed
$oldTable  : 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
$tableExists  : mixed
$webPath  : mixed
$websitePath  : mixed
$websiteThemesPath  : mixed
$cx  : Cx
$em  : EntityManager
The doctrine entity manager
$fileSystem  : ViewManagerFileSystem
$act  : mixed
$themeRepository  : mixed

Methods

__construct()  : mixed
_activate()  : mixed
Gets the themes assigning page
_cleantmp()  : void
clean tmp folder
_fetchRemoteFile()  : mixed
_getDropdownActivated()  : string
Gets the activated themes dropdown menu
_getThemesDropdownDelete()  : string
Gets the themes dropdown menu
checkTable()  : mixed
check iftable exists
createFilesFromDB()  : mixed
create files from db
createZipFolder()  : mixed
Create the archive file to tmp folder
dropTable()  : mixed
if now rows in table -> drop $this->oldTable
examples()  : mixed
Gets the themes example page
formatFileList()  : array<string|int, mixed>
Format the Filesystem files and folders to viewManger format
getComponentFilePath()  : bool
Get the component's file path
getDbDropdown()  : mixed
create db themes dropdownmenu
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()  : mixed
Sets the drop down content for the files and create overrides tab
getPage()  : string
Gets the requested page
getThemeRelativePath()  : string
Get the relative path of a file
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
getUploadedFileFromUploader()  : bool|string
Get uploaded zip file by using uploader id
isFileTypeComponent()  : bool
check the given path is component file
newdir()  : mixed
create skin folder page
readFiles()  : array<string|int, mixed>
reading the directories of the file sytem with the specified path
replaceComponentFolderByItsType()  : mixed
settings()  : mixed
Settings section
sortFilesFolders()  : mixed
Sorting the array recursively
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()  : mixed
sortThemesByReleaseDate()  : string
sorting the theme by its releaseDate
update()  : mixed
update skin file
uploadFinished()  : array<string|int, mixed>
Uploader callback function
viewManager()  : mixed
Overview page of the view manager
activateFrontendTheme()  : mixed
Gets the right frontend entity by lang id and channel, updates the theme id (when neccessary) and persists the updated entity
getLibrarySettings()  : mixed
Get the library settings column on overview page
saveLibrarySettings()  : mixed
Save the library settings which have been done on the overview page
checkUpload()  : bool|string
check fileupload and move uploaded file if it's a valid archive
createDefaultFiles()  : mixed
Create default theme files
createdir()  : mixed
create skin folder
createDirectoryStructure()  : bool
Create the directory structure of the archive contents and set permissions
extractArchive()  : bool
Extracts the archive to the themes path
import()  : mixed
set up Import page call specific function depending on $_GET
importFile()  : mixed
import themes from archive
insertIntoDb()  : mixed
insert Skin into db and activate the theme on content pages
insertSkinIntoDb()  : mixed
Insert the skin into database
isInLanguageFullMode()  : bool
checks whether this cloudrexx has the possibility to use multi language mode
manage()  : mixed
Export theme as ZIP archive
overview()  : mixed
Show the Template Manager (advanced HTML/CSS/JS editor)
parseThemesData()  : mixed
replaceThemeName()  : string
Replaces remainders of the original theme in a freshly copied theme.
setNavigation()  : mixed
validateArchiveStructure()  : bool
check for valid archive structure, put directories into $arrDirectories set errormessage if structure not valid
validateThemeName()  : mixed

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 = ''

$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

Required files

public array<string|int, mixed> $filenames = array('index.html', 'style.css', 'content.html', 'home.html', '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', 'component.yml')

$subDirs

Subdirectores and contents of selected theme

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

Methods

_activate()

Gets the themes assigning page

public _activate() : mixed
Tags
access

private

global

ADONewConnection

global

array

global

\Cx\Core\Html\Sigma

_fetchRemoteFile()

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

_getDropdownActivated()

Gets the activated themes dropdown menu

public _getDropdownActivated(mixed $selectedTheme) : string
Parameters
$selectedTheme : mixed
Tags
access

public

Return values
string

$atdm

_getThemesDropdownDelete()

Gets the themes dropdown menu

public _getThemesDropdownDelete() : string
Tags
access

private

global

ADONewConnection

Return values
string

$tdm

checkTable()

check iftable exists

public checkTable(string $table) : mixed
Parameters
$table : string
Tags
access

public

createFilesFromDB()

create files from db

public createFilesFromDB(string $themes, string $fromDB) : mixed
Parameters
$themes : string
$fromDB : string

createZipFolder()

Create the archive file to tmp folder

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

Contains the PclZip archive object

$themeFilesArray : array<string|int, mixed>

Themes files in array

$folder : string = '/'

Folder name

dropTable()

if now rows in table -> drop $this->oldTable

public dropTable() : mixed
Tags
access

public

examples()

Gets the themes example page

public examples() : mixed
Tags
access

public

formatFileList()

Format the Filesystem files and folders to viewManger format

public 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.

getComponentFilePath()

Get the component's file path

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

| string

getDbDropdown()

create db themes dropdownmenu

public getDbDropdown() : mixed
Tags
access

public

getDropdownNotInDb()

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

public getDropdownNotInDb() : string
Tags
access

public

global

ADONewConnection

Return values
string

$nadm

getExportFilePath()

Get the export archive file path

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

path to the created archive

getFileFromPath()

Get the file from the given path

public 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

public getFilesDropdown(object $theme, string $themesPage, bool $isComponentFile) : mixed
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

getPage()

Gets the requested page

public getPage() : string
Tags
global

\Cx\Core\Html\Sigma

Return values
string

parsed content

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

getThemesDropdown()

Gets the themes dropdown menu

public 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

public 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

public 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

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

newdir()

create skin folder page

public newdir() : mixed
Tags
access

public

readFiles()

reading the directories of the file sytem with the specified path

public readFiles(mixed $dirPath) : array<string|int, mixed>
Parameters
$dirPath : mixed
Return values
array<string|int, mixed>

$directory

replaceComponentFolderByItsType()

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

settings()

Settings section

public settings() : mixed
Tags
global

array $_ARRAYLANG

global

type $objTemplate

sortFilesFolders()

Sorting the array recursively

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

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) : mixed
Parameters
$a : mixed
$b : mixed

sortThemesByReleaseDate()

sorting the theme by its releaseDate

public sortThemesByReleaseDate(string $a, string $b) : string
Parameters
$a : string
$b : string
Return values
string

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() : mixed
Tags
global

array $_ARRAYLANG

global

type $objTemplate

global

type $objDatabase

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) : mixed
Parameters
$langId : mixed
$channel : mixed
$themeId : mixed

getLibrarySettings()

Get the library settings column on overview page

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

the template object

saveLibrarySettings()

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

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

the template object

checkUpload()

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

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

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

createDefaultFiles()

Create default theme files

private createDefaultFiles(Theme $theme) : mixed

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

Parameters
$theme : Theme

createdir()

create skin folder

private createdir() : mixed
Tags
access

public

createDirectoryStructure()

Create the directory structure of the archive contents and set permissions

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

extractArchive()

Extracts the archive to the themes path

private 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

import()

set up Import page call specific function depending on $_GET

private import() : mixed
Tags
access

private

importFile()

import themes from archive

private importFile() : mixed
Tags
access

private

insertIntoDb()

insert Skin into db and activate the theme on content pages

private insertIntoDb(object $theme[, int $themeIdFromDatabaseBasedTheme = null ]) : mixed
Parameters
$theme : object
$themeIdFromDatabaseBasedTheme : int = null

insertSkinIntoDb()

Insert the skin into database

private 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

private isInLanguageFullMode() : bool
Return values
bool

is this cloudrexx in multi language mode

manage()

Export theme as ZIP archive

private manage() : mixed
Tags
access

private

overview()

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

private overview() : mixed

parseThemesData()

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

type $objTemplate

replaceThemeName()

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

private replaceThemeName(string $org, string $copy, mixed $path) : string

(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()
Return values
string

"error" on error, else empty string

validateArchiveStructure()

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

private 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()

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

        
On this page

Search results