HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: CEDI

» Return to Contents


The concept of a chain is crucial to proper understanding of the CEDI system. Pages in CEDI are not tied to any paticular hierarchical location, but rather may be found via a "chain" of links. For usability, a "bread crumb" trail is shown as you move through CEDI, and this should reflect the path chosen to get to the current page – thus a chain is passed through the URLs to encode this.

sources/cedi.php

Global_functions_cedi.php

Function summary

tempcode get_cedi_post_html (array row, ID_TEXT zone, boolean put_in_box)
tempcode get_cedi_page_html (array row, ID_TEXT zone, boolean put_in_box)
AUTO_LINK cedi_add_post (AUTO_LINK page_id, string message, BINARY validated, ?MEMBER member, boolean send_mail)
void cedi_edit_post (AUTO_LINK id, string message, BINARY validated, ?MEMBER member)
void cedi_delete_post (AUTO_LINK post_id, ?MEMBER member)
AUTO_LINK cedi_add_page (SHORT_TEXT title, LONG_TEXT description, LONG_TEXT notes, BINARY hide_posts, ?MEMBER member)
void cedi_edit_page (AUTO_LINK id, SHORT_TEXT title, LONG_TEXT description, LONG_TEXT notes, BINARY hide_posts, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, ?MEMBER member)
void cedi_delete_page (AUTO_LINK id)
array get_param_cedi_chain (ID_TEXT parameter_name, ?string default_value)
tempcode cedi_breadcrumbs (string chain, ?string current_title, boolean final_link, boolean links, boolean this_link_virtual_root)
string cedi_derive_chain (AUTO_LINK id)
mixed cedi_show_tree (?AUTO_LINK select, ?AUTO_LINK id, string tree, boolean include_orphans, boolean use_compound_list, boolean ins_format)
mixed _cedi_show_tree (array cedi_seen, ?AUTO_LINK select, AUTO_LINK id, string tree, SHORT_TEXT title, boolean use_compound_list, boolean ins_format)
array get_cedi_page_tree (array cedi_seen, ?AUTO_LINK page_id, ?string tree, ?ID_TEXT title, boolean do_stats, boolean use_compound_list, ?integer levels)
void dispatch_cedi_post_notification (AUTO_LINK post_id, ID_TEXT type)
void dispatch_cedi_page_notification (AUTO_LINK page_id, ID_TEXT type)

tempcode get_cedi_post_html(array row, ID_TEXT zone, boolean put_in_box)

Get tempcode for a CEDI post 'feature box' for the given row

Parameters…

Name row
Description The database field row of it
Type array

Name zone
Description The zone to use
Default value _SEARCH
Type ID_TEXT

Name put_in_box
Description Whether to put it in a box
Default value boolean-true
Type boolean

Returns…

Description A box for it, linking to the full page
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode get_cedi_page_html(array row, ID_TEXT zone, boolean put_in_box)

Get tempcode for a CEDI post 'feature box' for the given row

Parameters…

Name row
Description The database field row of it
Type array

Name zone
Description The zone to use
Default value _SEARCH
Type ID_TEXT

Name put_in_box
Description Whether to put it in a box
Default value boolean-true
Type boolean

Returns…

Description A box for it, linking to the full page
Type tempcode

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK cedi_add_post(AUTO_LINK page_id, string message, BINARY validated, ?MEMBER member, boolean send_mail)

Edit a CEDI post

Parameters…

Name page_id
Description The page ID
Type AUTO_LINK

Name message
Description The new post
Type string

Name validated
Description Whether the post will be validated
Default value 1
Type BINARY

Name member
Description The member doing the action (NULL: current member)
Default value
Type ?MEMBER

Name send_mail
Description Whether to send out a staff e-mail about the new CEDI post
Default value boolean-true
Type boolean

Returns…

Description The post ID
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void cedi_edit_post(AUTO_LINK id, string message, BINARY validated, ?MEMBER member)

Edit a CEDI post

Parameters…

Name id
Description The post ID
Type AUTO_LINK

Name message
Description The new post
Type string

Name validated
Description Whether the post will be validated
Type BINARY

Name member
Description The member doing the action (NULL: current member)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

void cedi_delete_post(AUTO_LINK post_id, ?MEMBER member)

Delete a CEDI post

Parameters…

Name post_id
Description The post ID
Type AUTO_LINK

Name member
Description The member doing the action (NULL: current member)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

AUTO_LINK cedi_add_page(SHORT_TEXT title, LONG_TEXT description, LONG_TEXT notes, BINARY hide_posts, ?MEMBER member)

Add a CEDI page

Parameters…

Name title
Description The page title
Type SHORT_TEXT

Name description
Description The page description
Type LONG_TEXT

Name notes
Description Hidden notes pertaining to the page
Type LONG_TEXT

Name hide_posts
Description Whether to hide the posts on the page by default
Type BINARY

Name member
Description The member doing the action (NULL: current member)
Default value
Type ?MEMBER

Returns…

Description The page ID
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void cedi_edit_page(AUTO_LINK id, SHORT_TEXT title, LONG_TEXT description, LONG_TEXT notes, BINARY hide_posts, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, ?MEMBER member)

Edit a CEDI page

Parameters…

Name id
Description The page ID
Type AUTO_LINK

Name title
Description The page title
Type SHORT_TEXT

Name description
Description The page description
Type LONG_TEXT

Name notes
Description Hidden notes pertaining to the page
Type LONG_TEXT

Name hide_posts
Description Whether to hide the posts on the page by default
Type BINARY

Name meta_keywords
Description Meta keywords
Type SHORT_TEXT

Name meta_description
Description Meta description
Type LONG_TEXT

Name member
Description The member doing the action (NULL: current member)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

void cedi_delete_page(AUTO_LINK id)

Delete a CEDI page

Parameters…

Name id
Description The page ID
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

array get_param_cedi_chain(ID_TEXT parameter_name, ?string default_value)

Get a chain script parameter or just an ID, in which case it does more work), and converts it into a id/chain pair

Parameters…

Name parameter_name
Description The name of the GET parameter that stores the chain
Type ID_TEXT

Name default_value
Description The default value for the chain (NULL: no default)
Default value
Type ?string

Returns…

Description An array of two elements: an ID and a chain
Type array

Return to the function index for this class Expand: View the source code to this function

tempcode cedi_breadcrumbs(string chain, ?string current_title, boolean final_link, boolean links, boolean this_link_virtual_root)

Convert a CEDI chain to a nice formatted XHTML tree.

Parameters…

Name chain
Description The chain to convert (which should include the current page ID)
Type string

Name current_title
Description The title of the current CEDI page (if not given, it is looked up) (NULL: work it out)
Default value
Type ?string

Name final_link
Description Whether to show the final tree element with a link to it (all others will always have links if $links is true)
Default value boolean-false
Type boolean

Name links
Description Whether to show links to pages in the tree
Default value boolean-true
Type boolean

Name this_link_virtual_root
Description Whether to make the link as a virtual-root link (only applies if $final_link is true)
Default value boolean-false
Type boolean

Returns…

Description Tempcode of the breadcrumb XHTML
Type tempcode

Return to the function index for this class Expand: View the source code to this function

string cedi_derive_chain(AUTO_LINK id)

Create a CEDI chain from the specified page ID

Parameters…

Name id
Description The ID of the page to derive a chain for
Type AUTO_LINK

Returns…

Description The CEDI chain derived
Type string

Return to the function index for this class Expand: View the source code to this function

mixed cedi_show_tree(?AUTO_LINK select, ?AUTO_LINK id, string tree, boolean include_orphans, boolean use_compound_list, boolean ins_format)

Get a nice formatted XHTML list of all the children beneath the specified CEDI page. This function is recursive.

Parameters…

Name select
Description The CEDI page to select by default (NULL: none)
Default value
Type ?AUTO_LINK

Name id
Description The CEDI page to look beneath (NULL: the root)
Default value
Type ?AUTO_LINK

Name tree
Description Tree built up so far, in recursion (blank: starting recursion)
Default value
Type string

Name include_orphans
Description Whether to include orphaned pages in the tree
Default value boolean-true
Type boolean

Name use_compound_list
Description Whether to create a compound list (gets pairs: tempcode, and comma-separated list of children)
Default value boolean-false
Type boolean

Name ins_format
Description Whether to use titles in IDs after a ! (used on tree edit page)
Default value boolean-false
Type boolean

Returns…

Description Tempcode for the list / pair of tempcode and compound
Type mixed

Return to the function index for this class Expand: View the source code to this function

mixed _cedi_show_tree(array cedi_seen, ?AUTO_LINK select, AUTO_LINK id, string tree, SHORT_TEXT title, boolean use_compound_list, boolean ins_format)

Helper function. Get a nice formatted XHTML list of all the children beneath the specified CEDI page. This function is recursive.

Parameters…

Name cedi_seen
Description A list of pages we've already seen (we don't repeat them in multiple list positions)
Type array

Name select
Description The CEDI page to select by default (NULL: none)
Type ?AUTO_LINK

Name id
Description The CEDI page to look beneath
Type AUTO_LINK

Name tree
Description Tree built up so far, in recursion (blank: starting recursion)
Type string

Name title
Description The title of the CEDI page to look beneath
Type SHORT_TEXT

Name use_compound_list
Description Whether to create a compound list (gets pairs: tempcode, and comma-separated list of children)
Default value boolean-false
Type boolean

Name ins_format
Description Whether to use titles in IDs after a ! (used on tree edit page)
Default value boolean-false
Type boolean

Returns…

Description Tempcode for the list / pair of tempcode and compound
Type mixed

Return to the function index for this class Expand: View the source code to this function

array get_cedi_page_tree(array cedi_seen, ?AUTO_LINK page_id, ?string tree, ?ID_TEXT title, boolean do_stats, boolean use_compound_list, ?integer levels)

Get a list of maps containing all the subpages, and path information, of the specified page - and those beneath it, recursively.

Parameters…

Name cedi_seen
Description A list of pages we've already seen (we don't repeat them in multiple list positions)
Type array

Name page_id
Description The page being at the root of our recursion (NULL: true root page)
Default value
Type ?AUTO_LINK

Name tree
Description The tree up to this point in the recursion (NULL: blank, as we are starting the recursion)
Default value
Type ?string

Name title
Description The name of the $page_id we are currently going through (NULL: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the childs title
Default value
Type ?ID_TEXT

Name do_stats
Description Whether to collect post counts with our tree information
Default value boolean-true
Type boolean

Name use_compound_list
Description Whether to make a compound list (a pair of a comma-separated list of children, and the child array)
Default value boolean-false
Type boolean

Name levels
Description The number of recursive levels to search (NULL: all)
Default value
Type ?integer

Returns…

Description A list of maps for all subcategories. Each map entry containins the fields 'id' (category ID) and 'tree' (tree path to the category, including the categories own title). There is also an additional 'downloadcount' entry if stats were requested
Type array

Return to the function index for this class Expand: View the source code to this function

void dispatch_cedi_post_notification(AUTO_LINK post_id, ID_TEXT type)

Dispatch a notification about a CEDI post

Parameters…

Name post_id
Description The post ID
Type AUTO_LINK

Name type
Description The action type
Type ID_TEXT
Values restricted to ADD EDIT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void dispatch_cedi_page_notification(AUTO_LINK page_id, ID_TEXT type)

Dispatch a notification about a CEDI page

Parameters…

Name page_id
Description The page ID
Type AUTO_LINK

Name type
Description The action type
Type ID_TEXT
Values restricted to ADD EDIT

(No return value)


Return to the function index for this class Expand: View the source code to this function