function __construct($data)
 {
     global $COURSE;
     parent::__construct($data);
     $this->type = 'datarecord';
     $this->fields = array();
     // fields are only used for pointing a data record
     $datainstances = get_records('data', 'course', $COURSE->id, '', 'id,name');
     foreach ($datainstances as $data) {
         $dataopts[] = $data->name;
     }
     unset($field);
     $field->name = 'key';
     $field->type = 'list';
     $field->options = $datainstances;
     $field->admin = true;
     $this->fields['key'] = $field;
     unset($field);
     $field->name = 'key';
     $field->type = 'list';
     $field->options = 'list';
     $field->admin = true;
     $this->fields['key'] = $field;
     $this->datasource = array('USER/id', 'USER/login', 'COURSE/id', 'COURSE/shortname', 'COURSE/category');
     unset($field);
     $field->name = 'keysource';
     $field->type = 'list';
     $field->options = $sourceopts;
     $field->admin = true;
     $this->fields['keysource'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taoauthordata';
     $this->fields = array();
     $field->name = 'authors';
     $field->type = 'textfield';
     $field->size = 80;
     $this->fields['authors'] = $field;
     unset($field);
     $field->name = 'contact';
     $field->type = 'textfield';
     $field->size = 60;
     $this->fields['contact'] = $field;
     unset($field);
     $field->name = 'organization';
     $field->type = 'textfield';
     $field->size = 120;
     $this->fields['organization'] = $field;
     unset($field);
     $field->name = 'contributors';
     $field->type = 'textfield';
     $field->size = 80;
     $this->fields['contributors'] = $field;
     unset($field);
     $field->name = 'version';
     $field->type = 'textfield';
     $field->size = 40;
     $this->fields['version'] = $field;
 }
 function __construct($data)
 {
     global $DB;
     parent::__construct($data);
     $this->type = 'worktodo';
     $this->fields = array();
     $this->allowedpageformats = 'page';
     $field = new StdClass();
     $field->name = 'worktodo';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['worktodo'] = $field;
     $field = new StdClass();
     $field->name = 'estimatedworktime';
     $field->type = 'textfield';
     $field->size = 10;
     $this->fields['estimatedworktime'] = $field;
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKTYPE'))) {
         $field = new StdClass();
         $field->name = 'worktypefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['worktypefield'] = $field;
     } else {
         // echo "no field for WORKTYPE ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKEFFORT'))) {
         $field = new StdClass();
         $field->name = 'workeffortfield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workeffortfield'] = $field;
     } else {
         // echo "no field for WORKEFFORT ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKMODE'))) {
         $field = new StdClass();
         $field->name = 'workmodefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workmodefield'] = $field;
     } else {
         // echo "no field for WORKMODE ";
     }
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taotargetdata';
     $this->fields = array();
     $field->name = 'sample';
     $field->type = 'textfield';
     $field->size = 60;
     $this->fields['sample'] = $field;
     unset($field);
     $field->name = 'goal';
     $field->type = 'textarea';
     $this->fields['goal'] = $field;
     unset($field);
     $field->name = 'b2i';
     $field->type = 'list';
     $field->multiple = 'multiple';
     $field->options = array('b2i_d1', 'b2i_d2', 'b2i_d3', 'b2i_d4', 'b2i_d5');
     $this->fields['b2i'] = $field;
     unset($field);
     $field->name = 'method';
     $field->type = 'textfield';
     $field->size = 100;
     $this->fields['method'] = $field;
     unset($field);
     $field->name = 'tools';
     $field->type = 'textarea';
     $this->fields['tools'] = $field;
     unset($field);
     $field->name = 'activityduration';
     $field->type = 'textfield';
     $field->size = 40;
     $this->fields['activityduration'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'definition';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'definition';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['definition'] = $field;
     if (!isset($data->subdefsnum)) {
         // second chance, get it from stored data
         $storeddata = json_decode(base64_decode(@$this->data->content));
         $subdefsnum = !empty($storeddata->subdefsnum) ? $storeddata->subdefsnum : 0;
     } else {
         $subdefsnum = $data->subdefsnum;
     }
     $field = new StdClass();
     $field->name = 'subdefsnum';
     $field->type = 'list';
     $field->options = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10');
     $field->straightoptions = true;
     $this->fields['subdefsnum'] = $field;
     for ($i = 0; $i < $subdefsnum; $i++) {
         $field = new StdClass();
         $field->name = 'subdef' . $i;
         $field->type = 'textarea';
         $field->size = 60;
         $this->fields['subdef' . $i] = $field;
     }
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'commentbox';
     $this->fields = array();
     $field->name = 'comment';
     $field->type = 'textarea';
     $this->fields[] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'pedagogicadvice';
     $this->fields = array();
     $field->name = 'advice';
     $field->type = 'textarea';
     $this->fields['advice'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'seealso';
     $this->fields = array();
     $field->name = 'seealso';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['seealso'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'important';
     $this->fields = array();
     $field->name = 'importantnote';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['importantnote'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'tipsandtricks';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'tipsandtricks';
     $field->type = 'textarea';
     $this->fields['tipsandtricks'] = $field;
 }
 public function __construct($data)
 {
     global $CFG, $COURSE, $PAGE;
     parent::__construct($data);
     $this->type = 'courseheading';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'showdescription';
     $field->type = 'choiceyesno';
     $this->fields['showdescription'] = $field;
     $field = new StdClass();
     $field->name = 'showshortname';
     $field->type = 'choiceyesno';
     $this->fields['showshortname'] = $field;
     $field = new StdClass();
     $field->name = 'showidnumber';
     $field->type = 'choiceyesno';
     $this->fields['showidnumber'] = $field;
     $field = new StdClass();
     $field->name = 'showcategory';
     $field->type = 'choiceyesno';
     $this->fields['showcategory'] = $field;
     $field = new StdClass();
     $field->name = 'image';
     $field->type = 'filepicker';
     $field->destination = 'url';
     if ($PAGE->state >= moodle_page::STATE_IN_BODY) {
         if (!is_file($CFG->dirroot . '/theme/' . $PAGE->theme->name . '/pix/customlabel_icons/defaultcourseheading.png')) {
             $field->default = $CFG->wwwroot . '/mod/customlabel/type/courseheading/defaultheading.png';
         } else {
             $field->default = $CFG->wwwroot . '/theme/' . $PAGE->theme->name . '/pix/customlabel_icons/defaultcourseheading.png';
         }
     } else {
         $field->default = $CFG->wwwroot . '/mod/customlabel/type/courseheading/defaultheading.png';
     }
     $this->fields['image'] = $field;
     $field = new StdClass();
     $field->name = 'overimagetext';
     $field->type = 'textfield';
     $field->size = 20;
     $field->default = '';
     $this->fields['overimagetext'] = $field;
     $field = new StdClass();
     $field->name = 'imageposition';
     $field->type = 'list';
     $field->options = array('none', 'left', 'right');
     $field->default = 'none';
     $this->fields['imageposition'] = $field;
     $field = new StdClass();
     $field->name = 'moduletype';
     $field->type = 'textfield';
     $field->size = 40;
     $field->default = get_string('trainingmodule', 'customlabeltype_courseheading');
     $this->fields['moduletype'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'localgoals';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'localgoals';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['localgoals'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'text';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'textcontent';
     $field->type = 'textarea';
     $field->lines = 20;
     $this->fields['textcontent'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'tao_lp_station7';
     $this->fields = array();
     $field->name = 'lp_content';
     $field->type = 'textarea';
     $field->size = 255;
     $this->fields['lp_content'] = $field;
     unset($field);
     $field->name = 'status';
     $field->type = 'list';
     $field->options = array('draft', 'completed', 'reviewed');
     $this->fields['status'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taolpheading';
     $this->fields = array();
     $field->name = 'subtitle';
     $field->type = 'textfield';
     $field->size = 60;
     $this->fields['subtitle'] = $field;
     unset($field);
     $field->name = 'disciplin';
     $field->type = 'list';
     $field->options = array('mathematics', 'biology', 'chemistry', 'physics', 'computers', 'othersciences', 'french', 'english', 'german', 'spanish', 'italian', 'foreignlanguages', 'social', 'geography', 'economy', 'hostory', 'arts', 'music', 'sport', 'it', 'other');
     $this->fields['disciplin'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taolpsubpageheading';
     $this->fields = array();
     $field->name = 'pagetitle';
     $field->type = 'textfield';
     $field->size = 255;
     $this->fields['pagetitle'] = $field;
     unset($field);
     $field->name = 'step';
     $field->type = 'list';
     $field->options = array('taostep1', 'taostep2', 'taostep3', 'taostep4', 'taostep5', 'taostep6', 'taostep7');
     $this->fields['step'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'pedagogicadvice';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'advice';
     $field->type = 'textarea';
     $this->fields['advice'] = $field;
     $field = new StdClass();
     $field->type = 'choiceyesno';
     $field->name = 'initiallyvisible';
     $field->default = 1;
     $this->fields['initiallyvisible'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taolpdistheading';
     $this->fields = array();
     $field->name = 'subtitle';
     $field->type = 'textfield';
     $field->size = 60;
     $this->fields['subtitle'] = $field;
     unset($field);
     $field->name = 'disciplin';
     $field->type = 'list';
     $field->multiple = 'multiple';
     $field->options = array('maths', 'francais', 'histoire', 'geographie', 'technologie', 'arts_plastiques', 'informatique', 'biologie', 'langues');
     $this->fields['disciplin'] = $field;
 }
 function __construct($data)
 {
     global $CFG, $PAGE;
     parent::__construct($data);
     $this->type = 'sequenceheading';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'heading';
     $field->size = 80;
     $field->type = 'textfield';
     $this->fields['heading'] = $field;
     $field = new StdClass();
     $field->name = 'shortdesc';
     $field->type = 'textarea';
     $this->fields['shortdesc'] = $field;
     $field = new StdClass();
     $field->name = 'image';
     $field->type = 'filepicker';
     $field->destination = 'url';
     if ($PAGE->state >= moodle_page::STATE_IN_BODY) {
         if (!is_file($CFG->dirroot . '/theme/' . $PAGE->theme->name . '/pix/customlabel_icons/defaultsequenceheading.png')) {
             $field->default = $CFG->wwwroot . '/mod/customlabel/type/sequenceheading/defaultsequenceheading.jpg';
         } else {
             $field->default = $CFG->wwwroot . '/theme/' . $PAGE->theme->name . '/pix/customlabel_icons/defaultsequenceheading.png';
         }
     } else {
         $field->default = $CFG->wwwroot . '/mod/customlabel/type/sequenceheading/defaultsequenceheading.jpg';
     }
     $this->fields['image'] = $field;
     $field = new StdClass();
     $field->name = 'overimagetext';
     $field->type = 'textfield';
     $field->size = 20;
     $this->fields['overimagetext'] = $field;
     $field = new StdClass();
     $field->name = 'imageposition';
     $field->type = 'list';
     $field->options = array('none', 'left', 'right');
     $field->default = 'none';
     $this->fields['imageposition'] = $field;
     $field = new StdClass();
     $field->name = 'verticalalign';
     $field->type = 'list';
     $field->options = array('top', 'middle', 'bottom');
     $field->default = 'top';
     $this->fields['verticalalign'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'contactpoint';
     $this->fields = array();
     /* $this->allowedpageformats = 'page'; */
     $field = new StdClass();
     $field->name = 'instructions';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['instructions'] = $field;
     $field = new Stdclass();
     $field->name = 'contacttype';
     $field->type = 'list';
     $field->options = array('any', 'anywritten', 'mail', 'phone', 'onlinevocal', 'chat', 'meeting', 'facetoface');
     $this->fields['contacttype'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'taolpdata';
     $this->fields = array();
     $field->name = 'topic';
     $field->type = 'textfield';
     $field->size = 60;
     $this->fields['topic'] = $field;
     unset($field);
     $field->name = 'goal';
     $field->type = 'textarea';
     $this->fields['goal'] = $field;
     unset($field);
     $field->name = 'c2i';
     $field->type = 'list';
     $field->multiple = 'multiple';
     $field->options = array('A1', 'A11', 'A12', 'A13', 'A14', 'A15', 'A2', 'A21', 'A22', 'A23', 'A3', 'A31', 'A32', 'A33', 'A34', 'B1', 'B11', 'B12', 'B13', 'B2', 'B21', 'B22', 'B23', 'B24', 'B3', 'B31', 'B32', 'B33', 'B34', 'B35', 'B4', 'B41', 'B42', 'B43');
     $this->fields['c2i'] = $field;
     unset($field);
     $field->name = 'disciplin';
     $field->type = 'list';
     $field->multiple = 'multiple';
     $field->options = array('anglais', 'allemand', 'arts_plastiques', 'education_civique', 'espagnol', 'francais', 'geographie', 'histoire', 'informatique', 'it', 'italien', 'langues', 'mathematiques', 'musique', 'physique', 'technologie', 'sciences_de_la_vie');
     $this->fields['disciplin'] = $field;
     unset($field);
     $field->name = 'target';
     $field->type = 'textfield';
     $field->size = 80;
     $this->fields['target'] = $field;
     unset($field);
     $field->name = 'duration';
     $field->type = 'textfield';
     $field->size = 80;
     $this->fields['duration'] = $field;
     unset($field);
     $field->name = 'prerequisite';
     $field->type = 'textarea';
     $this->fields[] = $field;
     unset($field);
     $field->name = 'equipment';
     $field->type = 'textarea';
     $this->fields[] = $field;
 }
 function __construct($data)
 {
     global $CFG;
     parent::__construct($data);
     $this->type = 'sequenceheading';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'heading';
     $field->size = 80;
     $field->type = 'textfield';
     $this->fields['heading'] = $field;
     $field = new StdClass();
     $field->name = 'shortdesc';
     $field->type = 'textarea';
     $this->fields['shortdesc'] = $field;
     $field = new StdClass();
     $field->name = 'imageurl';
     $field->type = 'textfield';
     $field->size = 60;
     if (!is_file($CFG->dirroot . '/theme/' . current_theme() . '/pix/customlabel_icons/defaultsequenceheading.png')) {
         $field->default = $CFG->wwwroot . '/mod/customlabel/type/sequenceheading/defaultsequenceheading.jpg';
     } else {
         $field->default = $CFG->wwwroot . '/theme/' . current_theme() . '/pix/customlabel_icons/defaultsequenceheading.png';
     }
     $this->fields['imageurl'] = $field;
     $field = new StdClass();
     $field->name = 'overimagetext';
     $field->type = 'textfield';
     $field->size = 20;
     $this->fields['overimagetext'] = $field;
     $field = new StdClass();
     $field->name = 'imageposition';
     $field->type = 'list';
     $field->options = array('none', 'left', 'right');
     $field->default = 'left';
     $this->fields['imageposition'] = $field;
     $field = new StdClass();
     $field->name = 'verticalalign';
     $field->type = 'list';
     $field->options = array('top', 'middle', 'bottom');
     $field->default = 'top';
     $this->fields['verticalalign'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'keypoints';
     $this->fields = array();
     $storeddata = json_decode(base64_decode(@$this->data->content));
     $keypointnum = !empty($storeddata->keypointnum) ? $storeddata->keypointnum : 3;
     $field = new StdClass();
     $field->name = 'keypointnum';
     $field->type = 'textfield';
     $field->size = 4;
     $field->default = 3;
     $this->fields['keypointnum'] = $field;
     for ($i = 0; $i < $keypointnum; $i++) {
         $field = new StdClass();
         $field->name = 'keypointitem' . $i;
         $field->type = 'textarea';
         $field->size = 60;
         $this->fields['keypointitem' . $i] = $field;
     }
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'theorema';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'theorema';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['theorema'] = $field;
     if (!isset($data->corollarynum)) {
         // second chance, get it from stored data
         $storeddata = json_decode(base64_decode(@$this->data->content));
         $subdefsnum = !empty($storeddata->corollarynum) ? $storeddata->corollarynum : 0;
     } else {
         $subdefsnum = $data->corollarynum;
     }
     $field = new StdClass();
     $field->name = 'corollarynum';
     $field->type = 'textfield';
     $field->size = 4;
     $field->default = 0;
     $this->fields['corollarynum'] = $field;
     for ($i = 0; $i < $subdefsnum; $i++) {
         $field = new StdClass();
         $field->name = 'corollary' . $i;
         $field->type = 'textarea';
         $field->size = 60;
         $this->fields['corollary' . $i] = $field;
     }
     $field = new StdClass();
     $field->name = 'showdemonstration';
     $field->type = 'choiceyesno';
     $this->fields['showdemonstration'] = $field;
     $field = new StdClass();
     $field->name = 'demonstration';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['demonstration'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'NEWTYPE';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'smalltext';
     $field->type = 'textfield';
     $field->maxlength = 80;
     $this->fields['smalltext'] = $field;
     unset($field);
     $field->name = 'parag';
     $field->type = 'textarea';
     $field->rows = 5;
     $field->cols = 40;
     $this->fields['parag'] = $field;
     unset($field);
     $field->name = 'list';
     $field->type = 'list';
     $field->options = array('opt1', 'opt2');
     // this can be changed to whatever any menu_list
     $this->fields['list'] = $field;
     unset($field);
     $field->name = 'listmultiple[]';
     $field->type = 'list';
     $field->options = array('opt1', 'opt2');
     // this can be changed to whatever any menu_list
     $field->multiple = 1;
     $field->size = 5;
     $this->fields['listmultiple'] = $field;
     unset($field);
     $field->name = 'lockedfield';
     $field->type = 'textfield';
     $field->maxlength = 80;
     $field->fullaccess = 0;
     $field->default = get_string('lockedsample', 'customlabel');
     $this->fields['lockedfield'] = $field;
 }
 function __construct($data)
 {
     global $DB;
     parent::__construct($data);
     $this->type = 'worktodo';
     $this->fields = array();
     $this->allowedpageformats = 'page';
     $field = new StdClass();
     $field->name = 'worktodo';
     $field->type = 'textarea';
     $field->rows = 20;
     $this->fields['worktodo'] = $field;
     $field = new StdClass();
     $field->name = 'estimatedworktime';
     $field->type = 'textfield';
     $field->size = 10;
     $this->fields['estimatedworktime'] = $field;
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKTYPE'))) {
         $field = new StdClass();
         $field->name = 'worktypefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['worktypefield'] = $field;
     } else {
         // echo "no field for WORKTYPE ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKEFFORT'))) {
         $field = new StdClass();
         $field->name = 'workeffortfield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workeffortfield'] = $field;
     } else {
         // echo "no field for WORKEFFORT ";
     }
     if ($fieldid = $DB->get_field('customlabel_mtd_type', 'id', array('code' => 'WORKMODE'))) {
         $field = new StdClass();
         $field->name = 'workmodefield';
         $field->type = 'vdatasource';
         $field->source = 'dbfieldkeyed';
         $field->table = 'customlabel_mtd_value';
         $field->field = 'value';
         $field->key = 'code';
         $field->select = " typeid = {$fieldid} ";
         // $field->multiple = 'multiple';
         $this->fields['workmodefield'] = $field;
     } else {
         // echo "no field for WORKMODE ";
     }
     // An activity module of the course that will be linked to this work requirement for
     // completion signalling, grade, etc.
     $field = new StdClass();
     $field->name = 'linktomodule';
     $field->type = 'vdatasource';
     $field->source = 'function';
     $field->function = 'customlabel_get_candidate_modules';
     $this->fields['linktomodule'] = $field;
 }
 function __construct($data)
 {
     parent::__construct($data);
     $this->type = 'coursedata';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'tablecaption';
     $field->type = 'textfield';
     $this->fields['tablecaption'] = $field;
     $field = new StdClass();
     $field->name = 'showgoals';
     $field->type = 'choiceyesno';
     $this->fields['showgoals'] = $field;
     $field = new StdClass();
     $field->name = 'goals';
     $field->type = 'textarea';
     $this->fields['goals'] = $field;
     $field = new StdClass();
     $field->name = 'showobjectives';
     $field->type = 'choiceyesno';
     $this->fields['showobjectives'] = $field;
     $field = new StdClass();
     $field->name = 'objectives';
     $field->type = 'textarea';
     $this->fields['objectives'] = $field;
     $field = new StdClass();
     $field->name = 'showconcepts';
     $field->type = 'choiceyesno';
     $this->fields['showconcepts'] = $field;
     $field = new StdClass();
     $field->name = 'concepts';
     $field->type = 'textarea';
     $field->size = 80;
     $this->fields['concepts'] = $field;
     $field = new StdClass();
     $field->name = 'showduration';
     $field->type = 'choiceyesno';
     $this->fields['showduration'] = $field;
     $field = new StdClass();
     $field->name = 'duration';
     $field->type = 'textfield';
     $field->size = 80;
     $this->fields['duration'] = $field;
     $field = new StdClass();
     $field->name = 'showteachingorganization';
     $field->type = 'choiceyesno';
     $this->fields['showteachingorganization'] = $field;
     $field = new StdClass();
     $field->name = 'teachingorganization';
     $field->type = 'textarea';
     $field->size = 80;
     $this->fields['teachingorganization'] = $field;
     $field = new StdClass();
     $field->name = 'showprerequisites';
     $field->type = 'choiceyesno';
     $this->fields['showprerequisites'] = $field;
     $field = new StdClass();
     $field->name = 'prerequisites';
     $field->type = 'textarea';
     $this->fields['prerequisites'] = $field;
     $field = new StdClass();
     $field->name = 'showfollowers';
     $field->type = 'choiceyesno';
     $this->fields['showfollowers'] = $field;
     $field = new StdClass();
     $field->name = 'followers';
     $field->type = 'textarea';
     $this->fields['followers'] = $field;
 }
 function __construct($data)
 {
     global $CFG, $DB;
     parent::__construct($data);
     $this->type = 'courseclassifier';
     $this->fields = array();
     $CFG->classification_type_table = 'customlabel_mtd_type';
     $CFG->classification_value_type_key = 'typeid';
     $CFG->course_metadata_table = 'customlabel_course_metadata';
     $CFG->course_metadata_value_key = 'valueid';
     $CFG->course_metadata_course_key = 'courseid';
     $field = new StdClass();
     $field->name = 'tablecaption';
     $field->type = 'textfield';
     $this->fields['tablecaption'] = $field;
     $field = new StdClass();
     $field->name = 'uselevels';
     $field->type = 'list';
     $field->options = array('1', '2', '3');
     $field->straightoptions = true;
     $field->mandatory = true;
     $this->fields['uselevels'] = $field;
     if ($fieldid = $DB->get_field($CFG->classification_type_table, 'id', array('code' => 'LEVEL0'))) {
         $field = new StdClass();
         $field->name = 'level0';
         $field->type = 'datasource';
         $field->source = 'dbfieldkeyed';
         $field->table = $CFG->classification_value_table;
         $field->field = 'value';
         $field->select = $CFG->classification_value_type_key . ' = ' . $fieldid;
         $field->multiple = 'multiple';
         $field->constraintson = 'level1,level2';
         $field->mandatory = true;
         $this->fields['level0'] = $field;
     }
     if ($fieldid = $DB->get_field($CFG->classification_type_table, 'id', array('code' => 'LEVEL1'))) {
         $field = new StdClass();
         $field->name = 'level1';
         $field->type = 'datasource';
         $field->source = 'dbfieldkeyed';
         $field->table = $CFG->classification_value_table;
         $field->field = 'value';
         $field->select = $CFG->classification_value_type_key . ' = ' . $fieldid;
         $field->multiple = 'multiple';
         $field->constraintson = 'level0,level2';
         $field->mandatory = true;
         $this->fields['level1'] = $field;
     }
     if ($fieldid = $DB->get_field($CFG->classification_type_table, 'id', array('code' => 'LEVEL2'))) {
         $field = new StdClass();
         $field->name = 'level2';
         $field->type = 'datasource';
         $field->source = 'dbfieldkeyed';
         $field->table = $CFG->classification_value_table;
         $field->field = 'value';
         $field->select = $CFG->classification_value_type_key . ' = ' . $fieldid;
         $field->multiple = 'multiple';
         $field->constraintson = 'level0,level1';
         $field->mandatory = true;
         $this->fields['level2'] = $field;
     }
     if ($fieldid = $DB->get_field($CFG->classification_type_table, 'id', array('code' => 'PEOPLE'))) {
         $field = new StdClass();
         $field->name = 'showpeople';
         $field->type = 'choiceyesno';
         $this->fields['showpeople'] = $field;
         $field = new StdClass();
         $field->name = 'people';
         $field->type = 'datasource';
         $field->source = 'dbfieldkeyed';
         $field->table = $CFG->classification_value_table;
         $field->field = 'value';
         $field->select = $CFG->classification_value_type_key . ' = ' . $fieldid;
         $field->multiple = 'multiple';
         $field->constraintson = '';
         $field->mandatory = true;
         $this->fields['people'] = $field;
     }
     unset($field);
 }
 function __construct($data)
 {
     global $USER;
     parent::__construct($data);
     $this->type = 'authordata';
     $this->fields = array();
     $field = new StdClass();
     $field->name = 'tablecaption';
     $field->type = 'textfield';
     $this->fields['tablecaption'] = $field;
     $field = new StdClass();
     $field->name = 'author1';
     $field->type = 'textfield';
     $this->fields['author1'] = $field;
     $field = new StdClass();
     $field->name = 'thumb1';
     $field->type = 'filepicker';
     $field->destination = 'url';
     $field->default = '';
     $this->fields['thumb1'] = $field;
     $field = new StdClass();
     $field->name = 'author2';
     $field->type = 'textfield';
     $this->fields['author2'] = $field;
     $field = new StdClass();
     $field->name = 'thumb2';
     $field->type = 'filepicker';
     $field->destination = 'url';
     $field->default = '';
     $this->fields['thumb2'] = $field;
     $field = new StdClass();
     $field->name = 'author3';
     $field->type = 'textfield';
     $this->fields['author3'] = $field;
     $field = new StdClass();
     $field->name = 'thumb3';
     $field->type = 'filepicker';
     $field->destination = 'url';
     $field->default = '';
     $this->fields['thumb3'] = $field;
     $field = new StdClass();
     $field->name = 'showinstitution';
     $field->type = 'choiceyesno';
     $this->fields['showinstitution'] = $field;
     $field = new StdClass();
     $field->name = 'institution';
     $field->type = 'textfield';
     $field->default = @$USER->institution;
     $this->fields['institution'] = $field;
     $field = new StdClass();
     $field->name = 'showdepartment';
     $field->type = 'choiceyesno';
     $this->fields['showdepartment'] = $field;
     $field = new StdClass();
     $field->name = 'department';
     $field->type = 'textfield';
     $field->default = @$USER->department;
     $this->fields['department'] = $field;
     $field = new StdClass();
     $field->name = 'showcontributors';
     $field->type = 'choiceyesno';
     $this->fields['showcontributors'] = $field;
     $field = new StdClass();
     $field->name = 'contributors';
     $field->type = 'textarea';
     $this->fields['contributors'] = $field;
 }