-
Notifications
You must be signed in to change notification settings - Fork 0
/
PublicRepoSharing.php
37 lines (30 loc) · 1.27 KB
/
PublicRepoSharing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace uzgent\PublicRepoSharing;
// Declare your module class, which must extend AbstractExternalModule
class PublicRepoSharing extends \ExternalModules\AbstractExternalModule {
public function redcap_every_page_top($project_id)
{
if (strpos($_SERVER['REQUEST_URI'], "/FileRepository/") !== FALSE)
{
$createLink = $this->getUrl("createLink.php", false, false );
?>
<script>
$( document ).ready(function () {
$('form > div > table > tbody > tr').each(function (index, tr) {
if (tr.children.length === 3) {
var href = tr.children[2].children[0].children[0].href;
var a = document.createElement("a");
a.href = "<?php echo $createLink; ?>" + "&" + href.substr(href.indexOf("?") + 1);
a.target = "_blank";
var i = document.createElement("i");
i.className = "fas fa-link";
a.appendChild(i);
tr.children[2].appendChild(a);
}
});
});
</script>
<?php
}
}
}