This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Views/user/user-settings.phtml
Marcin Kurczewski 50e4b40721 Upgraded to newest chibi
- Separate non-static router class
- Moved some setup code to new method, Core::init
- Persistent database connection between tests
2014-05-23 23:34:50 +02:00

56 lines
2 KiB
PHTML

<?php
$settings = $this->context->transport->user->getSettings();
?>
<form
action="<?= Core::getRouter()->linkTo(
['UserController', 'settingsAction'],
['identifier' => $this->context->transport->user->getName()]) ?>"
method="post"
class="user-settings simple-action">
<?php
$safety = array_filter(
PostSafety::getAll(),
function($s)
{
return Access::check(new Privilege(Privilege::ListPosts, $s->toString()));
});
$context = new StdClass;
$context->label = 'Safety';
$context->optionValuesDisabled = array_map(function($s) { return null; }, $safety);
$context->optionValuesEnabled = array_map(function($s) { return $s->toInteger(); }, $safety);
$context->optionLabels = array_map(function($s) { return ucfirst($s->toDisplayString()); }, $safety);
$context->optionNames = array_map(function($s) { return 'safety[]'; }, $safety);
$context->optionStates = array_map(function($s) use ($settings) { return $settings->hasEnabledSafety($s); }, $safety);
$this->renderExternal('input-checkboxes', $context);
$context = new StdClass;
$context->optionValuesDisabled = ['0'];
$context->optionValuesEnabled = ['1'];
$context->optionLabels = ['Enabled'];
$context->label = 'Endless scrolling';
$context->optionNames = ['endless-scrolling'];
$context->optionStates = [$settings->hasEnabledEndlessScrolling()];
$this->renderExternal('input-checkboxes', $context);
$context->label = 'Tags in thumbs';
$context->optionNames = ['post-tag-titles'];
$context->optionStates = [$settings->hasEnabledPostTagTitles()];
$this->renderExternal('input-checkboxes', $context);
$context->label = 'Hide down-voted';
$context->optionNames = ['hide-disliked-posts'];
$context->optionStates = [$settings->hasEnabledHidingDislikedPosts()];
$this->renderExternal('input-checkboxes', $context);
?>
<?php $this->renderExternal('message') ?>
<div class="form-row">
<label></label>
<button class="submit" type="submit">Update settings</button>
</div>
</form>