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

Class: Templating_GlobalFile

Source Location: /templating_classes/globalfile.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_GlobalFile __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 addGlobalFile [line 85]

int addGlobalFile( array $sqlData)

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



Tags:

return:  Global file id
throws:  Templating_GlobalFileException
access:  public


Parameters:

array   $sqlData   Row data

[ Top ]

method countGlobalFiles [line 350]

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

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

List of supported params:

  • n/a




Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

array   $params   Count params

[ Top ]

method deleteGlobalFile [line 164]

int deleteGlobalFile( int $id)

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



Tags:

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


Parameters:

int   $id   Global file id

[ Top ]

method getPathToGlobalFile [line 748]

mixed getPathToGlobalFile( string $object_name)

Returns full path to global file object. Takes global file object name on disk as first argument. Please note that the object doesn't have to exist to get the path to a object.



Tags:

access:  public


Parameters:

string   $object_name   Object name

[ Top ]

method getPathToGlobalFileUsingId [line 770]

mixed getPathToGlobalFileUsingId( string $object_id)

Takes global file object id as first argument. Returns full disk path to global file object.



Tags:

access:  public


Parameters:

string   $object_id   Object id

[ Top ]

method globalFileBelongsToCurrentProject [line 550]

bool globalFileBelongsToCurrentProject( int $file)

Checks whether the given global file belongs to the current project or not.

Takes the id of the global file as first argument. Returns bool.




Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $file   Global file id

[ Top ]

method globalFileBelongsToCurrentUser [line 596]

bool globalFileBelongsToCurrentUser( int $global_file)

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



Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $global_file   Global file id

[ Top ]

method moveGlobalFileToStore [line 401]

string moveGlobalFileToStore( string $name, string $path)

Moves global file to store. Takes the real name (~ file name on user's disk) as first argument, the path to the uploaded file as second argument. Returns the new name on disk (uniqid + real name).



Tags:

return:  File name on disk
throws:  Templating_GlobalFileException
access:  public


Parameters:

string   $name   File name
string   $path   Path to uploaded file

[ Top ]

method removeGlobalFileFromStore [line 445]

bool removeGlobalFileFromStore( int $global_file)

Removes global file form store. Takes the id of the global file as first argument. Returns bool.



Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $global_file   Global file id

[ Top ]

method selectGlobalFile [line 208]

array selectGlobalFile( int $id)

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



Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $id   Global file id

[ Top ]

method selectGlobalFiles [line 270]

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

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

List of supported params:

  • start, int, optional: row offset
  • limit, int, optional: amount of rows to return




Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method selectGlobalFileUsingName [line 495]

array selectGlobalFileUsingName( int $name)

Selects one global file. Takes the global file name as first argument. Returns array with global file information.



Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $name   Global file name

[ Top ]

method testForUniqueFilename [line 699]

bool testForUniqueFilename( string $file_name, [integer $id = null], string $action)

Tests given global file for uniqueness. Takes the global file name as first argument and the id as second argument as an option.

The second argument is used to compare if the uploaded global file name equals the former global file name that is already on disk. When the global file name is identical, we allow to replace this file.

Returns boolean true if global file name is unique.




Tags:

throws:  Templating_GlobalFileException
access:  public


Parameters:

string   $file_name   file name
integer   $id   Id of current file
string   $action   action What condition may occur

[ Top ]

method updateGlobalFile [line 121]

int updateGlobalFile( int $id, array $sqlData)

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



Tags:

return:  Affected rows
throws:  Templating_GlobalFileException
access:  public


Parameters:

int   $id   Global file id
array   $sqlData   Row data

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:50 +0100 by phpDocumentor 1.4.3