first commit

This commit is contained in:
2024-11-10 11:11:35 +01:00
commit 3f306ccb81
4417 changed files with 633288 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
<? global $user;?>
<div class="row block-header">
<div class="col-12">
<h2>Kategoria: <strong><?= $this -> category['name'];?></strong></h2>
</div>
</div>
<div class="menu-buttons">
<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>
<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 or $user['id'] == 3 ):?>
<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>
<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>

View File

@@ -0,0 +1,25 @@
<? global $user;?>
<div class="row block-header">
<div class="col-12">
<h2>Kategoria: <strong><?= $this -> category['name'];?></strong></h2>
</div>
</div>
<div class="menu-buttons">
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
<a href="/wiki/category_edit/id=<?= $this -> category['id'];?>" class="btn btn-success btn-sm" title="Edytuj kategorię">
<i class="fa fa-edit"></i>Edytuj kategorię
</a>
<? endif;?>
<a href="/wiki/main_view/" class="btn btn-dark btn-sm" title="Wstecz">
<i class="fa fa-reply"></i>Wstecz
</a>
</div>
<div class="text-container">
<?= $this -> category['text'];?>
</div>
<? if ( $user['id'] == 1 or $user['id'] == 3 ):?>
<br>
<div class="text-container">
<?= $this -> category['text_admin'];?>
</div>
<? endif;?>

View File

@@ -0,0 +1,109 @@
<div class="row block-header">
<div class="col-12">
<h2>Wiki</h2>
</div>
</div>
<div class="box">
<? if ( $this -> user['id'] == 1 or $this -> user['id'] == 3 ):?>
<div class="menu-buttons">
<a href="/wiki/category_edit/" class="btn btn-success btn-sm" title="Dodaj kategorię">
<i class="fa fa-plus"></i>Dodaj kategorię
</a>
</div>
<? endif;?>
<table class="table table-striped table-hover table-sm">
<tr>
<td>
<input type="text" class="form-control" id="search-name">
</td>
</tr>
</table>
<div class="wiki-categories">
<? foreach ( $this -> categories as $category ):?>
<div class="category">
<div class="title">
<a href="/wiki/category_preview/id=<?= $category['id'];?>"><?= $category['name'];?></a>
</div>
<? if ( $this -> user['id'] == 1 or $this -> user['id'] == 3 ):?>
<div class="row">
<div class="col-md-6">
<div class="users">
<? $category_users = \factory\Wiki::category_users( $category['id'] );?>
<? if ( is_array( $category_users ) ): foreach ( $category_users as $user_tmp ):?>
<?
$user = \factory\Users::user_details( $user_tmp );
echo '<div class="user" style="background: ' . $user['color'] . '" title="' . $user['name'] . ' ' . $user['surname'] . '">' . $user['name'][0] . $user['surname'][0] . '</div>';
?>
<? endforeach; endif;?>
</div>
</div>
<div class="col-md-6">
<div class="actions">
<a href="/wiki/category_edit/id=<?= $category['id'];?>">edytuj</a>
<a href="/wiki/category_delete/id=<?= $category['id'];?>" class="category-delete">usuń</a>
</div>
</div>
</div>
<? endif;?>
</div>
<? endforeach;?>
</div>
<script type="text/javascript">
$( function()
{
$( 'body' ).on( 'click', '.category-delete', function(e) {
e.preventDefault();
var href = $( this ).attr( 'href' );
$.confirm({
title: 'Potwierdź',
type: 'orange',
columnClass: 'col-md-8 col-md-offset-2 col-12',
closeIcon: true,
closeIconClass: 'fa fa-close',
content: 'Na pewno chcesz usunąć wybrany wpis?',
theme: 'modern',
buttons: {
submit: {
text: '<i class="fa fa-check"></i>Zatwierdź',
btnClass: 'btn-success',
action: function () {
document.location.href = href;
}
},
cancel: {
text: '<i class="fa fa-close"></i>Anuluj',
btnClass: 'btn-danger',
keys: ['enter'],
action: function() {}
}
}
});
});
var timer = '';
$( '#search-name' ).keyup( function()
{
var _this = $( this);
var category = _this.val();
clearTimeout( timer );
timer = setTimeout( function()
{
category = category.toLowerCase();
$( '.category' ).hide();
$( ".category .title a" ).each( function ( index )
{
var text = $( this ).text();
text = text.trim().toLowerCase(); console.log( text );
if ( text.indexOf( category ) >= 0 )
$( this ).parents( '.category' ).show();
});
if ( category == '' )
$( '.category' ).show();
}, 500 );
});
});
</script>