Commit b3630b96 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Fix portfolio search (bug #931481)



Removing get_links output in ArtefactTypeHtml does not seem affect anything, as it only being used
in self_search_make_links.

Change-Id: I4bf3594233eac54e518ed45e9c7798a7782bd799
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent 4d8b858c
......@@ -708,8 +708,5 @@ class ArtefactTypeHtml extends ArtefactType {
}
public static function get_links($id) {
return array(
'_default' => get_config('wwwroot'),
);
}
}
......@@ -804,6 +804,7 @@ class PluginSearchInternal extends PluginSearch {
);
if ($results['data']) {
require_once(get_config('docroot') . 'artefact/lib.php');
foreach ($results['data'] as &$result) {
$newresult = array();
foreach ($result as $key => &$value) {
......@@ -812,10 +813,13 @@ class PluginSearchInternal extends PluginSearch {
}
}
$newresult['type'] = 'artefact';
$artefactplugin = get_field('artefact_installed_type', 'plugin', 'name', $newresult['artefacttype']);
if ($artefactplugin == 'internal') {
$artefact = artefact_instance_from_id($newresult['id']);
$artefactplugin = $artefact->get_plugin_name();
if ($artefactplugin == 'internal' && in_array($artefact->get('artefacttype'), PluginArtefactInternal::get_profile_artefact_types())) {
// Profile artefact
$newresult['summary'] = $newresult['title'];
$newresult['title'] = get_string($newresult['artefacttype'], 'artefact.' . $artefactplugin);
$newresult['title'] = get_string($artefact->get('artefacttype'), 'artefact.' . $artefactplugin);
}
else {
$newresult['summary'] = $newresult['description'];
......
......@@ -127,7 +127,7 @@ abstract class PluginSearch extends Plugin {
*/
public static abstract function self_search($query_string, $limit, $offset, $type = 'all');
protected static function self_search_make_links($data) {
protected static function self_search_make_links(&$data) {
$wwwroot = get_config('wwwroot');
if ($data['count']) {
foreach ($data['data'] as &$result) {
......
......@@ -47,12 +47,12 @@ results.emptycontent = {$enc_noresults};
results.rowfunction = function (r, n, d) {
var titleElement;
if (r.links._default) {
if (r.links && r.links._default) {
titleElement = [H3(null, A({'href': r.links._default}, r.title))];
delete r.links._default;
}
else {
titleElement = [H3(null, A(null, r.title))];
titleElement = [H3(null, r.title)];
}
for ( var k in r.links ) {
......
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