PHP Class Mnemo, horde

Author: Jon Parise ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

_rsortByModDate() protected static méthode

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.
Résultat integer -1 if note one is greater, 1 if note two is greater, 0 if they are equal.

_rsortByNotepad() protected static méthode

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.
Résultat integer -1 if note one is greater, 1 if note two is greater; 0 if they are equal.

_sortByDesc() protected static méthode

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

_sortByModDate() protected static méthode

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

_sortByNotepad() protected static méthode

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

countMemos() public static méthode

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

getDefaultNotepad() public static méthode

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.
Résultat string The notepad identifier, or null if none.

getLabel() public static méthode

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

getMemo() public static méthode

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.
Résultat array The note.

getNotePreview() public static méthode

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

getPassphrase() public static méthode

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

getSyncNotepads() public static méthode

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.
Résultat array An array of notepad ids.

getUserName() public static méthode

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

hasPermission() public static méthode

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

initialize() public static méthode

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

listMemos() public static méthode

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)
Résultat array A list of the requested notes.

listNotepads() public static méthode

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.
Résultat array The memo lists.

storePassphrase() public static méthode

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.
Résultat boolean True