Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6f8c9e05

Přidáno uživatelem Ondřej Drtina před téměř 4 roky(ů)

commit před mergem s Milan. větví.

Zobrazit rozdíly:

application/controller/RemoveController.php
1 1
<?php
2 2
require "../model/DB.php";
3

  
4 3
$DB = new DB();
5
$DB->remove();
4
$DB->remove();
application/model/DB.php
702 702

  
703 703
// (D) DATABASE SETTINGS - CHANGE TO YOUR OWN!
704 704
define('DB_HOST', 'localhost');
705
define('DB_NAME', 'dalimil1');
705
define('DB_NAME', 'dalimil2');
706 706
define('DB_CHARSET', 'utf8');
707 707
define('DB_USER', 'postgres');
708
define('DB_PASSWORD', 'a');
708
define('DB_PASSWORD', 'ahavole');
application/search.php
35 35
<?php include "./view/modals/loginModal.html" ?>
36 36
<?php include "./view/modals/detailModal.html" ?>
37 37
<?php include "./view/modals/settingsModal.html" ?>
38
<?php include "./view/modals/removeModal.html" ?>
38 39
</body>
39 40
</html>
application/view/modals/removeModal.html
1
<div id="remove-modal" class="modal fade" role="dialog">
2
	<div class="modal-dialog modal-dialog-centered" role="document">
3
		<div class="modal-content">
4
			 <div class="modal-header">
5
					<h4 class="modal-title">Potvrdit odstranění</h4>
6
					<button type="button" class="close" data-dismiss="modal">&times;</button>
7
			 </div>
8
			 <div class="modal-body">
9
				<div class="container">
10
					<div class="row">
11
                        <p>Opravdu chcete odstranit zvolený záznam?</p>
12
                    </div>
13
				</div>
14
			 </div>
15
			 <div class="modal-footer">
16
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeSelectedItem()">Ano</button>
17
                <button type="button" class="btn btn-default" data-dismiss="modal">Ne</button>
18
            </div>
19
		</div>
20
	</div>
21
</div>
22

  
23
<script>
24
    $('#remove-modal').on('show.bs.modal', function (event){
25
        const button = $(event.relatedTarget);
26
        const pseudo_id = button.data('pseudo-id');//Extract info from data-* attributes
27

  
28
        const data_obj = data[pseudo_id];
29
        let modal = $(this);
30

  
31
        alert("id: " + data_obj.id);
32
    });
33
</script>
application/view/searchContent.php
548 548
                        result += "<td class=\"action-td\">" +
549 549
                            "<button class=\"btn\" title=\"Detail\"  data-toggle=\"modal\" data-target=\"#detail-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-search\"></i></button>" +
550 550
                            "</td>";
551
                        result += "<td class=\"action-td\">" +
552
                            "<button class=\"btn\" title=\"Odstranit\"  data-toggle=\"modal\" data-target=\"#remove-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-trash\"></i></button>" +
553
                            "</td>"; //added button for removing entry
551 554
                        result += "</tr>";
552 555
                    });
553 556
                    document.getElementById("search-table").innerHTML = result;
......
559 562
    <h3 id="no-data-label" class="mx-auto text-center font-italic">Žádná data nebyla nalezena</h3>
560 563

  
561 564
    <script>
565
        function removeSelectedItem(){
566
            const data = new FormData(); //to pass ids, which we want to delete from DB
567
            data.append("id", ""+4); //id to delete from table dd_wordform
568
            data.append("wordform_id", ""+4); //id to delete from M:N table dd_manuscript (prolly the same as above...)
569
            
570
            let xhr = new XMLHttpRequest();
571
            xhr.open("POST", "./controller/RemoveController.php");
572
            xhr.onload = function(){
573
                        alert("loaded");
574
                    };
575
            xhr.send(data);
576
            alert("removing item: 4");
577
        }
578

  
562 579
        function checkValidItemsPerPage(){
563 580
            var visibleItemCount = document.getElementById("itemsPerPage");
564 581
            if(!isNaN(visibleItemCount.value) && visibleItemCount.value % 1 === 0 && parseInt(visibleItemCount.value) >= 1 && parseInt(visibleItemCount.value) <= 500){

Také k dispozici: Unified diff