* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Jon Parise <jon@horde.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Jan Schneider <jan@horde.org>
* @package Nag
*/
class Nag
*
* @return Nag_Task A list of the requested tasks.
*/
- function listTasks($sortby = null,
- $sortdir = null,
- $altsortby = null,
- $tasklists = null,
- $completed = null)
+ public static function listTasks($sortby = null,
+ $sortdir = null,
+ $altsortby = null,
+ $tasklists = null,
+ $completed = null)
{
global $prefs, $registry;
*
* @return array The task hash.
*/
- function getTask($tasklist, $task)
+ public static function getTask($tasklist, $task)
{
$storage = Nag_Driver::singleton($tasklist);
$task = $storage->get($task);
*
* @return integer The number of tasks that the user owns.
*/
- function countTasks()
+ public static function countTasks()
{
static $count;
if (isset($count)) {
*
* @return array The alarms (taskId) active on $date.
*/
- function listAlarms($date, $tasklists = null)
+ public static function listAlarms($date, $tasklists = null)
{
if (is_null($tasklists)) {
$tasklists = $GLOBALS['display_tasklists'];
*
* @return array The task lists.
*/
- function listTasklists($owneronly = false, $permission = Horde_Perms::SHOW)
+ public static function listTasklists($owneronly = false,
+ $permission = Horde_Perms::SHOW)
{
if ($owneronly && !Horde_Auth::getAuth()) {
return array();
*
* @return array The filtered data.
*/
- function permissionsFilter($in, $permission = Horde_Perms::READ)
+ public static function permissionsFilter($in, $permission = Horde_Perms::READ)
{
// FIXME: Must find a way to check individual tasklists for
// permission. Can't specify attributes as it does not check for the
* Returns the default tasklist for the current user at the specified
* permissions level.
*/
- function getDefaultTasklist($permission = Horde_Perms::SHOW)
+ public static function getDefaultTasklist($permission = Horde_Perms::SHOW)
{
global $prefs;
*
* @return Horde_Share The new share.
*/
- function addTasklist($info)
+ public static function addTasklist($info)
{
$tasklist = $GLOBALS['nag_shares']->newShare(md5(microtime()));
if (is_a($tasklist, 'PEAR_Error')) {
*
* @return string The HTML <select> widget.
*/
- function buildPriorityWidget($name, $selected = -1)
+ public static function buildPriorityWidget($name, $selected = -1)
{
$descs = array(1 => _("(highest)"), 5 => _("(lowest)"));
*
* @return string HTML for a checkbox representing the completion state.
*/
- function buildCheckboxWidget($name, $checked = 0)
+ public static function buildCheckboxWidget($name, $checked = 0)
{
$name = htmlspecialchars($name);
return "<input type=\"checkbox\" id=\"$name\" name=\"$name\"" .
*
* @return string The formatted due date string.
*/
- function formatDate($unixdate = '', $hours = true)
+ public static function formatDate($unixdate = '', $hours = true)
{
global $prefs;
*
* @return string The HTML representation of $completed.
*/
- function formatCompletion($completed)
+ public static function formatCompletion($completed)
{
return $completed ?
Horde::img('checked.png', _("Completed")) :
*
* @return string The HTML representation of $priority.
*/
- function formatPriority($priority)
+ public static function formatPriority($priority)
{
return '<span class="pri-' . (int)$priority . '">' . (int)$priority .
'</span>';
*
* @return string The formatted alarm string.
*/
- function formatAlarm($value)
+ public static function formatAlarm($value)
{
if ($value) {
if ($value % 10080 == 0) {
*
* @return string The formatted assignee name.
*/
- function formatAssignee($assignee, $link = false)
+ public static function formatAssignee($assignee, $link = false)
{
if (!strlen($assignee)) {
return '';
/**
* Initial app setup code.
*/
- function initialize()
+ public static function initialize()
{
/* Store the request timestamp if it's not already present. */
if (!isset($_SERVER['REQUEST_TIME'])) {
/**
* Build Nag's list of menu items.
*/
- function getMenu()
+ public static function getMenu()
{
global $conf, $registry;
return $menu;
}
- function status()
+ public static function status()
{
global $notification;
* @param Nag_Task $task The changed task.
* @param Nag_Task $old_task The original task if $action is "edit".
*/
- function sendNotification($action, $task, $old_task = null)
+ public static function sendNotification($action, $task, $old_task = null)
{
if (!in_array($action, array('add', 'edit', 'delete'))) {
return PEAR::raiseError('Unknown event action: ' . $action);
/**
* Returns the real name, if available, of a user.
*/
- function getUserName($uid)
+ public static function getUserName($uid)
{
static $names = array();
*
* @return boolean True if the user wants notifications for the tasklist.
*/
- function _notificationPref($user, $mode, $tasklist = null)
+ public static function _notificationPref($user, $mode, $tasklist = null)
{
$prefs = Horde_Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'nag', $user, '', null,
* 0 if they are equal (though no tasks should ever be
* equal in this comparison).
*/
- function _sortByIdentity($a, $b)
+ public static function _sortByIdentity($a, $b)
{
return strcmp($a->id, $b->id);
}
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByPriority($a, $b)
+ public static function _sortByPriority($a, $b)
{
if ($a->priority == $b->priority) {
return self::_sortByIdentity($a, $b);
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByPriority($a, $b)
+ public static function _rsortByPriority($a, $b)
{
if ($a->priority == $b->priority) {
return self::_sortByIdentity($b, $a);
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByName($a, $b)
+ public static function _sortByName($a, $b)
{
return strcasecmp($a->name, $b->name);
}
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByName($a, $b)
+ public static function _rsortByName($a, $b)
{
return strcasecmp($b->name, $a->name);
}
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByAssignee($a, $b)
+ public static function _sortByAssignee($a, $b)
{
return strcasecmp($a->assignee, $b->assignee);
}
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByAssignee($a, $b)
+ public static function _rsortByAssignee($a, $b)
{
return strcasecmp($b->assignee, $a->assignee);
}
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByEstimate($a, $b)
+ public static function _sortByEstimate($a, $b)
{
$a_est = $a->estimation();
$b_est = $b->estimation();
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByEstimate($a, $b)
+ public static function _rsortByEstimate($a, $b)
{
$a_est = $a->estimation();
$b_est = $b->estimation();
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByCategory($a, $b)
+ public static function _sortByCategory($a, $b)
{
return strcasecmp($a->category ? $a->category : _("Unfiled"),
$b->category ? $b->category : _("Unfiled"));
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByCategory($a, $b)
+ public static function _rsortByCategory($a, $b)
{
return strcasecmp($b->category ? $b->category : _("Unfiled"),
$a->category ? $a->category : _("Unfiled"));
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByDue($a, $b)
+ public static function _sortByDue($a, $b)
{
if ($a->due == $b->due) {
return self::_sortByIdentity($a, $b);
* @return integer -1 if task one is greater, 1 if task two is greater,
* 0 if they are equal.
*/
- function _rsortByDue($a, $b)
+ public static function _rsortByDue($a, $b)
{
if ($a->due == $b->due) {
return self::_sortByIdentity($b, $a);
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByCompletion($a, $b)
+ public static function _sortByCompletion($a, $b)
{
if ($a->completed == $b->completed) {
return self::_sortByIdentity($a, $b);
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByCompletion($a, $b)
+ public static function _rsortByCompletion($a, $b)
{
if ($a->completed == $b->completed) {
return self::_sortByIdentity($b, $a);
* @return integer 1 if task one is greater, -1 if task two is greater;
* 0 if they are equal.
*/
- function _sortByOwner($a, $b)
+ public static function _sortByOwner($a, $b)
{
$ashare = $GLOBALS['nag_shares']->getShare($a->tasklist);
$bshare = $GLOBALS['nag_shares']->getShare($b->tasklist);
* @return integer -1 if task one is greater, 1 if task two is greater;
* 0 if they are equal.
*/
- function _rsortByOwner($a, $b)
+ public static function _rsortByOwner($a, $b)
{
$ashare = $GLOBALS['nag_shares']->getShare($a->tasklist);
$bshare = $GLOBALS['nag_shares']->getShare($b->tasklist);