Documentation

Mnemo
in package

Mnemo Base Class.

Tags
author

Jon Parise jon@horde.org

Table of Contents

ERR_DECRYPT  = 101
Decrypting failed
ERR_NO_PASSPHRASE  = 100
No passphrase provided.
SORT_ASCEND  = 0
Sort in ascending order.
SORT_DESC  = 0
Sort by memo description.
SORT_DESCEND  = 1
Sort in descending order.
SORT_MOD_DATE  = 3
Sort by moddate
SORT_NOTEPAD  = 2
Sort by notepad.
countMemos()  : int
Returns the number of notes in notepads that the current user owns.
getDefaultNotepad()  : string
Returns the default notepad for the current user at the specified permissions level.
getLabel()  : string
Returns the label to be used for a notepad.
getMemo()  : array<string|int, mixed>
Retrieves a specific note from storage.
getNotePreview()  : string
Get preview text for a note (the first 20 lines or so).
getPassphrase()  : string
Returns a note's passphrase for symmetric encryption from the session cache.
getSyncNotepads()  : array<string|int, mixed>
Returns the notepads that should be used for syncing.
getUserName()  : string
Returns the real name, if available, of a user.
hasPermission()  : mixed
Returns the specified permission for the current user.
initialize()  : mixed
Initial app setup code.
listMemos()  : array<string|int, mixed>
Retrieves the current user's note list from storage. This function will also sort the resulting list, if requested.
listNotepads()  : array<string|int, mixed>
Lists all notepads a user has access to.
storePassphrase()  : bool
Stores a note's passphrase for symmetric encryption in the session cache.
_rsortByDesc()  : int
Comparison function for reverse sorting notes by description.
_rsortByModDate()  : int
Comparison function for reverse sorting notes by modification date.
_rsortByNotepad()  : int
Comparison function for reverse sorting notes by notepad name.
_sortByDesc()  : int
Comparison function for sorting notes by description.
_sortByModDate()  : int
Comparison function for sorting notes by modification date.
_sortByNotepad()  : int
Comparison function for sorting notes by notepad name.

Constants

ERR_DECRYPT

Decrypting failed

public mixed ERR_DECRYPT = 101

ERR_NO_PASSPHRASE

No passphrase provided.

public mixed ERR_NO_PASSPHRASE = 100

SORT_ASCEND

Sort in ascending order.

public mixed SORT_ASCEND = 0

SORT_DESC

Sort by memo description.

public mixed SORT_DESC = 0

SORT_DESCEND

Sort in descending order.

public mixed SORT_DESCEND = 1

SORT_MOD_DATE

Sort by moddate

public mixed SORT_MOD_DATE = 3

SORT_NOTEPAD

Sort by notepad.

public mixed SORT_NOTEPAD = 2

Methods

countMemos()

Returns the number of notes in notepads that the current user owns.

public static countMemos() : int
Return values
int

The number of notes that the user owns.

getDefaultNotepad()

Returns the default notepad for the current user at the specified permissions level.

public static getDefaultNotepad([int $permission = Horde_Perms::SHOW ]) : string
Parameters
$permission : int = Horde_Perms::SHOW

Horde_Perms constant for permission level required.

Return values
string

The notepad identifier, or null if none.

getLabel()

Returns the label to be used for a notepad.

public static getLabel(mixed $notepad) : string

Attaches the owner name of shared notepads if necessary.

Parameters
$notepad : mixed
Return values
string

The notepad's label.

getMemo()

Retrieves a specific note from storage.

public static getMemo(string $notepad, string $noteId[, string $passphrase = null ]) : array<string|int, mixed>
Parameters
$notepad : string

The notepad to retrieve the note from.

$noteId : string

The Id of the note to retrieve.

$passphrase : string = null

A passphrase with which this note was supposed to be encrypted.

Return values
array<string|int, mixed>

The note.

getNotePreview()

Get preview text for a note (the first 20 lines or so).

public static getNotePreview(array<string|int, mixed> $note) : string
Parameters
$note : array<string|int, mixed>

The note array

Return values
string

A few lines of the note for previews or tooltips.

getPassphrase()

Returns a note's passphrase for symmetric encryption from the session cache.

public static getPassphrase(string $id) : string
Parameters
$id : string

A note id.

Return values
string

The passphrase, if set.

getSyncNotepads()

Returns the notepads that should be used for syncing.

public static getSyncNotepads([bool $prune = false ]) : array<string|int, mixed>
Parameters
$prune : bool = false

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 values
array<string|int, mixed>

An array of notepad ids.

getUserName()

Returns the real name, if available, of a user.

public static getUserName(mixed $uid) : string
Parameters
$uid : mixed
Return values
string

The real name

hasPermission()

Returns the specified permission for the current user.

public static hasPermission(string $permission) : mixed
Parameters
$permission : string

A permission, currently only 'max_notes'.

Return values
mixed

The value of the specified permission.

initialize()

Initial app setup code.

public static initialize() : mixed

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

Return values
mixed

listMemos()

Retrieves the current user's note list from storage. This function will also sort the resulting list, if requested.

public static listMemos([constant $sortby = self::SORT_DESC ][, constant $sortdir = self::SORT_ASCEND ]) : array<string|int, mixed>
Parameters
$sortby : constant = self::SORT_DESC

The field by which to sort. (self::SORT_DESC, self::SORT_NOTEPAD, self::SORT_MOD_DATE)

$sortdir : constant = self::SORT_ASCEND

The direction by which to sort. (self::SORT_ASC, self::SORT_DESC)

Tags
see
Mnemo_Driver::listMemos()
Return values
array<string|int, mixed>

A list of the requested notes.

listNotepads()

Lists all notepads a user has access to.

public static listNotepads([bool $owneronly = false ][, int $permission = Horde_Perms::SHOW ]) : array<string|int, mixed>

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.

Parameters
$owneronly : bool = false

Only return memo lists that this user owns? Defaults to false.

$permission : int = Horde_Perms::SHOW

The permission to filter notepads by.

Return values
array<string|int, mixed>

The memo lists.

storePassphrase()

Stores a note's passphrase for symmetric encryption in the session cache.

public static storePassphrase(string $id, string $passphrase) : bool
Parameters
$id : string

A note id.

$passphrase : string

The note's passphrase.

Return values
bool

True

_rsortByDesc()

Comparison function for reverse sorting notes by description.

protected static _rsortByDesc(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

-1 if note one is greater, 1 if note two is greater; 0 if they are equal.

_rsortByModDate()

Comparison function for reverse sorting notes by modification date.

protected static _rsortByModDate(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

-1 if note one is greater, 1 if note two is greater, 0 if they are equal.

_rsortByNotepad()

Comparison function for reverse sorting notes by notepad name.

protected static _rsortByNotepad(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

-1 if note one is greater, 1 if note two is greater; 0 if they are equal.

_sortByDesc()

Comparison function for sorting notes by description.

protected static _sortByDesc(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

1 if memo one is greater, -1 if memo two is greater; 0 if they are equal.

_sortByModDate()

Comparison function for sorting notes by modification date.

protected static _sortByModDate(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

1 if note one is greater, -1 if note two is greater; 0 if they are equal.

_sortByNotepad()

Comparison function for sorting notes by notepad name.

protected static _sortByNotepad(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
$a : array<string|int, mixed>

Note one.

$b : array<string|int, mixed>

Note two.

Return values
int

1 if note one is greater, -1 if note two is greater; 0 if they are equal.

Search results