Welcompose
[ class tree: Welcompose ] [ index: Welcompose ] [ all elements ]

Class: Templating_Template

Source Location: /templating_classes/template.class.php

Class Overview




Variables

Methods



Class Details

[line 38]


[ Top ]


Class Variables

static $instance =  null

[line 45]

Singleton



Tags:

access:  public

Type:   object


[ Top ]

$base =  null

[line 52]

Reference to base class



Tags:

access:  public

Type:   object


[ Top ]



Class Methods


constructor __construct [line 59]

Templating_Template __construct( )

Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.



Tags:

access:  public


[ Top ]

method addTemplate [line 98]

int addTemplate( array $sqlData)

Creates new template. Takes field=>value array with template data as first argument. Returns insert id.



Tags:

return:  Template id
throws:  Templating_TemplateException
access:  public


Parameters:

array   $sqlData   Row data

[ Top ]

method countTemplates [line 398]

array countTemplates( [array $params = array()])

Method to count templates. Takes key=>value with count params as first argument. Returns array.

List of supported params:

  • type, int, optional: Template type id
  • set, int, optional: Template set id




Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

array   $params   Count params

[ Top ]

method deleteTemplate [line 173]

int deleteTemplate( int $id)

Removes template from the template table. Takes the template id as first argument. Returns amount of affected rows.



Tags:

return:  Amount of affected rows
throws:  Templating_TemplateException
access:  public


Parameters:

int   $id   Template id

[ Top ]

method instance [line 82]

object instance( )

Singleton. Returns instance of the Templating_Template object.



Tags:

access:  public


[ Top ]

method mapTemplateToSets [line 475]

bool mapTemplateToSets( int $template, [array $sets = array()])

Maps template to template sets. Takes template id as first argument, array with list of set ids as second argument. Returns boolean true.

If an empty array is passed as sets, all existing links will be removed.




Tags:

throws:  throw new Templating_TemplateException
access:  public


Parameters:

int   $template   Template id
array   $sets   Template set ids

[ Top ]

method selectTemplate [line 222]

array selectTemplate( int $id)

Selects one template. Takes the template id as first argument. Returns array with template information.



Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

int   $id   Template id

[ Top ]

method selectTemplates [line 291]

array selectTemplates( [array $params = array()])

Method to select one or more templates. Takes key=>value array with select params as first argument. Returns array.

List of supported params:

  • type, int, optional: Template type id
  • set, int, optional: Template set id
  • start, int, optional: row off
  • limit, int, optional: amount of rows to return




Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method selectTemplateToSetsMap [line 540]

array selectTemplateToSetsMap( int $template)

Selects links between the given template and its associated template sets. Takes the template id as first argument. Returns array.



Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

int   $template   Group id

[ Top ]

method smartyFetchTemplate [line 840]

string smartyFetchTemplate( int $page_id, string $template_type_name)

Fetches template for smarty out of the database. The right template will be chosen using the id of the current page and the name of the template type.

Takes the page id as first argument, the name of the template type as second argument. Returns string.




Tags:

return:  Template
throws:  Templating_TemplateException
access:  public


Parameters:

int   $page_id   Page id
string   $template_type_name   Template type name

[ Top ]

method smartyFetchTemplateTimestamp [line 911]

int smartyFetchTemplateTimestamp( int $page_id, string $template_type_name)

Fetches last modification timestamp of a template. The right template will be chosen using the id of the current page and the name of the template type.

Takes the page id as first argument, the name of the template type as second argument. Returns int.




Tags:

return:  Unix timestamp
throws:  Templating_TemplateException
access:  public


Parameters:

int   $page_id   Page id
string   $template_type_name   Template type name

[ Top ]

method templateBelongsToCurrentProject [line 588]

bool templateBelongsToCurrentProject( int $template)

Checks whether the given template belongs to the current project or not. Takes the id of the template as first argument. Returns bool.



Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

int   $template   Template id

[ Top ]

method templateBelongsToCurrentUser [line 638]

bool templateBelongsToCurrentUser( int $template)

Tests whether template belongs to current user or not. Takes the template id as first argument. Returns bool.



Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

int   $template   Template id

[ Top ]

method testForUniqueName [line 675]

bool testForUniqueName( string $name, [int $id = null])

Tests given template name for uniqueness. Takes the template name as

first argument and an optional template id as second argument. If the template id is given, this template won't be considered when checking for uniqueness (useful for updates). Returns boolean true if template name is unique.




Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

string   $name   Template name
int   $id   Template id

[ Top ]

method testForUniqueTypeAndSet [line 742]

bool testForUniqueTypeAndSet( string $type, [int $id = null])

Tests given template type and set combination for uniqueness. Takes the template type as

first argument and an optional template id as second argument. To crosscheck the type and set combination the sets POST are used. If the template id is given, this template won't be considered when checking for uniqueness (useful for updates). Returns boolean true if template type and set(s) combination is unique.




Tags:

throws:  Templating_TemplateException
access:  public


Parameters:

string   $type   Template type
int   $id   Template id

[ Top ]

method updateTemplate [line 130]

int updateTemplate( int $id, array $sqlData)

Updates template. Takes the template id as first argument, a field=>value array with the new template data as second argument. Returns amount of affected rows.



Tags:

return:  Affected rows
throws:  Templating_TemplateException
access:  public


Parameters:

int   $id   Template id
array   $sqlData   Row data

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:52:05 +0100 by phpDocumentor 1.4.3