/** * 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 $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. * * @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); } }
/** * 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 $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); } }
/** * 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)); } } } }
/** * 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)); } } } }
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)); } } } }
public function set_from_data($data) { $fields = array('autoenrol_curricula', 'autoenrol_tracks', 'child_classification'); foreach ($fields as $field) { $fieldname = "param_{$field}"; if (isset($data->{$fieldname})) { $this->{$fieldname} = $data->{$fieldname}; } } return parent::set_from_data($data); }
function update() { global $CFG; global $CURMAN; $old = new cluster($this->id); $parent_obj = new cluster($this->parent); $this->depth = empty($parent_obj->depth) ? 1 : $parent_obj->depth + 1; $result = parent::update(); if ($this->parent != $old->parent) { $cluster_context_level = context_level_base::get_custom_context_level('cluster', 'block_curr_admin'); $cluster_context_instance = get_context_instance($cluster_context_level, $this->id); // find all subclusters and adjust their depth $delta_depth = $this->depth - $old->depth; $sql = "UPDATE {$CURMAN->db->prefix_table(CLSTTABLE)}\n SET depth = depth + {$delta_depth}\n WHERE id IN (SELECT instanceid\n FROM {$CURMAN->db->prefix_table('context')}\n WHERE contextlevel = {$cluster_context_level}\n AND path LIKE '{$cluster_context_instance->path}/%')"; execute_sql($sql, false); // Blank out the depth and path for associated records and child records in context table $sql = "UPDATE {$CFG->prefix}context\n SET depth=0, path=NULL\n WHERE id={$cluster_context_instance->id} OR path LIKE '{$cluster_context_instance->path}/%'"; execute_sql($sql, false); // Rebuild any blanked out records in context table build_context_path(); } $plugins = cluster::get_plugins(); foreach ($plugins as $plugin) { require_once CURMAN_DIRLOCATION . '/cluster/' . $plugin . '/lib.php'; call_user_func('cluster_' . $plugin . '_update', $this); } $result = $result && field_data::set_for_context_from_datarecord('cluster', $this); events_trigger('crlm_cluster_updated', $this); return $result; }
public function update() { $result = parent::update(); $result = $result && field_data::set_for_context_from_datarecord('curriculum', $this); // If this setting is changed, we need to update the existing curriclum expiration values (ELIS-1172) if ($rs = get_recordset_select(CURASSTABLE, "timeexpired != 0 AND curriculumid = {$this->id}", '', 'id, userid')) { $timenow = time(); while ($curass = rs_fetch_next_record($rs)) { $update = new stdClass(); $update->id = $curass->id; $update->timeexpired = calculate_curriculum_expiry(NULL, $this->id, $curass->userid); $update->timemodified = $timenow; update_record(CURASSTABLE, $update); } rs_close($rs); } return $result; }
public function update() { $result = parent::update(); if (isset($this->curriculum)) { $this->add_course_to_curricula($this->curriculum); } // Add moodle course template if (isset($this->location)) { $template = new coursetemplate($this->id); $template->location = $this->location; $template->templateclass = $this->templateclass; $template->courseid = $this->id; $template->data_update_record(true); } else { coursetemplate::delete_for_course($this->id); } $result = $result && field_data::set_for_context_from_datarecord('course', $this); return $result; }
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)); } } } }
public function delete() { $status = parent::delete(); cluster::cluster_update_assignments($this->clusterid, $this->userid); return $status; }
/** * * @global <type> $CURMAN */ public function add() { global $CURMAN; if (empty($this->position)) { //SELECT MIN(userid) FROM eli_crlm_wait_list WHERE 1 $sql = 'SELECT ' . sql_max('position') . ' as max FROM ' . $CURMAN->db->prefix_table(WATLSTTABLE) . ' as wl WHERE wl.classid = ' . $this->classid; $max_record = get_record_sql($sql); $max = $max_record->max; $this->position = $max + 1; } $subject = get_string('waitlist', 'block_curr_admin'); $cmclass = new cmclass($this->classid); $message = get_string('added_to_waitlist_message', 'block_curr_admin', $cmclass->idnumber); $user = cm_get_moodleuser($this->userid); $from = get_admin(); // Send a notification and e-mail only if the Moodle user exists if ($user != null) { notification::notify($message, $user, $from); email_to_user($user, $from, $subject, $message); } parent::add(); }
/** * Function to load the object with data from passed parameter. * * @param $data array Array of properties and values. * */ function data_load_array($data) { if (!parent::data_load_array($data)) { return false; } if (!empty($data['cluster'])) { $this->load_cluster_info($data['cluster']); } return true; }
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)); } } } }
public function delete() { $result = course::remove_environment($this->id); $result = $result && cmclass::remove_environment($this->id); return $result && parent::delete(); }
function add() { parent::add(); events_trigger('crlm_curriculum_course_associated', $this); }
/** * loads the data into this object specifically moodlecourseid since it is in a group form element * @param array $data */ public function data_load_array($data) { parent::data_load_array($data); if (!empty($data['moodleCourses']['moodlecourseid'])) { $this->moodlecourseid = $data['moodleCourses']['moodlecourseid']; } }
public function delete() { $result = taginstance::delete_for_tag($this->id); return $result && parent::delete(); }