Overview

Packages

  • Agora
  • None

Classes

  • Agora
  • Agora_Api
  • Agora_Driver
  • Agora_Driver_SplitSql
  • Agora_Driver_Sql
  • Agora_Exception
  • Agora_Factory_Driver
  • Agora_Form_Forum
  • Agora_Form_Message
  • Agora_Form_Search
  • Agora_View
  • Horde_Form_Renderer_MessageForm
  • Overview
  • Package
  • Class
  • Tree

Class Agora_Api

Agora external API interface.

This file defines Agora's external API interface. Other applications can interact with Agora through this API.

Copyright 2003-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Horde_Registry_Api
Extended by Agora_Api
Package: Agora
Author: Marko Djukic marko@oblo.com
Author: Duck duck@obala.net
Located at Api.php
Methods summary
public array
# listForums( integer $forum_id = 0, string $scope = null )

Get back a list of available forums.

Get back a list of available forums.

Parameters

$forum_id
<p>Supplying this parameter will return a list of child forums of the requested forum id.</p>
$scope
If set, limit the forums to requested application.

Returns

array
The list of available forums.
public mixed
# getForumName( string $scope, integer $forum_id )

Retrieve the name of a forum

Retrieve the name of a forum

Parameters

$scope
Scope which form belongs to
$forum_id
The forum id to fetch the name for.

Returns

mixed
The forum name | Pear_Error
public
# saveForum( string $scope, string $parent, array $info )

Create or modify an agora forum. This is used for apps to create forums for their own use. They will not show up in the regular agora forum view since they will be using a datatree group 'agora.forums.'.

Create or modify an agora forum. This is used for apps to create forums for their own use. They will not show up in the regular agora forum view since they will be using a datatree group 'agora.forums.'.

Parameters

$scope
The Horde application that is saving this forum.
$parent
The parent forum.
$info
The forum information to save
public boolean
# deleteForum( string $scope, string $forum_name )

Allow other applications to delete forums. Used when an object that has been commented on has been deleted.

Allow other applications to delete forums. Used when an object that has been commented on has been deleted.

Parameters

$scope
The Horde application that the forum belongs to.
$forum_name
The unique forum name to delete.

Returns

boolean
True on success.
public array
# getThreads( string $forum_name, boolean $sort_by = 'message_timestamp', string $sort_dir = 0, integer $bodies = false, string $scope = 'agora', string $base_url = null, string $from = 0, string $count = 0 )

Returns all messages of a forum, in a threaded order.

Returns all messages of a forum, in a threaded order.

Parameters

$forum_name
The unique name for the forum.
$sort_by
$bodies Whether to include message bodies in the view.
$sort_dir
$sort_by Return messages sorted by this property.
$bodies
<p>$sort_dir The direction by which to sort: 0 - ascending 1 - descending</p>
$scope
<p>The application that the specified forum belongs to.</p>
$base_url
<p>An alternate link where edit/delete/reply links point to.</p>
$from
The thread to begin listing at.
$count
The number of threads to return.

Returns

array
All messages of the specified forum.
public array
# getThreadsBatch( array $forum_names, boolean $sort_by = 'message_timestamp', string $sort_dir = 0, integer $bodies = false, string $scope = 'agora', string $base_url = null, string $from = 0, string $count = 0 )

Returns all messages for the forums requested, in a threaded order.

Returns all messages for the forums requested, in a threaded order.

Parameters

$forum_names
An array of unique forum names.
$sort_by
$bodies Whether to include message bodies in the view.
$sort_dir
$sort_by Return messages sorted by this property.
$bodies
<p>$sort_dir The direction by which to sort: 0 - ascending 1 - descending</p>
$scope
<p>The application that the specified forum belongs to.</p>
$base_url
<p>An alternate link where edit/delete/reply links point to.</p>
$from
The thread to begin listing at.
$count
The number of threads to return.

Returns

array
An array of message arrays of the specified forum.
public array
# getThreadsByForumOwner( string $owner, boolean $sort_by = 'message_timestamp', string $sort_dir = 0, integer $bodies = false, string $scope = 'agora', string $from = 0, string $count = 0 )

Returns all messages of a forum, in a threaded order.

Returns all messages of a forum, in a threaded order.

Parameters

$owner
$forum_owner Forum owner
$sort_by
$bodies Whether to include message bodies in the view.
$sort_dir
$sort_by Return messages sorted by this property.
$bodies
<p>$sort_dir The direction by which to sort: 0 - ascending 1 - descending</p>
$scope
<p>The application that the specified forum belongs to.</p>
$from
The thread to begin listing at.
$count
The number of threads to return.

Returns

array
All messages of the specified forum.
public integer
# numMessages( string $forum_name, string $scope = 'agora', integer $thread_id = null )

Returns the number of messages in a forum.

Returns the number of messages in a forum.

Parameters

$forum_name
The unique name for the forum.
$scope
<p>The application that the specified forum belongs to.</p>
$thread_id
<p>The thread to count, if not supplied it will count all messages</p>

Returns

integer
The number of messages in the specified forum.
public mixed
# numMessagesBatch( array $forum_name, string $scope = 'agora', integer $thread_id = null )

Returns the number of messages for the requested forums. All requested forums must belong to the same scope.

Returns the number of messages for the requested forums. All requested forums must belong to the same scope.

Parameters

$forum_name
An array of unique forum names.
$scope
<p>The application that the specified forum belongs to.</p>
$thread_id
<p>The thread to count, if not supplied it will count all messages</p>

Returns

mixed

An array containing the message counts with the forum name as the key | PEAR_Error

public string
# renderThreads( string $forum_name, boolean $bodies = false, string $scope = 'agora', string $base_url = null, string $template_file = false )

Returns all threads of a forum in a threaded view.

Returns all threads of a forum in a threaded view.

Parameters

$forum_name
The unique name for the forum.
$bodies
Whether to include message bodies in the view.
$scope
The application that the specified forum belongs to.
$base_url
<p>An alternate link where edit/delete/reply links point to.</p>
$template_file
Template file to use.

Returns

string
The HTML code of the thread view.
public mixed
# addMessage( string $scope, string $forum_name, string $callback, array $params = array() )

Allows other Horde apps to add/edit messages.

Allows other Horde apps to add/edit messages.

The forum name is constructed by just the $forum_name variable under the data root 'agora.forums.'. It is up to the apps themselves to make sure that the forum name is unique.

If the forum does not exist, it will be automatically created by Agora.

Parameters

$scope
The application which is posting this message.
$forum_name
The unique name for the forum.
$callback
<p>A callback method of the specified application that gets called to make sure that posting to this forum is allowed.</p>
$params
Any parameters for the forum message posting. <pre>message_id - An existing message to edit message_parent_id - The ID of the parent message message_body - Message body</pre>

Returns

mixed

Returns message id if the message was posted or PEAR_Error object on error

public mixed
# postMessage( string $scope, string $forum_name, string $callback, array $params = array(), string $url = null, array $variables = null )

Allows other Horde apps to post messages.

Allows other Horde apps to post messages.

The forum name is constructed by just the $forum_name variable under the data root 'agora.forums.'. It is up to the apps themselves to make sure that the forum name is unique.

If the forum does not exist, it will be automatically created by Agora.

Parameters

$scope
The application which is posting this message.
$forum_name
The unique name for the forum.
$callback
<p>A callback method of the specified application that gets called to make sure that posting to this forum is allowed.</p>
$params
Any parameters for the forum message posting. <pre>message_id - An existing message to edit message_parent_id - The ID of the parent message title - Posting title</pre>
$url
<p>If specified, the form gets submitted to this URL instead of the current page.</p>
$variables
<p>A hash with all variables of a submitted form generated by this method.</p>

Returns

mixed

Returns either the rendered Horde_Form for posting a message or PEAR_Error object on error, or true in case of a successful post.

public mixed
# removeMessage( string $scope, string $forum_name, string $callback, array $params = array(), array $variables = null )

Allows other Horde apps to remove messages.

Allows other Horde apps to remove messages.

The forum name is constructed by just the $forum_name variable under the data root 'agora.forums.'. It is up to the apps themselves to make sure that the forum name is unique.

Parameters

$scope
The application which is posting this message.
$forum_name
The unique name for the forum.
$callback
<p>A callback method of the specified application that gets called to make sure that posting to this forum is allowed.</p>
$params
Any parameters for the forum message posting. message_id - An existing message to <span class="php-keyword2">delete</span>
$variables
<p>A hash with all variables of a submitted form generated by this method.</p>

Returns

mixed

Returns either the rendered Horde_Form for posting a message or PEAR_Error object on error, or true in case of a successful post.

public mixed
# doComments( string $scope, string $key, string $callback, boolean $bodies = true, string $base_url = null, string $url = null, array $variables = null, string $template_file = false )

Allows other Horde apps to post messages.

Allows other Horde apps to post messages.

In most apps we use the same code to make comments possible. This function does most of that. Allow comments to be added to any app. The app itself should check if the agora api is present, determine a key and call this function before app::menu is called (before any output has started. At the end of its output it can print the array returned to show the comments.

Parameters

$scope
The application which is posting this message.
$key
<p>Unique key from the object (picture etc we're viewing. It will be used as the forum name.</p>
$callback
<p>A callback method of the specified application that gets called to make sure that posting to this forum is allowed.</p>
$bodies
<p>$body Show the comment bodies in the thread view or not.</p>
$base_url
<p>Base URL the edit/delete/reply links should point to.</p>
$url
<p>If specified, the form gets submitted to this URL instead of the current page.</p>
$variables
<p>A hash with all variables of a submitted form generated by this method.</p>
$template_file
Template file to use.

Returns

mixed

array Returns either the rendered Horde_Form for comments and threads for posting/viewing a message or PEAR objects on error.

public
# prepareFormData( string $scope, string $parent = false, array $info = array(), string $callback = null )

Fill up a form data array.

Fill up a form data array.

Parameters

$scope
The Horde application that is saving this forum.
$parent
The parent forum.
$info
<p>The forum information to consisting of: forum_parent_id forum_name forum_description forum_moderated forum_attachments</p>
$callback
<p>A callback method of the specified application that gets called to make sure that posting to this forum is allowed.</p>
public
# moderateForm( string $scope )

Prepare the moderate form

Prepare the moderate form

Parameters

$scope
The Horde application that is saving this forum.
API documentation generated by ApiGen