Revize 5aceeb68
Přidáno uživatelem Tomáš Pašek před téměř 4 roky(ů)
application/controller/CreateChangeRequestController.php | ||
---|---|---|
1 |
<?php |
|
2 |
require "../model/DB.php"; |
|
3 |
$DB = new DB(); |
|
4 |
|
|
5 |
$result = $DB->createChangeRequest($_POST); |
application/controller/GetChangeRequests.php | ||
---|---|---|
1 |
<?php |
|
2 |
require "../model/DB.php"; |
|
3 |
$DB = new DB(); |
|
4 |
|
|
5 |
$results = $DB->getChangeRequests(); |
|
6 |
|
|
7 |
echo json_encode(count($results)==0 ? null : $results); |
application/controller/RemoveChangeRequest.php | ||
---|---|---|
1 |
<?php |
|
2 |
require "../model/DB.php"; |
|
3 |
$DB = new DB(); |
|
4 |
|
|
5 |
$DB->removeChangeRequest($_POST["requestId"]); |
application/controller/TableController.php | ||
---|---|---|
4 | 4 |
require "../model/Word.php"; |
5 | 5 |
require "../model/Lemma.php"; |
6 | 6 |
$DB = new DB(); |
7 |
session_start(); |
|
7 | 8 |
|
8 | 9 |
$parArray = Array(); |
9 | 10 |
$whereQuery = createWhereQuery($parArray); |
... | ... | |
73 | 74 |
$array['positiondetail'] = $_POST['positiondetail']; |
74 | 75 |
$whereQuery .= " w.positiondetail = :positiondetail AND"; |
75 | 76 |
} |
76 |
if (array_key_exists("finished", $_POST) && $_POST['finished'] != "") { |
|
77 |
$array['finished'] = $_POST['finished']; |
|
78 |
$whereQuery .= " w.finished = :finished AND"; |
|
77 |
if (!array_key_exists("loggedIn", $_SESSION) || $_SESSION['loggedIn'] == false) { |
|
78 |
$whereQuery .= " w.finished = true AND"; |
|
79 | 79 |
} |
80 | 80 |
if (array_key_exists("manuscript", $_POST) && $_POST['manuscript'] != "") { |
81 | 81 |
$array['manuscript'] = Array(); |
application/model/DB.php | ||
---|---|---|
48 | 48 |
if (array_key_exists("tag", $params)) { |
49 | 49 |
$this->stmt->bindParam(':tag',$params['tag'], PDO::PARAM_STR); |
50 | 50 |
} |
51 |
if (array_key_exists("finished", $params)) { |
|
52 |
$this->stmt->bindParam(':finished',$params['finished']); |
|
53 |
} |
|
54 | 51 |
if (array_key_exists("description2", $params)) { |
55 | 52 |
$this->stmt->bindParam(':description2',$params['description2']); |
56 | 53 |
} |
... | ... | |
85 | 82 |
return $this->stmt->fetchAll(); |
86 | 83 |
} |
87 | 84 |
|
85 |
function createChangeRequest($request) { |
|
86 |
$this->stmt = $this->pdo->prepare('INSERT INTO changes (wordform_id, message) VALUES (:wordform_id, :message)'); |
|
87 |
$this->stmt->bindParam(':wordform_id', $request['wordform_id']); |
|
88 |
$this->stmt->bindParam(':message',$request['message']); |
|
89 |
$this->stmt->execute(); |
|
90 |
return $this->stmt->fetchAll(); |
|
91 |
} |
|
92 |
|
|
93 |
function removeChangeRequest($requestId) { |
|
94 |
$this->stmt = $this->pdo->prepare('DELETE FROM changes WHERE id = :requestId'); |
|
95 |
$this->stmt->bindParam(':requestId', $requestId); |
|
96 |
$this->stmt->execute(); |
|
97 |
return $this->stmt->fetchAll(); |
|
98 |
} |
|
99 |
|
|
100 |
function getChangeRequests() { |
|
101 |
$this->stmt = $this->pdo->prepare('SELECT c.id as changeId, c.message, w.id as wordformId, w.word, l.lemma FROM changes as c left join dd_wordform as w on c.wordform_id = w.id left join dd_lemma as l on w.lemma_id = l.id'); |
|
102 |
$this->stmt->execute(); |
|
103 |
return $this->stmt->fetchAll(); |
|
104 |
} |
|
105 |
|
|
88 | 106 |
function updateUserRole($userId, $role) { |
89 | 107 |
$this->stmt = $this->pdo->prepare("UPDATE users SET role = :role WHERE id = :userId"); |
90 | 108 |
$this->stmt->bindParam(':role', $role); |
... | ... | |
730 | 748 |
|
731 | 749 |
// (D) DATABASE SETTINGS - CHANGE TO YOUR OWN! |
732 | 750 |
define('DB_HOST', 'localhost'); |
733 |
define('DB_NAME', 'dalim2'); |
|
751 |
define('DB_NAME', 'dalimil2');
|
|
734 | 752 |
define('DB_CHARSET', 'utf8'); |
735 | 753 |
define('DB_USER', 'postgres'); |
736 | 754 |
define('DB_PASSWORD', 'a'); |
dbUsersUpgrade/users.txt | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
-- Dumped from database version 10.16 |
|
6 |
-- Dumped by pg_dump version 10.16 |
|
7 |
|
|
8 |
-- Started on 2021-04-10 22:53:56 |
|
9 |
|
|
10 |
SET statement_timeout = 0; |
|
11 |
SET lock_timeout = 0; |
|
12 |
SET idle_in_transaction_session_timeout = 0; |
|
13 |
SET client_encoding = 'UTF8'; |
|
14 |
SET standard_conforming_strings = on; |
|
15 |
SELECT pg_catalog.set_config('search_path', '', false); |
|
16 |
SET check_function_bodies = false; |
|
17 |
SET xmloption = content; |
|
18 |
SET client_min_messages = warning; |
|
19 |
SET row_security = off; |
|
20 |
|
|
21 |
SET default_tablespace = ''; |
|
22 |
|
|
23 |
SET default_with_oids = false; |
|
24 |
|
|
25 |
-- |
|
26 |
-- TOC entry 203 (class 1259 OID 16487) |
|
27 |
-- Name: users; Type: TABLE; Schema: public; Owner: postgres |
|
28 |
-- |
|
29 |
|
|
30 |
CREATE TABLE public.users ( |
|
31 |
id integer NOT NULL, |
|
32 |
password character varying(100) NOT NULL, |
|
33 |
username character varying NOT NULL, |
|
34 |
role character varying NOT NULL |
|
35 |
); |
|
36 |
|
|
37 |
|
|
38 |
ALTER TABLE public.users OWNER TO postgres; |
|
39 |
|
|
40 |
-- |
|
41 |
-- TOC entry 204 (class 1259 OID 16497) |
|
42 |
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
|
43 |
-- |
|
44 |
|
|
45 |
ALTER TABLE public.users ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
|
46 |
SEQUENCE NAME public.users_id_seq |
|
47 |
START WITH 1 |
|
48 |
INCREMENT BY 1 |
|
49 |
NO MINVALUE |
|
50 |
NO MAXVALUE |
|
51 |
CACHE 1 |
|
52 |
); |
|
53 |
|
|
54 |
|
|
55 |
-- |
|
56 |
-- TOC entry 2814 (class 0 OID 16487) |
|
57 |
-- Dependencies: 203 |
|
58 |
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres |
|
59 |
-- |
|
60 |
|
|
61 |
COPY public.users (id, password, username, role) FROM stdin; |
|
62 |
4 $2y$10$liQbaSxcPykR4516JVQ/G.pDYu0niSOF7q/IhJlOrUqXsHwIwp/p2 admin editor |
|
63 |
\. |
|
64 |
|
|
65 |
|
|
66 |
-- |
|
67 |
-- TOC entry 2821 (class 0 OID 0) |
|
68 |
-- Dependencies: 204 |
|
69 |
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
|
70 |
-- |
|
71 |
|
|
72 |
SELECT pg_catalog.setval('public.users_id_seq', 4, true); |
|
73 |
|
|
74 |
|
|
75 |
-- |
|
76 |
-- TOC entry 2690 (class 2606 OID 16496) |
|
77 |
-- Name: users username_unique; Type: CONSTRAINT; Schema: public; Owner: postgres |
|
78 |
-- |
|
79 |
|
|
80 |
ALTER TABLE ONLY public.users |
|
81 |
ADD CONSTRAINT username_unique UNIQUE (username); |
|
82 |
|
|
83 |
|
|
84 |
-- |
|
85 |
-- TOC entry 2692 (class 2606 OID 16491) |
|
86 |
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres |
|
87 |
-- |
|
88 |
|
|
89 |
ALTER TABLE ONLY public.users |
|
90 |
ADD CONSTRAINT users_pkey PRIMARY KEY (id); |
|
91 |
|
|
92 |
|
|
93 |
-- Completed on 2021-04-10 22:53:56 |
|
94 |
|
|
95 |
-- |
|
96 |
-- PostgreSQL database dump complete |
|
97 |
-- |
|
98 |
|
dbupgrade/changes.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
-- Dumped from database version 10.16 |
|
6 |
-- Dumped by pg_dump version 10.16 |
|
7 |
|
|
8 |
-- Started on 2021-04-24 21:33:05 |
|
9 |
|
|
10 |
SET statement_timeout = 0; |
|
11 |
SET lock_timeout = 0; |
|
12 |
SET idle_in_transaction_session_timeout = 0; |
|
13 |
SET client_encoding = 'UTF8'; |
|
14 |
SET standard_conforming_strings = on; |
|
15 |
SELECT pg_catalog.set_config('search_path', '', false); |
|
16 |
SET check_function_bodies = false; |
|
17 |
SET xmloption = content; |
|
18 |
SET client_min_messages = warning; |
|
19 |
SET row_security = off; |
|
20 |
|
|
21 |
SET default_tablespace = ''; |
|
22 |
|
|
23 |
SET default_with_oids = false; |
|
24 |
|
|
25 |
-- |
|
26 |
-- TOC entry 205 (class 1259 OID 24745) |
|
27 |
-- Name: changes; Type: TABLE; Schema: public; Owner: postgres |
|
28 |
-- |
|
29 |
|
|
30 |
CREATE TABLE public.changes ( |
|
31 |
id integer NOT NULL, |
|
32 |
wordform_id integer NOT NULL, |
|
33 |
message character varying NOT NULL |
|
34 |
); |
|
35 |
|
|
36 |
|
|
37 |
ALTER TABLE public.changes OWNER TO postgres; |
|
38 |
|
|
39 |
-- |
|
40 |
-- TOC entry 206 (class 1259 OID 24753) |
|
41 |
-- Name: changes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
|
42 |
-- |
|
43 |
|
|
44 |
ALTER TABLE public.changes ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( |
|
45 |
SEQUENCE NAME public.changes_id_seq |
|
46 |
START WITH 1 |
|
47 |
INCREMENT BY 1 |
|
48 |
NO MINVALUE |
|
49 |
NO MAXVALUE |
|
50 |
CACHE 1 |
|
51 |
); |
|
52 |
|
|
53 |
|
|
54 |
-- |
|
55 |
-- TOC entry 2818 (class 0 OID 24745) |
|
56 |
-- Dependencies: 205 |
|
57 |
-- Data for Name: changes; Type: TABLE DATA; Schema: public; Owner: postgres |
|
58 |
-- |
|
59 |
|
|
60 |
COPY public.changes (id, wordform_id, message) FROM stdin; |
|
61 |
\. |
|
62 |
|
|
63 |
|
|
64 |
-- |
|
65 |
-- TOC entry 2825 (class 0 OID 0) |
|
66 |
-- Dependencies: 206 |
|
67 |
-- Name: changes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
|
68 |
-- |
|
69 |
|
|
70 |
SELECT pg_catalog.setval('public.changes_id_seq', 1, true); |
|
71 |
|
|
72 |
|
|
73 |
-- |
|
74 |
-- TOC entry 2696 (class 2606 OID 24752) |
|
75 |
-- Name: changes changes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres |
|
76 |
-- |
|
77 |
|
|
78 |
ALTER TABLE ONLY public.changes |
|
79 |
ADD CONSTRAINT changes_pkey PRIMARY KEY (id); |
|
80 |
|
|
81 |
|
|
82 |
-- Completed on 2021-04-24 21:33:05 |
|
83 |
|
|
84 |
-- |
|
85 |
-- PostgreSQL database dump complete |
|
86 |
-- |
|
87 |
|
dbupgrade/users.sql | ||
---|---|---|
1 |
-- |
|
2 |
-- PostgreSQL database dump |
|
3 |
-- |
|
4 |
|
|
5 |
-- Dumped from database version 10.16 |
|
6 |
-- Dumped by pg_dump version 10.16 |
|
7 |
|
|
8 |
-- Started on 2021-04-10 22:53:56 |
|
9 |
|
|
10 |
SET statement_timeout = 0; |
|
11 |
SET lock_timeout = 0; |
|
12 |
SET idle_in_transaction_session_timeout = 0; |
|
13 |
SET client_encoding = 'UTF8'; |
|
14 |
SET standard_conforming_strings = on; |
|
15 |
SELECT pg_catalog.set_config('search_path', '', false); |
|
16 |
SET check_function_bodies = false; |
|
17 |
SET xmloption = content; |
|
18 |
SET client_min_messages = warning; |
|
19 |
SET row_security = off; |
|
20 |
|
|
21 |
SET default_tablespace = ''; |
|
22 |
|
|
23 |
SET default_with_oids = false; |
|
24 |
|
|
25 |
-- |
|
26 |
-- TOC entry 203 (class 1259 OID 16487) |
|
27 |
-- Name: users; Type: TABLE; Schema: public; Owner: postgres |
|
28 |
-- |
|
29 |
|
|
30 |
CREATE TABLE public.users ( |
|
31 |
id integer NOT NULL, |
|
32 |
password character varying(100) NOT NULL, |
|
33 |
username character varying NOT NULL, |
|
34 |
role character varying NOT NULL |
|
35 |
); |
|
36 |
|
|
37 |
|
|
38 |
ALTER TABLE public.users OWNER TO postgres; |
|
39 |
|
|
40 |
-- |
|
41 |
-- TOC entry 204 (class 1259 OID 16497) |
|
42 |
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres |
|
43 |
-- |
|
44 |
|
|
45 |
ALTER TABLE public.users ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
|
46 |
SEQUENCE NAME public.users_id_seq |
|
47 |
START WITH 1 |
|
48 |
INCREMENT BY 1 |
|
49 |
NO MINVALUE |
|
50 |
NO MAXVALUE |
|
51 |
CACHE 1 |
|
52 |
); |
|
53 |
|
|
54 |
|
|
55 |
-- |
|
56 |
-- TOC entry 2814 (class 0 OID 16487) |
|
57 |
-- Dependencies: 203 |
|
58 |
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres |
|
59 |
-- |
|
60 |
|
|
61 |
COPY public.users (id, password, username, role) FROM stdin; |
|
62 |
4 $2y$10$liQbaSxcPykR4516JVQ/G.pDYu0niSOF7q/IhJlOrUqXsHwIwp/p2 admin editor |
|
63 |
\. |
|
64 |
|
|
65 |
|
|
66 |
-- |
|
67 |
-- TOC entry 2821 (class 0 OID 0) |
|
68 |
-- Dependencies: 204 |
|
69 |
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres |
|
70 |
-- |
|
71 |
|
|
72 |
SELECT pg_catalog.setval('public.users_id_seq', 4, true); |
|
73 |
|
|
74 |
|
|
75 |
-- |
|
76 |
-- TOC entry 2690 (class 2606 OID 16496) |
|
77 |
-- Name: users username_unique; Type: CONSTRAINT; Schema: public; Owner: postgres |
|
78 |
-- |
|
79 |
|
|
80 |
ALTER TABLE ONLY public.users |
|
81 |
ADD CONSTRAINT username_unique UNIQUE (username); |
|
82 |
|
|
83 |
|
|
84 |
-- |
|
85 |
-- TOC entry 2692 (class 2606 OID 16491) |
|
86 |
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres |
|
87 |
-- |
|
88 |
|
|
89 |
ALTER TABLE ONLY public.users |
|
90 |
ADD CONSTRAINT users_pkey PRIMARY KEY (id); |
|
91 |
|
|
92 |
|
|
93 |
-- Completed on 2021-04-10 22:53:56 |
|
94 |
|
|
95 |
-- |
|
96 |
-- PostgreSQL database dump complete |
|
97 |
-- |
|
98 |
|
Také k dispozici: Unified diff
Feature #8637 Návrh změn záznamů