[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/dao/ -> articles.class.php (sommaire)

(pas de description)

Poids: 1258 lignes (50 kb)
Inclus ou requis:0 fois
Référencé: 46 fois
Nécessite: 0 fichiers

Définit 1 class

Articles:: (31 méthodes):
  Articles()
  getArticle()
  getBlogArticle()
  getBlogArticleByTitle()
  _getBlogArticleFromQuery()
  getBlogNextArticle()
  getBlogPrevArticle()
  getNumBlogArticles()
  check()
  getSearchConditions()
  buildWhere()
  getBlogArticles()
  getNumberPostsPerMonth()
  getNumberPostsPerMonthAdmin()
  getDaysWithPosts()
  addPostCategoriesLink()
  deletePostCategoriesLink()
  updatePostCategoriesLink()
  updateGlobalArticleCategoriesLink()
  addArticle()
  addArticleText()
  getArticleText()
  updateArticleText()
  updateArticle()
  updateArticleCustomFields()
  updateArticleNumReads()
  updateArticleNumReadsByName()
  deleteArticle()
  deleteArticleText()
  deleteBlogPosts()
  mapRow()


Classe: Articles  - X-Ref

\ingroup DAO

Model for the Articles
Articles()   X-Ref
Pas de description

getArticle( $articleId )   X-Ref
Gets an article from the database, given its id. Also manages the
cache for articles.

param: articleId Identifier of the article we want to fetch
return: Returns an Article object or 'false' otherwise.

getBlogArticle( $artId, $blogId = -1,$includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_ALL )   X-Ref
Gets an article from the database, given its id

param: artId Identifier of the article we want to fetch
param: blogId If set, the article must belong to the given blog
return: Returns an Article object or 'false' otherwise.

getBlogArticleByTitle( $articleTitle, $blogId, $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId = -1, $status = POST_STATUS_PUBLISHED,$maxDate = -1 )   X-Ref
Gets an article from the database, given its slug, this is used
with the fancy permalinks

param: artTitle Identifier of the article we want to fetch
param: blogId If set, the article must belong to the given blog
return: Returns an Article object or 'false' otherwise.

_getBlogArticleFromQuery($query)   X-Ref


getBlogNextArticle( $article )   X-Ref
Returns the article that goes after the one we give as the parameter.

param: article An article object         
return: An Article object with the next article or false if there was no article.

getBlogPrevArticle( $article )   X-Ref
Returns the article that goes before the one we give as the parameter.

param: article An article object
return: An Article object with the previous article or false if there was no article.

getNumBlogArticles( $blogId,$date = -1,$categoryId = 0,$status = POST_STATUS_PUBLISHED,$userId = 0,$maxDate = 0,$searchTerms = "")   X-Ref


check( $article, $date = -1, $categoryId = 0, $status = POST_STATUS_PUBLISHED, $userId = 0, $maxDate = 0 )   X-Ref


getSearchConditions( $searchTerms )   X-Ref


buildWhere( $blogId, $date = -1, $amount = -1, $categoryId = 0, $status = 0, $userId = 0, $maxDate = 0, $searchTerms = "" )   X-Ref
builds a WHERE clause for a query


getBlogArticles( $blogId, $date = -1, $amount = -1, $categoryId = 0, $status = POST_STATUS_PUBLISHED, $userId = 0, $maxDate = 0, $searchTerms = "", $page = -1 )   X-Ref
Returns all the articles for a given blog, according to the conditions specified in
the call. If this function is too cumbersome to use (I reckon it might be,
too many parameters that have been added over time due to new requirements).

param: blogId Identifier of the blog from where we want to fetch the articles
param: date date in MySQL TIMESTAMP(14) format
param: amount The maximum amount of posts that we would like to be returned.
param: categoryId A category identifier. If specified, only the posts of
param: status If specified, only the posts with given status will be returned.
param: userId If specified, only the posts that belong to the specified user
param: maxDate a date in MySQL TIMESTAMP(14)
param: searchTerms in case we would like to further refine the filtering,
return: Returns an array with all the articles from the given blog

getNumberPostsPerMonth( $blogId )   X-Ref
Gets the number of posts per month per year from the database

param: blogId The numeric identifier of the blog from which we'd like to
return: A 2-dimensional associative array where the first index is the year and the second

getNumberPostsPerMonthAdmin( $blogId )   X-Ref
like the one above but with a few changes, such as always showing posts in the future
and returning all the months in the array, even if the total amount was '0'
Only used in the "editPosts" screen of the admin interface


getDaysWithPosts( $blogId, $year = null , $month = null )   X-Ref
The same as the one above but for just one month

param: blogId The identifier of the blog from which we'd like to calculate this
param: year Yeardddd
param: month Month from which we'd like to calculate this
return: An associative array where the index is the day of the month and the value

addPostCategoriesLink( $article )   X-Ref
adds records to the table that holds the many-to-many relationship between
categories and posts in the blog.

param: articleId
param: categories
return: True

deletePostCategoriesLink( $article )   X-Ref
removes the relationship between posts and categories from the database. This
method should only be used when removing an article!!


updatePostCategoriesLink( $article, $oldArticle = null )   X-Ref
update the links between a post and its categories
(basically, we use brute force here: first remove them and then recreate them again...
It takes less time than going through all of them and checking if they exist or not.


updateGlobalArticleCategoriesLink( $article, $oldArticle = null )   X-Ref
Updates global article category counters


addArticle( &$newArticle )   X-Ref
Adds a new article to the database

param: newArticle An Article object with all the necessary information.
return: Returns true if article was added successfully or false otherwise. If successful, it will modify the parmeter

addArticleText( $newArticle )   X-Ref
saves the text of an article to the database

param: newArticle the Article object that we have just saved
param:
return: true if successful or false otherwise

getArticleText( $articleId )   X-Ref
returns the text fields of an article

param: articleId
return: an array

updateArticleText( $article )   X-Ref
updates the text of an article

param: article an Article object
return: true if successful or false otherwise

updateArticle( $article )   X-Ref
Updates an article in the database

param: article The Article object that we'd like to update in the database.
return: Returns true if update was successful or false otherwise.

updateArticleCustomFields( $artId, $blogId, $fields )   X-Ref
updates the custom fields used by an article. It's actually easier to remove them all
and readd them again than check one by one if it already exists and if so updating it
and if not, add it

param: artId
param: blogId
param: fields
return: True if successful or false otherwise

updateArticleNumReads( $articleId )   X-Ref
Updates the number of times a post has been read. This method does not just increase the num_read
counter by one but it can set it to whatever we want... Usually the value we pass in '$numReads' will
be the old value + 1, but it could be whatever.

param: articleId A valid article identifier.
param: numReads A value, meaning how many times the post has been read.
return: Returns true if successful or false otherwise.

updateArticleNumReadsByName( $articleName )   X-Ref
similar as the one above but it takes an article 'name' instead of an article id

param: articleName an article "name" (the post 'slug')
return: true if successful or false otherwise

deleteArticle( $artId, $userId, $blogId, $forever = false )   X-Ref
Removes an article from the database

If forever == true, the article is physically removed from the database.
Otherwise, the 'status' field is set to 'deleted'

Problem is, that MySQL will automatically update the 'date' field because he feels
like it... even if we explicitely say date = old_date... grrreat :P

Valid article identifier, blog identifier and user identifier are required to remove an
article. It was done for security reasons and to make perfectly clear that we are removing
an article (so that we wouldn't be deleting the wrong one if there was any bug!)

param: artId A valid article identifier
param: userid A valid user identifier
param: blogId A valid blog identifier
param: forever A boolean meaning whether the post should be removed forever or simply its status
return: Returns true if successful or false otherwise.

deleteArticleText( $articleId )   X-Ref
removes the text of an article

param: articleId
return: true if successful or false otherwise

deleteBlogPosts( $blogId )   X-Ref
Removes all the posts from the given blog

param: blogId The blog identifier

mapRow( $query_result )   X-Ref




Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics