public function __construct($id = 0, $data = array()) { if (empty($id)) { $data['title'] = get_string($this->get_artefact_type(), 'artefact.resume'); } parent::__construct($id, $data); }
/** * overriding this because profile fields * are unique in that except for email, you only get ONE * so if we don't get an id, we still need to go look for it */ public function __construct($id = 0, $data = null) { $type = $this->get_artefact_type(); if (!empty($id) || $type == 'email') { return parent::__construct($id, $data); } if (!empty($data['owner'])) { if ($a = get_record('artefact', 'artefacttype', $type, 'owner', $data['owner'])) { return parent::__construct($a->id, $a); } else { $this->owner = $data['owner']; } } $this->ctime = time(); $this->atime = time(); $this->artefacttype = $type; if (empty($id)) { $this->dirty = true; $this->ctime = $this->mtime = time(); if (empty($data)) { $data = array(); } foreach ((array) $data as $field => $value) { if (property_exists($this, $field)) { $this->{$field} = $value; } } } }
public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if ($this->id && ($extra = get_record('artefact_annotation_feedback', 'artefact', $this->id))) { foreach ($extra as $name => $value) { if (property_exists($this, $name)) { $this->{$name} = $value; } } } }
/** * We override the constructor to fetch the extra data. * * @param integer * @param object */ public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if ($this->id) { if ($pdata = get_record('artefact_cpds_activity', 'artefact', $this->id, null, null, null, null, '*, ' . db_format_tsfield('startdate') . ', ' . db_format_tsfield('enddate'))) { foreach ($pdata as $name => $value) { if (property_exists($this, $name)) { $this->{$name} = $value; } } } else { // This should never happen unless the user is playing around with activity IDs in the location bar or similar throw new ArtefactNotFoundException(get_string('activitydoesnotexist', 'artefact.cpds')); } } }
public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if (empty($this->id)) { $this->locked = 0; } if ($this->id && ($filedata = get_record('artefact_file_files', 'artefact', $this->id))) { foreach ($filedata as $name => $value) { if (property_exists($this, $name)) { $this->{$name} = $value; } } } }
public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if (empty($this->id)) { $this->allowcomments = get_config_plugin('artefact', 'file', 'commentsallowed' . $this->artefacttype); } }
/** * We override the constructor to fetch the extra data. * * @param integer * @param object */ public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if ($this->id) { if ($bpdata = get_record('artefact_blog_blogpost', 'blogpost', $this->id)) { foreach ($bpdata as $name => $value) { if (property_exists($this, $name)) { $this->{$name} = $value; } } } else { // This should never happen unless the user is playing around with blog post IDs in the location bar or similar throw new ArtefactNotFoundException(get_string('blogpostdoesnotexist', 'artefact.blog')); } } else { $this->allowcomments = 1; // Turn comments on for new posts } }
public function __construct($id = 0, $data = null) { parent::__construct($id, $data); }
public function __construct($id = 0, $data = array()) { parent::__construct($id, $data); }
/** * We override the constructor to fetch the extra data. * * @param integer * @param object */ public function __construct($id = 0, $data = null) { parent::__construct($id, $data); if ($this->id) { if ($pdata = get_record('artefact_ilps_unit', 'artefact', $this->id, null, null, null, null, '*, ' . db_format_tsfield('targetcompletion') . ', ' . db_format_tsfield('datecompleted'))) { foreach ($pdata as $name => $value) { if (property_exists($this, $name)) { $this->{$name} = $value; } } } else { // This should never happen unless the user is playing around with unit IDs in the status bar or similar throw new ArtefactNotFoundException(get_string('unitdoesnotexist', 'artefact.ilps')); } } }