[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/course/classes/management/ -> helper.php (summary)

Course and category management helper class.

Copyright: 2013 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 940 lines (38 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

helper:: (31 methods):
  get_course_detail_array()
  get_category_listitem_actions()
  get_course_listitem_actions()
  get_course_detail_actions()
  action_course_change_sortorder_up_one()
  action_course_change_sortorder_down_one()
  action_course_change_sortorder_up_one_by_record()
  action_course_change_sortorder_down_one_by_record()
  action_course_change_sortorder_after_course()
  action_course_show()
  action_course_hide()
  action_course_show_by_record()
  action_course_hide_by_record()
  action_category_change_sortorder_up_one()
  action_category_change_sortorder_down_one()
  action_category_change_sortorder_up_one_by_id()
  action_category_change_sortorder_down_one_by_id()
  action_category_hide()
  action_category_show()
  action_category_show_by_id()
  action_category_hide_by_id()
  action_category_resort_subcategories()
  action_category_resort_courses()
  action_category_move_courses_into()
  get_management_viewmodes()
  search_courses()
  move_courses_into_category()
  get_category_courses_visibility()
  get_category_children_visibility()
  record_expanded_category()
  get_expanded_categories()


Class: helper  - X-Ref

Course and category management interface helper class.

This class provides methods useful to the course and category management interfaces.
Many of the methods on this class are static and serve one of two purposes.
1.  encapsulate functionality in an effort to ensure minimal changes between the different
methods of interaction. Specifically browser, AJAX and webservice.
2.  abstract logic for acquiring actions away from output so that renderers may use them without
having to include any logic or capability checks.

get_course_detail_array(\course_in_list $course)   X-Ref
Returns course details in an array ready to be printed.

param: \course_in_list $course
return: array

get_category_listitem_actions(\coursecat $category)   X-Ref
Returns an array of actions that can be performed upon a category being shown in a list.

param: \coursecat $category
return: array

get_course_listitem_actions(\coursecat $category, \course_in_list $course)   X-Ref
Returns an array of actions for a course listitem.

param: \coursecat $category
param: \course_in_list $course
return: string

get_course_detail_actions(\course_in_list $course)   X-Ref
Returns an array of actions that can be performed on the course being displayed.

param: \course_in_list $course
return: array

action_course_change_sortorder_up_one(\course_in_list $course, \coursecat $category)   X-Ref
Resorts the courses within a category moving the given course up by one.

param: \course_in_list $course
param: \coursecat $category
return: bool

action_course_change_sortorder_down_one(\course_in_list $course, \coursecat $category)   X-Ref
Resorts the courses within a category moving the given course down by one.

param: \course_in_list $course
param: \coursecat $category
return: bool

action_course_change_sortorder_up_one_by_record($courserecordorid)   X-Ref
Resorts the courses within a category moving the given course up by one.

param: int|\stdClass $courserecordorid
return: bool

action_course_change_sortorder_down_one_by_record($courserecordorid)   X-Ref
Resorts the courses within a category moving the given course down by one.

param: int|\stdClass $courserecordorid
return: bool

action_course_change_sortorder_after_course($courserecordorid, $moveaftercourseid)   X-Ref
Changes the sort order so that the first course appears after the second course.

param: int|\stdClass $courserecordorid
param: int $moveaftercourseid
return: bool

action_course_show(\course_in_list $course)   X-Ref
Makes a course visible given a \course_in_list object.

param: \course_in_list $course
return: bool

action_course_hide(\course_in_list $course)   X-Ref
Makes a course hidden given a \course_in_list object.

param: \course_in_list $course
return: bool

action_course_show_by_record($courserecordorid)   X-Ref
Makes a course visible given a course id or a database record.

param: int|\stdClass $courserecordorid
return: bool

action_course_hide_by_record($courserecordorid)   X-Ref
Makes a course hidden given a course id or a database record.

param: int|\stdClass $courserecordorid
return: bool

action_category_change_sortorder_up_one(\coursecat $category)   X-Ref
Resort a categories subcategories shifting the given category up one.

param: \coursecat $category
return: bool

action_category_change_sortorder_down_one(\coursecat $category)   X-Ref
Resort a categories subcategories shifting the given category down one.

param: \coursecat $category
return: bool

action_category_change_sortorder_up_one_by_id($categoryid)   X-Ref
Resort a categories subcategories shifting the given category up one.

param: int $categoryid
return: bool

action_category_change_sortorder_down_one_by_id($categoryid)   X-Ref
Resort a categories subcategories shifting the given category down one.

param: int $categoryid
return: bool

action_category_hide(\coursecat $category)   X-Ref
Makes a category hidden given a \coursecat record.

param: \coursecat $category
return: bool

action_category_show(\coursecat $category)   X-Ref
Makes a category visible given a \coursecat record.

param: \coursecat $category
return: bool

action_category_show_by_id($categoryid)   X-Ref
Makes a category visible given a \coursecat id or database record.

param: int|\stdClass $categoryid
return: bool

action_category_hide_by_id($categoryid)   X-Ref
Makes a category hidden given a \coursecat id or database record.

param: int|\stdClass $categoryid
return: bool

action_category_resort_subcategories(\coursecat $category, $sort, $cleanup = true)   X-Ref
Resorts the sub categories of the given category.

param: \coursecat $category
param: string $sort One of idnumber or name.
param: bool $cleanup If true cleanup will be done, if false you will need to do it manually later.
return: bool

action_category_resort_courses(\coursecat $category, $sort, $cleanup = true)   X-Ref
Resorts the courses within the given category.

param: \coursecat $category
param: string $sort One of fullname, shortname or idnumber
param: bool $cleanup If true cleanup will be done, if false you will need to do it manually later.
return: bool

action_category_move_courses_into(\coursecat $oldcategory, \coursecat $newcategory, array $courseids)   X-Ref
Moves courses out of one category and into a new category.

param: \coursecat $oldcategory The category we are moving courses out of.
param: \coursecat $newcategory The category we are moving courses into.
param: array $courseids The ID's of the courses we want to move.
return: bool True on success.

get_management_viewmodes()   X-Ref
Returns the view modes for the management interface.

return: array

search_courses($search, $blocklist, $modulelist, $page = 0, $perpage = null)   X-Ref
Search for courses with matching params.

Please note that only one of search, blocklist, or modulelist can be specified at a time.
Specifying more than one will result in only the first being used.

param: string $search Words to search for. We search fullname, shortname, idnumber and summary.
param: int $blocklist The ID of a block, courses will only be returned if they use this block.
param: string $modulelist The name of a module (relates to database table name). Only courses containing this module
param: int $page The page number to display, starting at 0.
param: int $perpage The number of courses to display per page.
return: array

move_courses_into_category($categoryorid, $courseids = array()   X-Ref
Moves one or more courses out of the category they are currently in and into a new category.

This function works much the same way as action_category_move_courses_into however it allows courses from multiple
categories to be moved into a single category.

param: int|\coursecat $categoryorid The category to move them into.
param: array|int $courseids An array of course id's or optionally just a single course id.
return: bool True on success or false on failure.

get_category_courses_visibility($categoryid)   X-Ref
Returns an array of courseids and visiblity for all courses within the given category.

param: int $categoryid
return: array

get_category_children_visibility($categoryid)   X-Ref
Returns an array of all categoryids that have the given category as a parent and their visible value.

param: int $categoryid
return: array

record_expanded_category(\coursecat $coursecat, $expanded = true)   X-Ref
Records when a category is expanded or collapsed so that when the user

param: \coursecat $coursecat The category we're working with.
param: bool $expanded True if the category is expanded now.

get_expanded_categories($withpath = null)   X-Ref
Returns the categories that should be expanded when displaying the interface.

param: int|null $withpath If specified a path to require as the parent.
return: \coursecat[] An array of Category ID's to expand.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1