Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe TemplateModel
+ Graphe d'héritage de TemplateModel:

Fonctions membres publiques

 getTemplateList ()
 
 getUpdatedList ($state=false, $all=false, $cleanup=false)
 
 getCoreList ()
 
 prepareCoreFiles ($dir, $element, $template)
 
 publish ($ids, $value, $exid)
 
 getFiles ()
 
 getDirectoryTree ($dir)
 
 getCoreFile ($file, $client_id)
 
getTemplate ()
 
 checkNewName ()
 
 getFromName ()
 
 copy ()
 
 cleanup ()
 
 getForm ($data=array(), $loadData=true)
 
getSource ()
 
 save ($data)
 
 getOverridesFolder ($name, $path)
 
 getOverridesList ()
 
 createOverride ($override)
 
 createTemplateOverride ($overridePath, $htmlPath)
 
 deleteFile ($file)
 
 createFile ($name, $type, $location)
 
 uploadFile ($file, $location)
 
 createFolder ($name, $location)
 
 deleteFolder ($location)
 
 renameFile ($file, $name)
 
 getImage ()
 
 cropImage ($file, $w, $h, $x, $y)
 
 resizeImage ($file, $width, $height)
 
 getPreview ()
 
 getFont ()
 
 copyFile ($newName, $location, $file)
 
 getArchive ()
 
 extractArchive ($file)
 
 getMediaFiles ()
 
 child ()
 
 getAllTemplateStyles ()
 
 copyStyles ()
 
- Fonctions membres publiques hérités de FormModel
 __construct ($config=array(), MVCFactoryInterface $factory=null, FormFactoryInterface $formFactory=null)
 
 checkin ($pk=null)
 
 checkout ($pk=null)
 
 validate ($form, $data, $group=null)
 
- Fonctions membres publiques hérités de BaseDatabaseModel
 __construct ($config=array(), MVCFactoryInterface $factory=null)
 
 getTable ($name='', $prefix='', $options=array())
 
 isCheckedOut ($item)
 
 getDbo ()
 
 setDbo (DatabaseInterface $db=null)
 
 __get ($name)
 
- Fonctions membres publiques hérités de BaseModel
 __construct ($config=array())
 
 getName ()
 
- Fonctions membres publiques hérités de CMSObject
 __construct ($properties=null)
 
 __toString ()
 
 def ($property, $default=null)
 
 get ($property, $default=null)
 
 getProperties ($public=true)
 
 getError ($i=null, $toString=true)
 
 getErrors ()
 
 set ($property, $value=null)
 
 setProperties ($properties)
 
 setError ($error)
 
- Fonctions membres publiques hérités de StatefulModelInterface
 getState ($property=null, $default=null)
 
 setState ($property, $value=null)
 
- Fonctions membres publiques hérités de DispatcherAwareInterface
 setDispatcher (DispatcherInterface $dispatcher)
 
- Fonctions membres publiques hérités de CurrentUserInterface
 setCurrentUser (User $currentUser)
 
- Fonctions membres publiques hérités de CacheControllerFactoryAwareInterface
 setCacheControllerFactory (CacheControllerFactoryInterface $factory)
 
- Fonctions membres publiques hérités de DatabaseAwareInterface
 setDatabase (DatabaseInterface $db)
 
- Fonctions membres publiques hérités de FormFactoryAwareInterface
 setFormFactory (FormFactoryInterface $factory)
 

Fonctions membres protégées

 getFile ($path, $name)
 
 storeFileInfo ($path, $name, $template)
 
 populateState ()
 
 fixTemplateName ()
 
 loadFormData ()
 
 checkFormat ($ext)
 
- Fonctions membres protégées hérités de BaseDatabaseModel
 _getList ($query, $limitstart=0, $limit=0)
 
 _getListCount ($query)
 
 _createTable ($name, $prefix='Table', $config=array())
 
 bootComponent ($component)
 
 dispatchEvent (EventInterface $event)
 

Attributs protégés

 $template = null
 
 $element = null
 
 $mediaElement = null
 
- Attributs protégés hérités de FormModel
 $events_map = null
 
- Attributs protégés hérités de BaseDatabaseModel
 $option = null
 
 $event_clean_cache = null
 
- Attributs protégés hérités de BaseModel
 $name
 
- Attributs protégés hérités de CMSObject
 $_errors = array()
 

Fonctions membres privées

 getSafeName ($name)
 
 validateDate ($date)
 
 getBasePath ()
 

Membres hérités additionnels

- Fonctions membres publiques statiques hérités de BaseModel
static addIncludePath ($path='', $prefix='')
 
- Attributs protégés statiques hérités de BaseModel
static $paths
 

Description détaillée

Template model class.

Depuis
1.6

Documentation des fonctions membres

◆ checkFormat()

checkFormat (   $ext)
protected

Check if the extension is allowed and will be shown in the template manager

Paramètres
string$extThe extension to check if it is allowed
Renvoie
boolean true if the extension is allowed false otherwise
Depuis
3.6.0

Références $params, et ComponentHelper\getParams().

◆ checkNewName()

checkNewName ( )

Method to check if new template name already exists

Renvoie
boolean true if name is not used, false otherwise
Depuis
2.5

Références $db, $name, $query, Joomla\Database\getDatabase(), et Joomla\CMS\MVC\Model\getState().

◆ child()

child ( )

Method to create the templateDetails.xml for the child template

Renvoie
boolean true if name is not used, false otherwise
Depuis
4.1.0

Références $app, $client, $result, $template, $user, $xml, Text\_(), Path\clean(), File\copy(), Folder\create(), Folder\delete(), Folder\exists(), File\exists(), Factory\getApplication(), ApplicationHelper\getClientInfo(), Joomla\CMS\MVC\Model\getState(), Factory\getUser(), et File\write().

◆ cleanup()

cleanup ( )

Method to delete tmp folder

Renvoie
boolean true if delete successful, false otherwise
Depuis
2.5

Références $app, Folder\delete(), Factory\getApplication(), et Joomla\CMS\MVC\Model\getState().

◆ copy()

copy ( )

Method to check if new template name already exists

Renvoie
boolean true if name is not used, false otherwise
Depuis
2.5

Références $app, $client, $folder, $languages, $manifest, $template, Text\_(), Path\clean(), Folder\copy(), File\copy(), Folder\create(), Folder\delete(), Folder\exists(), File\exists(), Factory\getApplication(), ApplicationHelper\getClientInfo(), Joomla\CMS\MVC\Model\getState(), et JPATH_SITE.

◆ copyFile()

copyFile (   $newName,
  $location,
  $file 
)

Copy a file.

Paramètres
string$newNameThe name of the copied file
string$locationThe final location where the file is to be copied
string$fileThe name and location of the file
Renvoie
boolean true if image resize successful, false otherwise.
Depuis
3.2

Références $app, $explodeArray, $location, $path, Text\_(), Path\clean(), File\copy(), Factory\getApplication(), et Text\sprintf().

◆ copyStyles()

copyStyles ( )

Method to copy selected styles to the child template

Renvoie
boolean true if name is not used, false otherwise
Depuis
4.1.3

Références $app, $columns, $db, $query, $style, $template, Text\_(), Factory\getApplication(), Joomla\Database\getDatabase(), Joomla\CMS\MVC\Model\getState(), Text\sprintf(), et ArrayHelper\toInteger().

◆ createFile()

createFile (   $name,
  $type,
  $location 
)

Create new file.

Paramètres
string$nameThe name of file.
string$typeThe extension of the file.
string$locationLocation for the new file.
Renvoie
boolean true if file created successfully, false otherwise
Depuis
3.2

Références $app, $base, $check, $location, $name, $type, Text\_(), Path\clean(), Factory\getApplication(), et Text\sprintf().

◆ createFolder()

createFolder (   $name,
  $location 
)

Create new folder.

Paramètres
string$nameThe name of the new folder.
string$locationLocation for the new folder.
Renvoie
boolean True if override folder is created successfully, false otherwise
Depuis
3.2

Références $app, $base, $location, $name, $path, Text\_(), Path\clean(), Folder\create(), et Factory\getApplication().

◆ createOverride()

createOverride (   $override)

Create overrides.

Paramètres
string$overrideThe override location.
Renvoie
boolean true if override creation is successful, false otherwise
Depuis
3.2

Références $app, $client, $explodeArray, $name, $path, $return, $size, $template, $url, Text\_(), Path\clean(), Folder\create(), elseif, Folder\exists(), Factory\getApplication(), ApplicationHelper\getClientInfo(), et JPATH_ROOT.

◆ createTemplateOverride()

createTemplateOverride (   $overridePath,
  $htmlPath 
)

Create override folder & file

Paramètres
string$overridePathThe override location
string$htmlPathThe html location
Renvoie
boolean True on success. False otherwise.

Références $folder, $return, File\copy(), Folder\create(), Folder\exists(), File\exists(), Folder\files(), Folder\folders(), Factory\getDate(), File\getExt(), null, et File\stripExt().

◆ cropImage()

cropImage (   $file,
  $w,
  $h,
  $x,
  $y 
)

Crop an image.

Paramètres
string$fileThe name and location of the file
string$wwidth.
string$hheight.
string$xx-coordinate.
string$yy-coordinate.
Renvoie
boolean true if image cropped successfully, false otherwise.
Depuis
3.2

Références $app, $image, $path, et Factory\getApplication().

◆ deleteFile()

deleteFile (   $file)

Delete a particular file.

Paramètres
string$fileThe relative location of the file.
Renvoie
boolean True if file deletion is successful, false otherwise
Depuis
3.2

Références $app, $return, Text\_(), File\delete(), et Factory\getApplication().

◆ deleteFolder()

deleteFolder (   $location)

Delete a folder.

Paramètres
string$locationThe name and location of the folder.
Renvoie
boolean True if override folder is deleted successfully, false otherwise
Depuis
3.2

Références $app, $base, $location, $path, $return, Text\_(), Path\clean(), Folder\delete(), et Factory\getApplication().

◆ extractArchive()

extractArchive (   $file)

Extract contents of an archive file.

Paramètres
string$fileThe name and location of the file
Renvoie
boolean true if image extraction is successful, false otherwise.
Depuis
3.2

Références $app, $explodeArray, $i, $path, Text\_(), Path\clean(), et Factory\getApplication().

◆ fixTemplateName()

fixTemplateName ( )
protected

Method to rename the template in the XML files and rename the language files

Renvoie
boolean true if successful, false otherwise
Depuis
2.5

Références $manifest, $result, $template, File\exists(), Folder\files(), Joomla\CMS\MVC\Model\getState(), File\move(), et File\write().

◆ getAllTemplateStyles()

getAllTemplateStyles ( )

Method to get the parent template existing styles

Renvoie
array array of id,titles of the styles
Depuis
4.1.3

Références $db, $query, $template, Joomla\Database\getDatabase(), et ParameterType\INTEGER.

◆ getArchive()

getArchive ( )

Get the compressed files.

Renvoie
array if file exists, false otherwise
Depuis
3.2

Références $app, $i, $path, Text\_(), Path\clean(), et Factory\getApplication().

◆ getBasePath()

getBasePath ( )
private

Method to resolve the base folder.

Renvoie
string The absolute path for the base.
Depuis
4.1.0

Références $app, $this, Factory\getApplication(), et JPATH_ROOT.

◆ getCoreFile()

getCoreFile (   $file,
  $client_id 
)

Method to get the core file of override file

Paramètres
string$fileOverride file
integer$client_idClient Id
Renvoie
string $corefile The full path and file name for the target file, or boolean false if the file is not found in any of the paths.
Depuis
4.0.0

Références $app, $client, $explodeArray, $folder, $type, Path\clean(), elseif, Path\find(), Factory\getApplication(), ApplicationHelper\getClientInfo(), et JPATH_ROOT.

◆ getCoreList()

getCoreList ( )

Method to get a list of all the core files of override files.

Renvoie
array An array of all core files.
Depuis
4.0.0

Références $app, $b, $client, $path, $template, Path\clean(), Factory\getApplication(), et ApplicationHelper\getClientInfo().

◆ getDirectoryTree()

getDirectoryTree (   $dir)

Get the directory tree.

Paramètres
string$dirThe path of the directory to scan
Renvoie
array
Depuis
3.2

Références $dir, $key, $result, $this, $value, et JPATH_ROOT.

◆ getFile()

getFile (   $path,
  $name 
)
protected

Internal method to get file properties.

Paramètres
string$pathThe base path.
string$nameThe file name.
Renvoie
object
Depuis
1.6

Références $name, $path, $temp, $this, et JPATH_ROOT.

◆ getFiles()

getFiles ( )

Method to get a list of all the files to edit in a template.

Renvoie
array A nested array of relevant files.
Depuis
1.6

Références $app, $client, $lang, $path, $result, $template, Text\_(), Path\clean(), Factory\getApplication(), ApplicationHelper\getClientInfo(), et Factory\getLanguage().

◆ getFont()

getFont ( )

Rename a file.

Renvoie
mixed array on success, false on failure
Depuis
3.2

Références $app, $client, $explodeArray, $folder, $path, $template, $uri, Text\_(), Path\clean(), Factory\getApplication(), ApplicationHelper\getClientInfo(), et Uri\root().

◆ getForm()

getForm (   $data = array(),
  $loadData = true 
)

Method to get the record form.

Paramètres
array$dataData for the form.
boolean$loadDataTrue if the form is to load its own data (default case), false if not.
Renvoie
Form|boolean A Form object on success, false on failure
Depuis
1.6

Implémente FormModelInterface.

Références $app, $db, $form, $query, $state, Text\_(), Factory\getApplication(), Joomla\Database\getDatabase(), et Joomla\CMS\MVC\Model\loadForm().

◆ getFromName()

getFromName ( )

Method to check if new template name already exists

Renvoie
string name of current template
Depuis
2.5

◆ getImage()

getImage ( )

Get an image address, height and width.

Renvoie
array an associative array containing image address, height and width.
Depuis
3.2

Références $app, $image, $path, $uri, Text\_(), Path\clean(), Factory\getApplication(), JPATH_ROOT, et Uri\root().

◆ getMediaFiles()

getMediaFiles ( )

Method to get a list of all the files to edit in a template's media folder.

Renvoie
array A nested array of relevant files.
Depuis
4.1.0

Références $app, $path, $result, $template, Text\_(), Path\clean(), Factory\getApplication(), JPATH_ROOT, et TemplatesHelper\parseXMLTemplateFile().

◆ getOverridesFolder()

getOverridesFolder (   $name,
  $path 
)

Get overrides folder.

Paramètres
string$nameThe name of override.
string$pathLocation of override.
Renvoie
object containing override name and path.
Depuis
3.2

Références $folder, $name, et $path.

◆ getOverridesList()

getOverridesList ( )

Get a list of overrides.

Renvoie
array containing overrides.
Depuis
3.2

Références $client, $component, $folder, $layout, $module, $modules, $path, $result, $template, $view, Path\clean(), Folder\folders(), ApplicationHelper\getClientInfo(), et JPATH_ROOT.

◆ getPreview()

getPreview ( )

Template preview.

Renvoie
object object containing the id of the template.
Depuis
3.2

Références $app, $db, $query, $result, Text\_(), Factory\getApplication(), et Joomla\Database\getDatabase().

◆ getSafeName()

getSafeName (   $name)
private

Creates a safe file name for the given name.

Paramètres
string$nameThe filename
Renvoie
string $fileName The filtered name without Date
Depuis
4.0.0

Références $date, $explodeArray, $extension, $name, $size, et File\getExt().

◆ getSource()

& getSource ( )

Method to get a single record.

Renvoie
mixed Object on success, false on failure.
Depuis
1.6

Références $app, $input, $item, $this, Text\_(), Path\check(), Path\clean(), Factory\getApplication(), Joomla\CMS\MVC\Model\getState(), et JPATH_ROOT.

◆ getTemplate()

& getTemplate ( )

Method to get the template information.

Renvoie
mixed Object if successful, false if not and internal error is set.
Depuis
1.6

Références $app, $db, $query, $result, $template, $this, Text\_(), Factory\getApplication(), Joomla\Database\getDatabase(), Joomla\CMS\MVC\Model\getState(), if, ParameterType\INTEGER, JPATH_ROOT, et TemplatesHelper\parseXMLTemplateFile().

◆ getTemplateList()

getTemplateList ( )

Method to get all template list.

Renvoie
object stdClass object
Depuis
4.0.0

Références $db, $query, $results, Joomla\Database\getDatabase(), et Joomla\CMS\MVC\Model\getState().

◆ getUpdatedList()

getUpdatedList (   $state = false,
  $all = false,
  $cleanup = false 
)

Method to get all updated file list.

Paramètres
boolean$stateThe optional parameter if you want unchecked list.
boolean$allThe optional parameter if you want all list.
boolean$cleanupThe optional parameter if you want to clean record which is no more required.
Renvoie
object stdClass object
Depuis
4.0.0

Références $client, $db, $path, $query, $results, $state, $template, Path\clean(), elseif, ApplicationHelper\getClientInfo(), Joomla\Database\getDatabase(), Joomla\CMS\MVC\Model\getState(), et ParameterType\INTEGER.

◆ loadFormData()

loadFormData ( )
protected

Method to get the data that should be injected in the form.

Renvoie
mixed The data for the form.
Depuis
1.6

Références $data, et Joomla\CMS\MVC\Model\preprocessData().

◆ populateState()

populateState ( )
protected

Method to auto-populate the model state.

Note. Calling getState in this method will result in recursion.

Renvoie
void
Depuis
1.6

Références $app, $params, Factory\getApplication(), ComponentHelper\getParams(), et Joomla\CMS\MVC\Model\setState().

◆ prepareCoreFiles()

prepareCoreFiles (   $dir,
  $element,
  $template 
)

Prepare core files.

Paramètres
string$dirThe path of the directory to scan.
string$elementThe path of the template element.
\stdClass$templateThe stdClass object of template.
Renvoie
array
Depuis
4.0.0

Références $dir, $info, $key, $template, et $value.

◆ publish()

publish (   $ids,
  $value,
  $exid 
)

Method to update status of list.

Paramètres
array$idsThe base path.
array$valueThe file name.
integer$exidThe template extension id.
Renvoie
integer Number of files changed.
Depuis
4.0.0

Références $db, $id, $result, $value, elseif, Joomla\Database\getDatabase(), et ParameterType\INTEGER.

◆ renameFile()

renameFile (   $file,
  $name 
)

Rename a file.

Paramètres
string$fileThe name and location of the old file
string$nameThe new name of the file.
Renvoie
string Encoded string containing the new file location.
Depuis
3.2

Références $app, $explodeArray, $name, $path, $type, Text\_(), et Factory\getApplication().

◆ resizeImage()

resizeImage (   $file,
  $width,
  $height 
)

Resize an image.

Paramètres
string$fileThe name and location of the file
string$widthThe new width of the image.
string$heightThe new height of the image.
Renvoie
boolean true if image resize successful, false otherwise.
Depuis
3.2

Références $app, $height, $image, $path, $width, Factory\getApplication(), et Image\SCALE_FILL.

◆ save()

save (   $data)

Method to store the source file contents.

Paramètres
array$dataThe source data to save.
Renvoie
boolean True on success, false otherwise and internal error set.
Depuis
1.6

Références $app, $data, $explodeArray, $return, $template, $this, $user, Text\_(), Path\clean(), Factory\getApplication(), Path\getPermissions(), PluginHelper\importPlugin(), Path\isOwner(), JPATH_ROOT, null, Path\setPermissions(), Text\sprintf(), et File\write().

◆ storeFileInfo()

storeFileInfo (   $path,
  $name,
  $template 
)
protected

Method to store file information.

Paramètres
string$pathThe base path.
string$nameThe file name.
stdClass$templateThe std class object of template.
Renvoie
object stdClass object.
Depuis
4.0.0

Références $name, $path, $temp, $template, et null.

◆ uploadFile()

uploadFile (   $file,
  $location 
)

Upload new file.

Paramètres
array$fileThe uploaded file array.
string$locationLocation for the new file.
Renvoie
boolean True if file uploaded successfully, false otherwise
Depuis
3.2

Références $app, $location, $path, $url, Text\_(), TemplateHelper\canUpload(), Path\clean(), Factory\getApplication(), File\makeSafe(), null, et File\upload().

◆ validateDate()

validateDate (   $date)
private

Validate Date in file name.

Paramètres
string$dateDate to validate.
Renvoie
boolean Return true if date is valid and false if not.
Depuis
4.0.0

Références $date, et $format.

Documentation des champs

◆ $element

$element = null
protected

◆ $mediaElement

$mediaElement = null
protected

◆ $template

$template = null
protected

La documentation de cette classe a été générée à partir du fichier suivant :