Overview

Packages

  • Jonah
  • None

Classes

  • Jonah
  • Jonah_Api
  • Jonah_Block_Latest
  • Jonah_Driver
  • Jonah_Driver_Sql
  • Jonah_Exception
  • Jonah_Factory_Driver
  • Jonah_Form_Feed
  • Jonah_Form_Story
  • Jonah_Test
  • Jonah_View_ChannelDelete
  • Jonah_View_ChannelEdit
  • Jonah_View_ChannelList
  • Jonah_View_StoryDelete
  • Jonah_View_StoryEdit
  • Jonah_View_StoryList
  • Jonah_View_StoryPdf
  • Jonah_View_StoryView
  • Jonah_View_TagSearchList
  • Overview
  • Package
  • Class
  • Tree

Class Jonah_Driver_Sql

Jonah storage implementation for PHP's PEAR database abstraction layer.

The table structure can be created by the scripts/db/jonah_news.sql script. The needed tables are jonah_channels and jonah_stories.

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

See the enclosed file LICENSE for license information (BSD). If you did not did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.

Jonah_Driver
Extended by Jonah_Driver_Sql
Package: Jonah
Author: Marko Djukic marko@oblo.com
Author: Chuck Hagenbuch chuck@horde.org
Author: Jan Schneider jan@horde.org
Author: Ben Klang ben@alkaloid.net
Author: Michael J. Rubinsky mrubinsk@horde.org
Located at Driver/Sql.php
Methods summary
public
# __construct( array $params = array() )

Constructs a new Driver storage object.

Constructs a new Driver storage object.

Parameters

$params
A hash containing connection parameters.

Overrides

Jonah_Driver::__construct()
public integer
# saveChannel( array & $info )

Saves a channel to the backend.

Saves a channel to the backend.

Parameters

$info
<p>The channel to add. Must contain a combination of the following entries:</p> <pre><span class="php-quote">'channel_id'</span> <span class="php-keyword1">If</span> <span class="php-keyword1">empty</span> a <span class="php-keyword1">new</span> channel is being added, otherwise one is being edited. <span class="php-quote">'channel_slug'</span> The channel slug. <span class="php-quote">'channel_name'</span> The headline. <span class="php-quote">'channel_desc'</span> A description of this channel. <span class="php-quote">'channel_type'</span> Whether internal <span class="php-keyword1">or</span> external. <span class="php-quote">'channel_interval'</span> <span class="php-keyword1">If</span> external then interval at which to refresh. <span class="php-quote">'channel_link'</span> The <span class="php-keyword2">link</span> to the source. <span class="php-quote">'channel_url'</span> The url from where to fetch the story <span class="php-keyword1">list</span>. <span class="php-quote">'channel_image'</span> A channel image.</pre>

Returns

integer
The channel ID.

Throws

Jonah_Exception
public mixed
# getChannels( )

Get a list of stored channels.

Get a list of stored channels.

Returns

mixed
An array of channels.

Throws

Jonah_Exception
public integer
# getChannelId( string $channel )

Look up a channel ID by its name

Look up a channel ID by its name

Parameters

$channel

Returns

integer
Channel ID
public integer
# getStoryCount( integer $channel_id )

Returns the total number of stories in the specified channel.

Returns the total number of stories in the specified channel.

Parameters

$channel_id
The Channel Id

Returns

integer
The count
public integer
# getLatestStoryId( integer $channel_id )

Gets the latest released story from a given internal channel

Gets the latest released story from a given internal channel

Parameters

$channel_id
The channel id.

Returns

integer
The story id.

Throws

Jonah_Exception
Horde_Exception_NotFound
public
# deleteStory( mixed $channel_id, mixed $story_id )
public boolean
# writeTags( integer $resource_id, integer $channel_id, array $tags )

Write out the tags for a specific resource.

Write out the tags for a specific resource.

Parameters

$resource_id
The story we are tagging.
$channel_id
The channel id for the story we are tagging
$tags
An array of tags.

Returns

boolean

Throws

Jonah_Exception

Todo:

Move this to a tagger class that uses Content_Tagger

Overrides

Jonah_Driver::writeTags()
public array
# readTags( integer $resource_id )

Retrieve the tags for a specified resource.

Retrieve the tags for a specified resource.

Parameters

$resource_id
The resource to get tags for.

Returns

array
An array of tags

Todo:

Move this to a tagger class that uses content_tagger

Overrides

Jonah_Driver::readTags()
public array
# listTagInfo( array $tags = array(), array $channel_id = null )

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.

Parameters

$tags
<p>An optional array of tag_ids. If omitted, all tags will be included.</p>
$channel_id
An optional array of channel_ids.

Returns

array
An array containing tag_name, and total

Overrides

Jonah_Driver::listTagInfo()
public mixed
# searchTagsById( array $ids, integer $max = 10, integer $from = 0, array $channel_id = array(), integer $order = Jonah::ORDER_PUBLISHED )

Search for resources matching the specified criteria

Search for resources matching the specified criteria

Parameters

$ids
<p>An array of tag_ids to search for. Note that these are AND'd together.</p>
$max
<p>The maximum number of stories to get. If null, all stories will be returned.</p>
$from
The number of the story to start with.
$channel_id
<p>$channel Limit the result set to resources present in these channels</p>
$order
<p>How to order the results for internal channels. Possible values are the JONAH_ORDER_* constants.</p>

Returns

mixed
Array of stories

Overrides

Jonah_Driver::searchTagsById()
public
# searchTags( mixed $names, mixed $max = 10, mixed $from = 0, mixed $channel_id = array(), mixed $order = Jonah::ORDER_PUBLISHED )

Search for articles matching specific tag name(s).

Search for articles matching specific tag name(s).

See

Jonah_Driver_sql::searchTagsById()
public mixed
# getTagNames( array $ids )

Return a set of tag names given the tag_ids.

Return a set of tag names given the tag_ids.

Parameters

$ids
An array of tag_ids to get names for.

Returns

mixed
An array of tag names | PEAR_Error.

Overrides

Jonah_Driver::getTagNames()
public mixed
# getTagIds( array $names )

Return a set of tag_ids, given the tag name

Return a set of tag_ids, given the tag name

Parameters

$names
An array of names to search for

Returns

mixed
An array of tag_name => tag_ids | PEAR_Error
Methods inherited from Jonah_Driver
deleteChannel(), getChannel(), getChecksum(), getIdBySlug(), getIntervalLabel(), getStories(), getStory(), getStoryLink(), renderChannel(), saveStory()
API documentation generated by ApiGen