$helptext = get_string('choosetemplatesitepageandcollectiondescription1', 'view'); } else { $helptext = get_string('choosetemplateinstitutionpageandcollectiondescription', 'view'); } } else { $views->copyableby->owner = $USER->get('id'); $helptext = get_string('choosetemplatepageandcollectiondescription', 'view'); } } $sort[] = array('column' => 'title', 'desc' => 0); if ($searchcollection) { array_unshift($sort, array('column' => 'collection', 'desc' => 0, 'tablealias' => 'cv')); $views->collection = $searchcollection; } $views->sort = (object) $sort; View::get_templatesearch_data($views); $strpreview = json_encode(get_string('Preview', 'view')); $strclose = json_encode(get_string('Close')); $js = <<<EOF templatelist = new SearchTable('templatesearch'); addLoadEvent(function() { templatelist.rewriteOther = function () { forEach(getElementsByTagAndClassName('a', 'grouplink', 'templatesearch'), function(i) { connect(i, 'onclick', function (e) { e.stop(); var href = getNodeAttribute(this, 'href'); var params = parseQueryString(href.substring(href.indexOf('?')+1, href.length)); sendjsonrequest(config.wwwroot + 'group/groupinfo.json.php', params, 'POST', partial(showPreview, 'small'));