98 lines
3.5 KiB
PHP
98 lines
3.5 KiB
PHP
<? global $user; ?>
|
|
<div class="form_container" style="max-width: 100%;">
|
|
<div class="block-header">
|
|
<h2>Kategoria: <strong><?= $this->category['name']; ?></strong></h2>
|
|
</div>
|
|
<div class="action_menu" id="g-menu">
|
|
<a href="#" onclick='checkForm( "formularz" ); return false;' class="btn btn-success btn-sm" title="Zapisz kategorię">
|
|
<i class="fa fa-check-circle"></i>Zapisz kategorię
|
|
</a>
|
|
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
|
|
<i class="fa fa-reply"></i>Wstecz
|
|
</a>
|
|
</div>
|
|
<div id="g-form-container">
|
|
<form method='POST' action='/wiki/category_save/' id="formularz" class="form-horizontal">
|
|
<input type="hidden" name="id" value="<?= $this->category['id']; ?>" />
|
|
<div class="row">
|
|
<div class="col-lg-7">
|
|
<?= \Html::input([
|
|
'label' => 'Nazwa',
|
|
'name' => 'name',
|
|
'id' => 'name',
|
|
'value' => $this->category['name'],
|
|
'class' => 'require',
|
|
'inline' => true
|
|
]); ?>
|
|
<?= \Html::textarea([
|
|
'name' => 'text',
|
|
'id' => 'text',
|
|
'value' => $this->category['text']
|
|
]) ?>
|
|
<? if ($user['id'] == 1 or $user['id'] == 3): ?>
|
|
<br>
|
|
<?= \Html::textarea([
|
|
'name' => 'text_admin',
|
|
'id' => 'text_admin',
|
|
'value' => $this->category['text_admin']
|
|
]) ?>
|
|
<? endif; ?>
|
|
</div>
|
|
<div class="col-lg-5" style="padding: 25px; background: #FFF;">
|
|
<? if ( $user['id'] == 1 ):?>
|
|
<p class="bold">Widoczne dla</p>
|
|
<? foreach ($this->users as $user_tmp): ?>
|
|
<? if ($user['id'] != 4): ?>
|
|
<p style="display: flex; align-items: center;">
|
|
<input type="checkbox" class="g-checkbox" name="users[]" value="<?= $user_tmp['id']; ?>" <? if (in_array($user_tmp['id'], $this->category['users']) or $user_tmp['id'] == 1 or $user_tmp['id'] == 3): ?>checked="checked" <? endif; ?>>
|
|
<span style="margin-left: 5px;"><?= $user_tmp['name']; ?> <?= $user_tmp['surname']; ?></span>
|
|
</p>
|
|
<? endif; ?>
|
|
<? endforeach; ?>
|
|
<? endif; ?>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
|
|
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
|
|
<script type="text/javascript">
|
|
function checkForm(id) {
|
|
check = true;
|
|
$('form#' + id + ' input[type="text"]').each(function() {
|
|
if ($(this).hasClass('require') && $(this).val() === '') {
|
|
$(this).parents('.form-group').addClass('has-error');
|
|
check = false;
|
|
} else
|
|
$(this).parents('.form-group').removeClass('has-error');
|
|
});
|
|
|
|
$('form#' + id + ' textarea').each(function() {
|
|
if ($(this).hasClass('require') && $(this).val() === '') {
|
|
$(this).parents('.form-group').addClass('has-error');
|
|
check = false;
|
|
} else
|
|
$(this).parents('.form-group').removeClass('has-error');
|
|
});
|
|
|
|
if (check)
|
|
$('form#' + id).submit();
|
|
|
|
return false;
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$('textarea#text').ckeditor({
|
|
toolbar: 'MyToolbar',
|
|
language: 'pl',
|
|
height: '350'
|
|
});
|
|
|
|
$('textarea#text_admin').ckeditor({
|
|
toolbar: 'MyToolbar',
|
|
language: 'pl',
|
|
height: '350'
|
|
});
|
|
});
|
|
</script>
|