Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a9af2c07

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

Feature #8644: Vydávání záznamů

Zobrazit rozdíly:

application/search.php
1 1
<!doctype html>
2

  
2
<?php session_start()?>
3 3
<html >
4 4
<head>
5 5
    <meta charset="utf-8">
application/view/searchContent.php
461 461
    <table class="table table-striped">
462 462
        <thead>
463 463
        <tr>
464
            <?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
465
                <th scope="col">Vydáno</th>
466
            <?php }?>
464 467
            <th scope="col">Lemma</th>
465 468
            <th scope="col">Slovní tvar</th>
466 469
            <th scope="col">Morfologie</th>
......
601 604
                    return output;
602 605
                }
603 606

  
607
                function publishItem(id){
608
                    let item = data[id];
609
                    const finishedChecked = document.getElementById("check-"+id).checked;
610

  
611
                    const formData = new FormData();
612
                    formData.append("finished", finishedChecked);
613

  
614
                    formData.append("id", item.id);
615
                    formData.append("ending", item.ending);
616
                    formData.append("prefix", item.prefix);
617
                    formData.append("suffix", item.suffix);
618

  
619
                    formData.append("namedentity", item.namedentity);
620
                    formData.append("position1", item.position1);
621
                    formData.append("position2", item.position2);
622
                    formData.append("positiondetail", item.positiondetail);
623
                    formData.append("word", item.word);
624
                    formData.append("lemma", item.lemma.lemma);
625
                    formData.append("manuscript", item.manuscript);
626
                    formData.append("context", item.context);
627
                    formData.append("description", item.description);
628
                    formData.append("description2", item.description2);
629
                    formData.append("description3", item.description3);
630
                    formData.append("tag", item.tag.tag);
631
                    formData.append("pos", item.lemma.pos);
632
                    formData.append("date", item.date);
633

  
634
                    var xhr = new XMLHttpRequest();
635
                    xhr.open("POST", "./controller/UpdateController.php");
636
                    xhr.send(formData);//TODO VACI CHECK?
637
                    setTimeout(function(){
638
                        location.reload();
639
                    }, 500);
640
                }
641

  
604 642
                function renderData(data) {
605 643
                    let result = "";
606 644
                    data.forEach((item,id) => {
607 645
                        result += "<tr>";
646
                        <?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
647
                            result += "<td><input type='checkbox' id='check-"+item.id+"' onchange='publishItem("+item.id+")' "+ ((item.finished === true) ? 'checked' : '') +" /></td>";
648
                        <?php }?>
608 649
                        result += "<td>" + item.lemma.lemma + "</td>";
609 650
                        result += "<td>" + item.word + "</td>";
610 651
                        result += "<td>" + item.tag.tag + "</td>";

Také k dispozici: Unified diff