Commit a66b7db2 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Deal with institution views in formatted_owner()



Allowing the View::formatted_owner function to be called on
institution views will allow for simpler code where we have a mix of
views, and just want to get an owner name for each one.

Change-Id: I3d583b83665f751a8eb03172299b8a2bf9eca6ea
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 1ce257e0
......@@ -52,6 +52,7 @@ class View {
private $artefact_metadata;
private $ownerobj;
private $groupobj;
private $institutionobj;
private $numcolumns;
private $layout;
private $theme;
......@@ -612,7 +613,13 @@ class View {
return $this->groupobj;
}
public function get_institution_object() {
if (!isset($this->institutionobj)) {
$this->institutionobj = get_record('institution', 'name', $this->get('institution'));
}
return $this->institutionobj;
}
public function delete() {
safe_require('artefact', 'comment');
db_begin();
......@@ -2035,6 +2042,13 @@ class View {
$group = $this->get_group_object();
return $group->name;
}
else if ($i = $this->get('institution')) {
if ($i == 'mahara') {
return get_config('sitename');
}
$institution = $this->get_institution_object();
return $institution->displayname;
}
return null;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment