PHP Class Template, newscoop

Since: 1.0.0
Author: Damjan
Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$m_columnNames
$m_dbTableName
$m_keyColumnNames
$m_keyIsAutoIncrement

Public Methods

Method Description
ChangeCharset ( $p_oFile, $p_dFile, $p_type, $p_charset )
GetAllFolders ( array $p_folders ) : array Returns an array containing the directories tree for the given path.
GetAllTemplates ( array $p_sqlOptions = null, boolean $p_update = true, boolean $p_useFilter = false, boolean $p_strict = false ) : array
GetContents ( string $p_path ) : string
GetFullPath ( string $p_path, string $p_filename ) : string Return the full path to the file.
GetPath ( $p_path, $p_filename ) : string Get the relative path to the given file in the template directory.
GetTemplateFilterRegex ( boolean $p_sql = false ) : string Return an regular expression to filter template lists
InUse ( $p_templateName ) : boolean Returns TRUE if the template is being used in an Issue or Section.
IsValidPath ( string $p_path, boolenan $p_checkIfExists = true ) : boolean Returns true if the template path is valid.
OnUpload ( $f_fileVarName, string $p_baseUpload, string $p_desiredName = null, string $p_charset = null ) : mixed Call this to upload a template file. Note: Template::UpdateStatus() will be called automatically for you if this is successful.
ProcessFile ( $p_tmpFile, $p_newFile, $p_charset = null )
Template ( $p_templateIdOrName = null ) A template is an HTML file with Campsite parser tags inside.
UpdateOnChange ( string $p_tplOrig, string $p_tplNew ) : mixed Update the Name field for a template on Renaming/Moving.
UpdateStatus ( ) : void Sync the database with the filesystem.
delete ( ) : mixed Deletes a template file.
fileExists ( ) : boolean Return TRUE if the file exists.
getAbsoluteUrl ( ) : string
getCacheLifetime ( ) : integer
getLevel ( ) : integer
getName ( ) : string
getTemplateId ( ) : integer
getType ( ) : integer
move ( string $p_current_folder, string $p_destination_folder ) : boolean Moves a template from current folder to destination folder.
setCacheLifetime ( $p_lifetime ) : boolean
setProperty ( $p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false ) Wrapper around DatabaseObject::setProperty

Method Details

ChangeCharset() public static method

public static ChangeCharset ( $p_oFile, $p_dFile, $p_type, $p_charset )

GetAllFolders() public static method

Returns an array containing the directories tree for the given path.
public static GetAllFolders ( array $p_folders ) : array
$p_folders array
return array $p_folders

GetAllTemplates() public static method

public static GetAllTemplates ( array $p_sqlOptions = null, boolean $p_update = true, boolean $p_useFilter = false, boolean $p_strict = false ) : array
$p_sqlOptions array
$p_update boolean
$p_useFilter boolean filter templates matching setting in SystemPreferences
$p_strict boolean if true, retrieves only template (tpl) files
return array

GetContents() public static method

public static GetContents ( string $p_path ) : string
$p_path string
return string

GetFullPath() public static method

Return the full path to the file.
public static GetFullPath ( string $p_path, string $p_filename ) : string
$p_path string Path of the file starting from the base template directory.
$p_filename string
return string

GetPath() public static method

Get the relative path to the given file in the template directory.
public static GetPath ( $p_path, $p_filename ) : string
return string

GetTemplateFilterRegex() public static method

Return an regular expression to filter template lists
public static GetTemplateFilterRegex ( boolean $p_sql = false ) : string
$p_sql boolean indicates usage for sql query
return string

InUse() public static method

Returns TRUE if the template is being used in an Issue or Section.
public static InUse ( $p_templateName ) : boolean
return boolean

IsValidPath() public static method

Returns true if the template path is valid.
public static IsValidPath ( string $p_path, boolenan $p_checkIfExists = true ) : boolean
$p_path string
$p_checkIfExists boolenan
return boolean

OnUpload() public static method

Call this to upload a template file. Note: Template::UpdateStatus() will be called automatically for you if this is successful.
public static OnUpload ( $f_fileVarName, string $p_baseUpload, string $p_desiredName = null, string $p_charset = null ) : mixed
$p_baseUpload string Directory path to add to the base template directory.
$p_desiredName string Desired name of the file.
$p_charset string Desired character set of the file.
return mixed TRUE on success, PEAR_Error on failure.

ProcessFile() public static method

public static ProcessFile ( $p_tmpFile, $p_newFile, $p_charset = null )

Template() public method

A template is an HTML file with Campsite parser tags inside.
public Template ( $p_templateIdOrName = null )

UpdateOnChange() public static method

It is called before any UpdateStatus() when renaming/moving a template to avoid a new Id is set for the changed template.
public static UpdateOnChange ( string $p_tplOrig, string $p_tplNew ) : mixed
$p_tplOrig string The original template Name
$p_tplNew string The new template Name
return mixed

UpdateStatus() public static method

Sync the database with the filesystem.
public static UpdateStatus ( ) : void
return void

delete() public method

It does not take care on database info upgrade because it trusts of the cool Template::UpdateStatus() function.
public delete ( ) : mixed
return mixed

fileExists() public method

Return TRUE if the file exists.
public fileExists ( ) : boolean
return boolean

getAbsoluteUrl() public method

public getAbsoluteUrl ( ) : string
return string

getCacheLifetime() public method

public getCacheLifetime ( ) : integer
return integer

getLevel() public method

public getLevel ( ) : integer
return integer

getName() public method

public getName ( ) : string
return string

getTemplateId() public method

public getTemplateId ( ) : integer
return integer

getType() public method

public getType ( ) : integer
return integer

move() public method

It does not take care on database info upgrade because it trusts of the cool Template::UpdateStatus() function.
public move ( string $p_current_folder, string $p_destination_folder ) : boolean
$p_current_folder string
$p_destination_folder string
return boolean true on succes or false on failure

setCacheLifetime() public method

public setCacheLifetime ( $p_lifetime ) : boolean
return boolean

setProperty() public method

Wrapper around DatabaseObject::setProperty
public setProperty ( $p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false )

Property Details

$m_columnNames public property

public $m_columnNames

$m_dbTableName public property

public $m_dbTableName

$m_keyColumnNames public property

public $m_keyColumnNames

$m_keyIsAutoIncrement public property

public $m_keyIsAutoIncrement