Class storing display options and functions to help display course category and/or courses lists.  
 More...
|  | 
|  | get_and_erase_attributes ($classname) | 
|  | Return all attributes and erases them so they are not applied again. 
 | 
|  | 
|  | get_categories_display_option ($optionname, $defaultvalue=null) | 
|  | Return the specified option to display list of subcategories. 
 | 
|  | 
|  | get_categories_display_options () | 
|  | Returns all options to display list of subcategories. 
 | 
|  | 
|  | get_category_formatted_description ($coursecat, $options=null) | 
|  | Returns formatted and filtered description of the given category. 
 | 
|  | 
|  | get_course_formatted_name ($course, $options=array()) | 
|  | Returns course name as it is configured to appear in courses lists formatted to course context. 
 | 
|  | 
|  | get_course_formatted_summary ($course, $options=array()) | 
|  | Returns given course's summary with proper embedded files urls and formatted. 
 | 
|  | 
|  | get_courses_display_option ($optionname, $defaultvalue=null) | 
|  | Return the specified option to display list of courses. 
 | 
|  | 
|  | get_courses_display_options () | 
|  | Returns all options to display the courses. 
 | 
|  | 
|  | get_show_courses () | 
|  | Returns how (if) to show the courses - none, collapsed, expanded, etc. 
 | 
|  | 
|  | get_subcat_depth () | 
|  | Returns the maximum depth to expand subcategories in the tree. 
 | 
|  | 
|  | set_attributes ($attributes) | 
|  | Sets additional general options to pass between renderer functions, usually HTML attributes. 
 | 
|  | 
|  | set_categories_display_options ($options) | 
|  | Sets options to display list of subcategories. 
 | 
|  | 
|  | set_courses_display_option ($key, $value) | 
|  | Sets one option to display list of courses. 
 | 
|  | 
|  | set_courses_display_options ($options) | 
|  | Sets options to display list of courses. 
 | 
|  | 
|  | set_search_criteria ($searchcriteria) | 
|  | Sets the search criteria if the course is a search result. 
 | 
|  | 
|  | set_show_courses ($showcourses) | 
|  | Sets how (if) to show the courses - none, collapsed, expanded, etc. 
 | 
|  | 
|  | set_subcat_depth ($subcatdepth) | 
|  | Sets the maximum depth to expand subcategories in the tree. 
 | 
|  | 
|  | 
| array | $attributes = array() | 
|  | additional HTML attributes 
 | 
|  | 
| array | $categoriesdisplayoptions = array() | 
|  | options to display subcategories list 
 | 
|  | 
| array | $coursesdisplayoptions = array() | 
|  | options to display courses list 
 | 
|  | 
| array | $searchcriteria = null | 
|  | search criteria if the list is a search result 
 | 
|  | 
| string | $showcourses = 10 | 
|  | [none, collapsed, expanded] how (if) display courses list 
 | 
|  | 
| int | $subcatdepth = 1 | 
|  | depth to expand subcategories in the tree (deeper subcategories will be loaded by AJAX or proceed to category page by clicking on category name) 
 | 
|  | 
Class storing display options and functions to help display course category and/or courses lists. 
This is a wrapper for core_course_category objects that also stores display options and functions to retrieve sorted and paginated lists of categories/courses.
If theme overrides methods in core_course_renderers that access this class it may as well not use this class at all or extend it.
- Copyright
- 2013 Marina Glancy 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ get_and_erase_attributes()
      
        
          | coursecat_helper::get_and_erase_attributes | ( |  | $classname | ) |  | 
      
 
Return all attributes and erases them so they are not applied again. 
- Parameters
- 
  
    | string | $classname | adds additional class name to the beginning of $attributes['class'] |  
 
- Return values
- 
  
  
 
 
◆ get_categories_display_option()
      
        
          | coursecat_helper::get_categories_display_option | ( |  | $optionname, | 
        
          |  |  |  | $defaultvalue = null ) | 
      
 
Return the specified option to display list of subcategories. 
- Parameters
- 
  
    | string | $optionname | option name |  | mixed | $defaultvalue | default value for option if it is not specified |  
 
- Return values
- 
  
  
 
 
◆ get_categories_display_options()
      
        
          | coursecat_helper::get_categories_display_options | ( |  | ) |  | 
      
 
 
◆ get_category_formatted_description()
      
        
          | coursecat_helper::get_category_formatted_description | ( |  | $coursecat, | 
        
          |  |  |  | $options = null ) | 
      
 
Returns formatted and filtered description of the given category. 
- Parameters
- 
  
    | core_course_category | $coursecat | category |  | stdClass | array | $options | format options, by default [noclean,overflowdiv], if context is not specified it will be added automatically |  
 
- Return values
- 
  
  
 
 
◆ get_course_formatted_name()
      
        
          | coursecat_helper::get_course_formatted_name | ( |  | $course, | 
        
          |  |  |  | $options = array() ) | 
      
 
Returns course name as it is configured to appear in courses lists formatted to course context. 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ get_course_formatted_summary()
      
        
          | coursecat_helper::get_course_formatted_summary | ( |  | $course, | 
        
          |  |  |  | $options = array() ) | 
      
 
Returns given course's summary with proper embedded files urls and formatted. 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ get_courses_display_option()
      
        
          | coursecat_helper::get_courses_display_option | ( |  | $optionname, | 
        
          |  |  |  | $defaultvalue = null ) | 
      
 
Return the specified option to display list of courses. 
- Parameters
- 
  
    | string | $optionname | option name |  | mixed | $defaultvalue | default value for option if it is not specified |  
 
- Return values
- 
  
  
 
 
◆ get_courses_display_options()
      
        
          | coursecat_helper::get_courses_display_options | ( |  | ) |  | 
      
 
 
◆ get_show_courses()
      
        
          | coursecat_helper::get_show_courses | ( |  | ) |  | 
      
 
Returns how (if) to show the courses - none, collapsed, expanded, etc. 
- Return values
- 
  
    | int | - COURSECAT_SHOW_COURSES_NONE, COURSECAT_SHOW_COURSES_COLLAPSED, COURSECAT_SHOW_COURSES_EXPANDED, etc. |  
 
 
 
◆ get_subcat_depth()
      
        
          | coursecat_helper::get_subcat_depth | ( |  | ) |  | 
      
 
Returns the maximum depth to expand subcategories in the tree. 
deeper subcategories may be loaded by AJAX or proceed to category page by clicking on category name
- Return values
- 
  
  
 
 
◆ set_attributes()
      
        
          | coursecat_helper::set_attributes | ( |  | $attributes | ) |  | 
      
 
Sets additional general options to pass between renderer functions, usually HTML attributes. 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ set_categories_display_options()
      
        
          | coursecat_helper::set_categories_display_options | ( |  | $options | ) |  | 
      
 
Sets options to display list of subcategories. 
Options 'sort', 'offset' and 'limit' are passed to core_course_category\get_children(). Any other options may be used by renderer functions
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ set_courses_display_option()
      
        
          | coursecat_helper::set_courses_display_option | ( |  | $key, | 
        
          |  |  |  | $value ) | 
      
 
 
◆ set_courses_display_options()
      
        
          | coursecat_helper::set_courses_display_options | ( |  | $options | ) |  | 
      
 
Sets options to display list of courses. 
Options are later submitted as argument to core_course_category\get_courses() and/or core_course_category\search_courses()
Options that core_course_category\get_courses() accept:
- recursive - return courses from subcategories as well. Use with care, this may be a huge list!
- summary - preloads fields 'summary' and 'summaryformat'
- coursecontacts - preloads course contacts
- customfields - preloads custom fields data
- isenrolled - preloads indication whether this user is enrolled in the course
- sort - list of fields to sort. Example array('idnumber' => 1, 'shortname' => 1, 'id' => -1) will sort by idnumber asc, shortname asc and id desc. Default: array('sortorder' => 1) Only cached fields may be used for sorting!
- offset
- limit - maximum number of children to return, 0 or null for no limit
Options summary and coursecontacts are filled automatically in the set_show_courses()
Also renderer can set here any additional options it wants to pass between renderer functions.
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ set_search_criteria()
      
        
          | coursecat_helper::set_search_criteria | ( |  | $searchcriteria | ) |  | 
      
 
Sets the search criteria if the course is a search result. 
Search string will be used to highlight terms in course name and description
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
◆ set_show_courses()
      
        
          | coursecat_helper::set_show_courses | ( |  | $showcourses | ) |  | 
      
 
Sets how (if) to show the courses - none, collapsed, expanded, etc. 
- Parameters
- 
  
    | int | $showcourses | SHOW_COURSES_NONE, SHOW_COURSES_COLLAPSED, SHOW_COURSES_EXPANDED, etc. |  
 
- Return values
- 
  
  
 
 
◆ set_subcat_depth()
      
        
          | coursecat_helper::set_subcat_depth | ( |  | $subcatdepth | ) |  | 
      
 
Sets the maximum depth to expand subcategories in the tree. 
deeper subcategories may be loaded by AJAX or proceed to category page by clicking on category name
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
The documentation for this class was generated from the following file: