PHP Class Mnemo, horde

Author: Jon Parise ([email protected])
Datei anzeigen Open project: horde/horde Class Usage Examples

Public Methods

Method Description
countMemos ( ) : integer Returns the number of notes in notepads that the current user owns.
getDefaultNotepad ( integer $permission = Horde_Perms::SHOW ) : string Returns the default notepad for the current user at the specified permissions level.
getLabel ( $notepad ) : string Returns the label to be used for a notepad.
getMemo ( string $notepad, string $noteId, string $passphrase = null ) : array Retrieves a specific note from storage.
getNotePreview ( array $note ) : string Get preview text for a note (the first 20 lines or so).
getPassphrase ( string $id ) : string Returns a note's passphrase for symmetric encryption from the session cache.
getSyncNotepads ( boolean $prune = false ) : array Returns the notepads that should be used for syncing.
getUserName ( $uid ) : string Returns the real name, if available, of a user.
hasPermission ( string $permission ) : mixed Returns the specified permission for the current user.
initialize ( ) Initial app setup code.
listMemos ( constant $sortby = self::SORT_DESC, constant $sortdir = self::SORT_ASCEND ) : array Retrieves the current user's note list from storage. This function will also sort the resulting list, if requested.
listNotepads ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW ) : array Lists all notepads a user has access to.
storePassphrase ( string $id, string $passphrase ) : boolean Stores a note's passphrase for symmetric encryption in the session cache.

Protected Methods

Method Description
_rsortByDesc ( array $a, array $b ) : integer Comparison function for reverse sorting notes by description.
_rsortByModDate ( array $a, array $b ) : integer Comparison function for reverse sorting notes by modification date.
_rsortByNotepad ( array $a, array $b ) : integer Comparison function for reverse sorting notes by notepad name.
_sortByDesc ( array $a, array $b ) : integer Comparison function for sorting notes by description.
_sortByModDate ( array $a, array $b ) : integer Comparison function for sorting notes by modification date.
_sortByNotepad ( array $a, array $b ) : integer Comparison function for sorting notes by notepad name.

Method Details

_rsortByDesc() protected static method

Comparison function for reverse sorting notes by description.
protected static _rsortByDesc ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer -1 if note one is greater, 1 if note two is greater; 0 if they are equal.

_rsortByModDate() protected static method

Comparison function for reverse sorting notes by modification date.
protected static _rsortByModDate ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer -1 if note one is greater, 1 if note two is greater, 0 if they are equal.

_rsortByNotepad() protected static method

Comparison function for reverse sorting notes by notepad name.
protected static _rsortByNotepad ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer -1 if note one is greater, 1 if note two is greater; 0 if they are equal.

_sortByDesc() protected static method

Comparison function for sorting notes by description.
protected static _sortByDesc ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer 1 if memo one is greater, -1 if memo two is greater; 0 if they are equal.

_sortByModDate() protected static method

Comparison function for sorting notes by modification date.
protected static _sortByModDate ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer 1 if note one is greater, -1 if note two is greater; 0 if they are equal.

_sortByNotepad() protected static method

Comparison function for sorting notes by notepad name.
protected static _sortByNotepad ( array $a, array $b ) : integer
$a array Note one.
$b array Note two.
return integer 1 if note one is greater, -1 if note two is greater; 0 if they are equal.

countMemos() public static method

Returns the number of notes in notepads that the current user owns.
public static countMemos ( ) : integer
return integer The number of notes that the user owns.

getDefaultNotepad() public static method

Returns the default notepad for the current user at the specified permissions level.
public static getDefaultNotepad ( integer $permission = Horde_Perms::SHOW ) : string
$permission integer Horde_Perms constant for permission level required.
return string The notepad identifier, or null if none.

getLabel() public static method

Attaches the owner name of shared notepads if necessary.
public static getLabel ( $notepad ) : string
return string The notepad's label.

getMemo() public static method

Retrieves a specific note from storage.
public static getMemo ( string $notepad, string $noteId, string $passphrase = null ) : array
$notepad string The notepad to retrieve the note from.
$noteId string The Id of the note to retrieve.
$passphrase string A passphrase with which this note was supposed to be encrypted.
return array The note.

getNotePreview() public static method

Get preview text for a note (the first 20 lines or so).
public static getNotePreview ( array $note ) : string
$note array The note array
return string A few lines of the note for previews or tooltips.

getPassphrase() public static method

Returns a note's passphrase for symmetric encryption from the session cache.
public static getPassphrase ( string $id ) : string
$id string A note id.
return string The passphrase, if set.

getSyncNotepads() public static method

Returns the notepads that should be used for syncing.
public static getSyncNotepads ( boolean $prune = false ) : array
$prune boolean Remove notepads ids from the sync list that no longer exist. The values are pruned *after* the results are passed back to the client to give sync clients a chance to remove their entries.
return array An array of notepad ids.

getUserName() public static method

Returns the real name, if available, of a user.
public static getUserName ( $uid ) : string
return string The real name

hasPermission() public static method

Returns the specified permission for the current user.
public static hasPermission ( string $permission ) : mixed
$permission string A permission, currently only 'max_notes'.
return mixed The value of the specified permission.

initialize() public static method

Defines the following $GLOBALS (@TODO these should use the injector) mnemo_shares display_notepads
public static initialize ( )

listMemos() public static method

Retrieves the current user's note list from storage. This function will also sort the resulting list, if requested.
See also: Mnemo_Driver::listMemos()
public static listMemos ( constant $sortby = self::SORT_DESC, constant $sortdir = self::SORT_ASCEND ) : array
$sortby constant The field by which to sort. (self::SORT_DESC, self::SORT_NOTEPAD, self::SORT_MOD_DATE)
$sortdir constant The direction by which to sort. (self::SORT_ASC, self::SORT_DESC)
return array A list of the requested notes.

listNotepads() public static method

This method takes the $conf['share']['hidden'] setting into account. If this setting is enabled, even if requesting permissions different than SHOW, it will only return calendars that the user owns or has SHOW permissions for. For checking individual calendar's permissions, use hasPermission() instead.
public static listNotepads ( boolean $owneronly = false, integer $permission = Horde_Perms::SHOW ) : array
$owneronly boolean Only return memo lists that this user owns? Defaults to false.
$permission integer The permission to filter notepads by.
return array The memo lists.

storePassphrase() public static method

Stores a note's passphrase for symmetric encryption in the session cache.
public static storePassphrase ( string $id, string $passphrase ) : boolean
$id string A note id.
$passphrase string The note's passphrase.
return boolean True