Home « Server software «
Documentation: sections/section.php
Class Section extends Anchor - The implementation of anchor for sections
This class implements the Anchor interface for sections.This script is a reference file of this system.
Voir aussi:
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com
get_bullet_url() - Get the url to display bullet images
function get_bullet_url()
- returns an anchor to the icon image
Voir aussi:
get_focus() - Get the focus for this anchor
function get_focus()
- returns array of anchor references
get_icon_url() - Get the url to display the icon for this anchor
function get_icon_url()
- returns an anchor to the icon image
Voir aussi:
get_label() - Provide a custom label
function get_label($variant, $id, $title='')
- $variant - string the module that is invoking the anchor (e.g., 'comments')
- $id - string the target label (e.g., 'edit_title', 'item_name', 'item_names')
- $title='' - string an optional title, if any
- returns string the foreseen label
get_neighbours() - Get next and previous items, if any
function get_neighbours($type, &$item)
- $type - string the item type (eg, 'article', 'image', 'file', etc.)
- &$item - array the anchored item asking for neighbours
- returns an array($previous_url, $previous_label, $next_url, $next_label, $option_url, $option_label)
Voir aussi:
get_path_bar() - Get the path bar for this anchor
function get_path_bar()
- returns an array of $url => $label
$anchor = get_anchor($article['anchor']);
$context['path_bar'] = array_merge($context['path_bar'], $anchor->get_path_bar());
This function uses the cache to save on database requests.
Voir aussi:
get_reference() - Get the reference for this anchor
function get_reference()
- returns 'section:<id>'
$anchor = get_anchor($article['anchor']);
$context['text'] .= '<input type="hidden" name="anchor" value="'.$anchor->get_reference().'" />';
Voir aussi:
get_teaser() - Get some introductory text from a section
function &get_teaser($variant = 'basic')
- $variant = 'basic' - string an optional variant
- returns NULL, of some text
If there is some introductory text, it is used. Else the description text is used instead. The number of words is capped in both cases.
Also, the number of remaining words is provided.
Following variants may be selected to adapt to various situations:
- 'basic' - strip every tag, we want almost plain ASCII - maybe this will be send in a mail message
- 'hover' - some text to be displayed while hovering a link
- 'quote' - transform YACS codes, then strip most HTML tags
- 'teaser' - limit the number of words, tranform YACS codes, and link to permalink
Voir aussi:
get_thumbnail_url() - Get the url to display the thumbnail for this anchor
function get_thumbnail_url()
- returns an anchor to the thumbnail image
Note: This function returns a URL to the thumbnail that is created by default when an icon is set for the section. However, the webmaster can decide to NOT display section thumbnails throughout the server. In this case, he/she has just to suppress the thumbnail URL in each section and that's it.
Voir aussi:
get_url() - Get the url to display the main page for this anchor
function get_url($action='view')
- $action='view' - string the targeted action ('view', 'print', 'edit', 'delete', ...)
- returns an anchor to the viewing script
Voir aussi:
get_user_profile() - Integrate a user profile, if applicable
function get_user_profile($user, $variant='prefix')
- $user - array one user profile
- $variant='prefix' - string a profiling option, including 'prefix', 'suffix', and 'extra'
- returns a string to be returned to the browser
*
with_prefix_profile -- if the variant is 'prefix',
returns a full description of the poster*
with_suffix_profile -- if the variant is 'suffix',
returns a textual description of the poster*
with_extra_profile -- if the variant is 'extra',
returns a full description of the poster in a sidebox* Also, if the '
yabb' layout has been selected -- if the variant is 'prefix',
displays an avatar for the userVoir aussi:
has_option() - Check that an option has been set for this section
function has_option($option)
- $option - string the option we are looking for
- returns TRUE or FALSE, or the value of the matching option if any
This function recursively invokes upstream anchors, if any. For example, if the option 'skin_boxes' is set at the section level, all articles, but also all attached files and images of these articles, will feature the skin 'boxes'.
is_editable() - Check that the surfer is an editor of an anchor
function is_editable($user_id=NULL)
- $user_id=NULL - int optional reference to some user profile
- returns TRUE or FALSE
$anchor = get_anchor($article['anchor']);
if($anchor->is_editable() {
...
}
A logged member is always considered as an editor if he has created the target item.
Compared to the original member function in shared/anchor.php, this one also checks rights of managing editors, and allows for anonymous changes.
is_public() - Determine if public access is allowed to the anchor
function is_public()
- returns TRUE or FALSE
Voir aussi:
is_viewable() - Check that the surfer is allowed to display the anchor
function is_viewable()
- returns TRUE or FALSE
load_by_id() - Load the related item
function load_by_id($id)
- $id -
Voir aussi:
touch() - Remember the last action for this section
function touch($action, $origin, $silently = FALSE)
- $action - string the description of the last action
- $origin - string the id of the item related to this update
- $silently = FALSE - boolean TRUE for a silent update
Voir aussi: