This class search for modules (input, output,type,description, name )

Saves the Modul-Input in a file (input.php) and Modul-Output in a file(output.php). All moduls of a clients are in [frontend]/modules/.

author rusmir.jusufovic

 Methods

Construct for the class cModuleHandler.

__construct($searchOptions) : void

With this class you can make a new Modul, rename a Modul. You can save a Output from Modul and Input in a file. The save rules are [Modulname] (is uneque) the files input and output will be named [Modulname]_input.php , [Modulname]_output.php

Parameters

$searchOptions

Exceptions

\cException if the module directory can not be created

Set the new modul name.

changeModuleName($name) 
Inherited
var

string

inherited_from \cModuleHandler::changeModuleName()

Parameters

$name

Make in all clients the module directory

createAllMainDirectories() : void
Inherited
inherited_from \cModuleHandler::createAllMainDirectories()

Exceptions

\cException if the frontend path can not be found or the module directory cann ot be created

Make a new module into the modul dir.

createModule($input, $output) : bool
Inherited

The modul name will be [ModulName] example Contact_Form or GoogleMaps2.

inherited_from \cModuleHandler::createModule()

Parameters

$input

$output

Returns

boolif modul exist or mkdir and saveInput and saveOutput success return true. Else if the mkdir or saveInput or saveOutput not success return false.

Make and save new file

createModuleFile(string $type, string $fileName, string $content) 
Inherited
inherited_from \cModuleHandler::createModuleFile()

Parameters

$type

string

css | js | template directory of the file

$fileName

string

file name

$content

string

content of the file

Delete file

deleteFile(string $type, string $fileName) 
Inherited
inherited_from \cModuleHandler::deleteFile()

Parameters

$type

string

js |template | css directory of the file

$fileName

string

file name

Removes this module from the filesystem.

eraseModule() : bool
Inherited

Also deletes the version files.

inherited_from \cModuleHandler::eraseModule()

Returns

booltrue on success or false on failure

Check if exist a file

existFile(string $type, string $fileName) 
Inherited
inherited_from \cModuleHandler::existFile()

Parameters

$type

string

js | template | css the directory of the file

$fileName

string

file name

Search for modules in input file of the module

findModulWithInput() : array

Returns

arrayresult

Search for modules in output of the module

findModulWithOutput() : array

Returns

arrayresult

Search for modules in description column of modules

findModuleWithDescription() : array

Returns

arrayresult

Search for modules in type column

findModuleWithType() : array

Returns

arrayresult

Search for modules in "name" column of modul

findeModulWithName() : array

Returns

arrayresult

Get all files from a module directory

getAllFilesFromDirectory(string $moduleDirectory) : array
Inherited
inherited_from \cModuleHandler::getAllFilesFromDirectory()

Parameters

$moduleDirectory

string

template css or js...

Returns

array

Get the cleaned name

getCleanName($name, $defaultChar) 
InheritedStatic
inherited_from \cModuleHandler::getCleanName()

Parameters

$name

$defaultChar

Get the main css file modulenam.css

getCssFileName() : string
Inherited
inherited_from \cModuleHandler::getCssFileName()

Returns

string

Get the css path of the modul

getCssPath() : string
Inherited
inherited_from \cModuleHandler::getCssPath()

Returns

string

getEncoding()

getEncoding() 
InheritedStatic
inherited_from \cModuleHandler::getEncoding()

Get the content of file, modul js or css or template or php

getFilesContent(string $directory, string $fileTyp, $fileName) 
Inherited
inherited_from \cModuleHandler::getFilesContent()

Parameters

$directory

string

where in module should we look

$fileTyp

string

css or js

$fileName

Get the name of the main js file (modulname.js)

getJsFileName() : string
Inherited
inherited_from \cModuleHandler::getJsFileName()

Returns

stringthe name of the js file

Get the js path of the modul

getJsPath() : string
Inherited
inherited_from \cModuleHandler::getJsPath()

Returns

string

Count result

getModulCount() : int

Returns

intcount in result

Get the Modul Path also cms path + module + module name.

getModulePath() : string
Inherited
inherited_from \cModuleHandler::getModulePath()

Returns

string

Main method for the class.

getModules() : array

Search for modules in db and in input and outputs files.

Returns

arrayresult

Get the php path of the modul

getPhpPath() : string
Inherited
inherited_from \cModuleHandler::getPhpPath()

Returns

string

Get the template path.

getTemplatePath(string $file) : string
Inherited

If file is set it will return the complete paht + file

inherited_from \cModuleHandler::getTemplatePath()

Parameters

$file

string

Returns

string

Init the vars of the class.

initWithDatabaseRow($db) 
Inherited
inherited_from \cModuleHandler::initWithDatabaseRow()

Parameters

$db

Can write/create a file

isWritable(string $fileName, string $directory) : \bool,
Inherited
inherited_from \cModuleHandler::isWritable()

Parameters

$fileName

string

file name

$directory

string

directory where is the file

Returns

\bool,success true else false

Show if the Modul with the modul name exist in modul dir.

modulePathExists() 
Inherited

return bool if the modul exist return true, else false

inherited_from \cModuleHandler::modulePathExists()

Exist the modulname in directory

modulePathExistsInDirectory(string $name) 
Inherited
inherited_from \cModuleHandler::modulePathExistsInDirectory()

Parameters

$name

string

Read the input of the file _input.php

readInput() : string
Inherited
inherited_from \cModuleHandler::readInput()

Returns

stringContents of the Module file (_input.php)

Read the output of the file _output.php

readOutput() : string
Inherited
inherited_from \cModuleHandler::readOutput()

Returns

stringContents of the Module file( _output.php)

Rename a modul and the input and output files.

renameModul(string $old, string $new) : bool
Inherited
inherited_from \cModuleHandler::renameModul()

Parameters

$old

string

old name of the modul

$new

string

new name of the modul

Returns

booltrue if success

Rename a file

renameModuleFile(string $type, string $oldFileName, string $newFileName) : boolean
Inherited
inherited_from \cModuleHandler::renameModuleFile()

Parameters

$type

string

css | js | template directory of the file

$oldFileName

string

old name of the file

$newFileName

string

the new name of the file

Returns

booleanby success return true

Save a content in the file, use for css/js

saveContentToFile(\unknown_type $templateName, \unknown_type $fileType, \unknown_type $fileContent, $saveDirectory) : false
Inherited
inherited_from \cModuleHandler::saveContentToFile()

Parameters

$templateName

\unknown_type

$fileType

\unknown_type

$fileContent

\unknown_type

$saveDirectory

Returns

falseor string

This method save a xml file with modul information.

saveInfoXML(string $moduleName, string $description, string $type, $alias) : true
Inherited

If the params not set, get the value from this

inherited_from \cModuleHandler::saveInfoXML()

Parameters

$moduleName

string

name of the modul

$description

string

description of the modul

$type

string

type of the modul

$alias

Returns

trueif success else false

Save a string into the file (_input.php)

saveInput(string $input) : bool
Inherited
inherited_from \cModuleHandler::saveInput()

Parameters

$input

string

Returns

boolif the action (save contents into the file _input.php is success) return true else false

Save a string into the file (_output.php).

saveOutput(string $output) : bool
Inherited
inherited_from \cModuleHandler::saveOutput()

Parameters

$output

string

Returns

boolif the action (save contents into the file _output.php is success) return true else false

Search for modules in db columns and in filesystem (input and output files)

searchForAllModules() : array

Returns

arrayresult

setEncoding()

setEncoding($encoding) 
InheritedStatic
inherited_from \cModuleHandler::setEncoding()

Parameters

$encoding

Init the vars of the class, make a query to the Db

_initByModule(int $idmod) 
Inherited
inherited_from \cModuleHandler::_initByModule()

Parameters

$idmod

int

the id of the modul

_initWithDatabaseRow()

_initWithDatabaseRow($db) 
Inherited
inherited_from \cModuleHandler::_initWithDatabaseRow()

Parameters

$db

Make main module directory.

_makeModuleDirectory() : boolean
Inherited
inherited_from \cModuleHandler::_makeModuleDirectory()

Returns

boolean

Make a directory template/css/image/js/php if not exist

createModuleDirectory(string $type) 
Inherited
inherited_from \cModuleHandler::createModuleDirectory()

Parameters

$type

string

Returns random characters

getRandomCharacters(integer $count) : string
Inherited
inherited_from \cModuleHandler::getRandomCharacters()

Parameters

$count

integer

amount of characters

Returns

string

Print a array

_echo(array $arg) 

Parameters

$arg

array

Search for a sting in input and output of module

_findInFiles(string $filter, \(db $dbRowModule) : boolean

Parameters

$filter

string

$dbRowModule

\(db

object with the row) $dbRowModule

Returns

booleanif found in files true else false

_rec_rmdir()

_rec_rmdir($path) 
Inherited
inherited_from \cModuleHandler::_rec_rmdir()

Parameters

$path

 Properties

 

$_cfg : array
Inherited
inherited_from \cModuleHandler::$$_cfg
 

$_cfgClient : array
Inherited
inherited_from \cModuleHandler::$$_cfgClient
 

$_client : int
Inherited
inherited_from \cModuleHandler::$$_client
 

$_description : string
Inherited
inherited_from \cModuleHandler::$$_description
 

$_directories : array
Inherited
inherited_from \cModuleHandler::$$_directories
 

$_elementPerPage : int
 

$_encoding : string
Inherited
inherited_from \cModuleHandler::$$_encoding
 

$_encodingStore 
Inherited
inherited_from \cModuleHandler::$$_encodingStore
 

$_fileEncoding : string
Inherited

..) getEffectiveSetting('encoding', 'file_encoding','UTF-8')

inherited_from \cModuleHandler::$$_fileEncoding
 

$_filter : string
 

$_idlang : int
Inherited
inherited_from \cModuleHandler::$$_idlang
 

$_idmod : int
Inherited
inherited_from \cModuleHandler::$$_idmod
 

$_input : string
Inherited
inherited_from \cModuleHandler::$$_input
 

$_moduleAlias : string
Inherited
inherited_from \cModuleHandler::$$_moduleAlias
 

$_moduleType : string

..)

 

$_orderBy : string
 

$_output : string
Inherited
inherited_from \cModuleHandler::$$_output
 

$_overrideEncoding 
Inherited
inherited_from \cModuleHandler::$$_overrideEncoding
 

$_result : array
 

$_searchIn : string
 

$_selectedPage : int
 

$_sortOrder : string
 

$_type : string
Inherited
inherited_from \cModuleHandler::$$_type
 

$_db : \DB_Contenido
Inherited
inherited_from \cModuleHandler::$$_db
 

$_moduleName : string
Inherited
inherited_from \cModuleHandler::$$_moduleName
 

$_modulePath : string
Inherited
inherited_from \cModuleHandler::$$_modulePath
 

$_path : string
Inherited
inherited_from \cModuleHandler::$$_path