_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20600 | ReportHtml.checkFootnote | train | public function checkFootnote(ReportHtmlFootnote $footnote)
{
$ct = count($this->printedfootnotes);
$i = 0;
$val = $footnote->getValue();
while ($i < $ct) {
if ($this->printedfootnotes[$i]->getValue() == $val) {
// If this footnote already exist then se... | php | {
"resource": ""
} |
q20601 | ReportHtml.getCurrentStyleHeight | train | public function getCurrentStyleHeight(): float
{
if (empty($this->currentStyle)) {
| php | {
"resource": ""
} |
q20602 | ReportHtml.getFootnotesHeight | train | public function getFootnotesHeight(float $cellWidth): float
{
$h = 0;
foreach ($this->printedfootnotes as $element) {
$h += | php | {
"resource": ""
} |
q20603 | ReportHtml.getStringWidth | train | public function getStringWidth(string $text): float
{
$style = $this->getStyle($this->currentStyle);
| php | {
"resource": ""
} |
q20604 | ReportHtml.getTextCellHeight | train | public function getTextCellHeight(string $str): float
{
// Count the number of lines to calculate the height
$nl = $this->countLines($str);
| php | {
"resource": ""
} |
q20605 | ReportHtml.setY | train | public function setY($y)
{
$this->Y = $y;
if ($this->maxY < $y) {
| php | {
"resource": ""
} |
q20606 | ReportHtml.textWrap | train | public function textWrap(string $str, float $width): string
{
// Calculate the line width
$lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
// Wordwrap each line
$lines = explode("\n", $str);
// Line Feed counter
$lfct = count($lines);
$wraptext... | php | {
"resource": ""
} |
q20607 | ReportHtml.write | train | public function write($text, $color = '', $useclass = true)
{
$style = $this->getStyle($this->getCurrentStyle());
$htmlcode = '<span dir="' . I18N::direction() . '"';
if ($useclass) {
$htmlcode .= ' class="' . $style['name'] . '"';
}
if (!empty($color)) {
... | php | {
"resource": ""
} |
q20608 | UpgradeController.step | train | public function step(ServerRequestInterface $request, ?Tree $tree): ResponseInterface
{
$step = $request->getQueryParams()['step'] ?? self::STEP_CHECK;
switch ($step) {
case self::STEP_CHECK:
return $this->wizardStepCheck();
case self::STEP_PREPARE:
... | php | {
"resource": ""
} |
q20609 | UpgradeController.wizardStepPrepare | train | private function wizardStepPrepare(): ResponseInterface
{
$this->filesystem->deleteDir(self::UPGRADE_FOLDER);
$this->filesystem->createDir(self::UPGRADE_FOLDER);
return response(view('components/alert-success', [
| php | {
"resource": ""
} |
q20610 | FlashMessages.addMessage | train | public static function addMessage($text, $status = 'info'): void
{
$message = new stdClass();
$message->text = $text;
$message->status = $status;
| php | {
"resource": ""
} |
q20611 | FlashMessages.getMessages | train | public static function getMessages(): array
{
$messages = Session::get(self::FLASH_KEY, []);
| php | {
"resource": ""
} |
q20612 | HousekeepingService.deleteOldWebtreesFiles | train | public function deleteOldWebtreesFiles(Filesystem $filesystem): array
{
$paths_to_delete = [];
foreach (self::OLD_PATHS as $path) {
if (!$this->deleteFileOrFolder($filesystem, $path)) | php | {
"resource": ""
} |
q20613 | HousekeepingService.deleteOldFiles | train | public function deleteOldFiles(Filesystem $filesystem, string $path, int $max_age): void
{
$list = $filesystem->listContents($path, true);
$timestamp = Carbon::now()->unix(); | php | {
"resource": ""
} |
q20614 | HousekeepingService.deleteFileOrFolder | train | private function deleteFileOrFolder(Filesystem $filesystem, string $path): bool
{
if ($filesystem->has($path)) {
try {
$metadata = $filesystem->getMetadata($path);
if ($metadata['type'] === 'dir') {
$filesystem->deleteDir($path);
... | php | {
"resource": ""
} |
q20615 | ReportBaseText.setWrapWidth | train | public function setWrapWidth(float $wrapwidth, float $cellwidth): float
{
$this->wrapWidthCell = $cellwidth;
if (strpos($this->text, "\n") !== | php | {
"resource": ""
} |
q20616 | ChartMedia.chartMedia | train | public function chartMedia(
array $media,
string $color_from = null,
string $color_to = null
): string {
$chart_color1 = (string) $this->theme->parameter('distribution-chart-no-values');
$chart_color2 = (string) $this->theme->parameter('distribution-chart-high-values');
... | php | {
"resource": ""
} |
q20617 | User.setEmail | train | public function setEmail($email): User
{
if ($this->email !== $email) {
$this->email = $email;
DB::table('user')
| php | {
"resource": ""
} |
q20618 | User.setRealName | train | public function setRealName($real_name): User
{
if ($this->real_name !== $real_name) {
$this->real_name = $real_name;
DB::table('user')
->where('user_id', '=', $this->user_id)
| php | {
"resource": ""
} |
q20619 | User.setUserName | train | public function setUserName($user_name): self
{
if ($this->user_name !== $user_name) {
$this->user_name = $user_name;
DB::table('user')
->where('user_id', '=', $this->user_id)
| php | {
"resource": ""
} |
q20620 | User.setPreference | train | public function setPreference(string $setting_name, string $setting_value): UserInterface
{
if ($this->user_id !== 0 && $this->getPreference($setting_name) !== $setting_value) {
DB::table('user_setting')->updateOrInsert([
'user_id' => $this->user_id,
'setting... | php | {
"resource": ""
} |
q20621 | User.setPassword | train | public function setPassword(string $password): User
{
DB::table('user')
->where('user_id', '=', $this->user_id) | php | {
"resource": ""
} |
q20622 | User.checkPassword | train | public function checkPassword(string $password): bool
{
$password_hash = DB::table('user')
->where('user_id', '=', $this->id())
->value('password');
if ($password_hash !== null && password_verify($password, $password_hash)) {
| php | {
"resource": ""
} |
q20623 | User.rowMapper | train | public static function rowMapper(): Closure
{
return static function (stdClass $row): User {
return new static((int) | php | {
"resource": ""
} |
q20624 | ListController.mediaList | train | public function mediaList(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
//route is assumed to be 'module'
$module = $request->get('module');
$action = $request->get('action');
$formats = GedcomTag::getFileFormTypes();
$action2 = $request->get('... | php | {
"resource": ""
} |
q20625 | ListController.noteList | train | public function noteList(Tree $tree): ResponseInterface
{
$notes = $this->allNotes($tree);
return $this->viewResponse('note-list-page', [
| php | {
"resource": ""
} |
q20626 | ListController.repositoryList | train | public function repositoryList(Tree $tree): ResponseInterface
{
$repositories = $this->allRepositories($tree);
return $this->viewResponse('repository-list-page', [
| php | {
"resource": ""
} |
q20627 | ListController.sourceList | train | public function sourceList(Tree $tree): ResponseInterface
{
$sources = $this->allSources($tree);
return $this->viewResponse('source-list-page', [
| php | {
"resource": ""
} |
q20628 | ListController.allFolders | train | private function allFolders(Tree $tree): array
{
$folders = DB::table('media_file')
->where('m_file', '=', $tree->id())
->where('multimedia_file_refn', 'NOT LIKE', 'http:%')
->where('multimedia_file_refn', 'NOT LIKE', 'https:%')
->where('multimedia_file_refn',... | php | {
"resource": ""
} |
q20629 | ListController.allMedia | train | private function allMedia(Tree $tree, string $folder, string $subfolders, string $sort, string $filter, string $form_type): array
{
$query = DB::table('media')
->join('media_file', static function (JoinClause $join): void {
$join
->on('media_file.m_file', '=',... | php | {
"resource": ""
} |
q20630 | ListController.allNotes | train | private function allNotes(Tree $tree): Collection
{
return DB::table('other')
->where('o_file', '=', $tree->id())
->where('o_type', '=', 'NOTE')
->get()
| php | {
"resource": ""
} |
q20631 | ListController.allRepositories | train | private function allRepositories(Tree $tree): Collection
{
return DB::table('other')
->where('o_file', '=', $tree->id())
->where('o_type', '=', 'REPO')
->get()
| php | {
"resource": ""
} |
q20632 | ListController.allSources | train | private function allSources(Tree $tree): Collection
{
return DB::table('sources')
->where('s_file', '=', $tree->id())
->get() | php | {
"resource": ""
} |
q20633 | GedcomRepository.gedcomHead | train | private function gedcomHead(): array
{
$title = '';
$version = '';
$source = '';
$head = GedcomRecord::getInstance('HEAD', $this->tree);
if ($head instanceof GedcomRecord) {
$sour = $head->facts(['SOUR'])->first();
if ($sour instanceof Fact) {
... | php | {
"resource": ""
} |
q20634 | ChangesLogController.changesQuery | train | private function changesQuery(ServerRequestInterface $request): Builder
{
$from = $request->getQueryParams()['from'] ?? '';
$to = $request->getQueryParams()['to'] ?? '';
$type = $request->getQueryParams()['type'] ?? '';
$oldged = $request->getQueryParams()['oldged'] ?... | php | {
"resource": ""
} |
q20635 | FunctionsRtl.getChar | train | public static function getChar(string $text, int $offset): array
{
if ($text == '') {
return [
'letter' => '',
'length' => 0,
];
}
$char = substr($text, $offset, 1);
$length = 1;
if ((ord($char) & 0xE0) == 0xC0) {
... | php | {
"resource": ""
} |
q20636 | FunctionsRtl.beginCurrentSpan | train | public static function beginCurrentSpan(&$result): void
{
if (self::$currentState === 'LTR') {
$result .= self::START_LTR;
}
if (self::$currentState === 'RTL') {
| php | {
"resource": ""
} |
q20637 | CalendarController.applyFilter | train | private function applyFilter(array $facts, string $filterof, string $filtersx): array
{
$filtered = [];
$hundred_years = Carbon::now()->subYears(100)->julianDay();
foreach ($facts as $fact) {
$record = $fact->record();
if ($filtersx) {
// Filter o... | php | {
"resource": ""
} |
q20638 | CalendarController.calendarListText | train | private function calendarListText(array $list, string $tag1, string $tag2, Tree $tree): string
{
$html = '';
foreach ($list as $id => $facts) {
| php | {
"resource": ""
} |
q20639 | ModuleThemeTrait.icon | train | public function icon(Fact $fact): string
{
$asset = 'public/css/' . $this->name() . '/images/facts/' . $fact->getTag() . '.png';
if (file_exists(Webtrees::ROOT_DIR . 'public' . $asset)) {
return '<img src="' . e(asset($asset)) . '" title="' . GedcomTag::getLabel($fact->getTag()) . '">';
... | php | {
"resource": ""
} |
q20640 | ModuleThemeTrait.individualBoxFacts | train | public function individualBoxFacts(Individual $individual): string
{
$html = '';
$opt_tags = preg_split('/\W/', $individual->tree()->getPreference('CHART_BOX_TAGS'), 0, PREG_SPLIT_NO_EMPTY);
// Show BIRT or equivalent event
foreach (Gedcom::BIRTH_EVENTS as $birttag) {
if... | php | {
"resource": ""
} |
q20641 | ModuleThemeTrait.individualBoxMenu | train | public function individualBoxMenu(Individual $individual): array
{
$menus = array_merge(
$this->individualBoxMenuCharts($individual),
| php | {
"resource": ""
} |
q20642 | ModuleThemeTrait.individualBoxMenuCharts | train | public function individualBoxMenuCharts(Individual $individual): array
{
$menus = [];
foreach (app(ModuleService::class)->findByComponent(ModuleChartInterface::class, $individual->tree(), Auth::user()) as $chart) {
$menu = $chart->chartBoxMenu($individual);
if ($menu) {
... | php | {
"resource": ""
} |
q20643 | ModuleThemeTrait.individualBoxMenuFamilyLinks | train | public function individualBoxMenuFamilyLinks(Individual $individual): array
{
$menus = [];
foreach ($individual->spouseFamilies() as $family) {
$menus[] = new Menu('<strong>' . I18N::translate('Family with spouse') . '</strong>', $family->url());
$spouse | php | {
"resource": ""
} |
q20644 | ModuleThemeTrait.menuControlPanel | train | public function menuControlPanel(Tree $tree): ?Menu
{
if (Auth::isAdmin()) {
return new Menu(I18N::translate('Control panel'), route('admin-control-panel'), 'menu-admin');
}
if (Auth::isManager($tree)) {
return new | php | {
"resource": ""
} |
q20645 | ModuleThemeTrait.menuLanguages | train | public function menuLanguages(): ?Menu
{
$menu = new Menu(I18N::translate('Language'), '#', 'menu-language');
foreach (I18N::activeLocales() as $locale) {
$language_tag = $locale->languageTag();
$class = 'menu-language-' . $language_tag . (WT_LOCALE === $language_tag ... | php | {
"resource": ""
} |
q20646 | ModuleThemeTrait.menuMyPage | train | public function menuMyPage(Tree $tree): Menu
{
return new Menu(I18N::translate('My page'), | php | {
"resource": ""
} |
q20647 | ModuleThemeTrait.menuMyPages | train | public function menuMyPages(?Tree $tree): ?Menu
{
if ($tree instanceof Tree && Auth::id()) {
return new Menu(I18N::translate('My pages'), '#', 'menu-mymenu', [], array_filter([
$this->menuMyPage($tree),
$this->menuMyIndividualRecord($tree),
| php | {
"resource": ""
} |
q20648 | ModuleThemeTrait.menuMyPedigree | train | public function menuMyPedigree(Tree $tree): ?Menu
{
$gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid');
$pedigree_chart = app(ModuleService::class)->findByComponent(ModuleChartInterface::class, $tree, Auth::user())
->filter(static function (ModuleInterface $module): bool {
... | php | {
"resource": ""
} |
q20649 | ModuleThemeTrait.menuPendingChanges | train | public function menuPendingChanges(?Tree $tree): ?Menu
{
if ($tree instanceof Tree && $tree->hasPendingEdit() && Auth::isModerator($tree)) {
$url = route('show-pending', [
'ged' => $tree->name(),
| php | {
"resource": ""
} |
q20650 | ModuleThemeTrait.menuThemes | train | public function menuThemes(): ?Menu
{
$themes = app(ModuleService::class)->findByInterface(ModuleThemeInterface::class, false, true);
$current_theme = app(ModuleThemeInterface::class);
if ($themes->count() > 1) {
$submenus = $themes->map(static function (ModuleThemeInterface $t... | php | {
"resource": ""
} |
q20651 | ModuleThemeTrait.genealogyMenuContent | train | public function genealogyMenuContent(array $menus): string
{
return implode('', array_map(static function (Menu $menu): string {
| php | {
"resource": ""
} |
q20652 | ModuleThemeTrait.userMenu | train | public function userMenu(?Tree $tree): array
{
return array_filter([
$this->menuPendingChanges($tree),
$this->menuMyPages($tree),
$this->menuThemes(),
| php | {
"resource": ""
} |
q20653 | Filter.formatText | train | public static function formatText(string $text, Tree $tree): string
{
switch ($tree->getPreference('FORMAT_TEXT')) {
case 'markdown':
return '<div class="markdown" dir="auto">' . self::markdown($text, $tree) . '</div>';
default:
| php | {
"resource": ""
} |
q20654 | Filter.expandUrls | train | public static function expandUrls(string $text, Tree $tree): string
{
// If it looks like a URL, turn it into a markdown autolink.
$text = preg_replace('/' . addcslashes(self::URL_REGEX, '/') . '/', '<$0>', $text);
// Create a minimal commonmark processor - just add support for autolinks.
... | php | {
"resource": ""
} |
q20655 | Filter.markdown | train | public static function markdown(string $text, Tree $tree): string
{
$environment = Environment::createCommonMarkEnvironment();
$environment->mergeConfig(['html_input' => 'escape']);
$environment->addExtension(new TableExtension());
| php | {
"resource": ""
} |
q20656 | ReportBaseFootnote.addText | train | public function addText(string $t)
{
$t = trim($t, "\r\n\t");
$t = str_replace([
'<br>',
' ',
], [
"\n",
' ',
], $t);
$t | php | {
"resource": ""
} |
q20657 | ModuleService.findByInterface | train | public function findByInterface(string $interface, $include_disabled = false, $sort = false): Collection
{
$modules = $this->all($include_disabled)
->filter($this->interfaceFilter($interface));
switch ($interface) {
case ModuleFooterInterface::class:
return $... | php | {
"resource": ""
} |
q20658 | ModuleService.all | train | public function all(bool $include_disabled = false): Collection
{
return app('cache.array')->rememberForever('all_modules', function (): Collection {
// Modules have a default status, order etc.
// We can override these from database settings.
$module_info = DB::table('mo... | php | {
"resource": ""
} |
q20659 | ModuleService.coreModules | train | private function coreModules(): Collection
{
return Collection::make(self::CORE_MODULES)
->map(static function (string $class, string $name): ModuleInterface {
| php | {
"resource": ""
} |
q20660 | ModuleService.setupLanguages | train | public function setupLanguages(): Collection
{
return $this->coreModules()
->filter(static function (ModuleInterface $module) {
return $module instanceof ModuleLanguageInterface && | php | {
"resource": ""
} |
q20661 | ModuleService.footerSorter | train | private function footerSorter(): Closure
{
return static function (ModuleFooterInterface $x, | php | {
"resource": ""
} |
q20662 | ModuleService.moduleSorter | train | private function moduleSorter(): Closure
{
return static function (ModuleInterface $x, ModuleInterface $y): int {
$title1 = $x instanceof ModuleLanguageInterface ? $x->locale()->endonymSortable() : $x->title();
$title2 = | php | {
"resource": ""
} |
q20663 | ModuleService.findByName | train | public function findByName(string $module_name, bool $include_disabled = false): ?ModuleInterface
{
return $this->all($include_disabled)
| php | {
"resource": ""
} |
q20664 | ModuleService.otherModules | train | public function otherModules(bool $include_disabled = false): Collection
{
return $this->findByInterface(ModuleInterface::class, $include_disabled, true)
->filter(static function (ModuleInterface $module): bool {
foreach (self::COMPONENTS as $interface) {
| php | {
"resource": ""
} |
q20665 | ModuleService.deletedModules | train | public function deletedModules(): Collection
{
$database_modules = DB::table('module')->pluck('module_name');
$disk_modules = $this->all(true) | php | {
"resource": ""
} |
q20666 | Session.regenerate | train | public static function regenerate(bool $destroy = false): void
{
if ($destroy) {
self::clear();
}
| php | {
"resource": ""
} |
q20667 | Session.getCsrfToken | train | public static function getCsrfToken(): string
{
if (!self::has('CSRF_TOKEN')) {
| php | {
"resource": ""
} |
q20668 | AdminTreesController.checkLinkMessage | train | private function checkLinkMessage(Tree $tree, $type1, $xref1, $type2, $xref2): string
{
/* I18N: The placeholders are GEDCOM XREFs and tags. e.g. “INDI I123 contains a FAMC link to F234.” */
return I18N::translate(
'%1$s %2$s has a %3$s link to %4$s.',
| php | {
"resource": ""
} |
q20669 | AdminTreesController.checkLink | train | private function checkLink(Tree $tree, string $xref): string
{
return '<b><a href="' . e(route('record', [
'xref' => $xref,
| php | {
"resource": ""
} |
q20670 | AdminTreesController.countCommonXrefs | train | private function countCommonXrefs(Tree $tree1, Tree $tree2): int
{
$subquery1 = DB::table('individuals')
->where('i_file', '=', $tree1->id())
->select(['i_id AS xref'])
->union(DB::table('families')
->where('f_file', '=', $tree1->id())
->se... | php | {
"resource": ""
} |
q20671 | AdminTreesController.duplicateXrefs | train | private function duplicateXrefs(Tree $tree): array
{
$subquery1 = DB::table('individuals')
->where('i_file', '=', $tree->id())
->select(['i_id AS xref', DB::raw("'INDI' AS type")])
->union(DB::table('families')
->where('f_file', '=', $tree->id())
... | php | {
"resource": ""
} |
q20672 | AdminTreesController.gedcomFiles | train | private function gedcomFiles(string $folder): array
{
$d = opendir($folder);
$files = [];
while (($f = readdir($d)) !== false) {
if (!is_dir(WT_DATA_DIR . $f) && is_readable(WT_DATA_DIR . $f)) {
$fp = fopen(WT_DATA_DIR . $f, 'rb');
$header ... | php | {
"resource": ""
} |
q20673 | AdminTreesController.generateNewTreeName | train | private function generateNewTreeName(): string
{
$tree_name = 'tree';
$tree_number = 1;
$existing_trees = | php | {
"resource": ""
} |
q20674 | HomePageController.treePageBlockUpdate | train | public function treePageBlockUpdate(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
{
$block = $this->treeBlock($request, $tree, $user);
$block_id = (int) $request->get('block_id');
| php | {
"resource": ""
} |
q20675 | HomePageController.treeBlock | train | private function treeBlock(ServerRequestInterface $request, Tree $tree, UserInterface $user): ModuleBlockInterface
{
$block_id = (int) $request->get('block_id');
$block = DB::table('block')
->where('block_id', '=', $block_id)
->where('gedcom_id', '=', $tree->id())
... | php | {
"resource": ""
} |
q20676 | HomePageController.treePage | train | public function treePage(Tree $tree): ResponseInterface
{
$has_blocks = DB::table('block')
->where('gedcom_id', '=', $tree->id())
->exists();
if (!$has_blocks) {
$this->checkDefaultTreeBlocksExist();
// Copy the defaults
(new Builder(DB::... | php | {
"resource": ""
} |
q20677 | HomePageController.treePageBlock | train | public function treePageBlock(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$block_id = $request->get('block_id');
$block_id = (int) DB::table('block')
->where('block_id', '=', $block_id)
->where('gedcom_id', '=', $tree->id())
->value('block_i... | php | {
"resource": ""
} |
q20678 | HomePageController.treePageDefaultEdit | train | public function treePageDefaultEdit(): ResponseInterface
{
$this->checkDefaultTreeBlocksExist();
$main_blocks = $this->treeBlocks(-1, 'main');
$side_blocks = $this->treeBlocks(-1, 'side');
$all_blocks = $this->availableTreeBlocks();
$title = I18N::translate('Set the de... | php | {
"resource": ""
} |
q20679 | HomePageController.treePageDefaultUpdate | train | public function treePageDefaultUpdate(ServerRequestInterface $request): ResponseInterface
{
$main_blocks = (array) $request->get('main');
$side_blocks = (array) $request->get('side');
| php | {
"resource": ""
} |
q20680 | HomePageController.treePageUpdate | train | public function treePageUpdate(ServerRequestInterface $request, Tree $tree): ResponseInterface
{
$defaults = (bool) $request->get('defaults');
if ($defaults) {
$main_blocks = $this->treeBlocks(-1, 'main')->all();
$side_blocks = $this->treeBlocks(-1, 'side')->all();
}... | php | {
"resource": ""
} |
q20681 | HomePageController.userPage | train | public function userPage(UserInterface $user): ResponseInterface
{
$has_blocks = DB::table('block')
->where('user_id', '=', $user->id())
->exists();
if (!$has_blocks) {
$this->checkDefaultUserBlocksExist();
// Copy the defaults
(new Build... | php | {
"resource": ""
} |
q20682 | HomePageController.userPageDefaultEdit | train | public function userPageDefaultEdit(): ResponseInterface
{
$this->checkDefaultUserBlocksExist();
$main_blocks = $this->userBlocks(-1, 'main');
$side_blocks = $this->userBlocks(-1, 'side');
$all_blocks = $this->availableUserBlocks();
$title = I18N::translate('Set the d... | php | {
"resource": ""
} |
q20683 | HomePageController.userPageDefaultUpdate | train | public function userPageDefaultUpdate(ServerRequestInterface $request): ResponseInterface
{
$main_blocks = (array) $request->get('main');
$side_blocks = (array) $request->get('side');
| php | {
"resource": ""
} |
q20684 | HomePageController.userPageUpdate | train | public function userPageUpdate(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
{
$defaults = (bool) $request->get('defaults');
if ($defaults) {
$main_blocks = $this->userBlocks(-1, 'main')->all();
$side_blocks = $this->userBlocks(-1, 'sid... | php | {
"resource": ""
} |
q20685 | HomePageController.userPageUserUpdate | train | public function userPageUserUpdate(ServerRequestInterface $request): ResponseInterface
{
$user_id = (int) $request->get('user_id');
$main_blocks = (array) $request->get('main');
$side_blocks = (array) $request->get('side');
| php | {
"resource": ""
} |
q20686 | HomePageController.getBlockModule | train | private function getBlockModule(Tree $tree, int $block_id): ModuleBlockInterface
{
$active_blocks = $this->module_service->findByComponent(ModuleBlockInterface::class, $tree, Auth::user());
$module_name = DB::table('block')
->where('block_id', '=', $block_id)
->value('module... | php | {
"resource": ""
} |
q20687 | HomePageController.availableTreeBlocks | train | private function availableTreeBlocks(): Collection
{
return $this->module_service->findByInterface(ModuleBlockInterface::class, false, true)
->filter(static function (ModuleBlockInterface $block): bool {
return $block->isTreeBlock();
}) | php | {
"resource": ""
} |
q20688 | HomePageController.availableUserBlocks | train | private function availableUserBlocks(): Collection
{
return $this->module_service->findByInterface(ModuleBlockInterface::class, false, true)
->filter(static function (ModuleBlockInterface $block): bool {
return $block->isUserBlock();
}) | php | {
"resource": ""
} |
q20689 | HomePageController.treeBlocks | train | private function treeBlocks(int $tree_id, string $location): Collection
{
$rows = DB::table('block')
->where('gedcom_id', '=', $tree_id)
->where('location', '=', $location)
->orderBy('block_order')
| php | {
"resource": ""
} |
q20690 | HomePageController.checkDefaultTreeBlocksExist | train | private function checkDefaultTreeBlocksExist(): void
{
$has_blocks = DB::table('block')
->where('gedcom_id', '=', -1)
->exists();
// No default settings? Create them.
if (!$has_blocks) {
foreach (['main', 'side'] as $location) {
foreach (... | php | {
"resource": ""
} |
q20691 | HomePageController.userBlocks | train | private function userBlocks(int $user_id, string $location): Collection
{
$rows = DB::table('block')
->where('user_id', '=', $user_id)
->where('location', '=', $location)
->orderBy('block_order')
| php | {
"resource": ""
} |
q20692 | HomePageController.updateUserBlocks | train | private function updateUserBlocks(int $user_id, array $main_blocks, array $side_blocks): void
{
$existing_block_ids = DB::table('block')
->where('user_id', '=', $user_id)
->pluck('block_id');
// Deleted blocks
foreach ($existing_block_ids as $existing_block_id) {
... | php | {
"resource": ""
} |
q20693 | ReportPdfHtml.render | train | public function render($renderer, $sub = false)
{
if (!empty($this->attrs['style'])) {
$renderer->setCurrentStyle($this->attrs['style']);
}
if (!empty($this->attrs['width'])) {
$this->attrs['width'] *= 3.9;
}
$this->text = $this->getStart() . $this->t... | php | {
"resource": ""
} |
q20694 | FamilyRepository.familyQuery | train | private function familyQuery(string $type): string
{
$row = DB::table('families')
->where('f_file', '=', $this->tree->id())
->orderBy('f_numchil', 'desc')
->first();
if ($row === null) {
return '';
}
/** @var Family $family */
... | php | {
"resource": ""
} |
q20695 | FamilyRepository.topTenGrandFamilyQuery | train | private function topTenGrandFamilyQuery(int $total): array
{
return DB::table('families')
->join('link AS children', static function (JoinClause $join): void {
$join
->on('children.l_from', '=', 'f_id')
->on('children.l_file', '=', 'f_file'... | php | {
"resource": ""
} |
q20696 | FamilyRepository.ageBetweenSiblingsQuery | train | private function ageBetweenSiblingsQuery(int $total): array
{
$prefix = DB::connection()->getTablePrefix();
return DB::table('link AS link1')
->join('link AS link2', static function (JoinClause $join): void {
$join
->on('link2.l_from', '=', 'link1.l_f... | php | {
"resource": ""
} |
q20697 | FamilyRepository.calculateAge | train | private function calculateAge(int $age): string
{
if ((int) ($age / 365.25) > 0) {
$result = (int) ($age / 365.25) . 'y';
} elseif ((int) ($age / 30.4375) > 0) {
$result = (int) ($age / 30.4375) . 'm'; | php | {
"resource": ""
} |
q20698 | FamilyRepository.topAgeBetweenSiblingsFullName | train | public function topAgeBetweenSiblingsFullName(int $total = 10): string
{
$record = $this->ageBetweenSiblingsNoList($total);
if (empty($record)) { | php | {
"resource": ""
} |
q20699 | FamilyRepository.topAgeBetweenSiblingsList | train | public function topAgeBetweenSiblingsList(int $total = 10, string $one = ''): string
{
$records = $this->ageBetweenSiblingsList($total, (bool) $one);
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.