initial commit
This commit is contained in:
13
Config.php
Normal file
13
Config.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Config {
|
||||
|
||||
const ROOT_PATH = "/";
|
||||
|
||||
|
||||
const WEBSITE_NAME = 'PSL-CMS';
|
||||
const WEBSITE_SLOGAN = 'Your simple content management system';
|
||||
|
||||
|
||||
|
||||
}
|
||||
94
admin/add_categories.php
Executable file
94
admin/add_categories.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
$category = new Category($db);
|
||||
|
||||
$category->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["categorySave"]) && $_POST["categoryName"]!='') {
|
||||
|
||||
$category->name = $_POST["categoryName"];
|
||||
if($category->id) {
|
||||
if($category->update()) {
|
||||
$saveMessage = "Category updated successfully!";
|
||||
}
|
||||
} else {
|
||||
$lastInserId = $category->insert();
|
||||
if($lastInserId) {
|
||||
$category->id = $lastInserId;
|
||||
$saveMessage = "Category saved successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$categoryDetails = $category->getCategory();
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Category <small>editation</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Add / Edit Category</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Category Name</label>
|
||||
<input type="text" class="form-control" id="categoryName" name="categoryName" value="<?php echo $categoryDetails['name']; ?>" placeholder="Category name..">
|
||||
</div>
|
||||
|
||||
<input type="submit" name="categorySave" id="categorySave" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
99
admin/add_image.php
Normal file
99
admin/add_image.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../models/ImagesManager.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["imageSave"])) {
|
||||
|
||||
$imagesManager = new ImagesManager();
|
||||
if(empty($_POST["imageName"])){
|
||||
$imagesManager->validateImage();
|
||||
}else{
|
||||
$imagesManager->validateImage($_POST["imageName"]);
|
||||
}
|
||||
$imagesManager->uploadImage();
|
||||
|
||||
$saveMessage = $imagesManager->getMessage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Image <small>upload</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Upload Image</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm" enctype="multipart/form-data">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="imageFile" class="control-label">Image file</label>
|
||||
<input class="form-control" class="form-control" id="imageFile" name="imageFile" type="file" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="imageName" class="control-label">New image name</label>
|
||||
<input type="text" class="form-control" id="imageName" name="imageName" placeholder="new name, if wanted">
|
||||
</div>
|
||||
|
||||
|
||||
<input type="submit" name="imageSave" id="imageSave" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
101
admin/add_menu.php
Normal file
101
admin/add_menu.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../models/Menu.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
$menu = new Menu($db);
|
||||
|
||||
$menu->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["menuSave"]) && $_POST["menuTitle"]!='' && $_POST["menuLink"]!='') {
|
||||
|
||||
$menu->title = $_POST["menuTitle"];
|
||||
$menu->link = $_POST["menuLink"];
|
||||
if($menu->id) {
|
||||
if($menu->update()) {
|
||||
$saveMessage = "Menu item updated successfully!";
|
||||
}
|
||||
} else {
|
||||
$lastInserId = $menu->insert();
|
||||
if($lastInserId) {
|
||||
$menu->id = $lastInserId;
|
||||
$saveMessage = "Menu item saved successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$menuDetails = $menu->getMenu();
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Menu <small>item editation</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Add / Edit Menu entry</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Menu item title</label>
|
||||
<input type="text" class="form-control" id="menuTitle" name="menuTitle" value="<?php echo $menuDetails['title']; ?>" placeholder="Menu item title..">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">link</label>
|
||||
<input type="text" class="form-control" id="menuLink" name="menuLink" value="<?php echo $menuDetails['link']; ?>" placeholder="Menu item link">
|
||||
</div>
|
||||
|
||||
<input type="submit" name="menuSave" id="menuSave" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
109
admin/add_page.php
Normal file
109
admin/add_page.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../models/Pages.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
$page = new Pages($db);
|
||||
|
||||
$page->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["pageSave"]) && $_POST["pageTitle"]!='' && $_POST["pageLink"]!='' && $_POST["pageContent"]!='') {
|
||||
|
||||
$page->title = $_POST["pageTitle"];
|
||||
$page->link = $_POST["pageLink"];
|
||||
$page->content = $_POST["pageContent"];
|
||||
|
||||
|
||||
if($page->id) {
|
||||
if($page->update()) {
|
||||
$saveMessage = "Page updated successfully!";
|
||||
}
|
||||
} else {
|
||||
$lastInserId = $page->insert();
|
||||
if($lastInserId) {
|
||||
$page->id = $lastInserId;
|
||||
$saveMessage = "Page saved successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pageyDetails = $page->getPage();
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Page <small>editation</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Add / Edit page</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Page Title</label>
|
||||
<input type="text" class="form-control" id="pageTitle" name="pageTitle" value="<?php echo $pageyDetails['title']; ?>" placeholder="Page title..">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Page link</label>
|
||||
<input type="text" class="form-control" id="pageLink" name="pageLink" value="<?php echo $pageyDetails['link']; ?>" placeholder="Page link">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Page content</label>
|
||||
<textarea class="form-control" id="pageContent" name="pageContent"><?php echo $pageyDetails['content']; ?> </textarea>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="pageSave" id="pageSave" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
134
admin/add_users.php
Executable file
134
admin/add_users.php
Executable file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
$user->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["saveUser"]) && $_POST["nick"]!='') {
|
||||
|
||||
$user->first_name = $_POST["first_name"];
|
||||
$user->last_name = $_POST["last_name"];
|
||||
$user->nick = $_POST["nick"];
|
||||
$user->type = $_POST["user_type"];
|
||||
$user->deleted = $_POST["user_status"];
|
||||
if($user->id) {
|
||||
$user->updated = date('Y-m-d H:i:s');
|
||||
if($user->update()) {
|
||||
$saveMessage = "User updated successfully!";
|
||||
}
|
||||
} else {
|
||||
$user->password = $_POST["password"];
|
||||
$lastInserId = $user->insert();
|
||||
if($lastInserId) {
|
||||
$user->id = $lastInserId;
|
||||
$saveMessage = "User saved successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$userDetails = $user->getUser();
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> User <small>editation</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Add / Edit User</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">First Name</label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" value="<?php echo $userDetails['first_name']; ?>" placeholder="First name..">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Last Name</label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" value="<?php echo $userDetails['last_name']; ?>" placeholder="Last name..">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">nick</label>
|
||||
<input type="text" class="form-control" id="nick" name="nick" value="<?php echo $userDetails['nick']; ?>" placeholder="nick..">
|
||||
</div>
|
||||
<?php
|
||||
if(!$user->id) {
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" value="<?php echo $userDetails['password']; ?>" placeholder="password..">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status" class="control-label">User Type </label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="user_type" id="admin" value="1" <?php if($userDetails['type'] == 1) { echo "checked";} ?>>Administrator
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="user_type" id="author" value="2" <?php if($userDetails['type'] == 2) { echo "checked";} ?>>Author
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status" class="control-label">User Status </label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="user_status" id="active" value="0" <?php if(!$userDetails['deleted']) { echo "checked";} ?>>Active
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="user_status" id="inactive" value="1" <?php if($userDetails['deleted']) { echo "checked";} ?>>Inactive
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="saveUser" id="saveUser" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
81
admin/categories.php
Executable file
81
admin/categories.php
Executable file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/categories.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Categories <small>management</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"style="background-color: #095f59;">
|
||||
<h3 class="panel-title">Categories</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="add_categories.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="categoryList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Category</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php include('../template/footer.php');?>
|
||||
133
admin/compose_post.php
Executable file
133
admin/compose_post.php
Executable file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
$post = new Post($db);
|
||||
|
||||
$categories = $post->getCategories();
|
||||
|
||||
$post->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
$saveMessage = '';
|
||||
if(!empty($_POST["savePost"]) && $_POST["title"]!=''&& $_POST["message"]!='') {
|
||||
|
||||
$post->title = $_POST["title"];
|
||||
$post->message = $_POST["message"];
|
||||
$post->category = $_POST["category"];
|
||||
$post->status = $_POST["status"];
|
||||
if($post->id) {
|
||||
$post->updated = date('Y-m-d H:i:s');
|
||||
if($post->update()) {
|
||||
$saveMessage = "Post updated successfully!";
|
||||
}
|
||||
} else {
|
||||
$post->userid = $_SESSION["userid"];
|
||||
$post->created = date('Y-m-d H:i:s');
|
||||
$post->updated = date('Y-m-d H:i:s');
|
||||
$lastInserId = $post->insert();
|
||||
if($lastInserId) {
|
||||
$post->id = $lastInserId;
|
||||
$saveMessage = "Post saved successfully!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postdetails = $post->getPost();
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Article <small>Editation</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Add New Post</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" id="postForm">
|
||||
<?php if ($saveMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-success col-sm-12"><?php echo $saveMessage; ?></div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label for="title" class="control-label">Title</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="<?php echo $postdetails['title']; ?>" placeholder="Post title..">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="lastname" class="control-label">Message</label>
|
||||
<textarea class="form-control" rows="5" id="message" name="message" placeholder="Post message.."><?php echo $postdetails['message']; ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sel1">Category</label>
|
||||
<select class="form-control" id="category" name="category">
|
||||
<?php
|
||||
foreach ($categories as $category) {
|
||||
$selected = '';
|
||||
if($category['name'] ==$postdetails['name']) {
|
||||
$selected = 'selected=selected';
|
||||
}
|
||||
echo "<option value='".$category['id']."' $selected>".$category['name']."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="status" class="control-label"></label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="status" id="publish" value="published" <?php if($postdetails['status'] == 'published') { echo "checked";} ?>>Publish
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="status" id="draft" value="draft" <?php if($postdetails['status'] == 'draft') { echo "checked";} ?>>Draft
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="status" id="archived" value="archived" <?php if($postdetails['status'] == 'archived') { echo "checked";} ?>>Archive
|
||||
</label>
|
||||
</div>
|
||||
<input type="submit" name="savePost" id="savePost" class="btn btn-info" value="Save" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
1
admin/css/dataTables.bootstrap.min.css
vendored
Executable file
1
admin/css/dataTables.bootstrap.min.css
vendored
Executable file
@@ -0,0 +1 @@
|
||||
table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0}
|
||||
150
admin/css/style.css
Executable file
150
admin/css/style.css
Executable file
@@ -0,0 +1,150 @@
|
||||
|
||||
body{
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.navbar{
|
||||
min-height: 33px !important;
|
||||
margin-bottom: 0;
|
||||
border-radius: 0;
|
||||
|
||||
}
|
||||
.navbar-nav> li>a, .navbar-brand{
|
||||
padding-top: 6px !important;
|
||||
padding-bottom: 0;
|
||||
height: 33px;
|
||||
|
||||
}
|
||||
|
||||
.main-color-bg{
|
||||
background-color: #095f59;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
|
||||
/*Header */
|
||||
|
||||
#header{
|
||||
background: #333333;
|
||||
color: #ffffff;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: : 15px;
|
||||
}
|
||||
|
||||
#header .create{
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.dash-box{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#footer{
|
||||
background: #333333;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
padding: 30px;
|
||||
margin-top: 30px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.navbar-default {
|
||||
background-color: #095f59;
|
||||
border-color: #689a9b;
|
||||
}
|
||||
.navbar-default .navbar-brand {
|
||||
color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-brand:hover,
|
||||
.navbar-default .navbar-brand:focus {
|
||||
color: #010800;
|
||||
}
|
||||
.navbar-default .navbar-text {
|
||||
color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-nav > li > a {
|
||||
color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-nav > li > a:hover,
|
||||
.navbar-default .navbar-nav > li > a:focus {
|
||||
color: #010800;
|
||||
}
|
||||
.navbar-default .navbar-nav > .active > a,
|
||||
.navbar-default .navbar-nav > .active > a:hover,
|
||||
.navbar-default .navbar-nav > .active > a:focus {
|
||||
color: #010800;
|
||||
background-color: #689a9b;
|
||||
}
|
||||
.navbar-default .navbar-nav > .open > a,
|
||||
.navbar-default .navbar-nav > .open > a:hover,
|
||||
.navbar-default .navbar-nav > .open > a:focus {
|
||||
color: #010800;
|
||||
background-color: #689a9b;
|
||||
}
|
||||
.navbar-default .navbar-toggle {
|
||||
border-color: #689a9b;
|
||||
}
|
||||
.navbar-default .navbar-toggle:hover,
|
||||
.navbar-default .navbar-toggle:focus {
|
||||
background-color: #689a9b;
|
||||
}
|
||||
.navbar-default .navbar-toggle .icon-bar {
|
||||
background-color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-collapse,
|
||||
.navbar-default .navbar-form {
|
||||
border-color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-link {
|
||||
color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-link:hover {
|
||||
color: #010800;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
|
||||
color: #efee24;
|
||||
}
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
|
||||
color: #010800;
|
||||
}
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
|
||||
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
|
||||
color: #010800;
|
||||
background-color: #689a9b;
|
||||
}
|
||||
}
|
||||
|
||||
/*Breadcrumb*/
|
||||
|
||||
.breadcrumb{
|
||||
background: #cccccc;
|
||||
color: #333333;
|
||||
}
|
||||
.breadcrumb a{
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
footer{
|
||||
background-color:#888;
|
||||
text-align:center;
|
||||
color:white;
|
||||
font-size:1.2em;
|
||||
padding:0.6em;
|
||||
}
|
||||
|
||||
footer a {
|
||||
color:#DDD;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.panel-heading{
|
||||
color:white!important;
|
||||
background-color:#337ab7!important;
|
||||
}
|
||||
84
admin/dashboard.php
Executable file
84
admin/dashboard.php
Executable file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Dashboard <small>Manage Your Site</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<?php include "left_menus.php"; ?>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" style="background-color: #095f59;">
|
||||
<h3 class="panel-title">Website Overview</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-md-3">
|
||||
<div class="well dash-box">
|
||||
<h2><span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?php echo $user->totalUser(); ?></h2>
|
||||
<h4>Users</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="well dash-box">
|
||||
<h2><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> <?php echo $category->totalCategory(); ?></h2>
|
||||
<h4>Categories</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="well dash-box">
|
||||
<h2><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span><?php echo $post->totalPost(); ?></h2>
|
||||
<h4>Posts</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<?php include('../template/footer.php');?>
|
||||
12
admin/dropdown.php
Normal file
12
admin/dropdown.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="col-md-2">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Manage
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="./posts.php">Add Article</a></li>
|
||||
<li><a href="./categories.php">Add Category</a></li>
|
||||
<li><a href="./pages.php">Create page</a></li>
|
||||
<li><a href="./logout.php">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
83
admin/images.php
Normal file
83
admin/images.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../models/ImagesManager.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
$images = new ImagesManager();
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/images.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Images <small>management</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"style="background-color: #095f59;">
|
||||
<h3 class="panel-title">Stored images</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="add_image.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="imagesList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Image (view by click)</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<?php include('../template/footer.php');?>
|
||||
63
admin/index.php
Executable file
63
admin/index.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
|
||||
|
||||
$user = new User($db);
|
||||
|
||||
if($user->loggedIn()) {
|
||||
header("location: dashboard.php");
|
||||
}
|
||||
|
||||
$loginMessage = '';
|
||||
if(!empty($_POST["login"]) && $_POST["nick"]!=''&& $_POST["password"]!='') {
|
||||
$user->nick = $_POST["nick"];
|
||||
$user->password = $_POST["password"];
|
||||
if($user->login()) {
|
||||
header("location: dashboard.php");
|
||||
} else {
|
||||
$loginMessage = 'Invalid login! Please try again.';
|
||||
}
|
||||
}
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<?php include('../template/container.php');?>
|
||||
<div class="container contact">
|
||||
<h2>Administration of PSL - CMS</h2>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading" style="background:#00796B;color:white;">
|
||||
<div class="panel-title">Login</div>
|
||||
</div>
|
||||
<div style="padding-top:30px" class="panel-body" >
|
||||
<?php if ($loginMessage != '') { ?>
|
||||
<div id="login-alert" class="alert alert-danger col-sm-12"><?php echo $loginMessage; ?></div>
|
||||
<?php } ?>
|
||||
<form id="loginform" class="form-horizontal" role="form" method="POST" action="">
|
||||
<div style="margin-bottom: 25px" class="input-group">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
||||
<input type="text" class="form-control" id="nick" name="nick" placeholder="nick" style="background:white;" required>
|
||||
</div>
|
||||
<div style="margin-bottom: 25px" class="input-group">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
|
||||
<input type="password" class="form-control" id="password" name="password"placeholder="password" required>
|
||||
</div>
|
||||
<div style="margin-top:10px" class="form-group">
|
||||
<div class="col-sm-12 controls">
|
||||
<input type="submit" name="login" value="Login" class="btn btn-info">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('../template/footer.php');?>
|
||||
37
admin/js/categories.js
Executable file
37
admin/js/categories.js
Executable file
@@ -0,0 +1,37 @@
|
||||
$(document).ready(function(){
|
||||
var categoryData = $('#categoryList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_categories.php",
|
||||
type:"POST",
|
||||
data:{action:'categoryListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[0, 2, 3],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 10
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var categoryId = $(this).attr("id");
|
||||
var action = "categoryDelete";
|
||||
if(confirm("Are you sure you want to delete this category?")) {
|
||||
$.ajax({
|
||||
url:"manage_categories.php",
|
||||
method:"POST",
|
||||
data:{categoryId:categoryId, action:action},
|
||||
success:function(data) {
|
||||
categoryData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
8
admin/js/dataTables.bootstrap.min.js
vendored
Executable file
8
admin/js/dataTables.bootstrap.min.js
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
DataTables Bootstrap 3 integration
|
||||
©2011-2015 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"});b.extend(f.ext.classes,
|
||||
{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm",sProcessing:"dataTables_processing panel panel-default"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,m,j,n){var o=new f.Api(a),s=a.oClasses,k=a.oLanguage.oPaginate,t=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")};
|
||||
l=0;for(h=f.length;l<h;l++)if(c=f[l],b.isArray(c))q(d,c);else{g=e="";switch(c){case "ellipsis":e="…";g="disabled";break;case "first":e=k.sFirst;g=c+(0<j?"":" disabled");break;case "previous":e=k.sPrevious;g=c+(0<j?"":" disabled");break;case "next":e=k.sNext;g=c+(j<n-1?"":" disabled");break;case "last":e=k.sLast;g=c+(j<n-1?"":" disabled");break;default:e=c+1,g=j===c?"active":""}e&&(i=b("<li>",{"class":s.sPageButton+" "+g,id:0===r&&"string"===typeof c?a.sTableId+"_"+c:null}).append(b("<a>",{href:"#",
|
||||
"aria-controls":a.sTableId,"aria-label":t[c],"data-dt-idx":p,tabindex:a.iTabIndex}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(u){}q(b(h).empty().html('<ul class="pagination"/>').children("ul"),m);i&&b(h).find("[data-dt-idx="+i+"]").focus()};return f});
|
||||
38
admin/js/images.js
Normal file
38
admin/js/images.js
Normal file
@@ -0,0 +1,38 @@
|
||||
$(document).ready(function(){
|
||||
var usersData = $('#imagesList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_image.php",
|
||||
type:"POST",
|
||||
data:{action:'imageListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[0, 1, 2],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 100000000
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var imageId = $(this).attr("id");
|
||||
var action = "imageDelete";
|
||||
if(confirm("Are you sure you want to delete this image?")) {
|
||||
$.ajax({
|
||||
url:"manage_image.php",
|
||||
method:"POST",
|
||||
data:{imageId:imageId, action:action},
|
||||
success:function(data) {
|
||||
usersData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
166
admin/js/jquery.dataTables.min.js
vendored
Executable file
166
admin/js/jquery.dataTables.min.js
vendored
Executable file
@@ -0,0 +1,166 @@
|
||||
/*!
|
||||
DataTables 1.10.12
|
||||
©2008-2015 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(D){return h(D,window,document)}):"object"===typeof exports?module.exports=function(D,I){D||(D=window);I||(I="undefined"!==typeof window?require("jquery"):require("jquery")(D));return h(I,D,D.document)}:h(jQuery,window,document)})(function(h,D,I,k){function X(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
|
||||
d[c]=e,"o"===b[1]&&X(a[e])});a._hungarianMap=d}function K(a,b,c){a._hungarianMap||X(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),K(a[d],b[d],c)):b[d]=b[e]})}function Da(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&E(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&E(a,a,"sZeroRecords","sLoadingRecords");
|
||||
a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&db(a)}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":"");"boolean"===typeof a.scrollX&&(a.scrollX=
|
||||
a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&K(m.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){if(!m.__browser){var b={};m.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,
|
||||
width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,m.__browser);a.oScroll.iBarWidth=m.__browser.barWidth}function hb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&
|
||||
(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ea(a,b){var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:I.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);ja(a,d,h(b).data())}function ja(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var f=
|
||||
(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),K(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),E(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),E(b,c,"aDataSort"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&
|
||||
(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return R(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):
|
||||
!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function Y(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Fa(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&ka(a);u(a,null,"column-sizing",[a])}function Z(a,b){var c=la(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=la(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}
|
||||
function aa(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function la(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ga(a){var b=a.aoColumns,c=a.aoData,d=m.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<j;g++){i=0;for(h=c.length;i<h;i++){t[i]===k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&
|
||||
g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function ib(a,b,c,d){var e,f,g,j,i,n,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){n=b[e];var q=n.targets!==k?n.targets:n.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Ea(a);d(q[f],n)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],n);else if("string"===typeof q[f]){j=0;for(i=l.length;j<i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&
|
||||
d(j,n)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function N(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ha(a,e,c,d);return e}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,e){c=Ia(a,e);return N(a,c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,
|
||||
f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(L(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function jb(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}
|
||||
function Ja(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\./g,".")})}function Q(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=Q(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ja(f);
|
||||
for(var i=0,n=j.length;i<n;i++){f=j[i].match(ba);g=j[i].match(U);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(n=a.length;i<n;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(U,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}function R(a){if(h.isPlainObject(a))return R(a._);
|
||||
if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ja(e),f;f=e[e.length-1];for(var g,j,i=0,n=e.length-1;i<n;i++){g=e[i].match(ba);j=e[i].match(U);if(g){e[i]=e[i].replace(ba,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(n=d.length;j<n;j++)f={},b(f,d[j],g),a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(U,
|
||||
""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(U))a[f.replace(U,"")](d);else a[f.replace(ba,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ka(a){return G(a.aoData,"_aData")}function na(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function oa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,1)}function ca(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);
|
||||
c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ia(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;La(a,e)}}function Ia(a,b,c,d){var e=[],f=b.firstChild,g,j,i=0,n,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");
|
||||
-1!==c&&(c=a.substring(c+1),R(a)(d,b.getAttribute(c)))}},S=function(a){if(c===k||c===i)j=l[i],n=h.trim(a.innerHTML),j&&j._bAttrSrc?(R(j.mData._)(d,n),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=R(j.mData)),j._setter(d,n)):d[i]=n;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)S(f),e.push(f);f=f.nextSibling}else{e=b.anCells;f=0;for(g=e.length;f<g;f++)S(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&R(a.rowId)(d,b);return{data:d,cells:e}}
|
||||
function Ha(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,n,l,q;if(null===e.nTr){j=c||I.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;La(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){n=a.aoColumns[l];i=c?d[l]:I.createElement(n.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||n.mRender||n.mData!==l)&&(!h.isPlainObject(n.mData)||n.mData._!==l+".display"))i.innerHTML=B(a,b,l,"display");n.sClass&&(i.className+=" "+n.sClass);n.bVisible&&!c?j.appendChild(i):!n.bVisible&&c&&i.parentNode.removeChild(i);
|
||||
n.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}u(a,"aoRowCreatedCallback",null,[j,f,b])}e.nTr.setAttribute("role","row")}function La(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?pa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===
|
||||
h("th, td",g).length,n=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Ma(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Na(a,"header")(a,d,f,n);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(n.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(n.sFooterTH);
|
||||
if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,n;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(n=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);
|
||||
for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+n]!==k&&g[d][f].cell==g[d][f+n].cell;){for(c=0;c<i;c++)j[d+c][f+n]=1;n++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",n)}}}}function O(a){var b=u(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=
|
||||
-1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!lb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ha(a,l);l=q.nTr;if(0!==e){var t=d[c%e];q._sRowStripe!=t&&(h(l).removeClass(q._sRowStripe).addClass(t),q._sRowStripe=t)}u(a,"aoRowCallback",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:
|
||||
f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];u(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ka(a),g,n,i]);u(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ka(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));u(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function T(a,b){var c=a.oFeatures,d=c.bFilter;
|
||||
c.bSort&&mb(a);d?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;O(a);a._drawHold=!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,n,l,q,t=0;t<f.length;t++){g=null;j=f[t];if("<"==j){i=h("<div/>")[0];
|
||||
n=f[t+1];if("'"==n||'"'==n){l="";for(q=2;f[t+q]!=n;)l+=f[t+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(n=l.split("."),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;t+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if("f"==j&&d.bFilter)g=pb(a);else if("r"==j&&d.bProcessing)g=qb(a);else if("t"==j)g=rb(a);else if("i"==j&&d.bInfo)g=sb(a);else if("p"==
|
||||
j&&d.bPaginate)g=tb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(n=i.length;q<n;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function da(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,n,l,q,t;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");
|
||||
q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;n=g;t=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][n+j]={cell:e,unique:t},a[f+g].nTr=d}e=e.nextSibling}}}function qa(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function ra(a,b,c){u(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},
|
||||
e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){u(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var n=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&n?n:h.extend(!0,b,n);delete g.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&L(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=u(a,null,"xhr",
|
||||
[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?L(a,0,"Invalid JSON response",1):4===b.readyState&&L(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;u(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(n,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(n,g)),g.data=f)}function lb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,
|
||||
!0),ra(a,ub(a),function(b){vb(a,b)}),!1):!0}function ub(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,n,l,q=V(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var k=function(a,b){j.push({name:a,value:b})};k("sEcho",a.iDraw);k("iColumns",c);k("sColumns",G(b,"sName").join(","));k("iDisplayStart",g);k("iDisplayLength",i);var S={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)n=b[g],
|
||||
l=f[g],i="function"==typeof n.mData?"function":n.mData,S.columns.push({data:i,name:n.sName,searchable:n.bSearchable,orderable:n.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),k("mDataProp_"+g,i),d.bFilter&&(k("sSearch_"+g,l.sSearch),k("bRegex_"+g,l.bRegex),k("bSearchable_"+g,n.bSearchable)),d.bSort&&k("bSortable_"+g,n.bSortable);d.bFilter&&(k("sSearch",e.sSearch),k("bRegex",e.bRegex));d.bSort&&(h.each(q,function(a,b){S.order.push({column:b.col,dir:b.dir});k("iSortCol_"+a,b.col);k("sSortDir_"+
|
||||
a,b.dir)}),k("iSortingCols",q.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:S:b?j:S}function vb(a,b){var c=sa(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}na(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,10);d=0;for(e=c.length;d<e;d++)N(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;O(a);a._bInitComplete||
|
||||
ta(a,b);a.bAjaxDataGet=!0;C(a,!1)}function sa(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?Q(c)(b):b}function pb(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?
|
||||
"":this.value;b!=e.sSearch&&(fa(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,O(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT",g?Oa(f,g):f).bind("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==I.activeElement&&i.val(e.sSearch)}catch(d){}});
|
||||
return b[0]}function fa(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ga(a);if("ssp"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)xb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);yb(a)}else f(b);a.bFiltered=!0;u(a,null,"search",[a])}function yb(a){for(var b=
|
||||
m.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,n=c.length;i<n;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function xb(a,b,c,d,e,f){if(""!==b)for(var g=a.aiDisplay,d=Pa(b,d,e,f),e=g.length-1;0<=e;e--)b=a.aoData[g[e]]._aFilterData[c],d.test(b)||g.splice(e,1)}function wb(a,b,c,d,e,f){var d=Pa(b,d,e,f),e=a.oPreviousSearch.sSearch,f=a.aiDisplayMaster,g;0!==m.ext.search.length&&(c=!0);g=zb(a);if(0>=b.length)a.aiDisplay=f.slice();
|
||||
else{if(g||c||e.length>b.length||0!==b.indexOf(e)||a.bSorted)a.aiDisplay=f.slice();b=a.aiDisplay;for(c=b.length-1;0<=c;c--)d.test(a.aoData[b[c]]._sFilterRow)||b.splice(c,1)}}function Pa(a,b,c,d){a=b?a:Qa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function zb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=m.ext.type.search;c=!1;d=0;for(f=a.aoData.length;d<
|
||||
f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(ua.innerHTML=i,i=Zb?ua.textContent:ua.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join(" ");c=!0}return c}function Ab(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}
|
||||
function Bb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function sb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Cb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Cb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),
|
||||
g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Db(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Db(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/
|
||||
e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ga(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){nb(a);kb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Fa(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=x(f.sWidth));u(a,null,"preInit",[a]);T(a);e=y(a);if("ssp"!=e||g)"ajax"==e?ra(a,[],function(c){var f=sa(a,c);for(b=0;b<f.length;b++)N(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ta(a,c)},a):(C(a,!1),
|
||||
ta(a))}else setTimeout(function(){ga(a)},200)}function ta(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&Y(a);u(a,null,"plugin-init",[a,b]);u(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);u(a,null,"length",[a,c])}function ob(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=new Option(d[g],f[g]);var i=
|
||||
h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).bind("change.DT",function(){Ra(a,h(this).val());O(a)});h(a.nTable).bind("length.dt.DT",function(b,c,d){a===c&&h("select",i).val(d)});return i[0]}function tb(a){var b=a.sPaginationType,c=m.ext.pager[b],d="function"===typeof c,e=function(a){O(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;
|
||||
d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Na(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Ta(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:
|
||||
"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:L(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(u(a,null,"page",[a]),c&&O(a));return b}function qb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");u(a,null,"processing",
|
||||
[a,b])}function rb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?!d?null:x(d):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",
|
||||
width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:x(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:x(d):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",0).append("bottom"===j?g:null).append(b.children("tfoot")))));
|
||||
var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:ka,sName:"scrolling"});return i[0]}function ka(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,n=j.children("table"),j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),
|
||||
m=t.children("table"),o=h(a.nTHead),F=h(a.nTable),p=F[0],r=p.style,u=a.nTFoot?h(a.nTFoot):null,Eb=a.oBrowser,Ua=Eb.bScrollOversize,s=G(a.aoColumns,"nTh"),P,v,w,y,z=[],A=[],B=[],C=[],D,E=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};v=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==v&&a.scrollBarVis!==k)a.scrollBarVis=v,Y(a);else{a.scrollBarVis=v;F.children("thead, tfoot").remove();u&&(w=u.clone().prependTo(F),P=u.find("tr"),w=
|
||||
w.find("tr"));y=o.clone().prependTo(F);o=o.find("tr");v=y.find("tr");y.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(qa(a,y),function(b,c){D=Z(a,b);c.style.width=a.aoColumns[D].sWidth});u&&J(function(a){a.style.width=""},w);f=F.outerWidth();if(""===c){r.width="100%";if(Ua&&(F.find("tbody").height()>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=x(F.outerWidth()-b);f=F.outerWidth()}else""!==d&&(r.width=x(d),f=F.outerWidth());J(E,v);J(function(a){B.push(a.innerHTML);
|
||||
z.push(x(h(a).css("width")))},v);J(function(a,b){if(h.inArray(a,s)!==-1)a.style.width=z[b]},o);h(v).height(0);u&&(J(E,w),J(function(a){C.push(a.innerHTML);A.push(x(h(a).css("width")))},w),J(function(a,b){a.style.width=A[b]},P),h(w).height(0));J(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+B[b]+"</div>";a.style.width=z[b]},v);u&&J(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+C[b]+"</div>";a.style.width=
|
||||
A[b]},w);if(F.outerWidth()<f){P=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(Ua&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=x(P-b);(""===c||""!==d)&&L(a,1,"Possible column misalignment",6)}else P="100%";q.width=x(P);g.width=x(P);u&&(a.nScrollFoot.style.width=x(P));!e&&Ua&&(q.height=x(p.offsetHeight+b));c=F.outerWidth();n[0].style.width=x(c);i.width=x(c);d=F.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+(Eb.bScrollbarLeft?"Left":
|
||||
"Right");i[e]=d?b+"px":"0px";u&&(m[0].style.width=x(c),t[0].style.width=x(c),t[0].style[e]=d?b+"px":"0px");F.children("colgroup").insertBefore(F.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function J(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Fa(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,f=d.sX,g=d.sXInner,
|
||||
j=c.length,i=la(a,"bVisible"),n=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,m,o,p=a.oBrowser,d=p.bScrollOversize;(m=b.style.width)&&-1!==m.indexOf("%")&&(l=m);for(m=0;m<i.length;m++)o=c[i[m]],null!==o.sWidth&&(o.sWidth=Fb(o.sWidthOrig,k),t=!0);if(d||!t&&!f&&!e&&j==aa(a)&&j==n.length)for(m=0;m<j;m++)i=Z(a,m),null!==i&&(c[i].sWidth=x(n.eq(m).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var r=h("<tr/>").appendTo(j.find("tbody"));
|
||||
j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");n=qa(a,j.find("thead")[0]);for(m=0;m<i.length;m++)o=c[i[m]],n[m].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?x(o.sWidthOrig):"",o.sWidthOrig&&f&&h(n[m]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(m=0;m<i.length;m++)t=i[m],o=c[t],h(Gb(a,t)).clone(!1).append(o.sContentPadding).appendTo(r);h("[name]",
|
||||
j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):l&&j.width(l);for(m=e=0;m<i.length;m++)k=h(n[m]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(n[m].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[m]].sWidth=x(k-g);b.style.width=x(e);o.remove()}l&&(b.style.width=
|
||||
x(l));if((l||f)&&!a._reszEvt)b=function(){h(D).bind("resize.DT-"+a.sInstance,Oa(function(){Y(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Fb(a,b){if(!a)return 0;var c=h("<div/>").css("width",x(a)).appendTo(b||I.body),d=c[0].offsetWidth;c.remove();return d}function Gb(a,b){var c=Hb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Hb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace($b,
|
||||
""),c=c.replace(/ /g," "),c.length>d&&(d=c.length,e=f);return e}function x(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function V(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):h.merge(n,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<n.length;a++){i=n[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||
|
||||
"string",n[a]._idx===k&&(n[a]._idx=h.inArray(n[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:n[a][1],index:n[a]._idx,type:j,formatter:m.ext.type.order[j+"-pre"]})}return d}function mb(a){var b,c,d=[],e=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Ga(a);h=V(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Ib(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=
|
||||
0;g<i;g++)if(j=h[g],c=k[j.col],e=m[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,p=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=p[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Jb(a){for(var b,c,d=a.aoColumns,e=V(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,
|
||||
"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Va(a,b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,
|
||||
G(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);T(a);"function"==typeof d&&d(a)}function Ma(a,b,c,d){var e=a.aoColumns[c];Wa(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Va(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Va(a,c,b.shiftKey,d))})}
|
||||
function va(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(G(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(G(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Ib(a,b){var c=a.aoColumns[b],d=m.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],
|
||||
c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function wa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};u(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
|
||||
b)}}function Kb(a){var b,c,d=a.aoColumns;if(a.oFeatures.bStateSave){var e=a.fnStateLoadCallback.call(a.oInstance,a);if(e&&e.time&&(b=u(a,"aoStateLoadParams","stateLoadParams",[a,e]),-1===h.inArray(!1,b)&&(b=a.iStateDuration,!(0<b&&e.time<+new Date-1E3*b)&&d.length===e.columns.length))){a.oLoadedState=h.extend(!0,{},e);e.start!==k&&(a._iDisplayStart=e.start,a.iInitDisplayStart=e.start);e.length!==k&&(a._iDisplayLength=e.length);e.order!==k&&(a.aaSorting=[],h.each(e.order,function(b,c){a.aaSorting.push(c[0]>=
|
||||
d.length?[0,c[1]]:c)}));e.search!==k&&h.extend(a.oPreviousSearch,Bb(e.search));b=0;for(c=e.columns.length;b<c;b++){var f=e.columns[b];f.visible!==k&&(d[b].bVisible=f.visible);f.search!==k&&h.extend(a.aoPreSearchCols[b],Bb(f.search))}u(a,"aoStateLoaded","stateLoaded",[a,e])}}}function xa(a){var b=m.settings,a=h.inArray(a,G(b,"nTable"));return-1!==a?b[a]:null}function L(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
|
||||
d);if(b)D.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&u(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function E(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?E(a,b,d[0],d[1]):E(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Lb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==
|
||||
e&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).bind("click.DT",b,function(b){a.blur();c(b)}).bind("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).bind("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function u(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,
|
||||
c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ya(a,b){var c=[],c=Mb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),
|
||||
c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function db(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Xa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Xa)}},function(b,c){v.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(v.type.search[b+a]=v.type.search.html)})}function Nb(a){return function(){var b=[xa(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,
|
||||
b)}}var m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new r(xa(this[v.iApiIndex])):new r(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):
|
||||
(""!==d.sX||""!==d.sY)&&ka(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,
|
||||
c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),
|
||||
[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return xa(this[v.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=
|
||||
function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();(d===k||d)&&h.draw();return 0};this.fnVersionCheck=v.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=v.internal;for(var e in m.ext.internal)e&&(this[e]=Nb(e));this.each(function(){var e={},e=1<d?Lb(e,a,!0):a,g=0,j,i=this.getAttribute("id"),n=!1,l=m.defaults,q=h(this);if("table"!=
|
||||
this.nodeName.toLowerCase())L(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);fb(l.column);K(l,l,!0);K(l.column,l.column,!0);K(l,h.extend(e,q.data()));var t=m.settings,g=0;for(j=t.length;g<j;g++){var p=t[g];if(p.nTable==this||p.nTHead.parentNode==this||p.nTFoot&&p.nTFoot.parentNode==this){g=e.bRetrieve!==k?e.bRetrieve:l.bRetrieve;if(c||g)return p.oInstance;if(e.bDestroy!==k?e.bDestroy:l.bDestroy){p.oInstance.fnDestroy();break}else{L(p,0,"Cannot reinitialise DataTable",3);
|
||||
return}}if(p.sTableId==this.id){t.splice(g,1);break}}if(null===i||""===i)this.id=i="DataTables_Table_"+m.ext._unique++;var o=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:i,sTableId:i});o.nTable=this;o.oApi=b.internal;o.oInit=e;t.push(o);o.oInstance=1===b.length?b:q.dataTable();eb(e);e.oLanguage&&Da(e.oLanguage);e.aLengthMenu&&!e.iDisplayLength&&(e.iDisplayLength=h.isArray(e.aLengthMenu[0])?e.aLengthMenu[0][0]:e.aLengthMenu[0]);e=Lb(h.extend(!0,{},l),e);E(o.oFeatures,
|
||||
e,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));E(o,e,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols",
|
||||
"aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);E(o.oScroll,e,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);E(o.oLanguage,e,"fnInfoCallback");z(o,"aoDrawCallback",e.fnDrawCallback,"user");z(o,"aoServerParams",e.fnServerParams,"user");z(o,"aoStateSaveParams",e.fnStateSaveParams,"user");z(o,"aoStateLoadParams",e.fnStateLoadParams,"user");z(o,"aoStateLoaded",e.fnStateLoaded,"user");z(o,"aoRowCallback",e.fnRowCallback,
|
||||
"user");z(o,"aoRowCreatedCallback",e.fnCreatedRow,"user");z(o,"aoHeaderCallback",e.fnHeaderCallback,"user");z(o,"aoFooterCallback",e.fnFooterCallback,"user");z(o,"aoInitComplete",e.fnInitComplete,"user");z(o,"aoPreDrawCallback",e.fnPreDrawCallback,"user");o.rowIdFn=Q(e.rowId);gb(o);i=o.oClasses;e.bJQueryUI?(h.extend(i,m.ext.oJUIClasses,e.oClasses),e.sDom===l.sDom&&"lfrtip"===l.sDom&&(o.sDom='<"H"lfr>t<"F"ip>'),o.renderer)?h.isPlainObject(o.renderer)&&!o.renderer.header&&(o.renderer.header="jqueryui"):
|
||||
o.renderer="jqueryui":h.extend(i,m.ext.classes,e.oClasses);q.addClass(i.sTable);o.iInitDisplayStart===k&&(o.iInitDisplayStart=e.iDisplayStart,o._iDisplayStart=e.iDisplayStart);null!==e.iDeferLoading&&(o.bDeferLoading=!0,g=h.isArray(e.iDeferLoading),o._iRecordsDisplay=g?e.iDeferLoading[0]:e.iDeferLoading,o._iRecordsTotal=g?e.iDeferLoading[1]:e.iDeferLoading);var r=o.oLanguage;h.extend(!0,r,e.oLanguage);""!==r.sUrl&&(h.ajax({dataType:"json",url:r.sUrl,success:function(a){Da(a);K(l.oLanguage,a);h.extend(true,
|
||||
r,a);ga(o)},error:function(){ga(o)}}),n=!0);null===e.asStripeClasses&&(o.asStripeClasses=[i.sStripeOdd,i.sStripeEven]);var g=o.asStripeClasses,v=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(g,function(a){return v.hasClass(a)}))&&(h("tbody tr",this).removeClass(g.join(" ")),o.asDestroyStripes=g.slice());t=[];g=this.getElementsByTagName("thead");0!==g.length&&(da(o.aoHeader,g[0]),t=qa(o));if(null===e.aoColumns){p=[];g=0;for(j=t.length;g<j;g++)p.push(null)}else p=e.aoColumns;g=0;for(j=
|
||||
p.length;g<j;g++)Ea(o,t?t[g]:null);ib(o,e.aoColumnDefs,p,function(a,b){ja(o,a,b)});if(v.length){var s=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(v[0]).children("th, td").each(function(a,b){var c=o.aoColumns[a];if(c.mData===a){var d=s(b,"sort")||s(b,"order"),e=s(b,"filter")||s(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ja(o,a)}}})}var w=o.oFeatures;e.bStateSave&&(w.bStateSave=
|
||||
!0,Kb(o,e),z(o,"aoDrawCallback",wa,"state_save"));if(e.aaSorting===k){t=o.aaSorting;g=0;for(j=t.length;g<j;g++)t[g][1]=o.aoColumns[g].asSorting[0]}va(o);w.bSort&&z(o,"aoDrawCallback",function(){if(o.bSorted){var a=V(o),b={};h.each(a,function(a,c){b[c.src]=c.dir});u(o,null,"order",[o,a,b]);Jb(o)}});z(o,"aoDrawCallback",function(){(o.bSorted||y(o)==="ssp"||w.bDeferRender)&&va(o)},"sc");g=q.children("caption").each(function(){this._captionSide=q.css("caption-side")});j=q.children("thead");0===j.length&&
|
||||
(j=h("<thead/>").appendTo(this));o.nTHead=j[0];j=q.children("tbody");0===j.length&&(j=h("<tbody/>").appendTo(this));o.nTBody=j[0];j=q.children("tfoot");if(0===j.length&&0<g.length&&(""!==o.oScroll.sX||""!==o.oScroll.sY))j=h("<tfoot/>").appendTo(this);0===j.length||0===j.children().length?q.addClass(i.sNoFooter):0<j.length&&(o.nTFoot=j[0],da(o.aoFooter,o.nTFoot));if(e.aaData)for(g=0;g<e.aaData.length;g++)N(o,e.aaData[g]);else(o.bDeferLoading||"dom"==y(o))&&ma(o,h(o.nTBody).children("tr"));o.aiDisplay=
|
||||
o.aiDisplayMaster.slice();o.bInitialised=!0;!1===n&&ga(o)}});b=null;return this},v,r,p,s,Ya={},Ob=/[\r\n]/g,Aa=/<.*?>/g,ac=/^[\w\+\-]/,bc=/[\w\+\-]$/,cc=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Xa=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,M=function(a){return!a||!0===a||"-"===a?!0:!1},Pb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Qb=function(a,b){Ya[b]||(Ya[b]=RegExp(Qa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,
|
||||
"").replace(Ya[b],"."):a},Za=function(a,b,c){var d="string"===typeof a;if(M(a))return!0;b&&d&&(a=Qb(a,b));c&&d&&(a=a.replace(Xa,""));return!isNaN(parseFloat(a))&&isFinite(a)},Rb=function(a,b,c){return M(a)?!0:!(M(a)||"string"===typeof a)?null:Za(a.replace(Aa,""),b,c)?!0:null},G=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<f;e++)a[e]&&d.push(a[e][b]);return d},ha=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&
|
||||
e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},W=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Sb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},pa=function(a){var b=[],c,d,e=a.length,f,g=0;d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};m.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,h=arguments;d&&g<d+c?(clearTimeout(e),
|
||||
e=setTimeout(function(){d=k;a.apply(b,h)},c)):(d=g,a.apply(b,h))}},escapeRegex:function(a){return a.replace(cc,"\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,U=/\(\)$/,Qa=m.util.escapeRegex,ua=h("<div>")[0],Zb=ua.textContent!==k,$b=/<.*?>/g,Oa=m.util.throttle,Tb=[],w=Array.prototype,dc=function(a){var b,c,d=m.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:
|
||||
null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};r=function(a,b){if(!(this instanceof r))return new r(a,b);var c=[],d=function(a){(a=dc(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=pa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};r.extend(this,this,Tb)};
|
||||
m.Api=r;h.extend(r.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new r(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new r(this.context,b)},flatten:function(){var a=
|
||||
[];return new r(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,h,i,n,l=this.context,m,t,p=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(h=l.length;g<h;g++){var o=new r(l[g]);if("table"===b)f=c.call(o,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(o,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===
|
||||
b||"row"===b||"cell"===b){t=this[g];"column-rows"===b&&(m=Ba(l[g],p.opts));i=0;for(n=t.length;i<n;i++)f=t[i],f="cell"===b?c.call(o,l[g],f.row,f.column,g,i):c.call(o,l[g],f,g,i,m),f!==k&&e.push(f)}}return e.length||d?(a=new r(l,a?e.concat.apply([],e):e),b=a.selector,b.rows=p.rows,b.cols=p.cols,b.opts=p.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=
|
||||
0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new r(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return hb(this,a,b,0,this.length,1)},reduceRight:w.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},
|
||||
unique:function(){return new r(this.context,pa(this))},unshift:w.unshift});r.extend=function(a,b,c){if(c.length&&b&&(b instanceof r||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);r.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,r.extend(a,b[f.name],f.propExt)}};r.register=p=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<
|
||||
d;c++)r.register(a[c],b);else for(var e=a.split("."),f=Tb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var n=f.length;i<n;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};r.registerPlural=s=function(a,b,c){r.register(a,c);r.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof r?a.length?h.isArray(a[0])?new r(a.context,
|
||||
a[0]):a[0]:k:a})};p("tables()",function(a){var b;if(a){b=r;var c=this.context;if("number"===typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,d);return c[a]}).toArray();b=new b(a)}else b=this;return b});p("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new r(b[0]):a});s("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});s("tables().body()","table().body()",
|
||||
function(){return this.iterator("table",function(a){return a.nTBody},1)});s("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});s("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});s("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});p("draw()",function(a){return this.iterator("table",function(b){"page"===
|
||||
a?O(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),T(b,!1===a))})});p("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});p("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,
|
||||
serverSide:"ssp"===y(a)}});p("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator("table",function(b){Ra(b,a)})});var Ub=function(a,b,c){if(c){var d=new r(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))T(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();ra(a,[],function(c){na(a);for(var c=sa(a,c),d=0,e=c.length;d<e;d++)N(a,c[d]);T(a,b);C(a,!1)})}};p("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});
|
||||
p("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});p("ajax.reload()",function(a,b){return this.iterator("table",function(c){Ub(c,!1===b,a)})});p("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});p("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Ub(c,
|
||||
!1===b,a)})});var $a=function(a,b,c,d,e){var f=[],g,j,i,n,l,m;i=typeof b;if(!b||"string"===i||"function"===i||b.length===k)b=[b];i=0;for(n=b.length;i<n;i++){j=b[i]&&b[i].split?b[i].split(","):[b[i]];l=0;for(m=j.length;l<m;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=v.selector[a];if(a.length){i=0;for(n=a.length;i<n;i++)f=a[i](d,e,f)}return pa(f)},ab=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",
|
||||
page:"all"},a)},bb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,d,e,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;d=b.order;e=b.page;if("ssp"==y(a))return"removed"===j?[]:W(0,c.length);if("current"==e){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==d||"applied"==d)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===
|
||||
h.inArray(a,g)?a:null});else if("index"==d||"original"==d){c=0;for(d=a.aoData.length;c<d;c++)"none"==j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};p("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var e=b;return $a("row",a,function(a){var b=Pb(a);if(b!==null&&!e)return[b];var j=Ba(c,e);if(b!==null&&h.inArray(b,j)!==-1)return[b];if(!a)return j;if(typeof a==="function")return h.map(j,function(b){var e=
|
||||
c.aoData[b];return a(b,e._aData,e.nTr)?b:null});b=Sb(ha(c.aoData,j,"nTr"));if(a.nodeName){if(a._DT_RowIndex!==k)return[a._DT_RowIndex];if(a._DT_CellIndex)return[a._DT_CellIndex.row];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){j=c.aIds[a.replace(/^#/,"")];if(j!==k)return[j.idx]}return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});p("rows().nodes()",function(){return this.iterator("row",
|
||||
function(a,b){return a.aoData[b].nTr||k},1)});p("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ha(a.aoData,b,"_aData")},1)});s("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});s("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ca(b,c,a)})});s("rows().indexes()","row().index()",function(){return this.iterator("row",
|
||||
function(a,b){return b},1)});s("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new r(c,b)});s("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,n,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(n=
|
||||
l.length;i<n;i++)l[i]._DT_CellIndex.row=g}oa(b.aiDisplayMaster,c);oa(b.aiDisplay,c);oa(a[d],c,!1);Sa(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});p("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(N(b,c));return h},1),c=this.rows(-1);c.pop();h.merge(c,b);
|
||||
return c});p("row()",function(a,b){return bb(this.rows(a,b))});p("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],"data");return this});p("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});p("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?
|
||||
ma(b,a)[0]:N(b,a)});return this.row(b[0])});var cb=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Vb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new r(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<G(g,"_details").length&&(f.on("draw.dt.DT_details",
|
||||
function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&cb(f,c)}))}}};p("row().child()",function(a,b){var c=this.context;if(a===k)return c.length&&this.length?
|
||||
c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)cb(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=aa(d),e.push(c[0]))};f(a,b);c._details&&c._details.remove();c._details=h(e);c._detailsShow&&c._details.insertAfter(c.nTr)}return this});
|
||||
p(["row().child.show()","row().child().show()"],function(){Vb(this,!0);return this});p(["row().child.hide()","row().child().hide()"],function(){Vb(this,!1);return this});p(["row().child.remove()","row().child().remove()"],function(){cb(this);return this});p("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var ec=/^(.+):(name|visIdx|visible)$/,Wb=function(a,b,c,d,e){for(var c=[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));
|
||||
return c};p("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=ab(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=G(g,"sName"),i=G(g,"nTh");return $a("column",e,function(a){var b=Pb(a);if(a==="")return W(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Wb(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(ec):"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],
|
||||
10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[Z(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});s("columns().header()",
|
||||
"column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});s("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});s("columns().data()","column().data()",function(){return this.iterator("column-rows",Wb,1)});s("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});s("columns().cache()","column().cache()",
|
||||
function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ha(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});s("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ha(a.aoData,e,"anCells",b)},1)});s("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,i,n,l;if(a!==k&&g.bVisible!==a){if(a){var m=
|
||||
h.inArray(!0,G(f,"bVisible"),c+1);i=0;for(n=j.length;i<n;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[m]||null)}else h(G(b.aoData,"anCells",c)).detach();g.bVisible=a;ea(b,b.aoHeader);ea(b,b.aoFooter);wa(b)}});a!==k&&(this.iterator("column",function(c,e){u(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});s("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?$(b,c):c},1)});p("columns.adjust()",
|
||||
function(){return this.iterator("table",function(a){Y(a)},1)});p("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return Z(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});p("column()",function(a,b){return bb(this.columns(a,b))});p("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=ab(c),f=
|
||||
b.aoData,g=Ba(b,e),j=Sb(ha(f,g,"anCells")),i=h([].concat.apply([],j)),l,n=b.aoColumns.length,m,p,r,u,v,s;return $a("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){m=[];p=0;for(r=g.length;p<r;p++){l=g[p];for(u=0;u<n;u++){v={row:l,column:u};if(c){s=f[l];a(v,B(b,l,u),s.anCells?s.anCells[u]:null)&&m.push(v)}else m.push(v)}}return m}if(h.isPlainObject(a))return[a];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||
|
||||
!a.nodeName)return c;s=h(a).closest("*[data-dt-row]");return s.length?[{row:s.data("dt-row"),column:s.data("dt-column")}]:[]},b,e)});var d=this.columns(b,c),e=this.rows(a,c),f,g,j,i,n,l=this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(n=d[b].length;i<n;i++)f.push({row:e[b][g],column:d[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});s("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&
|
||||
a.anCells?a.anCells[c]:k},1)});p("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});s("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});s("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});s("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,
|
||||
b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});s("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ca(b,c,a,d)})});p("cell()",function(a,b,c){return bb(this.cells(a,b,c))});p("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],c[0].row,c[0].column):k;jb(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});p("order()",function(a,b){var c=this.context;if(a===k)return 0!==
|
||||
c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});p("order.listener()",function(a,b,c){return this.iterator("table",function(d){Ma(d,a,b,c)})});p("order.fixed()",function(a){if(!a){var b=this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});p(["columns().order()",
|
||||
"column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});p("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&fa(e,h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});s("columns().search()","column().search()",function(a,
|
||||
b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),fa(e,e.oPreviousSearch,1))})});p("state()",function(){return this.context.length?this.context[0].oSavedState:null});p("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});p("state.loaded()",function(){return this.context.length?
|
||||
this.context[0].oLoadedState:null});p("state.save()",function(){return this.iterator("table",function(a){wa(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;h.each(m.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?h("table",e.nScrollFoot)[0]:
|
||||
null;if(e.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new r(c):c};m.camelToHungarian=K;p("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){p(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0].match(/\.dt\b/)||
|
||||
(a[0]+=".dt");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});p("clear()",function(){return this.iterator("table",function(a){na(a)})});p("settings()",function(){return new r(this.context,this.context)});p("init()",function(){var a=this.context;return a.length?a[0].oInit:null});p("data()",function(){return this.iterator("table",function(a){return G(a.aoData,"_aData")}).flatten()});p("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,
|
||||
d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;u(b,"aoDestroyCallback","destroy",[b]);a||(new r(b)).columns().visible(!0);k.unbind(".DT").find(":not(tbody *)").unbind(".DT");h(D).unbind(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));b.aaSorting=[];b.aaSortingFixed=[];va(b);h(l).removeClass(b.asStripeClasses.join(" "));
|
||||
h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);b.bJUI&&(h("th span."+d.sSortIcon+", td span."+d.sSortIcon,g).detach(),h("th, td",g).each(function(){var a=h("div."+d.sSortJUIWrapper,this);h(this).append(a.contents());a.detach()}));f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%
|
||||
p])}));c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,1)})});h.each(["column","row","cell"],function(a,b){p(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,n){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,n)})})});p("i18n()",function(a,b,c){var d=this.context[0],a=Q(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace("%d",c)});m.version="1.10.12";m.settings=[];m.models={};m.models.oSearch={bCaseInsensitive:!0,
|
||||
sSearch:"",bRegex:!1,bSmart:!0};m.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,
|
||||
sTitle:null,sType:null,sWidth:null,sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,
|
||||
fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===
|
||||
a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",
|
||||
sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",
|
||||
renderer:null,rowId:"DT_RowId"};X(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};X(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,
|
||||
bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],
|
||||
aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,
|
||||
fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=
|
||||
this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};m.ext=v={buttons:{},classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},
|
||||
header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(v,{afnFiltering:v.search,aTypes:v.type.detect,ofnSearch:v.type.search,oSort:v.type.order,afnSortData:v.order,aoFeatures:v.feature,oApi:v.internal,oStdClasses:v.classes,oPagination:v.pager});h.extend(m.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",
|
||||
sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",
|
||||
sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Ca="",Ca="",H=Ca+"ui-state-default",ia=Ca+"css_right ui-icon ui-icon-",Xb=Ca+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";h.extend(m.ext.oJUIClasses,
|
||||
m.ext.classes,{sPageButton:"fg-button ui-button "+H,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:H+" sorting_asc",sSortDesc:H+" sorting_desc",sSortable:H+" sorting",sSortableAsc:H+" sorting_asc_disabled",sSortableDesc:H+" sorting_desc_disabled",sSortableNone:H+" sorting_disabled",sSortJUIAsc:ia+"triangle-1-n",sSortJUIDesc:ia+"triangle-1-s",sSortJUI:ia+"carat-2-n-s",
|
||||
sSortJUIAscAllowed:ia+"carat-1-n",sSortJUIDescAllowed:ia+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+H,sScrollFoot:"dataTables_scrollFoot "+H,sHeaderTH:H,sFooterTH:H,sJUIHeader:Xb+" ui-corner-tl ui-corner-tr",sJUIFooter:Xb+" ui-corner-bl ui-corner-br"});var Mb=m.ext.pager;h.extend(Mb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ya(a,
|
||||
b)]},simple_numbers:function(a,b){return["previous",ya(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ya(a,b),"next","last"]},_numbers:ya,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},k,l,m=0,p=function(b,d){var o,r,u,s,v=function(b){Ta(a,b.data.action,true)};o=0;for(r=d.length;o<r;o++){s=d[o];if(h.isArray(s)){u=h("<"+(s.DT_el||"div")+"/>").appendTo(b);p(u,s)}else{k=null;
|
||||
l="";switch(s){case "ellipsis":b.append('<span class="ellipsis">…</span>');break;case "first":k=j.sFirst;l=s+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":k=j.sPrevious;l=s+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":k=j.sNext;l=s+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":k=j.sLast;l=s+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:k=s+1;l=e===s?g.sPageButtonActive:""}if(k!==null){u=h("<a>",{"class":g.sPageButton+" "+l,"aria-controls":a.sTableId,"aria-label":i[s],
|
||||
"data-dt-idx":m,tabindex:a.iTabIndex,id:c===0&&typeof s==="string"?a.sTableId+"_"+s:null}).html(k).appendTo(b);Wa(u,{action:s},v);m++}}}},r;try{r=h(b).find(I.activeElement).data("dt-idx")}catch(o){}p(h(b).empty(),d);r&&h(b).find("[data-dt-idx="+r+"]").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&(!ac.test(a)||!bc.test(a)))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||M(a)?"date":
|
||||
null},function(a,b){var c=b.oLanguage.sDecimal;return Za(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Rb(a,c,!0)?"html-num-fmt"+c:null},function(a){return M(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(m.ext.type.search,{html:function(a){return M(a)?a:"string"===typeof a?a.replace(Ob," ").replace(Aa,""):""},string:function(a){return M(a)?a:"string"===typeof a?a.replace(Ob,
|
||||
" "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Qb(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(v.type.order,{"date-pre":function(a){return Date.parse(a)||0},"html-pre":function(a){return M(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return M(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,
|
||||
b){return a<b?1:a>b?-1:0}});db("");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(e,
|
||||
f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]=="asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Yb=function(a){return"string"===typeof a?a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):a};m.render={number:function(a,
|
||||
b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Yb(f);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+f+(e||"")}}},text:function(){return{display:Yb}}};h.extend(m.ext.internal,{_fnExternApiFunc:Nb,_fnBuildAjax:ra,_fnAjaxUpdate:lb,_fnAjaxParameters:ub,_fnAjaxUpdateDraw:vb,_fnAjaxDataSrc:sa,_fnAddColumn:Ea,_fnColumnOptions:ja,
|
||||
_fnAdjustColumnSizing:Y,_fnVisibleToColumnIndex:Z,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:la,_fnColumnTypes:Ga,_fnApplyColumnDefs:ib,_fnHungarianMap:X,_fnCamelToHungarian:K,_fnLanguageCompat:Da,_fnBrowserDetect:gb,_fnAddData:N,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:jb,_fnSplitObjNotation:Ja,_fnGetObjectDataFn:Q,_fnSetObjectDataFn:R,
|
||||
_fnGetDataMaster:Ka,_fnClearTable:na,_fnDeleteIndex:oa,_fnInvalidate:ca,_fnGetRowElements:Ia,_fnCreateTr:Ha,_fnBuildHead:kb,_fnDrawHead:ea,_fnDraw:O,_fnReDraw:T,_fnAddOptionsHtml:nb,_fnDetectHeader:da,_fnGetUniqueThs:qa,_fnFeatureHtmlFilter:pb,_fnFilterComplete:fa,_fnFilterCustom:yb,_fnFilterColumn:xb,_fnFilter:wb,_fnFilterCreateSearch:Pa,_fnEscapeRegex:Qa,_fnFilterData:zb,_fnFeatureHtmlInfo:sb,_fnUpdateInfo:Cb,_fnInfoMacros:Db,_fnInitialise:ga,_fnInitComplete:ta,_fnLengthChange:Ra,_fnFeatureHtmlLength:ob,
|
||||
_fnFeatureHtmlPaginate:tb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:qb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:rb,_fnScrollDraw:ka,_fnApplyToChildren:J,_fnCalculateColumnWidths:Fa,_fnThrottle:Oa,_fnConvertToWidth:Fb,_fnGetWidestNode:Gb,_fnGetMaxLenString:Hb,_fnStringToCss:x,_fnSortFlatten:V,_fnSort:mb,_fnSortAria:Jb,_fnSortListener:Va,_fnSortAttachListener:Ma,_fnSortingClasses:va,_fnSortData:Ib,_fnSaveState:wa,_fnLoadState:Kb,_fnSettingsFromNode:xa,_fnLog:L,_fnMap:E,_fnBindAction:Wa,_fnCallbackReg:z,
|
||||
_fnCallbackFire:u,_fnLengthOverflow:Sa,_fnRenderer:Na,_fnDataSource:y,_fnRowAttributes:La,_fnCalculateEnd:function(){}});h.fn.dataTable=m;m.$=h;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
|
||||
63
admin/js/menu.js
Normal file
63
admin/js/menu.js
Normal file
@@ -0,0 +1,63 @@
|
||||
$(document).ready(function(){
|
||||
var categoryData = $('#menuList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_menu.php",
|
||||
type:"POST",
|
||||
data:{action:'menuListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[0,1,2,3,4],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 10
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var menuId = $(this).attr("id");
|
||||
var action = "menuDelete";
|
||||
if(confirm("Are you sure you want to delete this menu item?")) {
|
||||
$.ajax({
|
||||
url:"manage_menu.php",
|
||||
method:"POST",
|
||||
data:{menuId:menuId, action:action},
|
||||
success:function(data) {
|
||||
categoryData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.moveup', function(){
|
||||
var menuId = $(this).attr("id");
|
||||
var action = "menuMoveUp";
|
||||
$.ajax({
|
||||
url:"manage_menu.php",
|
||||
method:"POST",
|
||||
data:{menuId:menuId, action:action},
|
||||
success:function(data) {
|
||||
categoryData.ajax.reload();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(document).on('click', '.movedown', function(){
|
||||
var menuId = $(this).attr("id");
|
||||
var action = "menuMoveDown";
|
||||
$.ajax({
|
||||
url:"manage_menu.php",
|
||||
method:"POST",
|
||||
data:{menuId:menuId, action:action},
|
||||
success:function(data) {
|
||||
categoryData.ajax.reload();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
55
admin/js/pages.js
Normal file
55
admin/js/pages.js
Normal file
@@ -0,0 +1,55 @@
|
||||
$(document).ready(function(){
|
||||
var postsData = $('#pagesList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_pages.php",
|
||||
type:"POST",
|
||||
data:{action:'pagesListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[3,4,5],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 10
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var pageId = $(this).attr("id");
|
||||
var action = "pageDelete";
|
||||
if(confirm("Are you sure you want to delete this post?")) {
|
||||
$.ajax({
|
||||
url:"manage_pages.php",
|
||||
method:"POST",
|
||||
data:{pageId:pageId, action:action},
|
||||
success:function(data) {
|
||||
postsData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.add', function(){
|
||||
var pageId = $(this).attr("id");
|
||||
var action = "pageAddToMenu";
|
||||
if(confirm("Are you sure you want to add this page to menu")) {
|
||||
$.ajax({
|
||||
url:"manage_pages.php",
|
||||
method:"POST",
|
||||
data:{pageId:pageId, action:action},
|
||||
success:function(data) {
|
||||
postsData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
37
admin/js/posts.js
Executable file
37
admin/js/posts.js
Executable file
@@ -0,0 +1,37 @@
|
||||
$(document).ready(function(){
|
||||
var postsData = $('#postsList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_posts.php",
|
||||
type:"POST",
|
||||
data:{action:'postListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[0, 6, 7],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 10
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var postId = $(this).attr("id");
|
||||
var action = "postDelete";
|
||||
if(confirm("Are you sure you want to delete this post?")) {
|
||||
$.ajax({
|
||||
url:"manage_posts.php",
|
||||
method:"POST",
|
||||
data:{postId:postId, action:action},
|
||||
success:function(data) {
|
||||
postsData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
38
admin/js/users.js
Executable file
38
admin/js/users.js
Executable file
@@ -0,0 +1,38 @@
|
||||
$(document).ready(function(){
|
||||
var usersData = $('#userList').DataTable({
|
||||
"lengthChange": false,
|
||||
"processing":true,
|
||||
"serverSide":true,
|
||||
"order":[],
|
||||
"ajax":{
|
||||
url:"manage_user.php",
|
||||
type:"POST",
|
||||
data:{action:'userListing'},
|
||||
dataType:"json"
|
||||
},
|
||||
"columnDefs":[
|
||||
{
|
||||
"targets":[0, 4, 5],
|
||||
"orderable":false,
|
||||
},
|
||||
],
|
||||
"pageLength": 10
|
||||
});
|
||||
$(document).on('click', '.delete', function(){
|
||||
var userId = $(this).attr("id");
|
||||
var action = "userDelete";
|
||||
if(confirm("Are you sure you want to delete this user?")) {
|
||||
$.ajax({
|
||||
url:"manage_user.php",
|
||||
method:"POST",
|
||||
data:{userId:userId, action:action},
|
||||
success:function(data) {
|
||||
usersData.ajax.reload();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
20
admin/left_menus.php
Executable file
20
admin/left_menus.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<div class="col-md-3">
|
||||
<div class="list-group">
|
||||
<a href="dashboard.php" class="list-group-item active main-color-bg"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
|
||||
Dashboard <span class="badge"><?php echo $post->totalPost()+$category->totalCategory()+$user->totalUser(); ?></span>
|
||||
</a>
|
||||
<a href="posts.php" class="list-group-item"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Articles<span class="badge"><?php echo $post->totalPost(); ?></span></a>
|
||||
<a href="images.php" class="list-group-item"><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> Images <span class="badge"></span></a>
|
||||
|
||||
|
||||
<?php if($_SESSION['user_type'] == 1){ ?>
|
||||
|
||||
<a href="categories.php" class="list-group-item"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> Categories<span class="badge"><?php echo $category->totalCategory(); ?></span></a>
|
||||
<a href="users.php" class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Users <span class="badge"><?php echo $user->totalUser(); ?></span></a>
|
||||
|
||||
<a href="pages.php" class="list-group-item"><span class="glyphicon glyphicon-book" aria-hidden="true"></span> Pages <span class="badge"></span></a>
|
||||
<a href="menu.php" class="list-group-item"><span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span> Menu <span class="badge"></span></a>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
5
admin/logout.php
Executable file
5
admin/logout.php
Executable file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header("Location:index.php");
|
||||
?>
|
||||
19
admin/manage_categories.php
Executable file
19
admin/manage_categories.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$category = new Category($db);
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'categoryListing') {
|
||||
$category->getCategoryListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'categoryDelete') {
|
||||
$category->id = (isset($_POST['categoryId']) && $_POST['categoryId']) ? $_POST['categoryId'] : '0';
|
||||
$category->delete();
|
||||
}
|
||||
?>
|
||||
20
admin/manage_image.php
Normal file
20
admin/manage_image.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/ImagesManager.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$imagesManager = new ImagesManager();
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'imageListing') {
|
||||
$imagesManager->getImagesListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'imageDelete') {
|
||||
if(isset($_POST['imageId']) && $_POST['imageId']){
|
||||
$imagesManager->delete($_POST['imageId']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
31
admin/manage_menu.php
Normal file
31
admin/manage_menu.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/Menu.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$menu = new Menu($db);
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'menuListing') {
|
||||
$menu->getMenuListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'menuDelete') {
|
||||
$menu->id = (isset($_POST['menuId']) && $_POST['menuId']) ? $_POST['menuId'] : '0';
|
||||
$menu->delete();
|
||||
}
|
||||
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'menuMoveUp') {
|
||||
$menu->id = (isset($_POST['menuId']) && $_POST['menuId']) ? $_POST['menuId'] : '0';
|
||||
$menu->moveUp();
|
||||
}
|
||||
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'menuMoveDown') {
|
||||
$menu->id = (isset($_POST['menuId']) && $_POST['menuId']) ? $_POST['menuId'] : '0';
|
||||
$menu->moveDown();
|
||||
}
|
||||
?>
|
||||
26
admin/manage_pages.php
Normal file
26
admin/manage_pages.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/Pages.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$pages = new Pages($db);
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'pagesListing') {
|
||||
$pages->getPagesListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'pageDelete') {
|
||||
$pages->id = (isset($_POST['pageId']) && $_POST['pageId']) ? $_POST['pageId'] : '0';
|
||||
$pages->delete();
|
||||
}
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'pageAddToMenu') {
|
||||
$pages->id = (isset($_POST['pageId']) && $_POST['pageId']) ? $_POST['pageId'] : '0';
|
||||
$pages->addToMenu();
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
19
admin/manage_posts.php
Executable file
19
admin/manage_posts.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$post = new Post($db);
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'postListing') {
|
||||
$post->getPostsListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'postDelete') {
|
||||
$post->id = (isset($_POST['postId']) && $_POST['postId']) ? $_POST['postId'] : '0';
|
||||
$post->delete();
|
||||
}
|
||||
?>
|
||||
19
admin/manage_user.php
Executable file
19
admin/manage_user.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'userListing') {
|
||||
$user->getUsersListing();
|
||||
}
|
||||
if(!empty($_POST['action']) && $_POST['action'] == 'userDelete') {
|
||||
$user->id = (isset($_POST['userId']) && $_POST['userId']) ? $_POST['userId'] : '0';
|
||||
$user->delete();
|
||||
}
|
||||
?>
|
||||
85
admin/menu.php
Normal file
85
admin/menu.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../models/Menu.php';
|
||||
|
||||
include_once '../Config.php';
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
$menu = new Menu($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/menu.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Menu <small>arrangement</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"style="background-color: #095f59;">
|
||||
<h3 class="panel-title">Menu links</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="add_menu.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="menuList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order</th>
|
||||
<th>Title</th>
|
||||
<th>Link</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php include('../template/footer.php');?>
|
||||
83
admin/pages.php
Normal file
83
admin/pages.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Pages.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$pages = new Pages($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/pages.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Pages <small>management</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Pages Listing</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="add_page.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="pagesList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Link</th>
|
||||
<th>Title</th>
|
||||
<th>Content</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
83
admin/posts.php
Executable file
83
admin/posts.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/posts.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Articles <small>management</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Articles Listing</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="compose_post.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="postsList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Category</th>
|
||||
<th>User</th>
|
||||
<th>Status</th>
|
||||
<th>Created</th>
|
||||
<th>Updated</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php include('../template/footer.php');?>
|
||||
85
admin/users.php
Executable file
85
admin/users.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
include_once '../models/Database.php';
|
||||
include_once '../models/User.php';
|
||||
include_once '../models/Post.php';
|
||||
include_once '../models/Category.php';
|
||||
include_once '../Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$user = new User($db);
|
||||
$post = new Post($db);
|
||||
$category = new Category($db);
|
||||
|
||||
if(!$user->loggedIn()) {
|
||||
header("location: index.php");
|
||||
}
|
||||
|
||||
|
||||
include('../template/header.php');
|
||||
?>
|
||||
<title>Admin - <?= Config::WEBSITE_NAME ?></title>
|
||||
<script src="js/jquery.dataTables.min.js"></script>
|
||||
<script src="js/dataTables.bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css" />
|
||||
<script src="js/users.js"></script>
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" >
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h1><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Users <small>management</small></h1>
|
||||
</div>
|
||||
<br>
|
||||
<?php include('./dropdown.php')?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
|
||||
<section id="main">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php include "left_menus.php"; ?>
|
||||
<div class="col-md-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"style="background-color: #095f59;">
|
||||
<h3 class="panel-title">Latest Users</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
<h3 class="panel-title"></h3>
|
||||
</div>
|
||||
<div class="col-md-2" align="right">
|
||||
<a href="add_users.php" class="btn btn-default btn-xs">Add New</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="userList" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Nick</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<?php include('../template/footer.php');?>
|
||||
47
article.php
Executable file
47
article.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
include_once 'models/Database.php';
|
||||
include_once 'models/Articles.php';
|
||||
include_once 'models/Menu.php';
|
||||
include_once './Config.php';
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$article = new Articles($db);
|
||||
$menu = new Menu($db);
|
||||
|
||||
$article->id = (isset($_GET['id']) && $_GET['id']) ? $_GET['id'] : '0';
|
||||
|
||||
$result = $article->getArticles();
|
||||
|
||||
include('template/header.php');
|
||||
|
||||
?>
|
||||
<title><?= Config::WEBSITE_NAME ?></title>
|
||||
<link href="css/style.css" rel="stylesheet" id="bootstrap-css">
|
||||
<?php include('template/container.php');?>
|
||||
<div class="container">
|
||||
|
||||
<?php include('template/topmenu.php');?>
|
||||
|
||||
<?php
|
||||
foreach($result as $post) {
|
||||
$date = date_create($post['created']);
|
||||
$message = str_replace("\n\r", "<br><br>", $post['message']);
|
||||
?>
|
||||
<div class="col-md-10 blogShort">
|
||||
<h2><?php echo $post['title']; ?></h2>
|
||||
<em><strong>Published on</strong>: <?php echo date_format($date, "d F Y"); ?></em>
|
||||
<em><strong>Category:</strong> <a href="#" target="_blank"><?php echo $post['category']; ?></a></em>
|
||||
<br><br>
|
||||
<article>
|
||||
<p><?php echo $message; ?> </p>
|
||||
</article>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-md-12 gap10"></div>
|
||||
|
||||
|
||||
</div>
|
||||
<?php include('template/footer.php');?>
|
||||
5
css/bootstrap.min.css
vendored
Normal file
5
css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
128
css/style.css
Executable file
128
css/style.css
Executable file
@@ -0,0 +1,128 @@
|
||||
.blogShort{ border-bottom:1px solid #ddd;}
|
||||
.add{ padding: 10%; height: 300px;}
|
||||
|
||||
.nav-sidebar {
|
||||
width: 100%;
|
||||
padding: 8px 0;
|
||||
border-right: 1px solid #ddd;
|
||||
}
|
||||
.nav-sidebar a {
|
||||
color: #333;
|
||||
-webkit-transition: all 0.08s linear;
|
||||
-moz-transition: all 0.08s linear;
|
||||
-o-transition: all 0.08s linear;
|
||||
transition: all 0.08s linear;
|
||||
}
|
||||
.nav-sidebar .active a {
|
||||
cursor: default;
|
||||
background-color: #34ca78;
|
||||
color: #fff;
|
||||
}
|
||||
.nav-sidebar .active a:hover {
|
||||
background-color: #37D980;
|
||||
}
|
||||
.nav-sidebar .text-overflow a,
|
||||
.nav-sidebar .text-overflow .media-body {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.btn-blog {
|
||||
color: #ffffff;
|
||||
background-color: #37d980;
|
||||
border-color: #37d980;
|
||||
border-radius:0;
|
||||
margin-bottom:10px
|
||||
}
|
||||
.btn-blog:hover,
|
||||
.btn-blog:focus,
|
||||
.btn-blog:active,
|
||||
.btn-blog.active,
|
||||
.open .dropdown-toggle.btn-blog {
|
||||
color: white;
|
||||
background-color:#34ca78;
|
||||
border-color: #34ca78;
|
||||
}
|
||||
h2{color:#34ca78;}
|
||||
.margin10{margin-bottom:10px; margin-right:10px;}
|
||||
|
||||
|
||||
|
||||
/* Style the header with a grey background and some padding */
|
||||
.header {
|
||||
overflow: hidden;
|
||||
background-color: #f1f1f1;
|
||||
padding: 20px 10px;
|
||||
}
|
||||
|
||||
/* Style the header links */
|
||||
.header a {
|
||||
float: left;
|
||||
color: black;
|
||||
text-align: center;
|
||||
padding: 12px;
|
||||
text-decoration: none;
|
||||
font-size: 18px;
|
||||
line-height: 25px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Style the logo link (notice that we set the same value of line-height and font-size to prevent the header to increase when the font gets bigger */
|
||||
.header a.logo {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.header a.logo img{
|
||||
height:2em;
|
||||
}
|
||||
|
||||
/* Change the background color on mouse-over */
|
||||
.header a:hover {
|
||||
background-color: #ddd;
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* Style the active/current link*/
|
||||
.header a.active {
|
||||
background-color: dodgerblue;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Float the link section to the right */
|
||||
.header-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Add media queries for responsiveness - when the screen is 500px wide or less, stack the links on top of each other */
|
||||
@media screen and (max-width: 500px) {
|
||||
.header a {
|
||||
float: none;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
.header-right {
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
footer{
|
||||
background-color:#888;
|
||||
text-align:center;
|
||||
color:white;
|
||||
font-size:1.2em;
|
||||
padding:0.6em;
|
||||
}
|
||||
|
||||
footer a {
|
||||
color:#DDD;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#slogan{
|
||||
font-size:1.3em;
|
||||
line-height:2em;
|
||||
}
|
||||
BIN
database.sqlite
Executable file
BIN
database.sqlite
Executable file
Binary file not shown.
BIN
fonts/glyphicons-halflings-regular.ttf
Normal file
BIN
fonts/glyphicons-halflings-regular.ttf
Normal file
Binary file not shown.
BIN
fonts/glyphicons-halflings-regular.woff
Normal file
BIN
fonts/glyphicons-halflings-regular.woff
Normal file
Binary file not shown.
BIN
fonts/glyphicons-halflings-regular.woff2
Normal file
BIN
fonts/glyphicons-halflings-regular.woff2
Normal file
Binary file not shown.
49
index.php
Executable file
49
index.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
include_once 'models/Database.php';
|
||||
include_once 'models/Articles.php';
|
||||
include_once 'models/Menu.php';
|
||||
include_once './Config.php';
|
||||
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$article = new Articles($db);
|
||||
$menu = new Menu($db);
|
||||
|
||||
$article->id = 0;
|
||||
|
||||
$result = $article->getArticles();
|
||||
|
||||
include('template/header.php');
|
||||
|
||||
?>
|
||||
<title><?= Config::WEBSITE_NAME ?></title>
|
||||
<link href="css/style.css" rel="stylesheet" id="bootstrap-css">
|
||||
|
||||
<?php include('template/container.php');?>
|
||||
<div class="container">
|
||||
|
||||
<?php include('template/topmenu.php');?>
|
||||
|
||||
<?php
|
||||
//var_dump($result);
|
||||
foreach ($result as $post) {
|
||||
$date = date_create($post['created']);
|
||||
$message = str_replace("\n\r", "<br><br>", $post['message']);
|
||||
$message = $article->formatMessage($message, 100);
|
||||
?>
|
||||
<div class="col-md-10 blogShort">
|
||||
<h3><a href="article.php?id=<?php echo $post['id']; ?>"><?php echo $post['title']; ?></a></h3>
|
||||
<em><strong>Published on</strong>: <?php echo date_format($date, "d F Y"); ?></em>
|
||||
<em><strong>Category:</strong> <a href="#" target="_blank"><?php echo $post['category']; ?></a></em>
|
||||
<br><br>
|
||||
<article>
|
||||
<p><?php echo $message; ?> </p>
|
||||
</article>
|
||||
<a class="btn btn-blog pull-right" href="view.php?id=<?php echo $post['id']; ?>">READ MORE</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php include('template/footer.php');?>
|
||||
7
js/bootstrap.min.js
vendored
Normal file
7
js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
js/jquery.min.js
vendored
Normal file
4
js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
674
license.txt
Normal file
674
license.txt
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
51
models/Articles.php
Executable file
51
models/Articles.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
class Articles {
|
||||
|
||||
private $postTable = 'articles';
|
||||
private $categoryTable = 'categories';
|
||||
private $userTable = 'users';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function getArticles(){
|
||||
$query = '';
|
||||
if($this->id) {
|
||||
$query = " AND p.id ='".$this->id."'";
|
||||
}
|
||||
$sqlQuery = "
|
||||
SELECT p.id, p.title, p.message, p.category_id, u.first_name, u.last_name, p.status, p.created, p.updated, c.name as category
|
||||
FROM ".$this->postTable." p
|
||||
LEFT JOIN ".$this->categoryTable." c ON c.id = p.category_id
|
||||
LEFT JOIN ".$this->userTable." u ON u.id = p.userid
|
||||
WHERE p.status ='published' $query ORDER BY p.id DESC";
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
function formatMessage($string, $wordsreturned) {
|
||||
$retval = $string; // Just in case of a problem
|
||||
$array = explode(" ", $string);
|
||||
if (count($array)<=$wordsreturned){
|
||||
$retval = $string;
|
||||
}else{
|
||||
array_splice($array, $wordsreturned);
|
||||
$retval = implode(" ", $array)." ...";
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
public function totalPost(){
|
||||
$sqlQuery = "SELECT * FROM ".$this->postTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result->num_rows;
|
||||
}
|
||||
}
|
||||
?>
|
||||
144
models/Category.php
Executable file
144
models/Category.php
Executable file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
if (session_id() == "") session_start();
|
||||
class Category {
|
||||
|
||||
private $categoryTable = 'categories';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function getCategoryListing(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
$sqlQuery = "
|
||||
SELECT id, name
|
||||
FROM ".$this->categoryTable."
|
||||
";
|
||||
|
||||
if(!empty($_POST["search"]["value"])){
|
||||
$sqlQuery .= ' name LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
}
|
||||
|
||||
if(!empty($_POST["order"])){
|
||||
$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
|
||||
} else {
|
||||
$sqlQuery .= 'ORDER BY id DESC ';
|
||||
}
|
||||
if($_POST["length"] != -1){
|
||||
$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
|
||||
}
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
|
||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count; FROM ".$this->categoryTable);
|
||||
$stmtTotal->execute();
|
||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||
$allRecords = $allResult['count'];
|
||||
|
||||
$displayRecords = count($result);
|
||||
$categories = array();
|
||||
foreach ($result as $category) {
|
||||
$rows = array();
|
||||
$rows[] = $category['id'];
|
||||
$rows[] = $category['name'];
|
||||
$rows[] = '<a href="add_categories.php?id='.$category["id"].'" class="btn btn-warning btn-xs update">Edit</a>';
|
||||
$rows[] = '<button type="button" name="delete" id="'.$category["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$categories[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => intval($_POST["draw"]),
|
||||
"iTotalRecords" => $displayRecords,
|
||||
"iTotalDisplayRecords" => $allRecords,
|
||||
"data" => $categories
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
public function getCategory(){
|
||||
if($this->id) {
|
||||
$sqlQuery = "
|
||||
SELECT id, name
|
||||
FROM ".$this->categoryTable."
|
||||
WHERE id = :id; ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("id", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$category = $result;
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->name) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->categoryTable."(`name`)
|
||||
VALUES(:s)");
|
||||
|
||||
$this->name = htmlspecialchars(strip_tags($this->name));
|
||||
$stmt->bindParam("s", $this->name);
|
||||
|
||||
if($stmt->execute()){
|
||||
return $stmt->insert_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
UPDATE ".$this->categoryTable."
|
||||
SET name= :s
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$this->name = htmlspecialchars(strip_tags($this->name));
|
||||
|
||||
$stmt->bindParam("s", $this->name);
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
DELETE FROM ".$this->categoryTable."
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function totalCategory(){
|
||||
$sqlQuery = "SELECT COUNT(*) as count; FROM ".$this->categoryTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['count'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
20
models/Database.php
Executable file
20
models/Database.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
class Database{
|
||||
|
||||
public function getConnection(){
|
||||
try {
|
||||
|
||||
if (file_exists("./database.sqlite")) {
|
||||
$con = new \PDO("sqlite:./database.sqlite");
|
||||
} else {
|
||||
$con = new \PDO("sqlite:../database.sqlite");
|
||||
}
|
||||
|
||||
return $con;
|
||||
}catch (PDOException $err) {
|
||||
echo $err->getMessage();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
123
models/ImagesManager.php
Normal file
123
models/ImagesManager.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
class ImagesManager {
|
||||
|
||||
const FOLDER = "../public/images/";
|
||||
const MAX_FILE_SIZE = 1024 * 1024 * 4; // 4MB
|
||||
|
||||
protected $message = [];
|
||||
protected $permitted_types = [
|
||||
'image/jpeg',
|
||||
'image/bmp',
|
||||
'image/png',
|
||||
'image/jpg',
|
||||
'image/gif'
|
||||
];
|
||||
private $file_name;
|
||||
private $file_type;
|
||||
private $is_validated;
|
||||
private $temp_name;
|
||||
private $new_name;
|
||||
private $is_name_changed;
|
||||
private $file_error;
|
||||
private $file_size;
|
||||
|
||||
public function __construct () {
|
||||
$this->file_name = $_FILES['imageFile']['name'];
|
||||
$this->file_type = $_FILES['imageFile']['type'];
|
||||
$this->temp_name = $_FILES['imageFile']['tmp_name'];
|
||||
$this->file_error = $_FILES['imageFile']['error'];
|
||||
$this->file_size = $_FILES['imageFile']['size'];
|
||||
$this->is_validated = false;
|
||||
$this->is_name_changed = false;
|
||||
}
|
||||
|
||||
public function validateImage ($newName = null) {
|
||||
if ( strlen($this->file_name) > 255 || strlen($this->file_name) < 1 ) {
|
||||
$this->message[] .= "Change file name and upload again";
|
||||
return;
|
||||
}
|
||||
|
||||
if($newName !== null){
|
||||
$this->file_name = $newName;
|
||||
}
|
||||
|
||||
if ( file_exists(self::FOLDER . $this->file_name) ) {
|
||||
// do not reject file rather keep it.
|
||||
$fullpath = self::FOLDER . $this->file_name;
|
||||
$file_info = pathinfo($fullpath);
|
||||
$this->new_name = $file_info['imageFile'];
|
||||
$this->new_name .= "-". mt_rand(1000, 10000000);
|
||||
$this->new_name .= "." . $file_info['extension'];
|
||||
$this->is_name_changed = true;
|
||||
}
|
||||
|
||||
if ( in_array($this->file_type, $this->permitted_types) ) {
|
||||
$this->is_validated = true;
|
||||
}
|
||||
if ( $this->file_size > self::MAX_FILE_SIZE ) {
|
||||
$this->message[] .= "Images more than 1 MB are not allowed";
|
||||
$this->is_validated = false;
|
||||
}
|
||||
}
|
||||
public function uploadImage () {
|
||||
|
||||
if ( $this->is_validated ) {
|
||||
if ( $this->is_name_changed ) {
|
||||
$result = move_uploaded_file($this->temp_name, self::FOLDER . $this->new_name);
|
||||
if ( $result ) {
|
||||
$this->message[] .= "Image uploaded";
|
||||
}
|
||||
}
|
||||
$is_moved = move_uploaded_file($this->temp_name, self::FOLDER . $this->file_name);
|
||||
if ( !$is_moved ) {
|
||||
$this->message[] .= "Can't move the file to folder";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->message[] .= "Not validated";
|
||||
}
|
||||
}
|
||||
|
||||
public function getSavedIages(){
|
||||
$scan = scandir(self::FOLDER);
|
||||
|
||||
$out = array();
|
||||
|
||||
foreach ($scan as $file) {
|
||||
$filePath = self::FOLDER . '/' . $file;
|
||||
if (is_file($filePath)) {
|
||||
$out[] = $file;
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function delete($imageName){
|
||||
unlink(self::FOLDER . $imageName);
|
||||
}
|
||||
|
||||
public function getMessage(){
|
||||
return $this->message[0];
|
||||
}
|
||||
|
||||
public function getImagesListing(){
|
||||
$result = $this->getSavedIages();
|
||||
$images = array();
|
||||
foreach ($result as $file) {
|
||||
$rows = array();
|
||||
$rows[0] = $file;
|
||||
$rows[1] = "<a href='".self::FOLDER . $file."' target='blank'><img src=\"" . self::FOLDER . $file . "\" style='max-height:70px;'></a>";
|
||||
$rows[2] = '<button type="button" name="delete" id="'.$file.'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$images[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"iTotalRecords" => count($result),
|
||||
"iTotalDisplayRecords" => count($result),
|
||||
"data" => $images
|
||||
);
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
243
models/Menu.php
Normal file
243
models/Menu.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
if (session_id() == "") session_start();
|
||||
class Menu {
|
||||
|
||||
private $menuTable = 'menu';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function getMenuListing(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
$sqlQuery = "
|
||||
SELECT id,title,link,`order`
|
||||
FROM ".$this->menuTable."
|
||||
";
|
||||
if(!empty($_POST["search"]["value"])){
|
||||
$sqlQuery .= ' title LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
}
|
||||
if(!empty($_POST["order"])){
|
||||
$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
|
||||
} else {
|
||||
$sqlQuery .= 'ORDER BY `order` ASC ';
|
||||
}
|
||||
if($_POST["length"] != -1){
|
||||
$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
|
||||
}
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
|
||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count; FROM ".$this->menuTable);
|
||||
$stmtTotal->execute();
|
||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||
$allRecords = $allResult['count'];
|
||||
|
||||
$displayRecords = count($result);
|
||||
$menu = array();
|
||||
foreach ($result as $m) {
|
||||
$rows = array();
|
||||
$rows[] = $m['order'] . " " .
|
||||
'<button type="button" name="moveup" id="'.$m["id"].'" class="btn btn-success btn-xs moveup" ><span class="glyphicon glyphicon-triangle-top" aria-hidden="true"></span></button>' .
|
||||
'<button type="button" name="movedown" id="'.$m["id"].'" class="btn btn-success btn-xs movedown" ><span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></button>' ;
|
||||
$rows[] = $m['title'];
|
||||
$rows[] = $m['link'];
|
||||
$rows[] = '<a href="add_menu.php?id='.$m["id"].'" class="btn btn-warning btn-xs update">Edit</a>';
|
||||
$rows[] = '<button type="button" name="delete" id="'.$m["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$menu[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => intval($_POST["draw"]),
|
||||
"iTotalRecords" => $displayRecords,
|
||||
"iTotalDisplayRecords" => $allRecords,
|
||||
"data" => $menu
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
public function getMenu(){
|
||||
if($this->id) {
|
||||
$sqlQuery = "
|
||||
SELECT id,link,title
|
||||
FROM ".$this->menuTable."
|
||||
WHERE id = :id ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("id", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch();
|
||||
$post = $result;
|
||||
return $post;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getMenuArray(){
|
||||
$sqlQuery = "
|
||||
SELECT id, `order`,title,link
|
||||
FROM ".$this->menuTable."
|
||||
ORDER BY `order` ASC ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->title.$this->link) {
|
||||
$maxQuery = $this->conn->prepare("SELECT MAX(`order`) as max FROM ".$this->menuTable."");
|
||||
$maxQuery->execute();
|
||||
$maxResult = $maxQuery->fetch(PDO::FETCH_ASSOC);
|
||||
$max = ($maxResult['max'] * 1) + 1;
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->menuTable."(`title`,`link`,`order`)
|
||||
VALUES(:s1,:s2,:s3)");
|
||||
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
$this->link = htmlspecialchars(strip_tags($this->link));
|
||||
|
||||
$stmt->bindParam("s1", $this->title);
|
||||
$stmt->bindParam("s2", $this->link);
|
||||
$stmt->bindParam("s3", $max);
|
||||
|
||||
if($stmt->execute()){
|
||||
return $this->conn->lastInsertId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
UPDATE ".$this->menuTable."
|
||||
SET title= :s1, link = :s2
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$this->link = htmlspecialchars(strip_tags($this->link));
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
|
||||
$stmt->bindParam("s1", $this->title);
|
||||
$stmt->bindParam("s2", $this->link);
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
DELETE FROM ".$this->menuTable."
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function moveUp(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
|
||||
$curOrderQuery = $this->conn->prepare("SELECT `order` as o FROM ".$this->menuTable." WHERE id = :id");
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$curOrderQuery->bindParam("id", $this->id);
|
||||
$curOrderQuery->execute();
|
||||
$curOrderResult = $curOrderQuery->fetch(PDO::FETCH_ASSOC);
|
||||
$curOrder = ($curOrderResult['o'] * 1);
|
||||
|
||||
if($curOrder == 0) return; //Nižší už nejde
|
||||
|
||||
$q1 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = null WHERE id = :id");
|
||||
$q1->bindParam("id", $this->id);
|
||||
$q1->execute();
|
||||
$q1->execute();
|
||||
|
||||
$replacementOrder = $curOrder - 1;
|
||||
$q2 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = `order` + 1 WHERE `order` = :order");
|
||||
$q2->bindParam("order", $replacementOrder);
|
||||
$q2->execute();
|
||||
$q2->execute();
|
||||
|
||||
$newOrder = ($curOrder-1);
|
||||
$q3 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = :order WHERE id = :id");
|
||||
$q3->bindParam("order", $newOrder);
|
||||
$q3->bindParam("id", $this->id);
|
||||
$q3->execute();
|
||||
$q3->execute();
|
||||
}
|
||||
}
|
||||
|
||||
public function moveDown(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$curOrderQuery = $this->conn->prepare("SELECT `order` as o FROM ".$this->menuTable." WHERE id = :id");
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$curOrderQuery->bindParam("id", $this->id);
|
||||
$curOrderQuery->execute();
|
||||
$curOrderResult = $curOrderQuery->fetch(PDO::FETCH_ASSOC);
|
||||
$curOrder = ($curOrderResult['o'] * 1);
|
||||
|
||||
$maxQuery = $this->conn->prepare("SELECT MAX(`order`) as max FROM ".$this->menuTable."");
|
||||
$maxQuery->execute();
|
||||
$maxResult = $maxQuery->fetch(PDO::FETCH_ASSOC);
|
||||
$max = ($maxResult['max'] * 1) + 1;
|
||||
|
||||
if($curOrder >= $max-1) return; //Už jsem na konci
|
||||
|
||||
$q1 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = null WHERE id = :id");
|
||||
$q1->bindParam("id", $this->id);
|
||||
$q1->execute();
|
||||
$q1->execute();
|
||||
|
||||
$replacementOrder = $curOrder + 1;
|
||||
$q2 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = `order` - 1 WHERE `order` = :order");
|
||||
$q2->bindParam("order", $replacementOrder);
|
||||
$q2->execute();
|
||||
$q2->execute();
|
||||
|
||||
$newOrder = ($curOrder+1);
|
||||
$q3 = $this->conn->prepare("UPDATE ".$this->menuTable." SET `order` = :order WHERE id = :id");
|
||||
$q3->bindParam("order", $newOrder);
|
||||
$q3->bindParam("id", $this->id);
|
||||
$q3->execute();
|
||||
$q3->execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
206
models/Pages.php
Normal file
206
models/Pages.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
if (session_id() == "") session_start();
|
||||
class Pages {
|
||||
|
||||
private $pageTable = 'pages';
|
||||
private $menuTable = 'menu';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function getPagesListing(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
$sqlQuery = "
|
||||
SELECT id,link,title,content
|
||||
FROM ".$this->pageTable. " ";
|
||||
|
||||
if(!empty($_POST["search"]["value"])){
|
||||
$sqlQuery .= ' title LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR link LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR content LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
}
|
||||
if(!empty($_POST["order"])){
|
||||
$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
|
||||
} else {
|
||||
$sqlQuery .= 'ORDER BY id DESC ';
|
||||
}
|
||||
if($_POST["length"] != -1){
|
||||
$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
|
||||
}
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
|
||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count; FROM ".$this->pageTable);
|
||||
$stmtTotal->execute();
|
||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||
$allRecords = $allResult['count'];
|
||||
|
||||
|
||||
$displayRecords = count($result);
|
||||
$posts = array();
|
||||
foreach ($result as $post) {
|
||||
$rows = array();
|
||||
|
||||
$rows[] = $post['link'];
|
||||
$rows[] = $post['title'];
|
||||
$rows[] = htmlspecialchars($post['content']);
|
||||
$rows[] = '<button type="button" name="add" id="'.$post["id"].'" class="btn btn-success btn-xs add" >Add to menu</button>';
|
||||
$rows[] = '<a href="add_page.php?id='.$post["id"].'" class="btn btn-warning btn-xs update">Edit</a>';
|
||||
$rows[] = '<button type="button" name="delete" id="'.$post["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$posts[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => intval($_POST["draw"]),
|
||||
"iTotalRecords" => $displayRecords,
|
||||
"iTotalDisplayRecords" => $allRecords,
|
||||
"data" => $posts
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
public function getPage(){
|
||||
if($this->id) {
|
||||
$sqlQuery = "
|
||||
SELECT id,link,title,content
|
||||
FROM ".$this->pageTable."
|
||||
WHERE id = :id ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("id", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch();
|
||||
$post = $result;
|
||||
return $post;
|
||||
}
|
||||
}
|
||||
|
||||
public function getPageByLink(){
|
||||
if($this->link) {
|
||||
$sqlQuery = "
|
||||
SELECT id,link,title,content
|
||||
FROM ".$this->pageTable."
|
||||
WHERE link = :link ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("link", $this->link);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch();
|
||||
$post = $result;
|
||||
return $post;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->link && $this->title && $this->content) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->pageTable."(`title`, `link`, `content`)
|
||||
VALUES(:t,:l, :c)");
|
||||
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
$this->link = htmlspecialchars(strip_tags($this->link));
|
||||
|
||||
$stmt->bindParam(":t", $this->title);
|
||||
$stmt->bindParam(":l", $this->link);
|
||||
$stmt->bindParam(":c;", $this->content);
|
||||
|
||||
|
||||
if($stmt->execute()){
|
||||
return $this->conn->lastInsertId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($_SESSION['user_type'] != 2) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
UPDATE ".$this->pageTable."
|
||||
SET `link` = :link, `title` = :title, `content` = :cntnt
|
||||
WHERE id = :id");
|
||||
|
||||
$this->link = htmlspecialchars(strip_tags($this->link));
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
//$this->content = htmlspecialchars(strip_tags($this->content));
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
|
||||
$stmt->bindParam("link", $this->link);
|
||||
$stmt->bindParam("title", $this->title);
|
||||
$stmt->bindParam("cntnt",$this->content);
|
||||
$stmt->bindParam("id", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
DELETE FROM ".$this->pageTable."
|
||||
WHERE id = :id;");
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$stmt->bindParam(":id", $this->id);
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getPosts(){
|
||||
$sqlQuery = "
|
||||
SELECT id, title, link, content
|
||||
FROM ".$this->pageTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function addToMenu(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$maxQuery = $this->conn->prepare("SELECT MAX(`order`) as max FROM ".$this->menuTable."");
|
||||
$maxQuery->execute();
|
||||
$maxResult = $maxQuery->fetch(PDO::FETCH_ASSOC);
|
||||
$max = ($maxResult['max'] * 1) + 1;
|
||||
|
||||
$dataQuery = $this->conn->prepare("SELECT title,link FROM ".$this->pageTable."");
|
||||
$dataQuery->execute();
|
||||
$dataResult = $dataQuery->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->menuTable."(`title`,`link`,`order`)
|
||||
VALUES(:s1,:s2,:s3)");
|
||||
|
||||
$this->title = htmlspecialchars(strip_tags($dataResult['title']));
|
||||
$this->link = "./page.php?link=" . $dataResult['link'];
|
||||
|
||||
$stmt->bindParam("s1", $this->title);
|
||||
$stmt->bindParam("s2", $this->link);
|
||||
$stmt->bindParam("s3", $max);
|
||||
|
||||
if($stmt->execute()){
|
||||
return $this->conn->lastInsertId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
195
models/Post.php
Executable file
195
models/Post.php
Executable file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
if (session_id() == "") session_start();
|
||||
class Post {
|
||||
|
||||
private $postTable = 'articles';
|
||||
private $categoryTable = 'categories';
|
||||
private $userTable = 'users';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function getPostsListing(){
|
||||
|
||||
$whereQuery = '';
|
||||
if($_SESSION['user_type'] == 2) {
|
||||
$whereQuery = "WHERE p.userid ='".$_SESSION['userid']."'";
|
||||
}
|
||||
|
||||
$sqlQuery = "
|
||||
SELECT p.id, p.title, p.category_id, u.first_name, u.last_name, p.status, p.created, p.updated, c.name
|
||||
FROM ".$this->postTable." p
|
||||
LEFT JOIN ".$this->categoryTable." c ON c.id = p.category_id
|
||||
LEFT JOIN ".$this->userTable." u ON u.id = p.userid
|
||||
$whereQuery";
|
||||
|
||||
if(!empty($_POST["search"]["value"])){
|
||||
$sqlQuery .= ' title LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR message LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR created LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR updated LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
}
|
||||
if(!empty($_POST["order"])){
|
||||
$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
|
||||
} else {
|
||||
$sqlQuery .= 'ORDER BY p.id DESC ';
|
||||
}
|
||||
if($_POST["length"] != -1){
|
||||
$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
|
||||
}
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
|
||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count; FROM ".$this->postTable);
|
||||
$stmtTotal->execute();
|
||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||
$allRecords = $allResult['count'];
|
||||
|
||||
|
||||
$displayRecords = count($result);
|
||||
$posts = array();
|
||||
foreach ($result as $post) {
|
||||
$rows = array();
|
||||
$status = '';
|
||||
if($post['status'] == 'published') {
|
||||
$status = '<span class="label label-success">Published</span>';
|
||||
} else if($post['status'] == 'draft') {
|
||||
$status = '<span class="label label-warning">Draft</span>';
|
||||
} else if($post['status'] == 'archived') {
|
||||
$status = '<span class="label label-danger">Archived</span>';
|
||||
}
|
||||
|
||||
$rows[] = ucfirst($post['title']);
|
||||
$rows[] = $post['name'];
|
||||
$rows[] = ucfirst($post['first_name'])." ".$post['last_name'];
|
||||
$rows[] = $status;
|
||||
$rows[] = $post['created'];
|
||||
$rows[] = $post['updated'];
|
||||
$rows[] = '<a href="compose_post.php?id='.$post["id"].'" class="btn btn-warning btn-xs update">Edit</a>';
|
||||
$rows[] = '<button type="button" name="delete" id="'.$post["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$posts[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => intval($_POST["draw"]),
|
||||
"iTotalRecords" => $displayRecords,
|
||||
"iTotalDisplayRecords" => $allRecords,
|
||||
"data" => $posts
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
public function getPost(){
|
||||
if($this->id) {
|
||||
$sqlQuery = "
|
||||
SELECT p.id, p.title, p.message, p.category_id, p.status, p.created, p.updated, c.name
|
||||
FROM ".$this->postTable." p
|
||||
LEFT JOIN ".$this->categoryTable." c ON c.id = p.category_id
|
||||
WHERE p.id = :id ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("id", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch();
|
||||
$post = $result;
|
||||
return $post;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
|
||||
if($this->title && $this->message) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->postTable." (`title`, `message`, `category_id`, `userid`, `status`, `created` , `updated`)
|
||||
VALUES(:t,:m,:c,:ui,:s,:cr,:u)");
|
||||
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
$this->message = htmlspecialchars(strip_tags($this->message));
|
||||
$this->category = htmlspecialchars(strip_tags($this->category));
|
||||
$this->userid = htmlspecialchars(strip_tags($this->userid));
|
||||
$this->status = htmlspecialchars(strip_tags($this->status));
|
||||
$this->created = htmlspecialchars(strip_tags($this->created));
|
||||
$this->updated = htmlspecialchars(strip_tags($this->updated));
|
||||
|
||||
$stmt->bindParam("t", $this->title);
|
||||
$stmt->bindParam("m", $this->message);
|
||||
$stmt->bindParam("c", $this->category);
|
||||
$stmt->bindParam("ui", $this->userid);
|
||||
$stmt->bindParam("s", $this->status);
|
||||
$stmt->bindParam("u", $this->updated);
|
||||
$stmt->bindParam("cr", $this->created);
|
||||
|
||||
if($stmt->execute()){
|
||||
return $this->conn->lastInsertId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(){
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
UPDATE ".$this->postTable."
|
||||
SET title= :t, message = :m, category_id = :c, status= :s, updated = :u
|
||||
WHERE id = :i;");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$this->title = htmlspecialchars(strip_tags($this->title));
|
||||
$this->message = htmlspecialchars(strip_tags($this->message));
|
||||
$this->category = htmlspecialchars(strip_tags($this->category));
|
||||
$this->status = htmlspecialchars(strip_tags($this->status));
|
||||
$this->updated = htmlspecialchars(strip_tags($this->updated));
|
||||
|
||||
$stmt->bindParam("t", $this->title);
|
||||
$stmt->bindParam("m", $this->message);
|
||||
$stmt->bindParam("c", $this->category);
|
||||
$stmt->bindParam("s", $this->status);
|
||||
$stmt->bindParam("u", $this->updated);
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
DELETE FROM ".$this->postTable."
|
||||
WHERE id = :id;");
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$stmt->bindParam(":id", $this->id);
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getCategories(){
|
||||
$sqlQuery = "
|
||||
SELECT id, name
|
||||
FROM ".$this->categoryTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function totalPost(){
|
||||
$sqlQuery = "SELECT COUNT(*) as count FROM ".$this->postTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['count'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
227
models/User.php
Executable file
227
models/User.php
Executable file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
if (session_id() == "") session_start();
|
||||
|
||||
class User {
|
||||
|
||||
const SALT = "qwe4165dfh";
|
||||
|
||||
private $userTable = 'users';
|
||||
private $conn;
|
||||
|
||||
public function __construct($db){
|
||||
$this->conn = $db;
|
||||
}
|
||||
|
||||
public function login(){
|
||||
if($this->nick && $this->password) {
|
||||
$hash = crypt($this->password,self::SALT);
|
||||
$sqlQuery = "
|
||||
SELECT * FROM ".$this->userTable."
|
||||
WHERE nick = :nick AND password = :pass";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
|
||||
|
||||
|
||||
$stmt->bindParam("nick", $this->nick, );
|
||||
$stmt->bindParam("pass", $hash);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if($result){
|
||||
$user = $result;
|
||||
$_SESSION["userid"] = $user['id'];
|
||||
$_SESSION["user_type"] = $user['type'];
|
||||
$_SESSION["name"] = $user['first_name']." ".$user['last_name'];
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function loggedIn (){
|
||||
if(!empty($_SESSION["userid"])) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function totalUser(){
|
||||
$sqlQuery = "SELECT COUNT(*) as count FROM ".$this->userTable;
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['count'];
|
||||
}
|
||||
|
||||
public function getUsersListing(){
|
||||
|
||||
$whereQuery = '';
|
||||
if($_SESSION['user_type'] == 2) {
|
||||
$whereQuery = "WHERE id ='".$_SESSION['userid']."'";
|
||||
}
|
||||
|
||||
$sqlQuery = "
|
||||
SELECT id, first_name, last_name, nick, type, deleted
|
||||
FROM ".$this->userTable."
|
||||
$whereQuery ";
|
||||
|
||||
if(!empty($_POST["search"]["value"])){
|
||||
$sqlQuery .= ' first_name LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR last_name LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR nick LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
$sqlQuery .= ' OR type LIKE "%'.$_POST["search"]["value"].'%" ';
|
||||
}
|
||||
if(!empty($_POST["order"])){
|
||||
$sqlQuery .= 'ORDER BY '.$_POST['order']['0']['column'].' '.$_POST['order']['0']['dir'].' ';
|
||||
} else {
|
||||
$sqlQuery .= 'ORDER BY id DESC ';
|
||||
}
|
||||
if($_POST["length"] != -1){
|
||||
$sqlQuery .= 'LIMIT ' . $_POST['start'] . ', ' . $_POST['length'];
|
||||
}
|
||||
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll();
|
||||
|
||||
$stmtTotal = $this->conn->prepare("SELECT COUNT(*) as count FROM ".$this->userTable);
|
||||
$stmtTotal->execute();
|
||||
$allResult = $stmtTotal->fetch(PDO::FETCH_ASSOC);
|
||||
$allRecords = $allResult['count'];
|
||||
|
||||
|
||||
$displayRecords = count($result);
|
||||
$users = array();
|
||||
foreach ($result as $user) {
|
||||
$rows = array();
|
||||
$status = '';
|
||||
if($user['deleted']) {
|
||||
$status = '<span class="label label-danger">Inactive</span>';
|
||||
} else {
|
||||
$status = '<span class="label label-success">Active</span>';
|
||||
}
|
||||
|
||||
$type = '';
|
||||
if($user['type'] == 1){
|
||||
$type = '<span class="label label-danger">Admin</span>';
|
||||
} else if($user['type'] == 2){
|
||||
$type = '<span class="label label-warning">Author</span>';
|
||||
}
|
||||
|
||||
$rows[] = ucfirst($user['first_name'])." ".$user['last_name'];
|
||||
$rows[] = $user['nick'];
|
||||
$rows[] = $type;
|
||||
$rows[] = $status;
|
||||
$rows[] = '<a href="add_users.php?id='.$user["id"].'" class="btn btn-warning btn-xs update">Edit</a>';
|
||||
$rows[] = '<button type="button" name="delete" id="'.$user["id"].'" class="btn btn-danger btn-xs delete" >Delete</button>';
|
||||
$users[] = $rows;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
"draw" => intval($_POST["draw"]),
|
||||
"iTotalRecords" => $displayRecords,
|
||||
"iTotalDisplayRecords" => $allRecords,
|
||||
"data" => $users
|
||||
);
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
public function getUser(){
|
||||
if($this->id) {
|
||||
$sqlQuery = "
|
||||
SELECT id, first_name, last_name, nick, type, deleted
|
||||
FROM ".$this->userTable."
|
||||
WHERE id = :i ";
|
||||
$stmt = $this->conn->prepare($sqlQuery);
|
||||
$stmt->bindParam("i", $this->id);
|
||||
$stmt->execute();
|
||||
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
if($this->nick && $this->password) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
INSERT INTO ".$this->userTable."(`first_name`, `last_name`, `nick`, `password`, `type`, `deleted`)
|
||||
VALUES(:f,:l,:e,:p,:t,:d)");
|
||||
|
||||
$this->first_name = htmlspecialchars(strip_tags($this->first_name));
|
||||
$this->last_name = htmlspecialchars(strip_tags($this->last_name));
|
||||
$this->nick = htmlspecialchars(strip_tags($this->nick));
|
||||
$this->password = htmlspecialchars(strip_tags($this->password));
|
||||
$this->type = htmlspecialchars(strip_tags($this->type));
|
||||
$this->deleted = htmlspecialchars(strip_tags($this->deleted));
|
||||
|
||||
$stmt->bindParam("f", $this->first_name);
|
||||
$stmt->bindParam("l", $this->last_name);
|
||||
$stmt->bindParam("e", $this->nick);
|
||||
$stmt->bindParam("p", crypt($this->password,self::SALT));
|
||||
$stmt->bindParam("t", $this->type);
|
||||
$stmt->bindParam("d", $this->deleted);
|
||||
|
||||
|
||||
if($stmt->execute()){
|
||||
return $this->conn->lastInsertId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
|
||||
|
||||
if($this->id) {
|
||||
$stmt = $this->conn->prepare("
|
||||
UPDATE ".$this->userTable."
|
||||
SET first_name= :f, last_name = :l, nick = :e, type = :t, deleted= :d
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
$this->first_name = htmlspecialchars(strip_tags($this->first_name));
|
||||
$this->last_name = htmlspecialchars(strip_tags($this->last_name));
|
||||
$this->nick = htmlspecialchars(strip_tags($this->nick));
|
||||
$this->type = htmlspecialchars(strip_tags($this->type));
|
||||
$this->deleted = htmlspecialchars(strip_tags($this->deleted));
|
||||
|
||||
$stmt->bindParam("f", $this->first_name);
|
||||
$stmt->bindParam("l", $this->last_name);
|
||||
$stmt->bindParam("e", $this->nick);
|
||||
$stmt->bindParam("t", $this->type);
|
||||
$stmt->bindParam("d", $this->deleted);
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
if($_SESSION['user_type'] != 1) return;
|
||||
if($this->id) {
|
||||
|
||||
$stmt = $this->conn->prepare("
|
||||
DELETE FROM ".$this->userTable."
|
||||
WHERE id = :i");
|
||||
|
||||
$this->id = htmlspecialchars(strip_tags($this->id));
|
||||
|
||||
$stmt->bindParam("i", $this->id);
|
||||
|
||||
if($stmt->execute()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
43
page.php
Normal file
43
page.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
include_once 'models/Database.php';
|
||||
include_once 'models/Pages.php';
|
||||
include_once 'models/Menu.php';
|
||||
include_once './Config.php';
|
||||
|
||||
$database = new Database();
|
||||
$db = $database->getConnection();
|
||||
|
||||
$page = new Pages($db);
|
||||
$menu = new Menu($db);
|
||||
|
||||
$page->link = $_GET['link'];
|
||||
|
||||
$post = $page->getPageByLink();
|
||||
|
||||
include('template/header.php');
|
||||
|
||||
?>
|
||||
<title><?php echo $post['title']; ?> - <?= Config::WEBSITE_NAME ?></title>
|
||||
<link href="css/style.css" rel="stylesheet" id="bootstrap-css">
|
||||
<?php include('template/container.php');?>
|
||||
<div class="container">
|
||||
|
||||
<?php include('template/topmenu.php');?>
|
||||
|
||||
<?php
|
||||
$content = str_replace("\n\r", "<br><br>", $post['content']);
|
||||
?>
|
||||
|
||||
<div class="col-md-10 blogShort">
|
||||
<h2><?php echo $post['title']; ?></h2>
|
||||
<br><br>
|
||||
<article>
|
||||
<p><?php echo $content; ?> </p>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 gap10"></div>
|
||||
|
||||
|
||||
</div>
|
||||
<?php include('template/footer.php');?>
|
||||
BIN
public/images/-2886358.jpeg
Normal file
BIN
public/images/-2886358.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
BIN
public/images/_051fcdcd-f16e-41a5-b187-b2d42ba26988.jpeg
Normal file
BIN
public/images/_051fcdcd-f16e-41a5-b187-b2d42ba26988.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
BIN
public/images/logo.jpeg
Normal file
BIN
public/images/logo.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
BIN
resources/images/logo.png
Normal file
BIN
resources/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
5
template/container.php
Executable file
5
template/container.php
Executable file
@@ -0,0 +1,5 @@
|
||||
</head>
|
||||
<body class="">
|
||||
|
||||
<div class="container" style="min-height:500px;">
|
||||
|
||||
13
template/footer.php
Executable file
13
template/footer.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<div class="insert-post-ads1" style="margin-top:20px;">
|
||||
|
||||
<footer>
|
||||
Powered by <a href='https://jan-skoda.cz' target="_blank">PSL - CMS</a> by <a href='https://jan-skoda.cz' target="_blank">Jan Škoda</a>
|
||||
</footer>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
11
template/header.php
Executable file
11
template/header.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<link rel="stylesheet" href=" <?= Config::ROOT_PATH ?>css/bootstrap.min.css">
|
||||
|
||||
|
||||
<script src=" <?= Config::ROOT_PATH ?>js/jquery.min.js"></script>
|
||||
<script src=" <?= Config::ROOT_PATH ?>js/bootstrap.min.js"></script>
|
||||
<!-- jQuery -->
|
||||
18
template/topmenu.php
Normal file
18
template/topmenu.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<div id="blog" class="row">
|
||||
<div class="header">
|
||||
<a href="./index.php" class="logo">
|
||||
<img src="<?= Config::ROOT_PATH?>resources/images/logo.png">
|
||||
<?= Config::WEBSITE_NAME ?>
|
||||
</a>
|
||||
<div id="slogan"> <?= Config::WEBSITE_SLOGAN ?> </div>
|
||||
<?php
|
||||
$menuItems = $menu->getMenuArray();
|
||||
?>
|
||||
<div class="header-right">
|
||||
<?php
|
||||
foreach($menuItems as $item){
|
||||
echo '<a href="' . $item['link'] . '">' . $item['title'] . '</a>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user