Overview  Package  Tree cmsdAm 0.8

cmsdAm

Class cmsdam_sections

cmsdAm.cmsdam_sections

class cmsdam_sections

This is the most important class of cmsdAm.

Here are defined methods you can use to handle PHP/HTML pieces of code (templates) mapped into section names. Each section can be included from another section (for example from template index.php, the first section). Remember that sections can be mapped to cmsdAm users and/or groups to grant or deny web users from directly viewing the requested section.

Class instance: $cms->sections

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>

Field Summary
public var$conf

You should not use this variable from your section.

public var$i18n

You should not use this variable from your section.

public var$memcache

You should not use this variable from your section.

public var$http

You should not use this variable from your section.

public var$dbms

You should not use this variable from your section.

public var$users

You should not use this variable from your section.

public var$groups

You should not use this variable from your section.

public str$section_included

This is the name of the section from where you get this variable.

public int$section_cached

You can set this variable to 1 if you want to force cmsdAm NOT to cache this section.

public str$section_requested

This is the name of the requested section.

public int$n_subsections

This is the level of subsections (if any) of the requested section.

public int$n_sections

This is the number of defined sections.

public array$subsections

This array contains the splitted path for the requested (sub)section.

public str$description

This is the short description for the requested section.

public str$longdescription

This is the long description for the requested section.

public str$filename

This is the filename for the requested section.

public str$templates_relpath

cmsdAm relative path for template files.

public str$templates_lang_relpath

cmsdAm relative path for template files for the given browser language.

Method Summary
public nullcmsdam_sections

This is the class constructor.

public strsection_navigator

This method returns the navigation bar HTML string for the requested section.

public arraysection_navigator_arr

This is the scalable way to create the section navigation bar.

public arraysection_sorted_tree

Return a sorted array with all the section names like a directory tree.

public intsection_treelevel

Return the tree level for the given (sub)section.

public boolsection_include

Include a section into the page.

public boolsection_isvalid

Check if the given section exists and is valid for the logged in user.

public arraysection_valid_arr

Returns a section array with all valid section names for the logged user

public boolsection_link

This method create a html link that points to the specified section $section.

public strsection_nslink

This method returns a html link that points to the specified section number.

public strsection_slink

This method returns a html link that points to the specified section $section.

public strsection_llink

This method returns a html link that points to the specified section $section.

public strsection_ldesc

This method return the long description string of the specified section "$section".

public strsection_sdesc

This method return the short description string of the specified section "$section".

public strsection_filename

This method return the section filename.

public strsection_uri

This method return the section uri.

public boolopen_form

This method open a HTML form for the given section.

public boolclose_form

This method close a HTML form for the given section.

public boolsection_comment_add

This method add a section comment to the DB.

public arraysection_comment_getarray

This method returns an array that contains all the comment for this section.

public arraysection_comment_getid

This method returns an array of integer containig the comment ids for this section On error return false
On success return an array
On success without comments returns null

Field Detail

conf

public var $conf

You should not use this variable from your section.

Configuration class instance.


i18n

public var $i18n

You should not use this variable from your section.

i18n class instance.


memcache

public var $memcache

You should not use this variable from your section.

Memcache class instance.


http

public var $http

You should not use this variable from your section.

HTTP class instance.


dbms

public var $dbms

You should not use this variable from your section.

DBMS class instance.


users

public var $users

You should not use this variable from your section.

Users class instance.


groups

public var $groups

You should not use this variable from your section.

Groups class instance.


section_included

public str $section_included

This is the name of the section from where you get this variable.

It is automagically setted by cmsdAm. If you want to get the name of the included section where you are, use this variable.


section_cached

public int $section_cached

You can set this variable to 1 if you want to force cmsdAm NOT to cache this section.

The value [0 or 1] is taken from the external variable n_c


section_requested

public str $section_requested

This is the name of the requested section.

You can change its value from template/index.php (for example). It is automagically setted by cmsdAm. If you want to change the requested section at runtime from one of your sections, remember to call sections->cmsdam_sections() without parameters after you change this variable.


n_subsections

public int $n_subsections

This is the level of subsections (if any) of the requested section.


n_sections

public int $n_sections

This is the number of defined sections.


subsections

public array $subsections

This array contains the splitted path for the requested (sub)section.

0:s1,1:s1/s2,2:s1/s2/s3,ecc...


description

public str $description

This is the short description for the requested section.


longdescription

public str $longdescription

This is the long description for the requested section.


filename

public str $filename

This is the filename for the requested section.


templates_relpath

public str $templates_relpath

cmsdAm relative path for template files.

No leading nor trailing slash.


templates_lang_relpath

public str $templates_lang_relpath

cmsdAm relative path for template files for the given browser language.

No leading nor trailing slash.

Method Detail

cmsdam_sections()

public null cmsdam_sections()

This is the class constructor.

Here are automatically setted things.

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>

section_navigator()

public str section_navigator()

This method returns the navigation bar HTML string for the requested section.

This is not a scalable way to do things, for example because you can not modify html output, but sometime it can be very useful. You can use the method section_navigator_arr if you want a more scalable way of making navigation bar for requested section.

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
The navigation bar HTML string for the requested section

section_navigator_arr()

public array section_navigator_arr()

This is the scalable way to create the section navigation bar.

This method returns an array with the splitted path for the given section. Useful to make the navigation bar.

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
The navigation bar array

section_sorted_tree()

public array section_sorted_tree()

Return a sorted array with all the section names like a directory tree.

You can use it for example to create a section graphic representation tree.

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Sorted array with all section names.

section_treelevel()

public int section_treelevel(str cmsdam_section)

Return the tree level for the given (sub)section.

Parameters:
cmsdam_section - The section name
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
cmsdam section level

section_include()

public bool section_include(str cmsdam_section,
                            null param = null)

Include a section into the page.

This is the most important method of this class, useful to include other sections into the requested one. WARNING: You must use this method!! Don't try to use the "include" PHP directive to include sections, you have to do most checks and setting variables!!

Parameters:
cmsdam_section - The section name you want to include into the requested one
param - Not used at this time
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
True on success, False on errors

section_isvalid()

public bool section_isvalid(str section)

Check if the given section exists and is valid for the logged in user.

Parameters:
section - The section name to check
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
True if the section is valid, False if not

section_valid_arr()

public array section_valid_arr()

Returns a section array with all valid section names for the logged user

Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Section array

section_link()

public bool section_link(str section,
                         str linktext = "",
                         int httpcache = 0)

This method create a html link that points to the specified section $section.

You can use the link text $text if you don't want to use the LongDescription defined with the section. If $httpcache == 0 or if $httpcache is null the section will be cached.

Parameters:
section - The section you want to link
linktext - The link text if you don't want the LongDescription
httpcache - If httpcache == 1 you want NOT to HTTP cache this section
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
True on success, False on errors

section_nslink()

public str section_nslink(int sectionid,
                          str linktext = "",
                          int httpcache = 0)

This method returns a html link that points to the specified section number.

You can use the link text $text if you don't want to use the ShortDescription defined with the section. If $httpcache == 0 or if $httpcache is null the section will be cached.

Parameters:
sectionid - The number of the section you want to link
linktext - The link text if you don't want the LongDescription
httpcache - If httpcache == 1 you want NOT to HTTP cache this section
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
The html link string with short description for the section $section

section_slink()

public str section_slink(str section,
                         str linktext = "",
                         int httpcache = 0)

This method returns a html link that points to the specified section $section.

You can use the link text $text if you don't want to use the ShortDescription defined with the section. If $httpcache == 0 or if $httpcache is null the section will be cached.

Parameters:
section - The section you want to link
linktext - The link text if you don't want the LongDescription
httpcache - If httpcache == 1 you want NOT to HTTP cache this section
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
The html link string with short description for the section $section

section_llink()

public str section_llink(str section,
                         str linktext = "",
                         int httpcache = 0)

This method returns a html link that points to the specified section $section.

You can use the link text $text if you don't want to use the LongDescription defined with the section. If $httpcache == 0 or if $httpcache is null the section will be cached.

Parameters:
section - The section you want to link
linktext - The link text if you don't want the LongDescription
httpcache - If httpcache == 1 you want NOT to HTTP cache this section
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
The html link string with long description for the section $section

section_ldesc()

public str section_ldesc(str section)

This method return the long description string of the specified section "$section".

If the requested section is not valid this method returns the passed string.

Parameters:
section - The section name you want the long description
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Section long description

section_sdesc()

public str section_sdesc(str section)

This method return the short description string of the specified section "$section".

If the requested section is not valid this method returns the passed string.

Parameters:
section - The section name you want the short description
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Section short description

section_filename()

public str section_filename(str section)

This method return the section filename.

If the requested section is not valid this method returns null.

Parameters:
section - The section name you want the filename
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Section filename

section_uri()

public str section_uri(str section,
                       int httpcache = 0)

This method return the section uri.

Parameters:
section - The section name you want the uri
httpcache - 0 = HTTP cache, 1 = HTTP NOT cache
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Section URI

open_form()

public bool open_form(str section)

This method open a HTML form for the given section.

To avoid to create a form for each included section, cmsdAm let you create your own form. Using this method, will be created the form for the given section. To get the included section name use the '$cms->sections->section_included' variables.

Parameters:
section - The section name you want to open the form
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Always true.

close_form()

public bool close_form(str section)

This method close a HTML form for the given section.

To avoid to create a form for each included section, cmsdAm let you create your own form. Using this method, will be closed the form for the given section. To get the included section name use the '$cms->sections->section_included' variables.

Parameters:
section - The section name you want to close the form
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Always true.

section_comment_add()

public bool section_comment_add(str text)

This method add a section comment to the DB.

Parameters:
text - The text you want to add as a section comment
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
True on success, False on errors

section_comment_getarray()

public array section_comment_getarray(str param = 1)

This method returns an array that contains all the comment for this section.

On error return false
On success return an array
On success without comments returns null

Parameters:
param - the section you want array, the one requested if omitted or == 1
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Comments array for the requested section

section_comment_getid()

public array section_comment_getid(str param = 1)

This method returns an array of integer containig the comment ids for this section On error return false
On success return an array
On success without comments returns null

Parameters:
param - the section you want array, the one requested if omitted or == 1
Author:
dAm2K (Dino Ciuffetti) <dam2k@users.sourceforge.net>
Returns:
Comments array of ID for the requested section

Overview  Package  Tree cmsdAm 0.8