Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
Smiley Class Reference

Public Member Functions

 getURL ($name=null)
 
 getImageTag ($tooltip=null)
 
 img ($name, $tooltip=null, $width=null, $height=null)
 
 store ()
 
 rename ($new_name)
 
 delete ()
 

Static Public Member Functions

static getFilename ($name)
 
static getById ($id)
 
static getByIds ($ids)
 
static getByName ($name)
 
static getByShort ($short)
 
static Remove ($id)
 
static getGrouped ($group= 'all', $mode=self::FETCH_ALL)
 
static getFirstUsedCharacter ()
 
static getUsedCharacters ()
 
static getShort ()
 
static getStatistics ()
 
static getUsage ()
 
static updateUsage ()
 
static refresh ($smiley_file=null)
 

Data Fields

const FETCH_ALL = 0
 
const FETCH_ID = 1
 
 $id = null
 
 $name = ''
 
 $width = 0
 
 $height = 0
 
 $short = ''
 
 $count = 0
 
 $short_count = 0
 
 $fav_count = 0
 
 $mkdate = null
 
 $chdate = null
 

Member Function Documentation

delete ( )

Deletes the smiley.

static getById (   $id)
static

Returns the smiley object with the given id. If no such object is available, an empty object is returned.

Parameters
int$idId of the smiley to load
Returns
Smiley Smiley object
static getByIds (   $ids)
static

Returns a collection smiley objects with the given ids.

Parameters
mixed$idsIds of the smileys to load, also accepts an atomic id
Returns
Array Array of Smiley objects
static getByName (   $name)
static

Returns the smiley object with the given name. If no such object is available, an empty object is returned

Parameters
String$nameName of the smiley to load
Returns
Smiley Smiley object
static getByShort (   $short)
static

Returns the smiley object with the given short notation. If no such object is available, an empty object is returned

Parameters
String$shortShort notation of the smiley to load
Returns
Smiley Smiley object
static getFilename (   $name)
static

Returns the absolute filename of a smiley.

Parameters
mixed$nameSmiley name, defaults to current smiley's name
Returns
String Absolute filename
static getFirstUsedCharacter ( )
static

Returns an ordered unique list of the first characters of all smileys.

Returns
Array Ordered list of all first characters
static getGrouped (   $group = 'all',
  $mode = self::FETCH_ALL 
)
static

Loads a given group from the database.

Parameters
String$groupGroup to load, defaults to 'all'
int$modeFetch mode
  • FETCH_ALL to return actual Smiley objects
  • FETCH_ID to return the group's items' ids
Returns
Array Either the objects or the ids of the group's items
getImageTag (   $tooltip = null)

Returns the HTML image tag of the smiley

Parameters
mixed$tooltipTooltip to display for this smiley, defaults to smiley's name
Returns
String HTML image tag
See Also
Smiley::img
static getShort ( )
static

Returns a list of all available short notations.

Returns
Array Associative list with short notation as key and smiley name as value
static getStatistics ( )
static

Returns some statistics about the smiley database.

Returns
Array 4 numbers: available, used, occurences and last change
getURL (   $name = null)

Returns the url of a smiley.

Parameters
mixed$nameSmiley name, defaults to current smiley's name
Returns
String URL
static getUsage ( )
static

Searches the database for occurences of smileys and returns a list of how often each smiley was used. If smiley favorites are activated, the list will include the number how often a smiley was favored.

Returns
Array Associative array with smiley name as key and according usage numbers as value
static getUsedCharacters ( )
static

Returns an associative list of the first characters of all smileys and their according quantity.

Returns
Array Associative list with character as key and quantity as value
img (   $name,
  $tooltip = null,
  $width = null,
  $height = null 
)

Returns the HTML image tag of any smiley.

Parameters
String$nameName of the smiley
mixed$tooltipTooltip to display for this smiley, defaults to smiley's name
mixed$widthWidth of the smiley
mixed$heightHeight of the smiley
Returns
String HTML image tag
static refresh (   $smiley_file = null)
static

Synchronizes the smileys' file system or an atomic file with the database. The smiley directory is scanned for new, changed or missing files. Any difference will change the database's record.

This method is also used for uploading new smileys. Provide an absolute filename of a smiley and it will either be imported into the database or the database will be adjusted to the current file's dimensions.

Parameters
mixed$smiley_fileIf no filename is provided, the whole file system is refreshed
Returns
Array Numbers: inserted, updated, removed (, favorites adjusted)
static Remove (   $id)
static

Removes a smiley or a collection of smileys from the database.

Parameters
mixed$idId(s) to delete, accepts either an atomic id or an array of ids
rename (   $new_name)

Renames the smiley to the given new name.

Parameters
String$new_nameNew name of the smiley
Returns
bool true if smiley was renamed successfully, false otherwise
store ( )

Stores the current smiley to database.

static updateUsage ( )
static

Refreshes the database with current usage numbers.

Returns
int Number of changed objects

Field Documentation

$chdate = null
$count = 0
$fav_count = 0
$height = 0
$id = null
$mkdate = null
$name = ''
$short = ''
$short_count = 0
$width = 0
const FETCH_ALL = 0
const FETCH_ID = 1

The documentation for this class was generated from the following file: