Ejemplo n.º 1
0
 /**
  * Contructor.
  *
  * @param $studentdata int/object/array The data id of a data record or data elements to load manually.
  * @param $classdata object Optional cmclass object to load into the structure.
  * @param $complelements array Optional array of completion elements associated with the class.
  *
  */
 function __construct($studentdata = false, $classdata = false, $compelements = false)
 {
     global $CURMAN;
     parent::datarecord();
     $this->set_table(STUTABLE);
     $this->add_property('id', 'int');
     $this->add_property('classid', 'int', true);
     $this->add_property('userid', 'int', true);
     $this->add_property('enrolmenttime', 'int');
     $this->add_property('completetime', 'int');
     $this->add_property('endtime', 'int');
     $this->add_property('completestatusid', 'int');
     $this->completestatusid = key(student::$completestatusid_values);
     $this->add_property('grade', 'float');
     $this->add_property('credits', 'float');
     $this->add_property('locked', 'int');
     if (is_numeric($studentdata)) {
         $this->data_load_record($studentdata);
     } else {
         if (is_array($studentdata)) {
             $this->data_load_array($studentdata);
         } else {
             if (is_object($studentdata)) {
                 $this->data_load_array(get_object_vars($studentdata));
             }
         }
     }
     $this->load_cmclass($classdata, $compelements);
     if (!empty($this->userid)) {
         $this->user = new user($this->userid);
     } else {
         $this->user = new user();
     }
 }
 /**
  * Contructor.
  *
  * @uses $CURMAN
  * @param $curcrsdata int/object/array The data id of a data record or data elements to load manually.
  */
 function curriculumcourse($curcrsdata = false)
 {
     parent::datarecord();
     $this->set_table(CURCRSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('curriculumid', 'int');
     $this->add_property('courseid', 'int');
     $this->add_property('required', 'int');
     $this->add_property('frequency', 'int');
     $this->add_property('timeperiod', 'string');
     $this->add_property('position', 'int');
     $this->add_property('timecreated', 'int');
     $this->add_property('timemodifieid', 'int');
     if (is_numeric($curcrsdata)) {
         $this->data_load_record($curcrsdata);
     } else {
         if (is_array($curcrsdata)) {
             $this->data_load_array($curcrsdata);
         } else {
             if (is_object($curcrsdata)) {
                 $this->data_load_array(get_object_vars($curcrsdata));
             }
         }
     }
     if (!empty($this->curriculumid)) {
         $this->curriculum = new curriculum($this->curriculumid);
     }
     if (!empty($this->courseid)) {
         $this->course = new course($this->courseid);
     }
 }
Ejemplo n.º 3
0
 /**
  * Contructor.
  *
  * @param $attendancedata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function attendance($attendancedata = false)
 {
     parent::datarecord();
     $this->set_table(ATNTABLE);
     $this->add_property('id', 'int');
     $this->add_property('classid', 'int');
     $this->add_property('userid', 'int');
     $this->add_property('timestart', 'int');
     $this->add_property('timeend', 'int');
     $this->add_property('adduserid', 'int');
     $this->add_property('note', 'string');
     if (is_numeric($attendancedata)) {
         $this->data_load_record($attendancedata);
     } else {
         if (is_array($attendancedata)) {
             $this->data_load_array($attendancedata);
         } else {
             if (is_object($attendancedata)) {
                 $this->data_load_array(get_object_vars($attendancedata));
             }
         }
     }
     if (!empty($this->classid)) {
         $this->cmclass = new cmclass($this->classid);
     }
     if (!empty($this->userid)) {
         $this->user = new user($this->userid);
     }
 }
Ejemplo n.º 4
0
    /**
     * Contructor.
     *
     * @param $environmentdata int/object/array The data id of a data record or data elements to load manually.
     *
     */
    function environment($environmentdata = false)
    {
        parent::datarecord();
        $this->set_table(ENVTABLE);
        $this->add_property('id', 'int');
        $this->add_property('name', 'string');
        $this->add_property('description', 'string');
        $this->add_property('timecreated', 'int');
        $this->add_property('timemodified', 'int');
        if (is_numeric($environmentdata)) {
            $this->data_load_record($environmentdata);
        } else {
            if (is_array($environmentdata)) {
                $this->data_load_array($environmentdata);
            } else {
                if (is_object($environmentdata)) {
                    $this->data_load_array(get_object_vars($environmentdata));
                }
            }
        }
        // STRING - Styles to use for edit form.
        $this->_editstyle = '
.environmenteditform input,
.environmenteditform textarea {
    margin: 0;
    display: block;
}
        ';
    }
Ejemplo n.º 5
0
 /**
  * Contructor.
  *
  * @param $instructordata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function instructor($instructordata = false)
 {
     parent::datarecord();
     $this->set_table(INSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('classid', 'int');
     $this->add_property('userid', 'int');
     $this->add_property('syllabus', 'string');
     $this->add_property('assigntime', 'int');
     $this->add_property('completetime', 'int');
     if (is_numeric($instructordata)) {
         $this->data_load_record($instructordata);
     } else {
         if (is_array($instructordata)) {
             $this->data_load_array($instructordata);
         } else {
             if (is_object($instructordata)) {
                 $this->data_load_array(get_object_vars($instructordata));
             }
         }
     }
     if (!empty($this->classid)) {
         $this->cmclass = new cmclass($this->classid);
     }
     if (!empty($this->userid)) {
         $this->user = new user($this->userid);
     }
 }
 /**
  * Contructor.
  *
  * @param $curriculumstudentdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function curriculumstudent($curriculumstudentdata = false)
 {
     parent::datarecord();
     $this->set_table(CURASSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('userid', 'int');
     $this->add_property('curriculumid', 'int');
     $this->add_property('completed', 'int');
     $this->add_property('timecompleted', 'int');
     $this->add_property('timeexpired', 'int');
     $this->add_property('credits', 'float');
     $this->add_property('locked', 'int');
     $this->add_property('certificatecode', 'string');
     $this->add_property('timecreated', 'int');
     $this->add_property('timemodified', 'int');
     if (is_numeric($curriculumstudentdata)) {
         $this->data_load_record($curriculumstudentdata);
     } else {
         if (is_array($curriculumstudentdata)) {
             $this->data_load_array($curriculumstudentdata);
         } else {
             if (is_object($curriculumstudentdata)) {
                 $this->data_load_array(get_object_vars($curriculumstudentdata));
             }
         }
     }
     if (!empty($this->userid)) {
         $this->user = new user($this->userid);
     }
     if (!empty($this->curriculumid)) {
         $this->curriculum = new curriculum($this->curriculumid);
     }
 }
 /**
  * Contructor.
  *
  * @param $classmoodlecoursedata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function classmoodlecourse($classmoodlecoursedata = false)
 {
     parent::datarecord();
     $this->set_table(CLSMDLTABLE);
     $this->add_property('id', 'int');
     $this->add_property('classid', 'int');
     $this->add_property('moodlecourseid', 'int');
     $this->add_property('siteconfig', 'string');
     $this->add_property('enroltype', 'int');
     $this->add_property('enrolplugin', 'string');
     $this->add_property('timemodified', 'int');
     if (is_numeric($classmoodlecoursedata)) {
         $this->data_load_record($classmoodlecoursedata);
     } else {
         if (is_array($classmoodlecoursedata)) {
             $this->data_load_array($classmoodlecoursedata);
         } else {
             if (is_object($classmoodlecoursedata)) {
                 $this->data_load_array(get_object_vars($classmoodlecoursedata));
             }
         }
     }
     if (!empty($this->classid)) {
         $this->class = new cmclass($this->classid);
     }
 }
Ejemplo n.º 8
0
 /**
  * Constructor.
  *
  * @param $clusterdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function cluster($clusterdata = false)
 {
     global $CURMAN;
     parent::datarecord();
     $this->set_table(CLSTTABLE);
     $this->add_property('id', 'int');
     $this->add_property('name', 'string');
     $this->add_property('display', 'string');
     $this->add_property('leader', 'int');
     $this->add_property('parent', 'int');
     $this->add_property('depth', 'int');
     if (is_numeric($clusterdata)) {
         $this->data_load_record($clusterdata);
     } else {
         if (is_array($clusterdata)) {
             $this->data_load_array($clusterdata);
         } else {
             if (is_object($clusterdata)) {
                 $this->data_load_array(get_object_vars($clusterdata));
             }
         }
     }
     if (!empty($this->id)) {
         // custom fields
         $level = context_level_base::get_custom_context_level('cluster', 'block_curr_admin');
         if ($level) {
             $fielddata = field_data::get_for_context(get_context_instance($level, $this->id));
             $fielddata = $fielddata ? $fielddata : array();
             foreach ($fielddata as $name => $value) {
                 $this->{"field_{$name}"} = $value;
             }
         }
     }
     /*
      * profile_field1 -select box
      * profile_value1 -select box corresponding to profile_field1
      *
      * profile_field2 -select box
      * profile_value2 -select box corresponding to profile_field2
      */
     $prof_fields = $CURMAN->db->get_records(CLSTPROFTABLE, 'clusterid', $this->id, '', '*', 0, 2);
     if (!empty($prof_fields)) {
         foreach (range(1, 2) as $i) {
             $profile = pos($prof_fields);
             if (!empty($profile)) {
                 $field = 'profile_field' . $i;
                 $value = 'profile_value' . $i;
                 $this->{$field} = $profile->fieldid;
                 $this->{$value} = $profile->value;
             }
             next($prof_fields);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Contructor.
  *
  * @param $coursedata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function course($coursedata = false)
 {
     parent::datarecord();
     $this->set_table(CRSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('name', 'string', true);
     $this->add_property('code', 'string');
     $this->add_property('idnumber', 'string', true);
     $this->add_property('syllabus', 'string');
     $this->add_property('documents', 'string');
     $this->add_property('lengthdescription', 'string');
     $this->add_property('length', 'int');
     $this->add_property('credits', 'string');
     $this->add_property('completion_grade', 'int');
     $this->add_property('environmentid', 'int');
     $this->add_property('cost', 'string');
     $this->add_property('timecreated', 'int');
     $this->add_property('timemodified', 'int');
     $this->add_property('version', 'string');
     if (is_numeric($coursedata)) {
         $this->data_load_record($coursedata);
     } else {
         if (is_array($coursedata)) {
             $this->data_load_array($coursedata);
         } else {
             if (is_object($coursedata)) {
                 $this->data_load_array(get_object_vars($coursedata));
             }
         }
     }
     if (!empty($this->environmentid)) {
         $this->environment = new environment($this->environmentid);
     }
     // FIXME: this should be done every time the template is updated, i.e. through getter/setter methods
     global $CURMAN;
     if (!empty($this->id)) {
         $template = new coursetemplate($this->id);
         $course = $CURMAN->db->get_record('course', 'id', $template->location);
         if (!empty($course)) {
             $this->locationlabel = $course->fullname . ' ' . $course->shortname;
             $this->locationid = $template->location;
         }
         // custom fields
         $level = context_level_base::get_custom_context_level('course', 'block_curr_admin');
         if ($level) {
             $fielddata = field_data::get_for_context(get_context_instance($level, $this->id));
             $fielddata = $fielddata ? $fielddata : array();
             foreach ($fielddata as $name => $value) {
                 $this->{"field_{$name}"} = $value;
             }
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Contructor.
  *
  * @param $cmclassdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 public function cmclass($cmclassdata = false)
 {
     global $CURMAN;
     parent::datarecord();
     $this->set_table(CLSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('idnumber', 'string', true);
     $this->add_property('courseid', 'int', true);
     $this->add_property('startdate', 'int');
     $this->add_property('enddate', 'int');
     $this->add_property('duration', 'int');
     $this->add_property('starttimehour', 'int');
     $this->add_property('starttimeminute', 'int');
     $this->add_property('endtimehour', 'int');
     $this->add_property('endtimeminute', 'int');
     $this->add_property('maxstudents', 'int');
     $this->add_property('environmentid', 'int');
     $this->add_property('enrol_from_waitlist', 'int');
     if (is_numeric($cmclassdata)) {
         $this->data_load_record($cmclassdata);
     } else {
         if (is_array($cmclassdata)) {
             $this->data_load_array($cmclassdata);
         } else {
             if (is_object($cmclassdata)) {
                 $this->data_load_array(get_object_vars($cmclassdata));
             }
         }
     }
     if (!empty($this->id)) {
         // custom fields
         $level = context_level_base::get_custom_context_level('class', 'block_curr_admin');
         if ($level) {
             $fielddata = field_data::get_for_context(get_context_instance($level, $this->id));
             $fielddata = $fielddata ? $fielddata : array();
             foreach ($fielddata as $name => $value) {
                 $this->{"field_{$name}"} = $value;
             }
         }
     }
     if (!empty($this->courseid)) {
         $this->course = new course($this->courseid);
     }
     if (!empty($this->environmentid)) {
         $this->environment = new environment($this->environmentid);
     }
     $this->moodlecourseid = $this->get_moodle_course_id();
 }
Ejemplo n.º 11
0
 /**
  * Constructor.
  *
  * @param int|object|array $data The data id of a data record or data
  * elements to load manually.
  *
  */
 function usertrack($data = false)
 {
     parent::datarecord();
     $this->set_table(USRTRKTABLE);
     $this->add_property('id', 'int');
     $this->add_property('userid', 'int', true);
     $this->add_property('trackid', 'int', true);
     if (is_numeric($data)) {
         $this->data_load_record($data);
     } else {
         if (is_array($data)) {
             $this->data_load_array($data);
         } else {
             if (is_object($data)) {
                 $this->data_load_array(get_object_vars($data));
             }
         }
     }
 }
Ejemplo n.º 12
0
 /**
  * Constructor.
  *
  * @param $clusterdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function usercluster($data = false)
 {
     parent::datarecord();
     $this->set_table(CLSTUSERTABLE);
     $this->add_property('id', 'int');
     $this->add_property('userid', 'int');
     $this->add_property('clusterid', 'int');
     $this->add_property('autoenrol', 'int');
     if (is_numeric($data)) {
         $this->data_load_record($data);
     } else {
         if (is_array($data)) {
             $this->data_load_array($data);
         } else {
             if (is_object($data)) {
                 $this->data_load_array(get_object_vars($data));
             }
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Contructor.
  *
  * @param $curriculumdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function curriculum($curriculumdata = false)
 {
     parent::datarecord();
     $this->set_table(CURTABLE);
     $this->add_property('id', 'int');
     $this->add_property('idnumber', 'string', true);
     $this->add_property('name', 'string', true);
     $this->add_property('description', 'string');
     $this->add_property('reqcredits', 'float');
     $this->add_property('iscustom', 'int');
     $this->add_property('timecreated', 'int');
     $this->add_property('timemodified', 'int');
     $this->add_property('timetocomplete', 'string');
     $this->add_property('frequency', 'string');
     $this->add_property('priority', 'int');
     if (is_numeric($curriculumdata)) {
         $this->data_load_record($curriculumdata);
     } else {
         if (is_array($curriculumdata)) {
             $this->data_load_array($curriculumdata);
         } else {
             if (is_object($curriculumdata)) {
                 $this->data_load_array(get_object_vars($curriculumdata));
             }
         }
     }
     if (!empty($this->userid)) {
         $this->user = new user($this->userid);
     }
     if (!empty($this->id)) {
         // custom fields
         $level = context_level_base::get_custom_context_level('curriculum', 'block_curr_admin');
         if ($level) {
             $fielddata = field_data::get_for_context(get_context_instance($level, $this->id));
             $fielddata = $fielddata ? $fielddata : array();
             foreach ($fielddata as $name => $value) {
                 $this->{"field_{$name}"} = $value;
             }
         }
     }
 }
Ejemplo n.º 14
0
 function coursetemplate($templatedata = false)
 {
     parent::datarecord();
     //TODO: change property and db column from 'locaton' to 'courseid'
     $this->set_table(CTTABLE);
     $this->add_property('id', 'int');
     $this->add_property('courseid', 'int');
     $this->add_property('location', 'string');
     $this->add_property('templateclass', 'string');
     if (is_numeric($templatedata)) {
         $this->data_load_record($templatedata);
     } else {
         if (is_array($templatedata)) {
             $this->data_load_array($templatedata);
         } else {
             if (is_object($templatedata)) {
                 $this->data_load_array(get_object_vars($templatedata));
             }
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * Contructor.
  *
  * @param $tagdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function tag($tagdata = false)
 {
     parent::datarecord();
     $this->set_table(TAGTABLE);
     $this->add_property('id', 'int');
     $this->add_property('name', 'string');
     $this->add_property('description', 'string');
     $this->add_property('timecreated', 'int');
     $this->add_property('timemodified', 'int');
     if (is_numeric($tagdata)) {
         $this->data_load_record($tagdata);
     } else {
         if (is_array($tagdata)) {
             $this->data_load_array($tagdata);
         } else {
             if (is_object($tagdata)) {
                 $this->data_load_array(get_object_vars($tagdata));
             }
         }
     }
 }
 /**
  * Constructor.
  *
  * @param $clusterdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function clusterassignment($data = false)
 {
     parent::datarecord();
     $this->set_table(CLSTASSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('clusterid', 'int');
     $this->add_property('userid', 'int');
     $this->add_property('plugin', 'string');
     $this->add_property('autoenrol', 'int');
     $this->add_property('leader', 'int');
     if (is_numeric($data)) {
         $this->data_load_record($data);
     } else {
         if (is_array($data)) {
             $this->data_load_array($data);
         } else {
             if (is_object($data)) {
                 $this->data_load_array(get_object_vars($data));
             }
         }
     }
 }
 function clusterclassification($data = false)
 {
     parent::datarecord();
     $this->set_table(CLUSTERCLASSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('shortname', 'string');
     $this->add_property('name', 'string');
     $this->add_property('params', 'string');
     if (is_numeric($data) || is_string($data)) {
         $this->data_load_record($data);
     } else {
         if (is_array($data)) {
             $this->data_load_array($data);
         } else {
             if (is_object($data)) {
                 $this->data_load_array(get_object_vars($data));
             }
         }
     }
     if (empty($this->params)) {
         $this->params = serialize(array());
     }
 }
Ejemplo n.º 18
0
 function field_category_contextlevel($data = false)
 {
     parent::datarecord();
     $this->set_table(FIELDCATEGORYCONTEXTTABLE);
     $this->add_property('id', 'int');
     $this->add_property('categoryid', 'int');
     $this->add_property('contextlevel', 'int');
     if (is_numeric($data) || is_string($data)) {
         $this->data_load_record($data);
     } else {
         if (is_array($data)) {
             $this->data_load_array($data);
         } else {
             if (is_object($data)) {
                 $this->data_load_array(get_object_vars($data));
             }
         }
     }
 }
Ejemplo n.º 19
0
 function trackassignmentclass($trackassign = false)
 {
     parent::datarecord();
     $this->set_table(TRACKCLASSTABLE);
     $this->add_property('id', 'int');
     $this->add_property('trackid', 'int');
     $this->add_property('classid', 'int');
     $this->add_property('courseid', 'int');
     $this->add_property('autoenrol', 'int');
     if (is_numeric($trackassign)) {
         $this->data_load_record($trackassign);
     } else {
         if (is_array($trackassign)) {
             $this->data_load_array($trackassign);
         } else {
             if (is_object($trackassign)) {
                 $this->data_load_array(get_object_vars($trackassign));
             }
         }
     }
 }
Ejemplo n.º 20
0
 /**
  * Contructor.
  *
  * @param $userdata int/object/array The data id of a data record or data elements to load manually.
  *
  */
 function user($userdata = false)
 {
     parent::datarecord();
     $this->set_table(USRTABLE);
     $this->add_property('id', 'int');
     $this->add_property('idnumber', 'string', true);
     $this->add_property('username', 'string', true);
     $this->add_property('password', 'string', true);
     $this->add_property('firstname', 'string', true);
     $this->add_property('lastname', 'string', true);
     $this->add_property('mi', 'string');
     $this->add_property('email', 'string', true);
     $this->add_property('email2', 'string');
     $this->add_property('address', 'string');
     $this->add_property('address2', 'string');
     $this->add_property('city', 'string');
     $this->add_property('state', 'string');
     $this->add_property('country', 'string', true);
     $this->add_property('phone', 'string');
     $this->add_property('phone2', 'string');
     $this->add_property('fax', 'string');
     $this->add_property('postalcode', 'string');
     $this->add_property('birthdate', 'string');
     $this->add_property('gender', 'string');
     $this->add_property('language', 'string');
     $this->add_property('transfercredits', 'string');
     $this->add_property('comments', 'string');
     $this->add_property('notes', 'string');
     $this->add_property('timecreated', 'int');
     $this->add_property('timeapproved', 'int');
     $this->add_property('timemodified', 'int');
     $this->add_property('inactive', 'int');
     if (is_numeric($userdata) || is_string($userdata)) {
         $this->data_load_record($userdata);
     } else {
         if (is_array($userdata)) {
             $this->data_load_array($userdata);
         } else {
             if (is_object($userdata)) {
                 $this->data_load_array(get_object_vars($userdata));
             }
         }
     }
     if (!empty($this->id)) {
         /// Load any other data we may want that is associated with the id number...
         if ($clusters = cluster_get_user_clusters($this->id)) {
             $this->load_cluster_info($clusters);
         }
         // custom fields
         $level = context_level_base::get_custom_context_level('user', 'block_curr_admin');
         if ($level) {
             $fielddata = field_data::get_for_context(get_context_instance($level, $this->id));
             $fielddata = $fielddata ? $fielddata : array();
             foreach ($fielddata as $name => $value) {
                 $this->{"field_{$name}"} = $value;
             }
         }
     }
     // TODO: move this to accessors (set or get) so that birthdate and birthday/month/year are always in sync
     if (isset($this->birthdate)) {
         $birthdateparts = explode('/', $this->birthdate);
         if (!empty($birthdateparts[1])) {
             $this->birthday = $birthdateparts[2];
             $this->birthmonth = $birthdateparts[1];
             $this->birthyear = $birthdateparts[0];
         } else {
             $this->birthday = 0;
             $this->birthmonth = 0;
             $this->birthyear = 0;
         }
     }
 }