Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jlopez
wicopa
Commits
1ae990f0
Commit
1ae990f0
authored
May 27, 2019
by
jlopez
Browse files
Add tags
parent
9c8ae216
Pipeline
#203
failed with stages
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Tool.php
deleted
100644 → 0
View file @
9c8ae216
<?php
/**
* Created by PhpStorm.
* User: jimmy
* Date: 01/02/19
* Time: 13:55
*/
class
Tool
{
}
\ No newline at end of file
action/action_container.php
View file @
1ae990f0
...
...
@@ -38,6 +38,7 @@ $visibility = "public";
$description
=
NULL
;
$author
=
0
;
$labels
=
array
();
$tags
=
""
;
if
(
isset
(
$_POST
[
'containerid'
]))
{
$id
=
$_POST
[
'containerid'
];
...
...
@@ -75,7 +76,13 @@ if(isset($_POST['labels'])) {
$labels
=
$_POST
[
'labels'
];
}
$container
=
new
Container
(
$id
,
$name
,
$value
,
$type
,
$visibility
,
$description
,
$author
,
$today
);
if
(
isset
(
$_POST
[
'tags'
]))
{
$tags
=
$_POST
[
'tags'
];
$tags
=
preg_replace
(
"/[
\n\r
]/"
,
""
,
$tags
);
$tags
=
preg_replace
(
array
(
'/\s{2,}/'
,
'/[\t\n]/'
),
' '
,
$tags
);
}
$container
=
new
Container
(
$id
,
$name
,
$value
,
$type
,
$visibility
,
$description
,
$author
,
$today
,
$tags
);
if
(
$action
==
"create"
)
{
$container
->
escape
(
$db
);
...
...
container.php
View file @
1ae990f0
...
...
@@ -9,70 +9,9 @@ $db = new DBquery();
$containers
=
$db
->
getContainers
();
?>
<!doctype html>
<html
lang=
"en"
>
<head>
<!-- Required meta tags -->
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"
crossorigin=
"anonymous"
>
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link
rel=
"stylesheet"
href=
"./inc/css/style.css"
>
<script
src=
"./inc/js/jscolor.js"
></script>
<title>
wicopa
</title>
</head>
<body>
<nav
class=
"navbar navbar-expand-md navbar-dark navbar-custom p-1"
>
<a
class=
"navbar-brand"
href=
"#"
>
WICOPA
</a>
<div
class=
"collapse navbar-collapse justify-content-between"
id=
"navbar"
>
<div
class=
"navbar-nav"
>
<?php
echo
' <a class="nav-item nav-link" href="./index.php"> Home </a>'
;
echo
' <a class="nav-item nav-link active" href="./container.php"> Containers </a>'
;
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
if
(
isset
(
$_SESSION
[
'manage'
])
&&
!
empty
(
$_SESSION
[
'manage'
]))
{
echo
' <a class="nav-item nav-link" href="./manage.php"> Manage </a>'
;
}
}
?>
</div>
<div
class=
"navbar-nav"
>
<?php
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
'<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('
.
$_SESSION
[
'username'
]
.
') </a>'
;
}
else
{
echo
'<a class="nav-item btn btn-primary" href="./login.php"> Login </a>'
;
}
?>
</div>
</nav>
require_once
"./inc/php/buildHeader.php"
;
?>
<div
class=
"container-fluid"
>
...
...
@@ -89,6 +28,7 @@ $containers = $db->getContainers();
<th>
Name
</th>
<th>
Author
</th>
<th>
Labels
</th>
<th>
Tags
</th>
<th>
Date
</th>
<th>
Description
</th>
<th>
Action
</th>
...
...
@@ -154,6 +94,24 @@ $containers = $db->getContainers();
echo
'</td>'
;
$tags
=
explode
(
' '
,
$container
->
tags
);
$index
=
0
;
echo
'<td>'
;
foreach
(
$tags
as
$tag
)
{
echo
'<span class="badge" style="background:#'
.
"30336b"
.
'; color:#FFFFFF">'
.
$tag
.
'</span>'
;
/*if($index == 3) {
echo '<br/>';
$index = 0;
} else {
$index++;
} */
}
echo
'</td>'
;
echo
'<td>'
.
$container
->
date
.
'</td>'
;
echo
'<td>'
.
$container
->
description
.
'</td>'
;
...
...
dao/DBquery.php
View file @
1ae990f0
...
...
@@ -175,7 +175,7 @@ class DBquery
$result
=
mysqli_query
(
$this
->
dbh
,
$sql
);
$results
=
array
();
while
(
$row
=
mysqli_fetch_assoc
(
$result
)){
$cnt
=
new
Container
(
$row
[
'ID'
],
$row
[
'name'
],
$row
[
'value'
],
$row
[
'type'
],
$row
[
'visibility'
],
$row
[
'description'
],
$row
[
'author'
],
$row
[
'date'
]);
$cnt
=
new
Container
(
$row
[
'ID'
],
$row
[
'name'
],
$row
[
'value'
],
$row
[
'type'
],
$row
[
'visibility'
],
$row
[
'description'
],
$row
[
'author'
],
$row
[
'date'
]
,
$row
[
'tags'
]
);
array_push
(
$results
,
$cnt
);
}
return
$results
;
...
...
inc/php/buildHeader.php
0 → 100644
View file @
1ae990f0
<?php
echo
'
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link rel="stylesheet" href="./inc/css/style.css">
<script src="./inc/js/jscolor.js"></script>
<title>wicopa</title>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a>
<div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav">
'
;
echo
' <a class="nav-item nav-link" href="./index.php"> Home </a>'
;
echo
' <a class="nav-item nav-link" href="./container.php"> Containers </a>'
;
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
if
(
isset
(
$_SESSION
[
'manage'
])
&&
!
empty
(
$_SESSION
[
'manage'
]))
{
echo
' <a class="nav-item nav-link" href="./manage.php"> Manage </a>'
;
// echo ' <a class="nav-item nav-link" href="./config.php"> Configs </a>';
}
}
echo
'
</div>
<div class="navbar-nav">
'
;
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
'<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('
.
$_SESSION
[
'username'
]
.
') </a>'
;
}
else
{
echo
'<a class="nav-item btn btn-primary" href="./login.php"> Login </a>'
;
}
echo
'</div>
</nav>
'
;
index.php
View file @
1ae990f0
...
...
@@ -43,70 +43,9 @@ foreach ($db->getAllActiveSectionParent() as $s){
}
}
?>
<!doctype html>
<html
lang=
"en"
>
<head>
<!-- Required meta tags -->
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"
crossorigin=
"anonymous"
>
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css" crossorigin="anonymous"-->
<link
rel=
"stylesheet"
href=
"./inc/css/style.css"
>
<title>
wicopa
</title>
</head>
<body>
<nav
class=
"navbar navbar-expand-md navbar-dark navbar-custom p-1"
>
<a
class=
"navbar-brand"
href=
"#"
>
WICOPA
</a>
<div
class=
"collapse navbar-collapse justify-content-between"
id=
"navbar"
>
<div
class=
"navbar-nav"
>
<?php
echo
' <a class="nav-item nav-link active" href="./index.php"> Home </a>'
;
echo
' <a class="nav-item nav-link" href="./container.php"> Containers </a>'
;
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
if
(
isset
(
$_SESSION
[
'manage'
])
&&
!
empty
(
$_SESSION
[
'manage'
]))
{
echo
' <a class="nav-item nav-link" href="./manage.php"> Manage </a>'
;
}
}
?>
</div>
<div
class=
"navbar-nav"
>
<?php
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
'<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('
.
$_SESSION
[
'username'
]
.
') </a>'
;
}
else
{
echo
'<a class="nav-item btn btn-primary" href="./login.php"> Login </a>'
;
}
?>
</div>
</nav>
require_once
"./inc/php/buildHeader.php"
;
?>
<div
class=
"container-fluid"
>
...
...
@@ -428,6 +367,10 @@ foreach ($db->getAllActiveSectionParent() as $s){
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"tagsContainer"
>
Tags :
</label>
<textarea
class=
"form-control"
rows=
"5"
id=
"tagsContainer"
maxlength=
"500"
name =
"tags"
></textarea>
</div>
</div>
...
...
login.php
View file @
1ae990f0
...
...
@@ -6,62 +6,10 @@
* Time: 10:10
*/
//include('.
./inc
lude
/buildHeader.php
')
;
require_once
"
./inc
/php
/buildHeader.php
"
;
?>
<!doctype html>
<html
lang=
"en"
>
<head>
<!-- Required meta tags -->
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"
crossorigin=
"anonymous"
>
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link
rel=
"stylesheet"
href=
"./inc/css/style.css"
>
<title>
wicopa
</title>
</head>
<body>
<nav
class=
"navbar navbar-expand-md navbar-dark navbar-custom p-0"
>
<a
class=
"navbar-brand"
href=
"#"
>
WICOPA
</a>
<div
class=
"collapse navbar-collapse justify-content-between"
id=
"navbar"
>
<div
class=
"navbar-nav justify-content-center"
>
<?php
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
' <a class="nav-item nav-link" href="./index.php"> Home </a>'
;
echo
' <a class="nav-item nav-link" href="./gestion.php"> Gestion </a>'
;
}
?>
</div>
<div
class=
"navbar-nav"
>
<?php
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
'<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('
.
$_SESSION
[
'username'
]
.
') </a>'
;
}
else
{
echo
'<a class="nav-item btn btn-primary" href="./login.php"> Login </a>'
;
}
?>
</div>
</nav>
<div
class=
"container-fluid"
>
...
...
manage.php
View file @
1ae990f0
...
...
@@ -47,69 +47,9 @@ foreach ($grades as $grade) {
}
}
?>
<!doctype html>
<html
lang=
"en"
>
<head>
<!-- Required meta tags -->
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity=
"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin=
"anonymous"
>
<link
rel=
"stylesheet"
href=
"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"
crossorigin=
"anonymous"
>
<!-- local fallbacks -->
<!--link rel="stylesheet" href="./inc/css/bootstrap.min.css">
<link rel="stylesheet" href="./inc/css/jquery.dataTables.min.css"-->
<link
rel=
"stylesheet"
href=
"./inc/css/style.css"
>
<script
src=
"./inc/js/jscolor.js"
></script>
<title>
wicopa
</title>
</head>
<body>
<nav
class=
"navbar navbar-expand-md navbar-dark navbar-custom p-1"
>
<a
class=
"navbar-brand"
href=
"#"
>
WICOPA
</a>
<div
class=
"collapse navbar-collapse justify-content-between"
id=
"navbar"
>
<div
class=
"navbar-nav"
>
<?php
echo
' <a class="nav-item nav-link" href="./index.php"> Home </a>'
;
echo
' <a class="nav-item nav-link" href="./container.php"> Containers </a>'
;
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
if
(
isset
(
$_SESSION
[
'manage'
])
&&
!
empty
(
$_SESSION
[
'manage'
]))
{
echo
' <a class="nav-item nav-link active" href="./manage.php"> Manage </a>'
;
}
}
?>
</div>
<div
class=
"navbar-nav"
>
<?php
if
(
isset
(
$_SESSION
[
'username'
])
&&
!
empty
(
$_SESSION
[
'username'
]))
{
echo
'<a class="nav-item btn btn-primary " href="./action/action_logout.php"> Logout ('
.
$_SESSION
[
'username'
]
.
') </a>'
;
}
else
{
echo
'<a class="nav-item btn btn-primary" href="./login.php"> Login </a>'
;
}
?>
</div>
</nav>
require_once
"./inc/php/buildHeader.php"
;
?>
<div
class=
"container-fluid"
>
...
...
@@ -737,10 +677,6 @@ foreach ($grades as $grade) {
<!-- Latest compiled and minified JavaScript -->
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity=
"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin=
"anonymous"
></script>
<!-- local fallbaks -->
<!--script src="inc/js/jquery-latest.min.js" type="text/javascript"></script>
<script src="inc/js/bootstrap.min.js" type="text/javascript"></script-->
</body>
</html>
\ No newline at end of file
model/Container.php
View file @
1ae990f0
...
...
@@ -18,6 +18,7 @@ class Container
var
$description
=
""
;
var
$author
=
0
;
var
$date
=
NULL
;
var
$tags
=
""
;
/**
* Container constructor.
...
...
@@ -25,7 +26,7 @@ class Container
* @param string $name
* @param int $type
*/
public
function
__construct
(
$ID
,
$name
,
$value
,
$type
,
$visibility
,
$description
,
$author
,
$date
)
public
function
__construct
(
$ID
,
$name
,
$value
,
$type
,
$visibility
,
$description
,
$author
,
$date
,
$tags
)
{
$this
->
ID
=
$ID
;
$this
->
name
=
$name
;
...
...
@@ -35,29 +36,32 @@ class Container
$this
->
description
=
$description
;
$this
->
author
=
$author
;
$this
->
date
=
$date
;
$this
->
tags
=
$tags
;
}
public
function
escape
(
DBquery
$db
)
{
$this
->
name
=
utf8_decode
(
$db
->
escape
(
$this
->
name
));
$this
->
value
=
utf8_decode
(
$db
->
escape
(
$this
->
value
));
$this
->
description
=
utf8_decode
(
$db
->
escape
(
$this
->
description
));
$this
->
tags
=
utf8_decode
(
$db
->
escape
(
$this
->
tags
));
}
public
function
escape2
(
DBquery
$db
)
{
$this
->
name
=
utf8_encode
(
$db
->
escape
(
$this
->
name
));
$this
->
value
=
utf8_encode
(
$db
->
escape
(
$this
->
value
));
$this
->
description
=
utf8_encode
(
$db
->
escape
(
$this
->
description
));
$this
->
tags
=
utf8_encode
(
$db
->
escape
(
$this
->
tags
));
}
public
function
getInsert
()
{
return
"INSERT INTO Container (name, value, type, visibility, description, author, date)
VALUES ('
$this->name
', '
$this->value
', '
$this->type
', '
$this->visibility
', '
$this->description
', '
$this->author
', '
$this->date
');"
;
return
"INSERT INTO Container (name, value, type, visibility, description, author, date
, tags
)
VALUES ('
$this->name
', '
$this->value
', '
$this->type
', '
$this->visibility
', '
$this->description
', '
$this->author
', '
$this->date
'
, '
$this->tags
'
);"
;
}
public
function
getUpdate
()
{
return
"UPDATE Container
SET name='
$this->name
', value='
$this->value
', type='
$this->type
',
visiblity='
$this->visibility
', description='
$this->description
', author='
$this->author
', date='
$this->date
'
visiblity='
$this->visibility
', description='
$this->description
', author='
$this->author
', date='
$this->date
'
, tags='
$this->tags
'
WHERE ID = '
$this->ID
';"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment