Skip Navigation

UNL_UCBCN API Documentation

Developers, developers, developers, devel…

Class UNL_UCBCN

Description

The backend system object for the UNL UCBCN calendar system.

This object is the master object through which most calendar system interactions take place.

Located in /UNL/UCBCN.php (line 44)


	
			
Direct descendents
Class Description
UNL_UCBCN_EventInstance Generic object to hold a single event, and a single event date time.
Variable Summary
static UNL_UCBCN_CachingService $cache
static mixed $input_filters
static mixed $output_filters
string $dsn
string $template
Method Summary
static void addInputFilter (UNL_UCBCN_Filter $filter)
static void addOutputFilter (UNL_UCBCN_Filter $filter)
static void displayArray ( $array, [ $return = false])
static void displayObject ( $object, [ $return = false])
static void displayRegion ( $mixed, [bool $return = false], mixed $content)
static mixed factory (string $table)
static void getCachingService ()
static string getTemplateFilename (string $cname)
static string outputTemplate (string $cname, [string $templatename = null])
static void sendObjectOutput ( $object, [ $return = false], mixed $content)
static void setCachingService ( $cache)
UNL_UCBCN __construct ([array $options = array('dsn'=>'@DSN@', 'template_path'=>'')])
object UNL_UCBCN_Account_has_event addCalendarHasEvent (UNL_UCBCN_Calendar $calendar, UNL_UCBCN_Event $event, string $status, UNL_UCBCN_User $user, [string $source = null])
num archiveEvents ([UNL_UCBCN_Calendar $cal = null])
bool|object false calendarHasEvent (UNL_UCBCN_Calendar $calendar, UNL_UCBCN_Event $event)
bool cleanCache ([ $object = null], mixed $o)
mixed createAccount ([array $values = array()])
mixed createCalendar ([array $values = array()])
true createUser (UNL_UCBCN_Account $account, string $uid, [string $uidcreated = null])
object on dbInsert (string $table, array $values)
string getAbsoluteURL (string $url)
UNL_UCBCN_Calendar getCalendar (UNL_UCBCN_User $user, UNL_UCBCN_Account $account, [bool $return_false = true], [string $redirecturl = null])
object MDB2_Driver getDatabaseConnection ()
int getEventCount (UNL_UCBCN_Calendar $calendar, [string $status = 'posted'])
URL getURL ()
UNL_UCBCN_User getUser (string $uid)
mixed grantPermission (string $uid, int $calendar_id, int $permission_id)
void localRedirect (string $url, [bool $keepProtocol = true])
void setOptions (array $options)
void setupDBConn ()
void showError (string $description)
bool userHasPermission (UNL_UCBCN_User $user, string $permission_name, UNL_UCBCN_Calendar $calendar)
Variables
static UNL_UCBCN_CachingService $cache (line 83)

Cache object for output caching

  • access: protected
static mixed $input_filters = array() (line 71)

input filters

  • access: protected
static mixed $output_filters = array() (line 76)

output filters

  • access: protected
int $default_calendar_id = 1 (line 66)

Default calendar to use throughout the system.

  • access: public
string $dsn (line 61)

A string containing connection details in the format

dbtype://user:pass@www.example.com:port/database

  • access: public
string $template (line 50)

The template chosen to display in, defaults to default.

  • access: public
string $template_path (line 55)

The filesystem path to the templates.

  • access: public
Methods
static method addInputFilter (line 159)

adds an input filter to this controller, the filter will be called whenever input is processed

  • access: public
static void addInputFilter (UNL_UCBCN_Filter $filter)
static method addOutputFilter (line 169)

adds an output filter to this controller, the filter will be called whenever output is sent

  • access: public
static void addOutputFilter (UNL_UCBCN_Filter $filter)
static method displayArray (line 330)
static void displayArray ( $array, [ $return = false])
  • $array
  • $return
static method displayObject (line 348)
static void displayObject ( $object, [ $return = false])
  • $object
  • $return
static method displayRegion (line 312)

The heart of the template/display portions of this system.

A simple function which renders the given content using a savant formatted template based on the type of the object. IE: strings and ints get echoed objects use a corresponding savant template, arrays get rendered one by one

For caching support the object being outputted must implement three methods: getCacheKey() Return a unique string for the object/output. preRun(bool $cache_hit) Function which will be called before run (implement cache hit recording here and header() output) run() This function must populate the object and get it prepped for output.

  • access: public
static void displayRegion ( $mixed, [bool $return = false], mixed $content)
  • mixed $content: The content to send out.
  • bool $return: Whether to output or return the content.
  • $mixed
static method factory (line 199)

This function allows extended classes etc to get a DB DataObject for the event table they need access to.

  • return: A object for the database table requested.
  • access: public
static mixed factory (string $table)
  • string $table: The name of the table in the database to receive a DataObject for.
static method getCachingService (line 792)
  • access: public
static void getCachingService ()
static method getTemplateFilename (line 691)

This function takes in a class name and returns the correct template for the object.

  • return: Filename of the output template to use for the given class.
  • access: public
static string getTemplateFilename (string $cname)
  • string $cname: the name of the class to get the template for
static method outputTemplate (line 725)

Gets or sets the output template for a given class.

  • access: public
static string outputTemplate (string $cname, [string $templatename = null])
  • string $cname: Name of the class to set/get template for.
  • string $templatename: Name of the template to use.
static method sendObjectOutput (line 404)

Prepares an object for output, and displays it with a corresponding template.

This function is an output controller, which takes public member variables from an object and populates a Savant template with equivalent member variables.

  • access: protected
static void sendObjectOutput ( $object, [ $return = false], mixed $content)
  • mixed $content: Object with content to send out.
  • $object
  • $return
static method setCachingService (line 787)
  • access: public
static void setCachingService ( $cache)
  • UNL_UCBCN_CachingService $cache
Constructor __construct (line 91)

Constructor for the UCBCN object, initializes member variables and sets up connection details for the database.

  • access: public
UNL_UCBCN __construct ([array $options = array('dsn'=>'@DSN@', 'template_path'=>'')])
  • array $options: Associative array of options to set for the class.

Redefined in descendants as:
addCalendarHasEvent (line 487)

Adds an event to a calendar.

  • access: public
object UNL_UCBCN_Account_has_event addCalendarHasEvent (UNL_UCBCN_Calendar $calendar, UNL_UCBCN_Event $event, string $status, UNL_UCBCN_User $user, [string $source = null])
  • UNL_UCBCN_Calendar $calendar: UNL_UCBCN_Calendar object.
  • UNL_UCBCN_Event $event: The event to add to the calendar.
  • string $status: [pending|posted|archived]
  • UNL_UCBCN_User $user: User adding this event to a calendar.
  • string $source: Where is this coming from?
archiveEvents (line 757)

This function changes the status for events in the past to 'archived.'

  • return: of affected rows or mdb2 error object
  • access: public
num archiveEvents ([UNL_UCBCN_Calendar $cal = null])
calendarHasEvent (line 501)

Checks whether a calendar has an event or not.

  • return: on error, object on success.
  • access: public
bool|object false calendarHasEvent (UNL_UCBCN_Calendar $calendar, UNL_UCBCN_Event $event)
cleanCache (line 782)

Cleans the cache.

  • return: true if cache was successfully cleared.
  • access: public
bool cleanCache ([ $object = null], mixed $o)
  • mixed $o: Pass a cached object to clean it's cache, or a string id.
  • $object
createAccount (line 466)

This function creates a calendar account.

  • return: ID on success false on error.
  • access: public
mixed createAccount ([array $values = array()])
  • array $values: assoc array of field values for the account.
createCalendar (line 637)

This function creates a calendar for an account.

  • return: int ID of calendar record on success false on error.
  • access: public
mixed createCalendar ([array $values = array()])
  • array $values: assoc array of field values for the calendar.
createUser (line 213)

creates a new user record and returns it.

  • return: or inserted id on success
  • access: public
true createUser (UNL_UCBCN_Account $account, string $uid, [string $uidcreated = null])
  • UNL_UCBCN_Account $account: The account to add this user under.
  • string $uid: Unique id of the user to create
  • string $uidcreated: UID of the user who created this user.
dbInsert (line 235)

This function is a general insert function, given the table name and an assoc array of values, it will return the inserted record.

  • return: success, failed return value on failure.
  • access: public
object on dbInsert (string $table, array $values)
  • string $table: Name of the table
  • array $values: assoc array of values to insert.
getAbsoluteURL (line 676)

Returns an absolute URL using Net_URL

  • return: Full url
  • access: public
string getAbsoluteURL (string $url)
  • string $url: All/part of a url
getAccount (line 556)

Gets the account record(s) for the user

  • return: on success UNL_UCBCN_Error on error.
  • access: public
getCalendar (line 585)

Gets the calendar(s) for the given account that the given user has permission to. Optionally the user can be redirected on creation of a new calendar.

  • return: object on success false if no calendar exists and $return_false paramter was passed as true.
  • access: public
UNL_UCBCN_Calendar getCalendar (UNL_UCBCN_User $user, UNL_UCBCN_Account $account, [bool $return_false = true], [string $redirecturl = null])
  • UNL_UCBCN_User $user: User to get the calendar for
  • UNL_UCBCN_Account $account: Account to get calendar for.
  • bool $return_false: If true, will return false if no account exists, if false it invokes createCalendar.
  • string $redirecturl: A url to redirect on creation of a new record. If set the user will be redirected, otherwise the account will be returned.
getDatabaseConnection (line 707)

Gets an MDB2 connection object and returns it.

  • return: object on success, UNL_UCBCN_Error on error.
  • access: public
object MDB2_Driver getDatabaseConnection ()
getEventCount (line 182)

This function gets the count of events for the given status.

  • return: count
  • access: public
int getEventCount (UNL_UCBCN_Calendar $calendar, [string $status = 'posted'])
  • UNL_UCBCN_Calendar $calendar: Calendar to check.
  • string $status: [pending|posted|archived]
getURL (line 739)

Returns the URL for the calendar system.

  • return: to this instance.
  • access: public
URL getURL ()

Redefined in descendants as:
getUser (line 523)

This function returns a object for the user with the given uid.

If a record does not exist, one is inserted then returned.

  • access: public
UNL_UCBCN_User getUser (string $uid)
  • string $uid: The unique user identifier to get object for (username).
grantPermission (line 449)

This function adds the given permission for the user.

  • return: ID on success false on error.
  • access: public
mixed grantPermission (string $uid, int $calendar_id, int $permission_id)
  • string $uid: Username to add permission for.
  • int $calendar_id: ID of the calendar to add permission for.
  • int $permission_id: Permission id you wish to add for the person.
localRedirect (line 659)

Redirects to the given full or partial URL.

will turn the given url into an absolute url using the above getURL() function. This function does not return.

  • access: public
void localRedirect (string $url, [bool $keepProtocol = true])
  • string $url: Full/partial url to redirect to
  • bool $keepProtocol: Keep the https protocol or to force HTTP?
setOptions (line 126)

This function sets parameters for this class.

  • access: public
void setOptions (array $options)
  • array $options: an associative array of options to set.
setupDBConn (line 104)

This function initializes the information used by the database connections.

  • access: public
void setupDBConn ()
showError (line 285)

Simple function which displays the error to the end user.

  • access: public
void showError (string $description)
  • string $description: Description of the error.
userCanEditEvent (line 814)

This function determines if a user can edit the details of a specific event.

Permission relies on a couple requirements: User has 'Event Edit' rights over the calendar the event was originally created under, OR the event was 'recommended for the default calendar', and this user has permission over the default calendar.

  • return: true or false
  • access: public
bool userCanEditEvent (UNL_UCBCN_User $user, UNL_UCBCN_Event $event)
userHasPermission (line 261)

Checks if a user has a given permission over the account.

  • return: true or false
  • access: public
bool userHasPermission (UNL_UCBCN_User $user, string $permission_name, UNL_UCBCN_Calendar $calendar)

Documentation generated on Wed, 12 Aug 2009 13:00:43 -0500 by phpDocumentor 1.4.2