61 |
61 |
}
|
62 |
62 |
$this->stmt->execute();
|
63 |
63 |
$result = $this->stmt->fetchAll();
|
|
64 |
//print_r($result);
|
64 |
65 |
return $result;
|
65 |
66 |
} catch (Exception $ex) {
|
66 |
67 |
$this->error = $ex->getMessage();
|
... | ... | |
357 |
358 |
|
358 |
359 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_manuscript |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
359 |
360 |
|
360 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
|
361 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
361 |
362 |
$query = "SELECT * FROM dd_manuscript WHERE ";
|
362 |
363 |
$query .= " wordform_id = :wordform_id ;";
|
363 |
364 |
}
|
364 |
365 |
|
365 |
366 |
$this->stmt = $this->pdo->prepare($query);
|
366 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
367 |
|
$this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
|
|
367 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
368 |
$this->stmt->bindParam(':wordform_id', $_POST['id']);
|
368 |
369 |
}
|
369 |
370 |
$this->stmt->execute();
|
370 |
371 |
$result = $this->stmt->fetchAll();
|
... | ... | |
397 |
398 |
|
398 |
399 |
|
399 |
400 |
$this->stmt = $this->pdo->prepare($query);
|
400 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
401 |
|
$this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
|
|
401 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
402 |
$this->stmt->bindParam(':wordform_id', $_POST['id'], PDO::PARAM_INT);
|
402 |
403 |
}
|
403 |
404 |
//
|
404 |
405 |
$this->stmt->execute();
|
... | ... | |
411 |
412 |
$query .= " " . $id_to_insert . " ); ";
|
412 |
413 |
|
413 |
414 |
$this->stmt = $this->pdo->prepare($query);
|
414 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
415 |
|
$this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
|
|
415 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
416 |
$this->stmt->bindParam(':wordform_id', $_POST['id'], PDO::PARAM_INT);
|
416 |
417 |
}
|
417 |
418 |
$this->stmt->execute();
|
418 |
419 |
}
|
... | ... | |
640 |
641 |
|
641 |
642 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_manuscript |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
642 |
643 |
|
643 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
644 |
|
$query = "SELECT * FROM dd_manuscript WHERE ";
|
645 |
|
$query .= " wordform_id = :wordform_id ;";
|
646 |
|
|
647 |
|
$this->stmt = $this->pdo->prepare($query);
|
648 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
649 |
|
$this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
|
650 |
|
}
|
651 |
|
$this->stmt->execute();
|
652 |
|
$result = $this->stmt->fetchAll();
|
653 |
|
|
654 |
|
$to_insert = [];
|
655 |
|
$contained = [];
|
656 |
|
$found = false;
|
657 |
|
$integerIDs = [];
|
658 |
|
|
659 |
|
foreach ($result as $res) {
|
660 |
|
$integerIDs = array_map('intval', explode(',', $_POST['manuscript']));
|
661 |
|
foreach ($integerIDs as $new_value){
|
662 |
|
if($new_value == $res['manuscript']){
|
663 |
|
$found = true;
|
664 |
|
array_push($contained, $new_value);
|
665 |
|
}
|
666 |
|
}
|
667 |
|
if($found == false){
|
668 |
|
array_push($to_delete, $res);
|
669 |
|
}
|
670 |
|
$found = false;
|
671 |
|
}
|
672 |
|
$to_insert = array_diff($integerIDs, $contained);
|
|
644 |
$to_insert = array_map('intval', explode(',', $_POST['manuscript']));
|
673 |
645 |
foreach ($to_insert as $id_to_insert){
|
674 |
646 |
$query = "INSERT INTO dd_manuscript VALUES ( ";
|
675 |
647 |
$query .= " :wordform_id , ";
|
676 |
648 |
$query .= " " . $id_to_insert . " ); ";
|
677 |
649 |
|
678 |
650 |
$this->stmt = $this->pdo->prepare($query);
|
679 |
|
if (array_key_exists("wordform_id", $_POST) && $_POST['wordform_id'] != "") {
|
680 |
|
$this->stmt->bindParam(':wordform_id', $_POST['wordform_id'], PDO::PARAM_INT);
|
681 |
|
}
|
|
651 |
$this->stmt->bindParam(':wordform_id', $result[0]["max"], PDO::PARAM_INT);
|
682 |
652 |
$this->stmt->execute();
|
683 |
653 |
}
|
684 |
654 |
}
|
685 |
655 |
|
686 |
656 |
|
687 |
|
}
|
688 |
|
|
689 |
657 |
function remove(){
|
|
658 |
$query = "SELECT lemma_id FROM dd_wordform
|
|
659 |
WHERE id = :id;";
|
|
660 |
$this->stmt = $this->pdo->prepare($query);
|
|
661 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
662 |
$this->stmt->bindParam(':id', $_POST['id'], PDO::PARAM_STR);
|
|
663 |
}
|
|
664 |
$this->stmt->execute();
|
|
665 |
$lemma = $this->stmt->fetch(PDO::FETCH_ASSOC);
|
|
666 |
|
|
667 |
$query = "SELECT tag_id FROM dd_wordform
|
|
668 |
WHERE id = :id;";
|
|
669 |
$this->stmt = $this->pdo->prepare($query);
|
|
670 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
671 |
$this->stmt->bindParam(':id', $_POST['id'], PDO::PARAM_STR);
|
|
672 |
}
|
|
673 |
$this->stmt->execute();
|
|
674 |
$tag = $this->stmt->fetch(PDO::FETCH_ASSOC);
|
|
675 |
|
690 |
676 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_manuscript |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
691 |
677 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
692 |
678 |
$query = "DELETE FROM dd_manuscript WHERE";
|
... | ... | |
696 |
682 |
$this->stmt->execute();
|
697 |
683 |
}
|
698 |
684 |
|
699 |
|
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_lemma |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
685 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_wordform |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
686 |
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
|
687 |
$query = "DELETE FROM dd_wordform WHERE";
|
|
688 |
$query .= " id = :id ;";
|
|
689 |
$this->stmt = $this->pdo->prepare($query);
|
|
690 |
$this->stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
|
|
691 |
$this->stmt->execute();
|
|
692 |
}
|
700 |
693 |
|
701 |
|
/*if (array_key_exists("lemma", $_POST) && $_POST['lemma'] != "") {
|
|
694 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_lemma |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
695 |
$query = "SELECT id FROM dd_wordform WHERE lemma_id = :lemma_id;";
|
|
696 |
$this->stmt = $this->pdo->prepare($query);
|
|
697 |
$this->stmt->bindParam(':lemma_id', $lemma["lemma_id"], PDO::PARAM_INT);
|
|
698 |
$this->stmt->execute();
|
|
699 |
$result = $this->stmt->fetchAll();
|
|
700 |
if(sizeof($result)==0){
|
702 |
701 |
$query = "DELETE FROM dd_lemma WHERE";
|
703 |
702 |
$query .= " id = :lemma_id ;";
|
704 |
703 |
$this->stmt = $this->pdo->prepare($query);
|
705 |
|
$this->stmt->bindParam(':lemma_id', $lemma["id"], PDO::PARAM_INT);
|
|
704 |
$this->stmt->bindParam(':lemma_id', $lemma["lemma_id"], PDO::PARAM_INT);
|
706 |
705 |
$this->stmt->execute();
|
707 |
|
} TODO: fix lemma*/
|
|
706 |
}
|
708 |
707 |
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_tag |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
709 |
|
|
710 |
|
/*if (array_key_exists("tag", $_POST) && $_POST['tag'] != "") {
|
|
708 |
$query = "SELECT id FROM dd_wordform WHERE tag_id = :tag_id;";
|
|
709 |
$this->stmt = $this->pdo->prepare($query);
|
|
710 |
$this->stmt->bindParam(':tag_id', $tag["tag_id"], PDO::PARAM_INT);
|
|
711 |
$this->stmt->execute();
|
|
712 |
$result = $this->stmt->fetchAll();
|
|
713 |
if(sizeof($result)==0){
|
711 |
714 |
$query = "DELETE FROM dd_tag WHERE";
|
712 |
715 |
$query .= " id = :tag_id ;";
|
713 |
716 |
$this->stmt = $this->pdo->prepare($query);
|
714 |
|
$this->stmt->bindParam(':tag_id', $tag["id"], PDO::PARAM_INT);
|
715 |
|
$this->stmt->execute();
|
716 |
|
} TODO: fix tag */
|
717 |
|
|
718 |
|
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Tabulka dd_wordform |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
719 |
|
if (array_key_exists("id", $_POST) && $_POST['id'] != "") {
|
720 |
|
$query = "DELETE FROM dd_wordform WHERE";
|
721 |
|
$query .= " id = :id ;";
|
722 |
|
$this->stmt = $this->pdo->prepare($query);
|
723 |
|
$this->stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
|
|
717 |
$this->stmt->bindParam(':tag_id', $tag["tag_id"], PDO::PARAM_INT);
|
724 |
718 |
$this->stmt->execute();
|
|
719 |
}else{
|
|
720 |
echo "fail";
|
725 |
721 |
}
|
726 |
722 |
}
|
727 |
723 |
|
... | ... | |
732 |
728 |
define('DB_NAME', 'dalim2');
|
733 |
729 |
define('DB_CHARSET', 'utf8');
|
734 |
730 |
define('DB_USER', 'postgres');
|
735 |
|
define('DB_PASSWORD', 'x');
|
|
731 |
define('DB_PASSWORD', 'MVcesko98');
|
Enhancement #8640 Testování a oprava jednotlivých funkcionalit aplikace