-
Notifications
You must be signed in to change notification settings - Fork 4
/
AjaxRequests.php
63 lines (47 loc) · 2.1 KB
/
AjaxRequests.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Cissee\Webtrees\Module\ExtendedRelationships;
use Cissee\Webtrees\Module\ExtendedRelationships\FunctionsPrintRels;
use Cissee\WebtreesExt\Requests;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Tree;
use Psr\Http\Message\ServerRequestInterface;
class AjaxRequests {
public static function printMainSlcas(string $moduleName, ServerRequestInterface $request, Tree $tree) {
$mode = Requests::getInt($request, 'mode');
$recursion = Requests::getInt($request, 'recursion');
$showCa = Requests::getBool($request, 'showCa');
$pid = Requests::getString($request, 'pid');
$individual = Registry::individualFactory()->make($pid, $tree);
FunctionsPrintRels::printSlcasWrtDefaultIndividual($moduleName, $individual, $mode, $recursion, $showCa);
}
public static function printFamilySlcas(string $moduleName, ServerRequestInterface $request, Tree $tree) {
$mode = Requests::getInt($request, 'mode');
$recursion = Requests::getInt($request, 'recursion');
$showCa = Requests::getBool($request, 'showCa');
$beforeJD = Requests::getIntOrNull($request, 'beforeJD');
$pid = Requests::getString($request, 'pid');
$family = Registry::familyFactory()->make($pid, $tree);
if ($family->tree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
$access_level = Auth::PRIV_HIDE;
} else {
$access_level = Auth::accessLevel($family->tree());
}
FunctionsPrintRels::printSlcas($moduleName, $family, $access_level, $mode, $recursion, $showCa, $beforeJD);
}
public static function getRelationshipLink(string $moduleName, ServerRequestInterface $request, Tree $tree) {
$text = Requests::getStringOrNull($request, 'text');
$xref1 = Requests::getString($request, 'xref1');
$xref2 = Requests::getString($request, 'xref2');
$mode = Requests::getInt($request, 'mode');
$beforeJD = Requests::getIntOrNull($request, 'beforeJD');
return ExtendedRelationshipModule::getRelationshipLink(
$moduleName,
$tree,
$text,
$xref1,
$xref2,
$mode,
$beforeJD);
}
}