Class handels the view, creation, edit, delete of modul templates.
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/.
Methods
Construct for the class cModuleHandler.
__construct(int $idmod) : 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
$idmod
int
the id of the modul
Exceptions
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
bool
if 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
bool
true 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
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
$fileName
Get the name of the main js file (modulname.js)
getJsFileName() : string
Inherited
inherited_from |
\cModuleHandler::getJsFileName() |
Returns
string
the name of the js file
Get the js path of the modul
getJsPath() : string
Inherited
inherited_from |
\cModuleHandler::getJsPath() |
Returns
string
Get the Modul Path also cms path + module + module name.
getModulePath() : string
Inherited
inherited_from |
\cModuleHandler::getModulePath() |
Returns
string
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 output of the file _output.php
readOutput() : string
Inherited
inherited_from |
\cModuleHandler::readOutput() |
Returns
string
Contents 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
bool
true 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
boolean
by 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
false
or 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
true
if success else false
Save a string into the file (_output.php).
saveOutput(string $output) : bool
Inherited
inherited_from |
\cModuleHandler::saveOutput() |
Parameters
$output
string
Returns
bool
if the action (save contents into the file _output.php is
success) return true else false
We have two actions wich could send from form.
setAction(string $action)
Parameters
$action
string
Set the code from Form!
setCode(string $code)
setEncoding()
setEncoding($encoding)
InheritedStatic
inherited_from |
\cModuleHandler::setEncoding() |
Parameters
$encoding
Set the file and tmpFile from Form.
setFiles(string $file, string $tmpFile)
(get it with $_Request...)
Parameters
$file
string
$tmpFile
string
Set $frame and idmod and are.
setFrameIdmodArea(int $frame, int $idmod, int $area)
Parameters
$frame
int
$idmod
int
$area
int
Set the new delete from Form.
setNewDelete(string $new, string $delete)
This are set if user had push the delete or new button.
Parameters
$new
string
$delete
string
Set the selected file from Form.
setSelectedFile(string $selectedFile)
Parameters
$selectedFile
string
Set the status it can be send or empty ''
setStatus(string $status)
Parameters
$status
string
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
The method decide what action is send from
user (form).
_getAction() : string
Exceptions
Returns
string
[new, delete,empty,save,rename, default]
Has the selected file changed.
_hasSelectedFileChanged() : boolean
Returns
boolean
is the filename changed
Have the user premissions for the actions.
_havePremission(\cPermission $perm, \cGuiNotification $notification, string $action) : int
Parameters
$action
string
Returns
int
if user dont have permission return -1
_rec_rmdir()
_rec_rmdir($path)
Inherited
inherited_from |
\cModuleHandler::_rec_rmdir() |
Parameters
$path
rename a file in template directory
_rename() : void
Save the code in the file
_save()
This method test the code if the client setting htmlvalidator
is not set to false.
_validateHTML($notification)
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 |
$_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 |
$_idlang : int
Inherited
inherited_from |
\cModuleHandler::$$_idlang |
$_idmod : int
Inherited
inherited_from |
\cModuleHandler::$$_idmod |
$_moduleAlias : string
Inherited
inherited_from |
\cModuleHandler::$$_moduleAlias |
$_output : string
Inherited
inherited_from |
\cModuleHandler::$$_output |
$_overrideEncoding
Inherited
inherited_from |
\cModuleHandler::$$_overrideEncoding |
$_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 |
$_templateFileEnding : string