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

Class: Content_Box

Source Location: /content_classes/box.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]

Content_Box __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 addBox [line 85]

int addBox( array $sqlData)

Adds box to the box table. Takes a field=>value array with box data as first argument. Returns insert id.



Tags:

return:  Box id
throws:  Content_BoxException
access:  public


Parameters:

array   $sqlData   Row data

[ Top ]

method boxBelongsToCurrentProject [line 743]

int boxBelongsToCurrentProject( int $box)

Tests whether given box belongs to current project. Takes the box id as first argument. Returns bool.



Tags:

return:  bool
throws:  Content_BoxException
access:  public


Parameters:

int   $box   Box id

[ Top ]

method boxBelongsToCurrentUser [line 793]

bool boxBelongsToCurrentUser( int $box)

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



Tags:

throws:  Content_BoxException
access:  public


Parameters:

int   $box   box id

[ Top ]

method countBoxes [line 589]

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

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

List of supported params:

  • page, int, optional: Page id




Tags:

throws:  Content_BoxException
access:  public


Parameters:

array   $params   Count params

[ Top ]

method deleteBox [line 159]

int deleteBox( int $id)

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



Tags:

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


Parameters:

int   $id   Box id

[ Top ]

method selectBox [line 196]

array selectBox( int $id)

Selects one box. Takes the box id as first argument.

Returns array with box information.




Tags:

throws:  Content_BoxException
access:  public


Parameters:

int   $id   Box id

[ Top ]

method selectBoxes [line 336]

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

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

List of supported params:

  • order_marco, string, otpional: How to sort the result set. Supported macros:
    • NAME: sort by name
    • PRIORITY: sort by priority
    • RANDOM: sort by random selection
    • DATE_MODIFIED: sort by date modified
    • DATE_ADDED: sort by date added
  • page, int, optional: Page id
  • start, int, optional: row offset
  • limit, int, optional: amount of rows to return




Tags:

throws:  Content_BoxException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method selectBoxesAndPages [line 460]

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

Method to select one or more boxes and the related page info fields. If param 'page' is set the result set will gets all boxes except the ones related to the provided param page.

Takes key=>value array with select params as first argument. Returns array.

List of supported params:

  • order_marco, string, otpional: How to sort the result set. Supported macros:
    • NAME: sort by name
    • PRIORITY: sort by priority
    • RANDOM: sort by random selection
    • DATE_MODIFIED: sort by date modified
    • DATE_ADDED: sort by date added
  • page, int, optional: Page id
  • start, int, optional: row offset
  • limit, int, optional: amount of rows to return




Tags:

throws:  Content_BoxException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method selectBoxUsingName [line 258]

array selectBoxUsingName( int $page, string $name)

Selects box unsing its page and name. Takes the page id as first argument, the box name as second argument. Returns array.



Tags:

throws:  Content_BoxException
access:  public


Parameters:

int   $page   Page id
string   $name   Page name

[ Top ]

method testForUniqueName [line 665]

bool testForUniqueName( string $name, array $page_id_array)

Tests given box name for uniqueness. Takes the box name as first argument and an array consisting of page id and optional box id as second argument. If the box id is given, this box won't be considered when checking for uniqueness (useful for updates).

Returns boolean true if box name is unique.

Sample for $page_id_array():

  1.  $page_id_array array(
  2.      'page' => $page,
  3.      'id' => $id
  4.  );




Tags:

throws:  Content_BoxException
access:  public


Parameters:

string   $name   Box name
array   $page_id_array   Page id and box id

[ Top ]

method updateBox [line 118]

int updateBox( int $id, array $sqlData)

Updates box. Takes the box id as first argument, a field=>value array with the new box data as second argument.

Returns amount of affected rows.




Tags:

return:  Affected rows
throws:  Content_BoxException
access:  public


Parameters:

int   $id   Box id
array   $sqlData   Row data

[ Top ]


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