PHP Class Articles_model, 68kb

Inheritance: extends Base_module_model
Show file Open project: 68kb/68kb

Public Methods

Method Description
__construct ( ) : void Constructor
add_article ( array $data ) : mixed Add Article
add_fields ( $data ) : mixed Add Listing Fields
add_hit ( $id ) : boolean Add Hit
check_uri ( string $article_uri, $article_id = FALSE ) : boolean Check URI
delete_article ( $article_id ) : TRUE Delete Article
delete_article_attachments ( $id ) Delete all Uploaded files.
delete_article_tags ( $id ) Delete all article tags.
edit_article ( $article_id, array $data ) : boolean Edit Category
get_article ( $query ) Get Article
get_article_by_uri ( $uri ) : array Get Article By URI.
get_articles ( ) : mixed Get Article
get_articles_by_catid ( $id, $limit, $current_row, $show_count = TRUE ) : mixed Get Article By Cat ID.
get_attachments ( $id ) : array Get Attachments
get_category_relationship ( $article_id = '' ) : boolean Get Product to Categories
get_cats_by_article ( $id ) : array Get Category By Article.
get_highest_rated ( $number = 25 ) : array Get Highest Rated.
get_latest ( $number = 25 ) : array Get Latest Articles.
get_most_popular ( $number = 25 ) : array Get Most Popular.
get_related ( $id, $number = 5 ) : array Get Related Articles.
glossary ( $content ) : string Glossary
insert_cats ( $cats, $id ) : boolean Insert Article2Cats

Private Methods

Method Description
_dot ( $str, $len, $dots = "..." ) : string dot
_get_article_by_id ( $id ) : array Get Article By ID.

Method Details

__construct() public method

Constructor
public __construct ( ) : void
return void

add_article() public method

Add an article to the db.
public add_article ( array $data ) : mixed
$data array An array of data.
return mixed Id on success.

add_fields() public method

Add Listing Fields
public add_fields ( $data ) : mixed
return mixed

add_hit() public method

Increase the article hit count.
public add_hit ( $id ) : boolean
return boolean

check_uri() public method

Checks other articles for the same uri.
public check_uri ( string $article_uri, $article_id = FALSE ) : boolean
$article_uri string The uri name
return boolean True if checks out ok, FALSE otherwise

delete_article() public method

Responsible for deleting an article.
public delete_article ( $article_id ) : TRUE
return TRUE on success.

delete_article_attachments() public method

Delete all Uploaded files.

delete_article_tags() public method

Delete all article tags.
public delete_article_tags ( $id )

edit_article() public method

Handles editing an article.
public edit_article ( $article_id, array $data ) : boolean
$data array An array of data.
return boolean TRUE on success.

get_article() public method

Get Article
public get_article ( $query )

get_article_by_uri() public method

Get a single article from its a_uri
public get_article_by_uri ( $uri ) : array
return array

get_articles() public method

Gets a list of all articles
public get_articles ( ) : mixed
return mixed Either int or array.

get_articles_by_catid() public method

Get a list of articles from the same category.
public get_articles_by_catid ( $id, $limit, $current_row, $show_count = TRUE ) : mixed
return mixed

get_attachments() public method

Get all attachments by article ID
public get_attachments ( $id ) : array
return array

get_category_relationship() public method

Get Product to Categories
public get_category_relationship ( $article_id = '' ) : boolean
return boolean

get_cats_by_article() public method

Get a list of categories an article is associated with.
public get_cats_by_article ( $id ) : array
return array

get_highest_rated() public method

Get a list of the articles and order by rating. Usuage: $this->article_model->get_highest_rated(10);
public get_highest_rated ( $number = 25 ) : array
return array

get_latest() public method

Get a list of the latest articles
public get_latest ( $number = 25 ) : array
return array

glossary() public method

Checks for terms in the glossary and links the text to the term. Also can be used in conjunction with jQuery tooltip.
public glossary ( $content ) : string
return string the content with the link

insert_cats() public method

Insert the selected categories into the article2cat table.
public insert_cats ( $cats, $id ) : boolean
return boolean