本文整理汇总了PHP中ArtefactType::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactType::__construct方法的具体用法?PHP ArtefactType::__construct怎么用?PHP ArtefactType::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtefactType
的用法示例。
在下文中一共展示了ArtefactType::__construct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id = 0, $data = array())
{
if (empty($id)) {
$data['title'] = get_string($this->get_artefact_type(), 'artefact.resume');
}
parent::__construct($id, $data);
}
示例2: __construct
/**
* 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;
}
}
}
}
示例3: __construct
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;
}
}
}
}
示例4: __construct
/**
* 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'));
}
}
}
示例5: __construct
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);
}
}
示例6: __construct
/**
* 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
}
}
示例7: __construct
public function __construct($id = 0, $data = null) {
parent::__construct($id, $data);
}
示例8: __construct
public function __construct($id = 0, $data = array())
{
parent::__construct($id, $data);
}