Search moodle.org's
Developer Documentation


  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows - http://windows.php.net/download/), PHP 7 is NOT supported
  • Differences Between: [Versions 28 and 30] [Versions 28 and 31] [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

    A class for representing question categories.

    Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 484 lines (19 kb)
    Included or required:0 times
    Referenced: 1 time
    Includes or requires: 0 files

    Defines 3 classes

    question_category_list:: (2 methods):
      __construct()
      get_records()

    question_category_list_item:: (2 methods):
      set_icon_html()
      item_html()

    question_category_object:: (15 methods):
      question_category_object()
      initialize()
      display_user_interface()
      output_new_table()
      output_edit_lists()
      get_course_ids()
      edit_single_category()
      set_viable_parents()
      get_question_categories()
      delete_category()
      move_questions_and_delete_category()
      display_move_form()
      move_questions()
      add_category()
      update_category()


    Class: question_category_list  - X-Ref

    Class representing a list of question categories

    __construct($type='ul', $attributes='', $editable = false, $pageurl=null, $page = 0, $pageparamname = 'page', $itemsperpage = 20, $context = null)   X-Ref


    get_records()   X-Ref
    No description

    Class: question_category_list_item  - X-Ref

    An item in a list of question categories.

    set_icon_html($first, $last, $lastitem)   X-Ref
    No description

    item_html($extraargs = array()   X-Ref
    No description

    Class: question_category_object  - X-Ref

    Class representing q question category

    question_category_object($page, $pageurl, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts)   X-Ref
    Constructor

    Gets necessary strings and sets relevant path information

    initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts)   X-Ref
    Initializes this classes general category-related variables


    display_user_interface()   X-Ref
    Displays the user interface


    output_new_table()   X-Ref
    Outputs a table to allow entry of a new category


    output_edit_lists()   X-Ref
    Outputs a list to allow editing/rearranging of existing categories

    $this->initialize() must have already been called


    get_course_ids($categories)   X-Ref
    gets all the courseids for the given categories

    return: array courseids flat array in form categoryid=>courseid
    param: array categories contains category objects in  a tree representation

    edit_single_category($categoryid)   X-Ref
    No description

    set_viable_parents(&$parentstrings, $category)   X-Ref
    Sets the viable parents

    Viable parents are any except for the category itself, or any of it's descendants
    The parentstrings parameter is passed by reference and changed by this function.

    param: array parentstrings a list of parentstrings
    param: object category

    get_question_categories($parent=null, $sort="sortorder ASC")   X-Ref
    Gets question categories

    return: array categories
    param: int parent - if given, restrict records to those with this parent id.
    param: string sort - [[sortfield [,sortfield]] {ASC|DESC}]

    delete_category($categoryid)   X-Ref
    Deletes an existing question category

    param: int deletecat id of category to delete

    move_questions_and_delete_category($oldcat, $newcat)   X-Ref
    No description

    display_move_form($questionsincategory, $category)   X-Ref
    No description

    move_questions($oldcat, $newcat)   X-Ref
    No description

    add_category($newparent, $newcategory, $newinfo, $return = false, $newinfoformat = FORMAT_HTML)   X-Ref
    Creates a new category with given params


    update_category($updateid, $newparent, $newname, $newinfo, $newinfoformat = FORMAT_HTML)   X-Ref
    Updates an existing category with given params


    Search This Site: