Commit 4d8b858c authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Fix artefact::get_views_instances (bug #931467)



Also ensures that required library is available.

Change-Id: Ieb5e109aa9316c6d53dc3bf4e5e02c04cd5ae821
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent 506c004a
......@@ -207,14 +207,22 @@ abstract class ArtefactType {
$this->atime = time();
}
/**
* Returns the instances of all views where this artefact is used.
*
* @return array Array of view instances.
*/
public function get_views_instances() {
// @todo test this
if (!isset($this->viewsinstances)) {
$this->viewsinstances = false;
if ($views = $this->get_views_metadata()) {
$this->viewsinstances = array();
if (!class_exists('View')) {
require_once(get_config('libroot') . 'view.php');
}
foreach ($views as $view) {
$this->viewsinstances[] = new View($view->id, $view);
$this->viewsinstances[] = new View($view->view);
}
}
}
......
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