protected static function _sortByModDate($a, $b)
{
// Get notes` history
$history = $GLOBALS['injector']->getInstance('Horde_History');
$guidA = 'mnemo:' . $a['memolist_id'] . ':' . $a['uid'];
$guidB = 'mnemo:' . $b['memolist_id'] . ':' . $b['uid'];
// Gets the timestamp of the most recent modification to the note
$modDateA = $history->getActionTimestamp($guidA, 'modify');
$modDateB = $history->getActionTimestamp($guidB, 'modify');
// If the note hasn't been modified, get the creation timestamp
if ($modDateA == 0) {
$modDateA = $history->getActionTimestamp($guidA, 'add');
}
if ($modDateB == 0) {
$modDateB = $history->getActionTimestamp($guidB, 'add');
}
if ($modDateA == $modDateB) {
return 0;
}
return $modDateA > $modDateB ? 1 : -1;
}