[ Index ] |
|
Code source de Plume CMS 1.2.2 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 695 lignes (23 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
Resource:: (26 méthodes):
Resource()
setDefaults()
load()
runPostLoadHook()
loadCategories()
getPath()
loadAuthors()
loadComments()
isPathInUse()
getAsString()
getConnection()
getIDs()
getTextContent()
getUnformattedContent()
getFormattedContent()
getContentFormat()
getArrayDate()
isDateEOT()
set()
check()
commit()
runPostCommitHook()
addToCategory()
removeFromCategory()
addAuthor()
removeAuthor()
Resource($data='') X-Ref |
Constructor. |
setDefaults($user) X-Ref |
Set the default values for the resources. Should be extended by each resource class to set all the default values from the preferences. param: object User object return: bool Success |
load($id='') X-Ref |
Load all the "associated" data of the resource. When the Resource object is created from a SQL query against the `resources` table, only few of the data is available. For example $this->auhors and $this->cats are not set. This method do that. A resource object extending Resource should add its own specific data, like pages for articles. If an identifier or an id is given, the corresponding resource is loaded. param: mixed identifier or resource id ('') return: bool Sucess or failure |
runPostLoadHook() X-Ref |
Run the onload hook. Each type of resource extending Resource must call this function before returning true after load() |
loadCategories() X-Ref |
Get the categories of a resources. Save the categories as a RecordSet into $this->categories return: bool Success |
getPath($type='') X-Ref |
Get the path to the resource. The function is context aware. It means that depending of the context it will return a full path or not, with nice urls or the simple format. param: string Force type of path ('') return: string The path |
loadAuthors() X-Ref |
Get the authors of the resource. The authors are in the `users` table. The association author -> resource is done in the `authorasso` table. return: bool Success |
loadComments() X-Ref |
Get the comments of the resource. return: bool Success |
isPathInUse($path, $website='') X-Ref |
Check if a path is in use. Only the path given by the user when creating an article for example. param: string Path param: string Website id (The one of the current resource return: mixed False or id of the resource using it |
getAsString($format = 'html') X-Ref |
Return the content of the resource as a string ready for indexation. Must be overwritten for each type of resource. param: string Format of the string (html, wiki, text) return: string The content of the news as a string |
getConnection() X-Ref |
Get a Connection object for the resource. It reuses the main connexion object. After calling this method a Connection object is available as $this->con It is safe to call it many times. |
getIDs($str='') X-Ref |
Get ids of resources with a prefix or not. param: string prefix for ids ('') return: array ids |
getTextContent($field, $var='', $escape=true) X-Ref |
Get content of a field as text. No modification of the content is performed. param: string Field to get param: string Member variable name ('') param: bool Escape the & character (true) return: string Content |
getUnformattedContent($field, $var='') X-Ref |
Get unformatted content of a field. It removes the content type and returns the content without parsing. param: string Field to get param: string Member variable name ('') return: string Content |
getFormattedContent($field, $format='html', $var='') X-Ref |
Get parsed content. If content is wiki, transform it as HTML, etc. param: string Field to get param: string Output format ('html') param: string Member variable name ('') return: string Formatted content |
getContentFormat($field, $var='') X-Ref |
Get the format of a content. param: string Field of the content param: string Member variable name ('') return: string Content format |
getArrayDate($field, $var='') X-Ref |
Get date as array. Returns a date as an array ready to be used in the form::datetime field. param: string Date field param: string Member variable name ('') return: array array(h,m,s,M,D,Y) |
isDateEOT($field, $var='') X-Ref |
Returns if a date is at the end of time param: string Date field param: string Member variable name ('') return: bool Date at end of time |
set() X-Ref |
Save the basic data. The common data are the one available in the `resources` table. Check the 'article' and 'news' class to see practical implementations. It is recommended to have a check() method to do the check and auto initialization of the data. return: bool Success |
check() X-Ref |
Check the basic data. return: bool Success |
commit() X-Ref |
Save the data into the DB. Note that it does not save the category and author data, as those data are saved immediately. return: bool Success |
runPostCommitHook() X-Ref |
Is just running the post commit hook. |
addToCategory($catid, $type=PX_RESOURCE_CATEGORY_MAIN) X-Ref |
Associate the resource to a category. param: int Category id param: int Type of association (PX_RESOURCE_CATEGORY_MAIN) return: bool Success |
removeFromCategory($catid) X-Ref |
Remove a resource from a category. The resource cannot be removed from the category if the category is the main category. param: int Category id return: bool Success |
addAuthor($id, $type=PX_RESOURCE_CREATOR) X-Ref |
Add an author. The author cannot be associated 2 times. It means that an author is either author, contributor or translator but can't be both of them. param: int Author id param: int Author type (PX_RESOURCE_CREATOR) return: bool Success |
removeAuthor($id) X-Ref |
Remove an author. A resource need at least one author. If you try to remove the last author will get an error. Add the new author and them remove the old. param: int Author id return: bool Success |
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |