*/
class question_category_object {
- var $str;
/**
- * Nested lists to display categories.
- *
- * @var array
+ * @var array common language strings.
*/
- var $editlists = array();
- var $newtable;
- var $tab;
- var $tabsize = 3;
+ public $str;
+
+ /**
+ * @var array nested lists to display categories.
+ */
+ public $editlists = array();
+ public $newtable;
+ public $tab;
+ public $tabsize = 3;
/**
* @var moodle_url Object representing url for this page
*/
- var $pageurl;
+ public $pageurl;
+
/**
* @var question_category_edit_form Object representing form for adding / editing categories.
*/
- var $catform;
+ public $catform;
/**
* Constructor
/**
* Creates a new category with given params
*/
- public function add_category($newparent, $newcategory, $newinfo, $return = false) {
+ public function add_category($newparent, $newcategory, $newinfo, $return = false, $newinfoformat = FORMAT_HTML) {
global $DB;
if (empty($newcategory)) {
print_error('categorynamecantbeblank', 'question');
$cat->contextid = $contextid;
$cat->name = $newcategory;
$cat->info = $newinfo;
+ $cat->infoformat = $newinfoformat;
$cat->sortorder = 999;
$cat->stamp = make_unique_id_code();
$categoryid = $DB->insert_record("question_categories", $cat);
/**
* Updates an existing category with given params
*/
- public function update_category($updateid, $newparent, $newname, $newinfo) {
+ public function update_category($updateid, $newparent, $newname, $newinfo, $newinfoformat = FORMAT_HTML) {
global $CFG, $DB;
if (empty($newname)) {
print_error('categorynamecantbeblank', 'question');
$cat->id = $updateid;
$cat->name = $newname;
$cat->info = $newinfo;
+ $cat->infoformat = $newinfoformat;
$cat->parent = $parentid;
$cat->contextid = $tocontextid;
$DB->update_record('question_categories', $cat);