PageSourceSearch

https://www.uiam.sk/assets/js/custom.js

js uiam.sk collected 2026-10-02 06:06:23 UTC 100,128 bytes, 3,512 lines download raw bytes

1//------------------------------------------------------------------------------
2// Vseobecne nastavenia
3//------------------------------------------------------------------------------
4
5// Definovanie jazykovej verzie
6var language = $("#languageForJavascript").val();
7
8// Preklady pre DatePicker
9var monthNames = {
10  sk: [
11    "Január",
12    "Február",
13    "Marec",
14    "Apríl",
15    "Máj",
16    "Jún",
17    "Júl",
18    "August",
19    "September",
20    "Október",
21    "November",
22    "December",
23  ],
24};
25monthNames["en"] = [
26  "January",
27  "February",
28  "March",
29  "April",
30  "May",
31  "June",
32  "July",
33  "August",
34  "September",
35  "October",
36  "November",
37  "December",
38];
39var dayNamesMin = { sk: ["Ne", "Po", "Ut", "St", "Å t", "Pi", "So"] };
40dayNamesMin["en"] = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
41
42// Definovanie tabulky s prehladmi jednotlivych modulov
43if (language == "en")
44  var commonTable = $("#example").DataTable({
45    stateSave: true,
46    stateSaveCallback: function (settings, data) {
47      localStorage.setItem(
48        "DataTables_" + settings.sInstance,
49        JSON.stringify(data)
50      );
51    },
52    stateLoadCallback: function (settings) {
53      return JSON.parse(
54        localStorage.getItem("DataTables_" + settings.sInstance)
55      );
56    },
57    pageLength: 50,
58    dom: "lfrtip",
59  });
60else {
61  var commonTable = $("#example").DataTable({
62    stateSave: true,
63    stateSaveCallback: function (settings, data) {
64      localStorage.setItem(
65        "DataTables_" + settings.sInstance,
66        JSON.stringify(data)
67      );
68    },
69    stateLoadCallback: function (settings) {
70      return JSON.parse(
71        localStorage.getItem("DataTables_" + settings.sInstance)
72      );
73    },
74    pageLength: 50,
75    dom: "lfrtip",
76    language: {
77      sEmptyTable: "Nie sú k dispozícii žiadne dáta",
78      sInfo: "Záznamy _START_ až _END_ z celkom _TOTAL_",
79      sInfoEmpty: "Záznamy 0 až 0 z celkom 0 ",
80      sInfoFiltered: "(vyfiltrované spomedzi _MAX_ záznamov)",
81      sInfoPostFix: "",
82      sInfoThousands: ",",
83      sLengthMenu: "Zobraz _MENU_ záznamov",
84      sLoadingRecords: "Načítavam...",
85      sProcessing: "Spracúvam...",
86      sSearch: "Hľadať:",
87      sZeroRecords: "Nenašli sa žiadne vyhovujúce záznamy",
88      oPaginate: {
89        sFirst: "Prvá",
90        sLast: "Posledná",
91        sNext: "Nasledujúca",
92        sPrevious: "Predchádzajúca",
93      },
94      oAria: {
95        sSortAscending: ": aktivujte na zoradenie stĺpca vzostupne",
96        sSortDescending: ": aktivujte na zoradenie stĺpca zostupne",
97      },
98    },
99  });
100}
101
102// Nastavenie kalendara pre dd.mm.YYYY
103$(".dateDMY").datepicker({
104  dateFormat: "d.m.yy",
105  prevText: '<i class="fa fa-angle-left"></i>',
106  nextText: '<i class="fa fa-angle-right"></i>',
107  firstDay: 1,
108  monthNames: monthNames[language],
109  dayNamesMin: dayNamesMin[language],
110  beforeShowDay: function (date) {
111    if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
112    else css = "datepicker-0";
113    return [true, css];
114  },
115});
116
117/* zmenil som nastavenie http://localhost/skola/iam/web_new/assets/plugins/bootstrap/css/less/forms.less riadok 36 */
118//$('.dataTables_length label').css('font-weight','normal');
119//$('.dataTables_filter label').css('font-weight','normal');
120// label je tucny aj v inych blokoch ako datatable (filter, pages), label vo formularoch, text v textarea ...
121$("label").css("font-weight", "normal");
122
123$(".modal-link-publication").click(function () {
124  //console.log($(this).attr('id'))
125  $.ajax({
126    type: "POST",
127    dataType: "html",
128    url: "assets/ajax/ajaxPublication.php",
129    data: {
130      id: $(this).attr("id"),
131      case: "modalWindow",
132    },
133    success: function (data) {
134      $("#modal-body-publication").html(data);
135    },
136  });
137});
138
139$(".cca-timetable-change").change(function () {
140  $("#cca-form-timetable-search").submit();
141});
142
143$("#cca-form-timetable-reset").click(function () {
144  $("#action").val(2);
145  $("#cca-form-timetable-search").submit();
146});
147
148//------------------------------------------------------------------------------
149// Zobrazenie Knižnice
150//------------------------------------------------------------------------------
151
152// Udaje iba pre výber kniznice
153function inventory(bookID, type) {
154  $.ajax({
155    type: "POST",
156    dataType: "json",
157    url: "assets/ajax/ajaxLibrary.php",
158    data: {
159      bookID: bookID,
160      type: type,
161      case: "inventory",
162    },
163    success: function (data) {
164      //console.log(data);
165      $("#inv" + bookID).html(data);
166    },
167  });
168}
169
170function librarySelectPerson() {
171  //console.log('aaa')
172  $(".cca-modal-library").modal("hide");
173  $.blockUI({
174    css: {
175      border: "none",
176      padding: "15px",
177      backgroundColor: "#000",
178      "-webkit-border-radius": "10px",
179      "-moz-border-radius": "10px",
180      opacity: 0.5,
181      color: "#fff",
182    },
183  });
184}
185
186function libraryDetail(bookID) {
187  $.ajax({
188    type: "POST",
189    dataType: "json",
190    url: "assets/ajax/ajaxLibrary.php",
191    data: {
192      bookID: bookID,
193      case: "detail",
194    },
195    success: function (data) {
196      //console.log(data);
197      $(".cca-modal-library-title").html(data["title"]);
198      $(".cca-modal-library-body").html(data["body"]);
199    },
200  });
201  $(".cca-modal-library").modal("show");
202}
203
204function editReturn(id) {
205  $.blockUI({
206    css: {
207      border: "none",
208      padding: "15px",
209      backgroundColor: "#000",
210      "-webkit-border-radius": "10px",
211      "-moz-border-radius": "10px",
212      opacity: 0.5,
213      color: "#fff",
214    },
215  });
216  $.ajax({
217    type: "POST",
218    dataType: "json",
219    url: "assets/ajax/ajaxLibrary.php",
220    data: {
221      id: id,
222      case: "return",
223    },
224    success: function () {
225      window.location.replace("index.php?edit_id=22");
226    },
227  });
228}
229
230function editBorrow(bookID) {
231  $.ajax({
232    type: "POST",
233    dataType: "json",
234    url: "assets/ajax/ajaxLibrary.php",
235    data: {
236      bookID: bookID,
237      case: "borrow",
238    },
239    success: function (data) {
240      //console.log(data);
241      $(".cca-modal-library-title").html(data["title"]);
242      $(".cca-modal-library-body").html(data["body"]);
243    },
244  });
245  $(".cca-modal-library").modal("show");
246}
247
248if (typeof availableForLibrary != "undefined" && availableForLibrary !== null) {
249  var ccaTypeId = "book_id";
250  var ccaForm = "form_library";
251  var ccaURL = "assets/ajax/ajaxLibrary.php";
252  var ccaPage = "index.php?edit_id=21";
253
254  $(".cca-status").click(function () {
255    var status = $(this).val();
256    $.blockUI({
257      css: {
258        border: "none",
259        padding: "15px",
260        backgroundColor: "#000",
261        "-webkit-border-radius": "10px",
262        "-moz-border-radius": "10px",
263        opacity: 0.5,
264        color: "#fff",
265      },
266    });
267    $.ajax({
268      type: "POST",
269      dataType: "json",
270      url: "assets/ajax/ajaxLibrary.php",
271      data: {
272        status: status,
273        case: "status",
274      },
275      success: function () {
276        location.reload();
277      },
278    });
279  });
280
281  $("#library_user").change(function () {
282    $("#form_library_person").submit();
283  });
284}
285
286//------------------------------------------------------------------------------
287// Zobrazenie kalendárov
288//------------------------------------------------------------------------------
289
290// Udaje iba pre výber kalendárov
291if (
292  typeof availableForCalTimetable != "undefined" &&
293  availableForCalTimetable !== null
294) {
295  var ccaTypeId = "timetable_cal";
296  var ccaForm = "form_cal_timetable";
297
298  $("#calendarSelected").change(function () {
299    $("#calendarForm").submit();
300  });
301
302  $("#calendarAddTimetable").click(function () {
303    var timetable_cal = $("#timetable_cal").val();
304    console.log(timetable_cal);
305    $.ajax({
306      type: "POST",
307      dataType: "json",
308      url: "assets/ajax/ajaxCalendar.php",
309      data: {
310        timetable_cal: timetable_cal,
311        case: "create",
312      },
313      success: function (data) {
314        console.log(data);
315        $(".cca-modal-calendar-title").html(data["title"]);
316        $(".cca-modal-calendar-body").html(data["form"]);
317      },
318    });
319    $(".cca-modal-calendar").modal("show");
320  });
321
322  function calDeleteEvent(calendarID, eventID) {
323    console.log(calendarID);
324    $.ajax({
325      type: "POST",
326      dataType: "json",
327      url: "assets/calendar/ajax.php",
328      data: {
329        calendarID: calendarID,
330        eventID: eventID,
331        operation: "delete",
332      },
333      success: function (data) {
334        console.log(data);
335        $("#" + data["deleted"]).hide();
336      },
337    });
338  }
339}
340
341//------------------------------------------------------------------------------
342// Zobrazenie nastavenia rozvrhu
343//------------------------------------------------------------------------------
344
345// Udaje iba pre výber kalendárov
346if (
347  typeof availableForSetTimetable != "undefined" &&
348  availableForSetTimetable !== null
349) {
350  var ccaTypeId = "timetables_semester_id";
351  var ccaForm = "form_set_timetable";
352  var ccaPage = "index.php?edit_id=29";
353
354  $(".form_datetime_timetable_setting").datetimepicker({
355    format: "L",
356    locale: "sk",
357  });
358}
359
360//------------------------------------------------------------------------------
361// Zobrazenie citácií
362//------------------------------------------------------------------------------
363
364// Udaje iba pre výber citácií
365if (
366  typeof availableForPubCitations != "undefined" &&
367  availableForPubCitations !== null
368) {
369  var ccaTypeId = "p_d_id";
370  var ccaForm = "form_pub_citation";
371}
372
373//------------------------------------------------------------------------------
374// Vytváranie a úprava citácií
375//------------------------------------------------------------------------------
376
377// Udaje iba pre editaciu citácií
378if (
379  typeof availableForCitations != "undefined" &&
380  availableForCitations !== null
381) {
382  var ccaTypeId = "c_id";
383  var ccaForm = "form_citation";
384  var ccaURL = "assets/ajax/ajaxCitation.php";
385  var ccaPage = "index.php?edit_id=16";
386
387  $("#new-citation").click(function () {
388    $(".cca-modal-citation-source").modal("show");
389  });
390
391  $(".edit-citation").click(function () {
392    $(".cca-modal-citation-source").modal("hide");
393    var mainID = $("#p_d_id").val();
394    var cID = $(this).attr("id").substring(3);
395    //console.log(cID)
396
397    $.ajax({
398      type: "POST",
399      dataType: "json",
400      url: "assets/ajax/ajaxCitation.php",
401      data: {
402        case: "update-citation",
403        cID: cID,
404        mainID: mainID,
405      },
406      success: function (data) {
407        //console.log(data);
408        $(".cca-modal-citation-title").html(data["title"]);
409        $(".cca-modal-citation-body").html(data["form"]);
410        $(".cca-modal-citation-show").html(data["show"]);
411      },
412    });
413    $(".cca-modal-citation-edit").modal("show");
414  });
415
416  $('input[name="c_source"]').click(function () {
417    $(".cca-modal-citation-source").modal("hide");
418    var selectType = $(this).val();
419    var mainID = $("#p_d_id").val();
420    //console.log(selectType)
421
422    $.ajax({
423      type: "POST",
424      dataType: "json",
425      url: "assets/ajax/ajaxCitation.php",
426      data: {
427        case: "select-source",
428        selectType: selectType,
429        mainID: mainID,
430      },
431      success: function (data) {
432        //console.log(data);
433        $(".cca-modal-citation-title").html(data["title"]);
434        $(".cca-modal-citation-body").html(data["form"]);
435        $(".cca-modal-citation-show").html(data["show"]);
436      },
437    });
438    $(".cca-modal-citation-edit").modal("show");
439  });
440
441  function ajaxSelectCitation(typeCitPub) {
442    var search = $("#search-citation-UIAM").val();
443    //console.log(search)
444    if (search.length >= 3) {
445      $.ajax({
446        type: "POST",
447        dataType: "html",
448        url: "assets/ajax/ajaxCitation.php",
449        data: {
450          search: search,
451          typeCitPub: typeCitPub,
452          case: "search-UIAM",
453        },
454        success: function (data) {
455          $("#search-citation-UIAM-result").html(data);
456        },
457      });
458    } else {
459      $("#search-citation-UIAM-result").html("");
460    }
461  }
462
463  function ajaxConvert(type, fileType) {
464    var mainID = $("#p_d_id").val();
465    var inputData = $("#dropZone").val(); // .trim()
466    inputData = inputData.replace(/&/g, "&");
467    inputData = inputData.replace(/"/g, '"');
468    //console.log(inputData)
469    $.ajax({
470      type: "POST",
471      dataType: "html",
472      url: "assets/ajax/ajaxCitation.php",
473      data: {
474        mainID: mainID,
475        type: type,
476        inputData: inputData,
477        case: "citation-convert",
478      },
479      success: function (data) {
480        //console.log(data)
481        $("#citation-convert-result").html(data);
482      },
483    });
484  }
485}
486
487//------------------------------------------------------------------------------
488// Vytváranie a úprava projektov (nevýskumných)
489//------------------------------------------------------------------------------
490
491// Udaje iba pre editaciu výskumných projektov
492if (typeof availableForProject != "undefined" && availableForProject !== null) {
493  var ccaTypeId = "project_id";
494  var ccaForm = "form_project";
495  var ccaURL = "assets/ajax/ajaxProject.php";
496  var ccaPage = "index.php?edit_id=9";
497
498  $("#cca-add-research").click(function () {
499    var number = $("#cca-add-research-hidden").val();
500    number++;
501    $("#cca-add-research-id" + number).attr("class", "show");
502    $("#cca-add-research-hidden").val(number);
503  });
504
505  $("#project_full_sk").summernote({
506    height: 200, // set editor height
507    toolbar: [
508      ["misc", ["cca-editor-sk"]],
509      [
510        "font",
511        [
512          "bold",
513          "italic",
514          "underline",
515          "strikethrough",
516          "superscript",
517          "subscript",
518          "clear",
519        ],
520      ],
521      ["color", ["color"]],
522      ["para", ["ul", "ol", "paragraph"]],
523      ["table", ["table"]],
524      ["insert", ["link", "picture", "hr"]],
525      ["view", ["fullscreen", "codeview", "undo", "redo"]],
526      ["help", ["help"]],
527    ],
528  });
529  $("#project_full_en").summernote({
530    height: 200, // set editor height
531    toolbar: [
532      ["misc", ["cca-editor-en"]],
533      [
534        "font",
535        [
536          "bold",
537          "italic",
538          "underline",
539          "strikethrough",
540          "superscript",
541          "subscript",
542          "clear",
543        ],
544      ],
545      ["color", ["color"]],
546      ["para", ["ul", "ol", "paragraph"]],
547      ["table", ["table"]],
548      ["insert", ["link", "picture", "hr"]],
549      ["view", ["fullscreen", "codeview", "undo", "redo"]],
550      ["help", ["help"]],
551    ],
552  });
553
554  // Nastavenie kalendara pre datum expriracie
555  $("#project_date_expire").datepicker({
556    dateFormat: "d.m.yy",
557    prevText: '<i class="fa fa-angle-left"></i>',
558    nextText: '<i class="fa fa-angle-right"></i>',
559    firstDay: 1,
560    monthNames: monthNames[language],
561    dayNamesMin: dayNamesMin[language],
562    beforeShowDay: function (date) {
563      if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
564      else css = "datepicker-0";
565      return [true, css];
566    },
567  });
568
569  // Zoradenie druheho stlpca - DESC
570  commonTable.order([2, "desc"]).draw();
571}
572
573//------------------------------------------------------------------------------
574// Vytváranie a úprava výskumných projektov
575//------------------------------------------------------------------------------
576
577// Udaje iba pre editaciu výskumných projektov
578if (
579  typeof availableForResearch != "undefined" &&
580  availableForResearch !== null
581) {
582  var ccaTypeId = "r_p_id";
583  var ccaForm = "form_research";
584  var ccaURL = "assets/ajax/ajaxResearch.php";
585  var ccaPage = "index.php?edit_id=5";
586  var ccaFormClone = "index.php?edit_id=5&clone=1";
587
588  $("#cca-add-research").click(function () {
589    var number = $("#cca-add-research-hidden").val();
590    number++;
591    $("#cca-add-research-id" + number).attr("class", "show");
592    $("#cca-add-research-hidden").val(number);
593  });
594
595  $("#r_p_full_sk").summernote({
596    height: 200, // set editor height
597    toolbar: [
598      ["misc", ["cca-editor-sk"]],
599      [
600        "font",
601        [
602          "bold",
603          "italic",
604          "underline",
605          "strikethrough",
606          "superscript",
607          "subscript",
608          "clear",
609        ],
610      ],
611      ["color", ["color"]],
612      ["para", ["ul", "ol", "paragraph"]],
613      ["table", ["table"]],
614      ["insert", ["link", "picture", "hr"]],
615      ["view", ["fullscreen", "codeview", "undo", "redo"]],
616      ["help", ["help"]],
617    ],
618  });
619  $("#r_p_full_en").summernote({
620    height: 200, // set editor height
621    toolbar: [
622      ["misc", ["cca-editor-en"]],
623      [
624        "font",
625        [
626          "bold",
627          "italic",
628          "underline",
629          "strikethrough",
630          "superscript",
631          "subscript",
632          "clear",
633        ],
634      ],
635      ["color", ["color"]],
636      ["para", ["ul", "ol", "paragraph"]],
637      ["table", ["table"]],
638      ["insert", ["link", "picture", "hr"]],
639      ["view", ["fullscreen", "codeview", "undo", "redo"]],
640      ["help", ["help"]],
641    ],
642  });
643
644  $("#r_p_note_sk").summernote({
645    height: 200, // set editor height
646    toolbar: [
647      ["misc", ["cca-editor-sk"]],
648      [
649        "font",
650        [
651          "bold",
652          "italic",
653          "underline",
654          "strikethrough",
655          "superscript",
656          "subscript",
657          "clear",
658        ],
659      ],
660      ["color", ["color"]],
661      ["para", ["ul", "ol", "paragraph"]],
662      ["table", ["table"]],
663      ["insert", ["link", "picture", "hr"]],
664      ["view", ["fullscreen", "codeview", "undo", "redo"]],
665      ["help", ["help"]],
666    ],
667  });
668
669  $("#cca-add-solver").click(function () {
670    var number = $("#cca-add-solver-hidden").val();
671    number++;
672    $("#cca-add-solver-id" + number).attr("class", "show");
673    $("#cca-add-solver-hidden").val(number);
674  });
675
676  $(".cca-all-table").click(function () {
677    if ($(this).prop("checked"))
678      $(".all-col-row").children().prop("checked", true);
679    else $(".all-col-row").children().prop("checked", false);
680  });
681
682  $(".cca-one-col").click(function () {
683    var col = $(this).val();
684    if ($(this).prop("checked"))
685      $(".col" + col)
686        .children()
687        .prop("checked", true);
688    else
689      $(".col" + col)
690        .children()
691        .prop("checked", false);
692  });
693
694  $(".cca-one-row").click(function () {
695    var row = $(this).val();
696    if ($(this).prop("checked"))
697      $(".row" + row)
698        .children()
699        .prop("checked", true);
700    else
701      $(".row" + row)
702        .children()
703        .prop("checked", false);
704  });
705
706  // Zoradenie siedmeno stlpca (Zotriedenie) - DESC
707  // 2021/08/18 - zrusil som na ziadost RP - ma si pamatat posledne triedenie (podla stateSaveCallback)
708  //commonTable.order([5, 'desc']).draw();
709}
710
711//------------------------------------------------------------------------------
712// Úprava hlavných oblastí výskumu
713//------------------------------------------------------------------------------
714
715// Udaje iba pre editaciu hlavných výskumných projektov
716if (
717  typeof availableForMainResearch != "undefined" &&
718  availableForMainResearch !== null
719) {
720  $("#r_m_li_sk").summernote({
721    height: 200, // set editor height
722    toolbar: [
723      ["misc", ["cca-editor-sk"]],
724      [
725        "font",
726        [
727          "bold",
728          "italic",
729          "underline",
730          "strikethrough",
731          "superscript",
732          "subscript",
733          "clear",
734        ],
735      ],
736      ["color", ["color"]],
737      ["para", ["ul", "ol", "paragraph"]],
738      ["table", ["table"]],
739      ["insert", ["link", "picture", "hr"]],
740      ["view", ["fullscreen", "codeview", "undo", "redo"]],
741      ["help", ["help"]],
742    ],
743  });
744  $("#r_m_li_en").summernote({
745    height: 200, // set editor height
746    toolbar: [
747      ["misc", ["cca-editor-en"]],
748      [
749        "font",
750        [
751          "bold",
752          "italic",
753          "underline",
754          "strikethrough",
755          "superscript",
756          "subscript",
757          "clear",
758        ],
759      ],
760      ["color", ["color"]],
761      ["para", ["ul", "ol", "paragraph"]],
762      ["table", ["table"]],
763      ["insert", ["link", "picture", "hr"]],
764      ["view", ["fullscreen", "codeview", "undo", "redo"]],
765      ["help", ["help"]],
766    ],
767  });
768
769  $("#r_m_sk").summernote({
770    height: 200, // set editor height
771    toolbar: [
772      ["misc", ["cca-editor-sk"]],
773      [
774        "font",
775        [
776          "bold",
777          "italic",
778          "underline",
779          "strikethrough",
780          "superscript",
781          "subscript",
782          "clear",
783        ],
784      ],
785      ["color", ["color"]],
786      ["para", ["ul", "ol", "paragraph"]],
787      ["table", ["table"]],
788      ["insert", ["link", "picture", "hr"]],
789      ["view", ["fullscreen", "codeview", "undo", "redo"]],
790      ["help", ["help"]],
791    ],
792  });
793  $("#r_m_en").summernote({
794    height: 200, // set editor height
795    toolbar: [
796      ["misc", ["cca-editor-en"]],
797      [
798        "font",
799        [
800          "bold",
801          "italic",
802          "underline",
803          "strikethrough",
804          "superscript",
805          "subscript",
806          "clear",
807        ],
808      ],
809      ["color", ["color"]],
810      ["para", ["ul", "ol", "paragraph"]],
811      ["table", ["table"]],
812      ["insert", ["link", "picture", "hr"]],
813      ["view", ["fullscreen", "codeview", "undo", "redo"]],
814      ["help", ["help"]],
815    ],
816  });
817}
818
819//------------------------------------------------------------------------------
820// Vytváranie a úprava bannerov
821//------------------------------------------------------------------------------
822
823// Udaje iba pre editaciu Sliders
824if (typeof availableForSlider != "undefined" && availableForSlider !== null) {
825  var ccaTypeId = "sli_id";
826  var ccaForm = "form_slider";
827  var ccaURL = "assets/ajax/ajaxSlider.php";
828  var ccaPage = "index.php?edit_id=14";
829}
830
831//------------------------------------------------------------------------------
832// Vytváranie a úprava predmetov
833//------------------------------------------------------------------------------
834
835// Udaje iba pre editaciu predmetov
836if (typeof availableForCourses != "undefined" && availableForCourses !== null) {
837  var dataAjax;
838  var ccaTypeId = "courses_id";
839  var ccaForm = "form_courses";
840  var ccaURL = "assets/ajax/ajaxCourses.php";
841  var ccaPage = "index.php?edit_id=12";
842
843  $("#courses_final_evaluation_sk").summernote({
844    height: 150, // set editor height
845    toolbar: [
846      ["misc", ["cca-editor-sk"]],
847      [
848        "font",
849        [
850          "bold",
851          "italic",
852          "underline",
853          "strikethrough",
854          "superscript",
855          "subscript",
856          "clear",
857        ],
858      ],
859      ["color", ["color"]],
860      ["para", ["ul", "ol", "paragraph"]],
861      ["table", ["table"]],
862      ["insert", ["link", "picture", "hr"]],
863      ["view", ["fullscreen", "codeview", "undo", "redo"]],
864      ["help", ["help"]],
865    ],
866  });
867  $("#courses_final_evaluation_en").summernote({
868    height: 150, // set editor height
869    toolbar: [
870      ["misc", ["cca-editor-en"]],
871      [
872        "font",
873        [
874          "bold",
875          "italic",
876          "underline",
877          "strikethrough",
878          "superscript",
879          "subscript",
880          "clear",
881        ],
882      ],
883      ["color", ["color"]],
884      ["para", ["ul", "ol", "paragraph"]],
885      ["table", ["table"]],
886      ["insert", ["link", "picture", "hr"]],
887      ["view", ["fullscreen", "codeview", "undo", "redo"]],
888      ["help", ["help"]],
889    ],
890  });
891  $("#courses_goal_sk").summernote({
892    height: 100, // set editor height
893    toolbar: [
894      ["misc", ["cca-editor-sk"]],
895      [
896        "font",
897        [
898          "bold",
899          "italic",
900          "underline",
901          "strikethrough",
902          "superscript",
903          "subscript",
904          "clear",
905        ],
906      ],
907      ["color", ["color"]],
908      ["para", ["ul", "ol", "paragraph"]],
909      ["table", ["table"]],
910      ["insert", ["link", "picture", "hr"]],
911      ["view", ["fullscreen", "codeview", "undo", "redo"]],
912      ["help", ["help"]],
913    ],
914  });
915  $("#courses_goal_en").summernote({
916    height: 100, // set editor height
917    toolbar: [
918      ["misc", ["cca-editor-en"]],
919      [
920        "font",
921        [
922          "bold",
923          "italic",
924          "underline",
925          "strikethrough",
926          "superscript",
927          "subscript",
928          "clear",
929        ],
930      ],
931      ["color", ["color"]],
932      ["para", ["ul", "ol", "paragraph"]],
933      ["table", ["table"]],
934      ["insert", ["link", "picture", "hr"]],
935      ["view", ["fullscreen", "codeview", "undo", "redo"]],
936      ["help", ["help"]],
937    ],
938  });
939  $("#courses_syllabus_sk").summernote({
940    height: 200, // set editor height
941    toolbar: [
942      ["misc", ["cca-editor-sk"]],
943      [
944        "font",
945        [
946          "bold",
947          "italic",
948          "underline",
949          "strikethrough",
950          "superscript",
951          "subscript",
952          "clear",
953        ],
954      ],
955      ["color", ["color"]],
956      ["para", ["ul", "ol", "paragraph"]],
957      ["table", ["table"]],
958      ["insert", ["link", "picture", "hr"]],
959      ["view", ["fullscreen", "codeview", "undo", "redo"]],
960      ["help", ["help"]],
961    ],
962  });
963  $("#courses_syllabus_en").summernote({
964    height: 200, // set editor height
965    toolbar: [
966      ["misc", ["cca-editor-en"]],
967      [
968        "font",
969        [
970          "bold",
971          "italic",
972          "underline",
973          "strikethrough",
974          "superscript",
975          "subscript",
976          "clear",
977        ],
978      ],
979      ["color", ["color"]],
980      ["para", ["ul", "ol", "paragraph"]],
981      ["table", ["table"]],
982      ["insert", ["link", "picture", "hr"]],
983      ["view", ["fullscreen", "codeview", "undo", "redo"]],
984      ["help", ["help"]],
985    ],
986  });
987  $("#courses_literature_sk").summernote({
988    height: 200, // set editor height
989    toolbar: [
990      ["misc", ["cca-editor-sk"]],
991      [
992        "font",
993        [
994          "bold",
995          "italic",
996          "underline",
997          "strikethrough",
998          "superscript",
999          "subscript",
1000          "clear",
1001        ],
1002      ],
1003      ["color", ["color"]],
1004      ["para", ["ul", "ol", "paragraph"]],
1005      ["table", ["table"]],
1006      ["insert", ["link", "picture", "hr"]],
1007      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1008      ["help", ["help"]],
1009    ],
1010  });
1011  $("#courses_literature_en").summernote({
1012    height: 200, // set editor height
1013    toolbar: [
1014      ["misc", ["cca-editor-en"]],
1015      [
1016        "font",
1017        [
1018          "bold",
1019          "italic",
1020          "underline",
1021          "strikethrough",
1022          "superscript",
1023          "subscript",
1024          "clear",
1025        ],
1026      ],
1027      ["color", ["color"]],
1028      ["para", ["ul", "ol", "paragraph"]],
1029      ["table", ["table"]],
1030      ["insert", ["link", "picture", "hr"]],
1031      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1032      ["help", ["help"]],
1033    ],
1034  });
1035  $("#courses_activity_sk").summernote({
1036    height: 100, // set editor height
1037    toolbar: [
1038      ["misc", ["cca-editor-sk"]],
1039      [
1040        "font",
1041        [
1042          "bold",
1043          "italic",
1044          "underline",
1045          "strikethrough",
1046          "superscript",
1047          "subscript",
1048          "clear",
1049        ],
1050      ],
1051      ["color", ["color"]],
1052      ["para", ["ul", "ol", "paragraph"]
1052],
1053      ["table", ["table"]],
1054      ["insert", ["link", "picture", "hr"]],
1055      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1056      ["help", ["help"]],
1057    ],
1058  });
1059  $("#courses_activity_en").summernote({
1060    height: 100, // set editor height
1061    toolbar: [
1062      ["misc", ["cca-editor-en"]],
1063      [
1064        "font",
1065        [
1066          "bold",
1067          "italic",
1068          "underline",
1069          "strikethrough",
1070          "superscript",
1071          "subscript",
1072          "clear",
1073        ],
1074      ],
1075      ["color", ["color"]],
1076      ["para", ["ul", "ol", "paragraph"]],
1077      ["table", ["table"]],
1078      ["insert", ["link", "picture", "hr"]],
1079      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1080      ["help", ["help"]],
1081    ],
1082  });
1083  $("#courses_assesment_methods_criteria_sk").summernote({
1084    height: 70, // set editor height
1085    toolbar: [
1086      ["misc", ["cca-editor-sk"]],
1087      [
1088        "font",
1089        [
1090          "bold",
1091          "italic",
1092          "underline",
1093          "strikethrough",
1094          "superscript",
1095          "subscript",
1096          "clear",
1097        ],
1098      ],
1099      ["color", ["color"]],
1100      ["para", ["ul", "ol", "paragraph"]],
1101      ["table", ["table"]],
1102      ["insert", ["link", "picture", "hr"]],
1103      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1104      ["help", ["help"]],
1105    ],
1106  });
1107  $("#courses_assesment_methods_criteria_en").summernote({
1108    height: 70, // set editor height
1109    toolbar: [
1110      ["misc", ["cca-editor-en"]],
1111      [
1112        "font",
1113        [
1114          "bold",
1115          "italic",
1116          "underline",
1117          "strikethrough",
1118          "superscript",
1119          "subscript",
1120          "clear",
1121        ],
1122      ],
1123      ["color", ["color"]],
1124      ["para", ["ul", "ol", "paragraph"]],
1125      ["table", ["table"]],
1126      ["insert", ["link", "picture", "hr"]],
1127      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1128      ["help", ["help"]],
1129    ],
1130  });
1131  $("#courses_condition_sk").summernote({
1132    height: 50, // set editor height
1133    toolbar: [
1134      ["misc", ["cca-editor-sk"]],
1135      [
1136        "font",
1137        [
1138          "bold",
1139          "italic",
1140          "underline",
1141          "strikethrough",
1142          "superscript",
1143          "subscript",
1144          "clear",
1145        ],
1146      ],
1147      ["color", ["color"]],
1148      ["para", ["ul", "ol", "paragraph"]],
1149      ["table", ["table"]],
1150      ["insert", ["link", "picture", "hr"]],
1151      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1152      ["help", ["help"]],
1153    ],
1154  });
1155  $("#courses_condition_en").summernote({
1156    height: 50, // set editor height
1157    toolbar: [
1158      ["misc", ["cca-editor-en"]],
1159      [
1160        "font",
1161        [
1162          "bold",
1163          "italic",
1164          "underline",
1165          "strikethrough",
1166          "superscript",
1167          "subscript",
1168          "clear",
1169        ],
1170      ],
1171      ["color", ["color"]],
1172      ["para", ["ul", "ol", "paragraph"]],
1173      ["table", ["table"]],
1174      ["insert", ["link", "picture", "hr"]],
1175      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1176      ["help", ["help"]],
1177    ],
1178  });
1179
1180  $("#cca-add-course-program").click(function () {
1181    var number = $("#cca-add-course-program-hidden").val();
1182    number++;
1183    $("#cca-add-course-program-id" + number).attr("class", "show");
1184    $("#cca-add-course-program-hidden").val(number);
1185  });
1186
1187  $("#cca-add-ais-id").click(function () {
1188    //console.log('iii')
1189    // Zablokuje stranku pocas ukladania udajov
1190    $.blockUI({
1191      css: {
1192        border: "none",
1193        padding: "15px",
1194        backgroundColor: "#000",
1195        "-webkit-border-radius": "10px",
1196        "-moz-border-radius": "10px",
1197        opacity: 0.5,
1198        color: "#fff",
1199      },
1200    });
1201    addYearAIS(0, 0);
1202  });
1203  function addYearSingleAIS(coursesCode) {
1204    $.blockUI({
1205      css: {
1206        border: "none",
1207        padding: "15px",
1208        backgroundColor: "#000",
1209        "-webkit-border-radius": "10px",
1210        "-moz-border-radius": "10px",
1211        opacity: 0.5,
1212        color: "#fff",
1213      },
1214    });
1215    addYearAIS(0, coursesCode);
1216  }
1217  function addYearAIS(start, coursesCode) {
1218    $.ajax({
1219      type: "POST",
1220      dataType: "json",
1221      url: "assets/ajax/ajaxCourses.php",
1222      data: {
1223        coursesCode: coursesCode,
1224        start: start,
1225        case: "addYearAIS",
1226      },
1227      success: function (data) {
1228        console.log(data);
1229        console.log(data["checkText"]);
1230        if (data["stop"]) {
1231          $.unblockUI();
1232          $.redirect("index.php", { edit_id: 12 }, "GET");
1233        } else addYearAIS(data["next"], 0);
1234      },
1235    });
1236  }
1237
1238  $("#cca-synchronise").click(function () {
1239    //console.log('iii')
1240    // Zablokuje stranku pocas ukladania udajov
1241    $.blockUI({
1242      css: {
1243        border: "none",
1244        padding: "15px",
1245        backgroundColor: "#000",
1246        "-webkit-border-radius": "10px",
1247        "-moz-border-radius": "10px",
1248        opacity: 0.5,
1249        color: "#fff",
1250      },
1251    });
1252    synchroniseAIS(0, 0);
1253  });
1254  function synchroniseSingleAIS(courseID) {
1255    $.blockUI({
1256      css: {
1257        border: "none",
1258        padding: "15px",
1259        backgroundColor: "#000",
1260        "-webkit-border-radius": "10px",
1261        "-moz-border-radius": "10px",
1262        opacity: 0.5,
1263        color: "#fff",
1264      },
1265    });
1266    synchroniseAIS(0, courseID);
1267  }
1268  function synchroniseAIS(start, courseID) {
1269    $.ajax({
1270      type: "POST",
1271      dataType: "json",
1272      url: "assets/ajax/ajaxCourses.php",
1273      data: {
1274        courseID: courseID,
1275        start: start,
1276        case: "synchroniseAIS",
1277      },
1278      success: function (data) {
1279        console.log(data);
1280        console.log(data["checkText"]);
1281        if (data["stop"]) {
1282          $.unblockUI();
1283          $.redirect("index.php", { edit_id: 12 }, "GET");
1284        } else synchroniseAIS(data["next"], 0);
1285      },
1286    });
1287  }
1288  $("#cca-courses-check").click(function () {
1289    //console.log('iii')
1290    // Zablokuje stranku pocas ukladania udajov
1291    $.blockUI({
1292      css: {
1293        border: "none",
1294        padding: "15px",
1295        backgroundColor: "#000",
1296        "-webkit-border-radius": "10px",
1297        "-moz-border-radius": "10px",
1298        opacity: 0.5,
1299        color: "#fff",
1300      },
1301    });
1302    synchroniseAIS(0, 0);
1303  });
1304
1305  function QRCode(id) {
1306    $.ajax({
1307      type: "POST",
1308      dataType: "HTML",
1309      url: "assets/ajax/ajaxQR.php",
1310      data: {
1311        courseID: id,
1312      },
1313      success: function (data) {
1314        $("#qrBody").html(data);
1315        $(".qrcode").modal("show");
1316      },
1317    });
1318  }
1319}
1320
1321//------------------------------------------------------------------------------
1322// Vytváranie a úprava D, PN, SC, ...
1323//------------------------------------------------------------------------------
1324
1325// Udaje iba pre editaciu Holidays
1326if (
1327  typeof availableForHolidays != "undefined" &&
1328  availableForHolidays !== null
1329) {
1330  // Definovanie globalnej premenej - zoznam dni s volnom v DB
1331  var dataAjax;
1332  var ccaTypeId = "hol_id";
1333  var ccaForm = "form_holiday";
1334  var ccaURL = "assets/ajax/ajaxHoliday.php";
1335  var ccaPage = "index.php?edit_id=11";
1336
1337  // Na zaciatku nacitaj zoznam dni s volnom v DB - je to robene preto, lebo nedokaze cez ajax ziskat globalnu premennu
1338  getDataHolidays(function (data) {
1339    dataAjax = data;
1340  });
1341
1342  // ak admin vyberie uzivatela - jeho id sa odosle metodou GET
1343  $("#list_of_users").change(function () {
1344    window.location.href =
1345      "index.php?edit_id=11&holiday_user=" +
1346      $(this).val() +
1347      "&hol_type_id=" +
1348      $("#hol_type_id").val();
1349  });
1350
1351  // Nastavenie kalendara pre datum vlozenia
1352  $("#hol_date").datepicker({
1353    dateFormat: "d.m.yy",
1354    prevText: '<i class="fa fa-angle-left"></i>',
1355    nextText: '<i class="fa fa-angle-right"></i>',
1356    firstDay: 1,
1357    monthNames: monthNames[language],
1358    dayNamesMin: dayNamesMin[language],
1359    beforeShowDay: function (date) {
1360      if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
1361      else css = "datepicker-0";
1362      return [true, css];
1363    },
1364  });
1365
1366  // Nastavenie kalendara pre datum od
1367  $("#hol_from").datepicker({
1368    dateFormat: "d.m.yy",
1369    prevText: '<i class="fa fa-angle-left"></i>',
1370    nextText: '<i class="fa fa-angle-right"></i>',
1371    firstDay: 1,
1372    monthNames: monthNames[language],
1373    dayNamesMin: dayNamesMin[language],
1374    beforeShowDay: function (date) {
1375      return checkHolidays(date, "from");
1376    },
1377    onSelect: function (selectedDate) {
1378      // Ak je definovany from/od, potom ak nie je definovane to/do - nastav ho rovnaky
1379      if (!$("#hol_to").val()) $("#hol_to").datepicker("setDate", selectedDate);
1380      getHolidayDays(0);
1381    },
1382  });
1383
1384  // Nastavenie kalendara pre datum do
1385  $("#hol_to").datepicker({
1386    dateFormat: "d.m.yy",
1387    prevText: '<i class="fa fa-angle-left"></i>',
1388    nextText: '<i class="fa fa-angle-right"></i>',
1389    firstDay: 1,
1390    monthNames: monthNames[language],
1391    dayNamesMin: dayNamesMin[language],
1392    beforeShowDay: function (date) {
1393      return checkHolidays(date, "to");
1394    },
1395    onSelect: function (selectedDate) {
1396      getHolidayDays(0);
1397    },
1398  });
1399
1400  // Nastavenie kalendara pre jednodnovy datum
1401  $("#hol_pvkz").datepicker({
1402    dateFormat: "d.m.yy",
1403    prevText: '<i class="fa fa-angle-left"></i>',
1404    nextText: '<i class="fa fa-angle-right"></i>',
1405    firstDay: 1,
1406    monthNames: monthNames[language],
1407    dayNamesMin: dayNamesMin[language],
1408    beforeShowDay: function (date) {
1409      return checkHolidays(date, "from");
1410    },
1411    onSelect: function (selectedDate) {
1412      getHolidayDays(1);
1413    },
1414  });
1415
1416  $(".cca-print").click(function () {
1417    var id = $(this).closest("tr").attr("id");
1418    $("#print_id").val(id);
1419    $("#double").val(1);
1420    $("#form_holiday_print").submit();
1421  });
1422
1423  $(".cca-print-double").click(function () {
1424    var id = $(this).closest("tr").attr("id");
1425    $("#print_id").val(id);
1426    $("#double").val(2);
1427    $("#form_holiday_print").submit();
1428  });
1429
1430  $("#cca-print-selected, #cca-print-selected-double").click(function () {
1431    console.log(this.id);
1432    if (this.id == "cca-print-selected-double") $("#double").val(2);
1433    else $("#double").val(1);
1434    var ccaPrintArray = new Array();
1435    $(".cca-print-selected").each(function () {
1436      if ($(this).is(":checked")) ccaPrintArray.push($(this).val());
1437    });
1438    if (ccaPrintArray.length) {
1439      $("#print_id").val(ccaPrintArray.join(","));
1440      $("#form_holiday_print").submit();
1441    }
1442  });
1443
1444  $("#holiday_user").change(function () {
1445    $("#form_holiday_person").submit();
1446  });
1447
1448  $(".cca-holiday-number").dblclick(function () {
1449    var id = $(this).attr("id");
1450    var number = $(this).text();
1451    var block = $(this);
1452    if ($(this).children().attr("id") == "v" + id) {
1453      $.ajax({
1454        type: "POST",
1455        dataType: "html",
1456        url: "assets/ajax/ajaxHoliday.php",
1457        data: {
1458          data: id,
1459          value: $(this).children().val(),
1460          case: "countYearDays",
1461        },
1462        success: function (data) {
1463          //console.log(data);
1464          block.text(data);
1465        },
1466      });
1467    } else $(this).html('<input type="text" id="v' + id + '" value="' + number + '" size="2" maxlength="2" class="cca-align-center">');
1468  });
1469
1470  // Zoradenie druheho stlpca - DESC
1471  commonTable.order([1, "desc"]).draw();
1472  commonTable.page.len(25).draw();
1473}
1474
1475//------------------------------------------------------------------------------
1476// Vytváranie a úprava aktualit
1477//------------------------------------------------------------------------------
1478
1479// Udaje iba pre editaciu News
1480if (typeof availableForNews != "undefined" && availableForNews !== null) {
1481  // Definovanie globalnej premenej - zoznam dni s volnom v DB
1482  var dataAjax;
1483  var ccaTypeId = "news_id";
1484  var ccaForm = "form_news";
1485  var ccaURL = "assets/ajax/ajaxNews.php";
1486  var ccaPage = "index.php?edit_id=4";
1487
1488  $("#news_abstract_sk").summernote({
1489    height: 100, // set editor height
1490    toolbar: [
1491      ["image", ["cca-editor-sk"]],
1492      ["font", ["bold", "italic", "underline", "clear"]],
1493      ["para", ["ul", "ol", "paragraph"]],
1494      ["insert", ["link", "picture", "hr"]],
1495      ["view", ["codeview"]],
1496      ["help", ["help"]],
1497    ],
1498  });
1499  $("#news_abstract_en").summernote({
1500    height: 100, // set editor height
1501    toolbar: [
1502      ["image", ["cca-editor-en"]],
1503      ["font", ["bold", "italic", "underline", "clear"]],
1504      ["para", ["ul", "ol", "paragraph"]],
1505      ["insert", ["link", "picture", "hr"]],
1506      ["view", ["codeview"]],
1507      ["help", ["help"]],
1508    ],
1509  });
1510  $("#news_full_sk").summernote({
1511    height: 200, // set editor height
1512    toolbar: [
1513      ["misc", ["cca-editor-sk"]],
1514      [
1515        "font",
1516        [
1517          "bold",
1518          "italic",
1519          "underline",
1520          "strikethrough",
1521          "superscript",
1522          "subscript",
1523          "clear",
1524        ],
1525      ],
1526      ["color", ["color"]],
1527      ["para", ["ul", "ol", "paragraph"]],
1528      ["table", ["table"]],
1529      ["insert", ["link", "picture", "hr"]],
1530      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1531      ["help", ["help"]],
1532    ],
1533  });
1534  $("#news_full_en").summernote({
1535    height: 200, // set editor height
1536    toolbar: [
1537      ["misc", ["cca-editor-en"]],
1538      [
1539        "font",
1540        [
1541          "bold",
1542          "italic",
1543          "underline",
1544          "strikethrough",
1545          "superscript",
1546          "subscript",
1547          "clear",
1548        ],
1549      ],
1550      ["color", ["color"]],
1551      ["para", ["ul", "ol", "paragraph"]],
1552      ["table", ["table"]],
1553      ["insert", ["link", "picture", "hr"]],
1554      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1555      ["help", ["help"]],
1556    ],
1557  });
1558  $("#news_videopanel_sk").attr("contenteditable", false);
1559  $("#news_videopanel_show").click(function () {
1560    $("#id_videopanel").toggle();
1561  });
1562
1563  // http://eonasdan.github.io/bootstrap-datetimepicker/
1564  // https://github.com/Eonasdan/bootstrap-datetimepicker
1565  $(".form_datetime").datetimepicker({
1566    locale: "sk",
1567  });
1568
1569  $("#cca-add-news").click(function () {
1570    var number = $("#cca-add-news-hidden").val();
1571    number++;
1572    $("#cca-add-news-id" + number).attr("class", "show");
1573    $("#cca-add-news-hidden").val(number);
1574  });
1575
1576  // Zoradenie druheho stlpca - DESC
1577  commonTable.order([2, "desc"]).draw();
1578}
1579
1580//------------------------------------------------------------------------------
1581// Vytváranie a úprava rozvrhov
1582//------------------------------------------------------------------------------
1583
1584// Udaje iba pre editaciu Timetables
1585if (
1586  typeof availableForTimetable != "undefined" &&
1587  availableForTimetable !== null
1588) {
1589  var dataAjax;
1590  var ccaTypeId = "timetable_id";
1591  var ccaForm = "form_timetable";
1592  var ccaURL = "assets/ajax/ajaxTimetable.php";
1593  var ccaPage = "index.php?edit_id=7";
1594
1595  $("#change_year_semester").change(function () {
1596    $("#sky-form1").submit();
1597  });
1598
1599  // Setup - add a text input to each footer cell
1600  $("#example tfoot th").each(function () {
1601    var title = $(this).text();
1602    $(this).html('<input type="text" placeholder="Search ' + title + '">');
1603  });
1604
1605  // 19-09-09 - zapoznamkoval som to, pretoze pri editacii rozvrhu to nevyhladavalo - vracalo prazdne
1606  /*
1607	commonTable.columns().every(function() {
1608		var that = this;
1609
1610		$('input', this.footer()).on('keyup change', function () {
1611			if (that.search() !== this.value) {
1612				that
1613					.search(this.value)
1614					.draw();
1615			}
1616		});
1617	});
1618	*/
1619
1620  // 20-09-07
1621  /*
1622	$('.timetable_week_select').click(function() {
1623		if ($(this).is(':checked'))
1624			value = true;
1625		else
1626			value = false;
1627		if($(this).val() == 1) {
1628			startWeek = 10;
1629			stopWeek = 13;
1630		}
1631		else {
1632			startWeek = 1;
1633			stopWeek = 9;	
1634		}	
1635		for (var i = startWeek;
1635 i <= stopWeek; i++) 
1636			$('#timetable_week' + i).prop('checked', value);
1637	})
1638	*/
1639  // 21-09-17
1640  $(".timetable_week_select").click(function () {
1641    if ($(this).is(":checked")) value = true;
1642    else value = false;
1643    if ($(this).val() == 1) {
1644      startWeek = 5;
1645      stopWeek = 13;
1646    } else {
1647      startWeek = 1;
1648      stopWeek = 4;
1649    }
1650    for (var i = startWeek; i <= stopWeek; i++)
1651      $("#timetable_week" + i).prop("checked", value);
1652  });
1653}
1654
1655//------------------------------------------------------------------------------
1656// Vytváranie a úprava studentskych prac
1657//------------------------------------------------------------------------------
1658
1659// Udaje iba pre editaciu Thesis
1660if (typeof availableForThesis != "undefined" && availableForThesis !== null) {
1661  var dataAjax;
1662  var ccaTypeId = "thesis_id";
1663  var ccaForm = "form_thesis";
1664  var ccaURL = "assets/ajax/ajaxThesis.php";
1665  var ccaPage = "index.php?edit_id=10";
1666
1667  $("#change_year").change(function () {
1668    $("#sky-form1").submit();
1669  });
1670
1671  $("#thesis_abstract_sk").summernote({
1672    height: 200, // set editor height
1673    toolbar: [
1674      ["misc", ["cca-editor-sk"]],
1675      [
1676        "font",
1677        [
1678          "bold",
1679          "italic",
1680          "underline",
1681          "strikethrough",
1682          "superscript",
1683          "subscript",
1684          "clear",
1685        ],
1686      ],
1687      ["color", ["color"]],
1688      ["para", ["ul", "ol", "paragraph"]],
1689      ["table", ["table"]],
1690      ["insert", ["link", "picture", "hr"]],
1691      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1692      ["help", ["help"]],
1693    ],
1694  });
1695  $("#thesis_abstract_en").summernote({
1696    height: 200, // set editor height
1697    toolbar: [
1698      ["misc", ["cca-editor-en"]],
1699      [
1700        "font",
1701        [
1702          "bold",
1703          "italic",
1704          "underline",
1705          "strikethrough",
1706          "superscript",
1707          "subscript",
1708          "clear",
1709        ],
1710      ],
1711      ["color", ["color"]],
1712      ["para", ["ul", "ol", "paragraph"]],
1713      ["table", ["table"]],
1714      ["insert", ["link", "picture", "hr"]],
1715      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1716      ["help", ["help"]],
1717    ],
1718  });
1719
1720  $("#thesis_videopanel_sk").attr("contenteditable", false);
1721  $("#thesis_videopanel_show").click(function () {
1722    $("#id_videopanel").toggle();
1723  });
1724
1725  // Ak je vybrany konzultant - nezobrazuj meno a email
1726  $("#thesis_consultant").change(function () {
1727    if ($(this).val()) $(".thesis-show-hide").hide();
1728    else $(".thesis-show-hide").show();
1729  });
1730
1731  // Ak je zvoleny konzultant - default je nezobrazuj meno a email
1732  if ($("#thesis_consultant").val()) $(".thesis-show-hide").hide();
1733
1734  // Filtracia podla oblasti alebo skolitela/konzultanta
1735  $(".cca-thesis-change").change(function () {
1736    $("#cca-form-thesis-search").submit();
1737  });
1738
1739  $(".cca-show-thesis").click(function (e) {
1740    e.stopPropagation();
1741    e.preventDefault();
1742    var thesisID = $(this).attr("id").substring(2);
1743    console.log(thesisID);
1744
1745    $.ajax({
1746      type: "POST",
1747      dataType: "json",
1748      url: "assets/ajax/ajaxThesis.php",
1749      data: {
1750        case: "show-thesis",
1751        thesisID: thesisID,
1752      },
1753      success: function (data) {
1754        console.log(data);
1755        $(".cca-modal-thesis-title").html(data["title"]);
1756        $(".cca-modal-thesis-body").html(data["form"]);
1757        //$('.cca-modal-thesis-show').html(data['show']);
1758      },
1759    });
1760
1761    $(".cca-modal-thesis-edit").modal("show");
1762  });
1763
1764  if (language == "en")
1765    var attendanceTable = $("#example-thesis").DataTable({
1766      stateSave: true,
1767      pageLength: 25,
1768      order: [[0, "desc"]],
1769      dom: "lfrtip",
1770    });
1771  else {
1772    var attendanceTable = $("#example-thesis").DataTable({
1773      stateSave: true,
1774      pageLength: 25,
1775      order: [[0, "desc"]],
1776      dom: "lfrtip",
1777      language: {
1778        sEmptyTable: "Nie sú k dispozícii žiadne dáta",
1779        sInfo: "Záznamy _START_ až _END_ z celkom _TOTAL_",
1780        sInfoEmpty: "Záznamy 0 až 0 z celkom 0 ",
1781        sInfoFiltered: "(vyfiltrované spomedzi _MAX_ záznamov)",
1782        sInfoPostFix: "",
1783        sInfoThousands: ",",
1784        sLengthMenu: "Zobraz _MENU_ záznamov",
1785        sLoadingRecords: "Načítavam...",
1786        sProcessing: "Spracúvam...",
1787        sSearch: "Hľadať:",
1788        sZeroRecords: "Nenašli sa žiadne vyhovujúce záznamy",
1789        oPaginate: {
1790          sFirst: "Prvá",
1791          sLast: "Posledná",
1792          sNext: "Nasledujúca",
1793          sPrevious: "Predchádzajúca",
1794        },
1795        oAria: {
1796          sSortAscending: ": aktivujte na zoradenie stĺpca vzostupne",
1797          sSortDescending: ": aktivujte na zoradenie stĺpca zostupne",
1798        },
1799      },
1800    });
1801  }
1802
1803  if (language == "en")
1804    var attendanceTable = $(".example-thesis").DataTable({
1805      stateSave: true,
1806      pageLength: 50,
1807      dom: "lfrtip",
1808    });
1809  else {
1810    var attendanceTable = $(".example-thesis").DataTable({
1811      stateSave: true,
1812      pageLength: 50,
1813      dom: "lfrtip",
1814      language: {
1815        sEmptyTable: "Nie sú k dispozícii žiadne dáta",
1816        sInfo: "Záznamy _START_ až _END_ z celkom _TOTAL_",
1817        sInfoEmpty: "Záznamy 0 až 0 z celkom 0 ",
1818        sInfoFiltered: "(vyfiltrované spomedzi _MAX_ záznamov)",
1819        sInfoPostFix: "",
1820        sInfoThousands: ",",
1821        sLengthMenu: "Zobraz _MENU_ záznamov",
1822        sLoadingRecords: "Načítavam...",
1823        sProcessing: "Spracúvam...",
1824        sSearch: "Hľadať:",
1825        sZeroRecords: "Nenašli sa žiadne vyhovujúce záznamy",
1826        oPaginate: {
1827          sFirst: "Prvá",
1828          sLast: "Posledná",
1829          sNext: "Nasledujúca",
1830          sPrevious: "Predchádzajúca",
1831        },
1832        oAria: {
1833          sSortAscending: ": aktivujte na zoradenie stĺpca vzostupne",
1834          sSortDescending: ": aktivujte na zoradenie stĺpca zostupne",
1835        },
1836      },
1837    });
1838  }
1839
1840  function editStudent(student) {
1841    $.ajax({
1842      type: "POST",
1843      dataType: "html",
1844      url: "assets/ajax/ajaxThesis.php",
1845      data: {
1846        student: student,
1847        case: "editStudent",
1848      },
1849      success: function (data) {
1850        $("#cca-modal-body").html(data);
1851      },
1852    });
1853    $(".cca-modal-form").modal("show");
1854  }
1855
1856  function deleteStudent(student) {
1857    $("#delete_student").val(student);
1858    $(".cca-modal-form-delete").modal("show");
1859  }
1860
1861  function cloneRecordID(thesis) {
1862    console.log(thesis);
1863    $("#form_thesis_clone #clone_id").val(thesis);
1864    $("#form_thesis_clone").submit();
1865  }
1866
1867  // Zoradenie druheho stlpca - DESC
1868  commonTable.order([0, "desc"]).draw();
1869}
1870
1871//------------------------------------------------------------------------------
1872// Vytváranie a úprava statickych stranok
1873//------------------------------------------------------------------------------
1874
1875// Udaje iba pre editaciu Pages
1876if (typeof availableForPage != "undefined" && availableForPage !== null) {
1877  var dataAjax;
1878  var ccaTypeId = "page_id";
1879  var ccaForm = "form_page";
1880  var ccaURL = "assets/ajax/ajaxPage.php";
1881  var ccaPage = "index.php?edit_id=6";
1882
1883  $("#page_sk").summernote({
1884    height: 200, // set editor height
1885    toolbar: [
1886      ["misc", ["cca-editor-sk"]],
1887      [
1888        "font",
1889        [
1890          "bold",
1891          "italic",
1892          "underline",
1893          "strikethrough",
1894          "superscript",
1895          "subscript",
1896          "clear",
1897        ],
1898      ],
1899      ["color", ["color"]],
1900      ["para", ["ul", "ol", "paragraph"]],
1901      ["table", ["table"]],
1902      ["insert", ["link", "picture", "hr"]],
1903      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1904      ["help", ["help"]],
1905    ],
1906  });
1907  $("#page_en").summernote({
1908    height: 200, // set editor height
1909    toolbar: [
1910      ["misc", ["cca-editor-en"]],
1911      [
1912        "font",
1913        [
1914          "bold",
1915          "italic",
1916          "underline",
1917          "strikethrough",
1918          "superscript",
1919          "subscript",
1920          "clear",
1921        ],
1922      ],
1923      ["color", ["color"]],
1924      ["para", ["ul", "ol", "paragraph"]],
1925      ["table", ["table"]],
1926      ["insert", ["link", "picture", "hr"]],
1927      ["view", ["fullscreen", "codeview", "undo", "redo"]],
1928      ["help", ["help"]],
1929    ],
1930  });
1931
1932  $("#page_id_new").change(function () {
1933    $.ajax({
1934      type: "POST",
1935      dataType: "html",
1936      url: "assets/ajax/ajaxPage.php",
1937      data: {
1938        pageNewId: $("#page_id_new").val(),
1939        case: 5,
1940      },
1941      success: function (data) {
1942        //console.log(data);
1943        if (data) {
1944          $(".cca-alert-nodisplay").show();
1945          $(".cca-alert-nodisplay").html(data);
1946        } else {
1947          $(".cca-alert-nodisplay").hide();
1948        }
1949      },
1950    });
1951  });
1952}
1953
1954//------------------------------------------------------------------------------
1955// Vytváranie a úprava osob
1956//------------------------------------------------------------------------------
1957
1958// Udaje iba pre editaciu Person
1959if (typeof availableForPerson != "undefined" && availableForPerson !== null) {
1960  var dataAjax;
1961  var ccaTypeId = "person_id";
1962  var ccaForm = "form_person";
1963  var ccaURL = "assets/ajax/ajaxPerson.php";
1964  var ccaPage = "index.php?edit_id=8";
1965
1966  $("#personAll").click(function () {
1967    var input = $("<input>")
1968      .attr("type", "hidden")
1969      .attr("name", "personAllHidden")
1970      .val(1);
1971    $(this).append($(input));
1972    $("#form_person_select").submit();
1973  });
1974
1975  $("#person_research_sk").summernote({
1976    height: 100, // set editor height
1977    toolbar: [
1978      ["image", ["cca-editor-sk"]],
1979      ["font", ["bold", "italic", "underline", "clear"]],
1980      ["para", ["ul", "ol", "paragraph"]],
1981      ["insert", ["link", "picture", "hr"]],
1982      ["view", ["codeview"]],
1983      ["help", ["help"]],
1984    ],
1985  });
1986  $("#person_research_en").summernote({
1987    height: 100, // set editor height
1988    toolbar: [
1989      ["image", ["cca-editor-en"]],
1990      ["font", ["bold", "italic", "underline", "clear"]],
1991      ["para", ["ul", "ol", "paragraph"]],
1992      ["insert", ["link", "picture", "hr"]],
1993      ["view", ["codeview"]],
1994      ["help", ["help"]],
1995    ],
1996  });
1997
1998  $("#person_cv_sk").summernote({
1999    height: 200, // set editor height
2000    toolbar: [
2001      ["image", ["cca-editor-sk"]],
2002      ["font", ["bold", "italic", "underline", "clear"]],
2003      ["para", ["ul", "ol", "paragraph"]],
2004      ["insert", ["link", "picture", "hr"]],
2005      ["view", ["codeview"]],
2006      ["help", ["help"]],
2007    ],
2008  });
2009  $("#person_cv_en").summernote({
2010    height: 200, // set editor height
2011    toolbar: [
2012      ["image", ["cca-editor-en"]],
2013      ["font", ["bold", "italic", "underline", "clear"]],
2014      ["para", ["ul", "ol", "paragraph"]],
2015      ["insert", ["link", "picture", "hr"]],
2016      ["view", ["codeview"]],
2017      ["help", ["help"]],
2018    ],
2019  });
2020
2021  $("#person_text_sk").summernote({
2022    height: 300, // set editor height
2023    toolbar: [
2024      ["misc", ["cca-editor-sk"]],
2025      [
2026        "font",
2027        [
2028          "bold",
2029          "italic",
2030          "underline",
2031          "strikethrough",
2032          "superscript",
2033          "subscript",
2034          "clear",
2035        ],
2036      ],
2037      ["color", ["color"]],
2038      ["para", ["ul", "ol", "paragraph"]],
2039      ["table", ["table"]],
2040      ["insert", ["link", "picture", "hr"]],
2041      ["view", ["fullscreen", "codeview", "undo", "redo"]],
2042      ["help", ["help"]],
2043    ],
2044  });
2045  $("#person_text_en").summernote({
2046    height: 300, // set editor height
2047    toolbar: [
2048      ["misc", ["cca-editor-en"]],
2049      [
2050        "font",
2051        [
2052          "bold",
2053          "italic",
2054          "underline",
2055          "strikethrough",
2056          "superscript",
2057          "subscript",
2058          "clear",
2059        ],
2060      ],
2061      ["color", ["color"]],
2062      ["para", ["ul", "ol", "paragraph"]],
2063      ["table", ["table"]],
2064      ["insert", ["link", "picture", "hr"]],
2065      ["view", ["fullscreen", "codeview", "undo", "redo"]],
2066      ["help", ["help"]],
2067    ],
2068  });
2069}
2070
2071//------------------------------------------------------------------------------
2072// Vytváranie a úprava D, PN, SC, ...
2073//------------------------------------------------------------------------------
2074
2075// Udaje iba pre editaciu Holidays
2076if (
2077  typeof availableForContacts != "undefined" &&
2078  availableForContacts !== null
2079) {
2080  $('[data-toggle="cca-contacts-popover"]').popover();
2081
2082  // Nastavenie small v texte v tabulke
2083  $(".cca-small-text").css("font-size", "9px");
2084  $(".cca-small-text").css("color", "gray");
2085}
2086
2087//------------------------------------------------------------------------------
2088// Vytváranie a úprava dochádzky
2089//------------------------------------------------------------------------------
2090
2091// Udaje iba pre editaciu dochadzky
2092if (
2093  typeof availableForAttendance != "undefined" &&
2094  availableForAttendance !== null
2095) {
2096  var dataAjax;
2097  var ccaTypeId = "attendance_id";
2098  var ccaForm = "form_attendance";
2099  var ccaURL = "assets/ajax/ajaxAttendance.php";
2100  var ccaPage = "index.php?edit_id=13";
2101
2102  $("#change_year_month").change(function () {
2103    $("#sky-form1").submit();
2104  });
2105
2106  var attendanceTable = $("#example-attendance").DataTable({
2107    bSort: false,
2108    pageLength: 50,
2109    dom: "",
2110  });
2111
2112  /*
2113	$('#example-attendance tbody').on('mouseenter', 'td', function() {
2114		var colIdx = attendanceTable.cell(this).index().column; 
2115		$(attendanceTable.cells().nodes()).removeClass('highlight');
2116		$(attendanceTable.column(colIdx).nodes()).addClass('highlight');
2117	});
2118	*/
2119
2120  //$('.cca-click-td').dblclick(function() {
2121  $(".cca-click-td").click(function () {
2122    var id = $(this).attr("id");
2123    //console.log(id);
2124    $(".modal-body").text(id);
2125    $("#myModal").modal("show");
2126  });
2127
2128  $(".cca-time-attendance").datetimepicker({
2129    format: "LT",
2130    locale: "sk",
2131  });
2132}
2133
2134//------------------------------------------------------------------------------
2135// Dochádzka — rýchly ročný náhľad
2136//------------------------------------------------------------------------------
2137
2138// Udaje iba pre zobrazenie rocnej dochadzky
2139if (
2140  typeof availableForAttendanceYear != "undefined" &&
2141  availableForAttendanceYear !== null
2142) {
2143  // Zoradenie prve stlpca - DESC
2144  commonTable.order([0, "desc"]).draw();
2145}
2146
2147//------------------------------------------------------------------------------
2148// Vytváranie a úprava publikácií
2149//------------------------------------------------------------------------------
2150
2151// Udaje iba pre editaciu publikacii
2152if (
2153  typeof availableForPublication != "undefined" &&
2154  availableForPublication !== null
2155) {
2156  var dataAjax;
2157  var ccaTypeId = "p_d_id";
2158  var ccaForm = "form_publication";
2159  var ccaURL = "assets/ajax/ajaxPublication.php";
2160  var ccaPage = "index.php?edit_id=2";
2161
2162  // Zoradenie prve stlpca - DESC
2163  commonTable.order([0, "desc"]).draw();
2164
2165  // Typ publikácie > Kód kategórie publikácie
2166  $("#p_d_type_publication").change(function () {
2167    var p_d_type_publication = $(this).val();
2168    $.ajax({
2169      type: "POST",
2170      dataType: "html",
2171      url: "assets/ajax/ajaxPublication.php",
2172      data: {
2173        p_d_id: $("#p_d_id").val(),
2174        p_d_type_publication: p_d_type_publication,
2175        case: "typePublication",
2176      },
2177      success: function (data) {
2178        $("#cca-publication-type-id").html(data);
2179        $("#cca-publication-body-id").hide();
2180        commonPublication();
2181        commonAuthor();
2182        commonJournal();
2183        commonBooktitle();
2184      },
2185    });
2186  });
2187
2188  function commonPublication() {
2189    // Kód kategórie publikácie >
2190    $("#p_d_category").change(function () {
2191      var p_d_category = $(this).val();
2192      $.ajax({
2193        type: "POST",
2194        dataType: "html",
2195        url: "assets/ajax/ajaxPublication.php",
2196        data: {
2197          p_d_category: p_d_category,
2198          case: "typeCategory",
2199        },
2200        success: function (data) {
2201          $("#cca-publication-category-id").html(data);
2202          if (p_d_category) {
2203            $("#cca-publication-body-id").show();
2204            $("#cca-publication-category-hide-id").hide();
2205          } else $("#cca-publication-body-id").hide();
2206        },
2207      });
2208    });
2209    $("#cca-add-project").click(function () {
2210      var number = $("#cca-add-project-hidden").val();
2211      number++;
2212      $("#cca-add-project-id" + number).attr("class", "show");
2213      $("#cca-add-project-hidden").val(number);
2214    });
2215    $("#cca-add-project-add").click(function () {
2216      var number = $("#cca-add-project-add-hidden").val();
2217      number++;
2218      $("#cca-add-project-add-id" + number).attr("class", "show");
2219      $("#cca-add-project-add-hidden").val(number);
2220    });
2221  }
2222
2223  function commonAuthor() {
2224    $("#count_author").change(function () {
2225      var count = $(this).val();
2226      //console.log('count = ' + count)
2227      for (var i = 0; i < 20; i++) {
2228        if (count > i) $("#cca-show-hide-author" + i).attr("class", "show");
2229        else $("#cca-show-hide-author" + i).attr("class", "hide");
2230      }
2231    });
2232
2233    $("#cca-publication-js-copy").click(function () {
2234      $("#p_d_title_2").val($("#p_d_title_1").val());
2235    });
2236
2237    $(".cca-author-edit").click(function () {
2238      var order = $(this).attr("id").substring(16);
2239      var id = $("#p_p_id" + order).val();
2240      editAuthor(id, order, 1);
2241    });
2242
2243    $(".cca-edit-author").change(function () {
2244      var order = $(this).attr("id").substring(6);
2245      var id = $(this).val();
2246      editAuthor(id, order, 0);
2247    });
2248
2249    $(".cca-publication-percentage-author").change(function () {
2250      var countAuthor = $("#count_author").val();
2251      var percentage = 0;
2252      for (var i = 0; i < countAuthor; i++) {
2253        if (parseInt($("#p_a_participation" + i).val()))
2254          percentage += parseInt($("#p_a_participation" + i).val());
2255      }
2256      $("#cca-publication-percentage").text(percentage);
2257      if (percentage == 100)
2258        $("#cca-publication-percentage")
2259          .closest("div")
2260          .attr("class", "alert alert-success fade in");
2261      else
2262        $("#cca-publication-percentage")
2263          .closest("div")
2264          .attr("class", "alert alert-danger fade in");
2265    });
2266  }
2267
2268  function editAuthor(id, order, edit) {
2269    $.ajax({
2270      type: "POST",
2271      dataType: "json",
2272      url: "assets/ajax/ajaxPublication.php",
2273      data: {
2274        p_p_id: id,
2275        order: order,
2276        case: "editAuthor",
2277      },
2278      success: function (data) {
2279        //console.log(data);
2280        $("#cca-modal-title").html(data["title"]);
2281        $("#cca-modal-body").html(data["form"]);
2282        $("#cca-modal-show" + order).html(data["show"]);
2283        if (data["btnType"])
2284          $("#cca-author-order" + order).attr(
2285            "class",
2286            "btn btn-warning btn-xs cca-author-edit"
2287          );
2288        else
2289          $("#cca-author-order" + order).attr(
2290            "class",
2291            "btn btn-primary btn-xs cca-author-edit"
2292          );
2293        $("#cca-author-order" + order).attr("value", data["btn"]);
2294        if (data["department"])
2295          $("#p_a_department" + order).attr("value", data["department"]);
2296        if (data["position"])
2297          $("#p_a_position" + order).attr("value", data["position"]);
2298        // pocet autorov
2299        var countAuthors = $("#count_author").val();
2300        //console.log(countAuthors)
2301
2302        // Ak je posledny definovany podiel - nastav 100-SumaOstanych%
2303        var countZero = 0;
2304        for (var i = 0, percentage = 0; i < countAuthors; i++) {
2305          if (parseInt($("#p_a_participation" + i).val()))
2306            percentage += parseInt($("#p_a_participation" + i).val());
2307          else countZero++;
2308        }
2309        if (percentage < 100 && countZero == 1)
2310          $("#p_a_participation" + order).attr("value", 100 - percentage);
2311
2312        // Nastavenie suctu podielov
2313        var countZero = 1;
2314        for (var i = 0, percentage = 0; i < countAuthors; i++) {
2315          if (parseInt($("#p_a_participation" + i).val()))
2316            percentage += parseInt($("#p_a_participation" + i).val());
2317          else countZero = 0;
2318        }
2319        $("#cca-publication-percentage").text(percentage);
2320        if (percentage == 100 && countZero)
2321          $("#cca-publication-percentage")
2322            .closest("div")
2323            .attr("class", "alert alert-success fade in");
2324        else if (percentage == 100 && !countZero) {
2325          alert(
2326            "Sucet podielov je 100%, ale niektori z autorov nema ziadny podiel"
2327          );
2328          $("#cca-publication-percentage")
2329            .closest("div")
2330            .attr("class", "alert alert-danger fade in");
2331        } else
2332          $("#cca-publication-percentage")
2333            .closest("div")
2334            .attr("class", "alert alert-danger fade in");
2335      },
2336    });
2337    if (edit || id < 0) $(".cca-modal-form").modal("show");
2338  }
2339
2340  ///////////////////////////////////////////////////////////////////////////////////////////////////
2341  function commonJournal() {
2342    $("#cca-journal").click(function () {
2343      var id = $("#p_d_journal").val();
2344      //console.log('aaa ' + id)
2345      editJournal(id, 1);
2346    });
2347
2348    $("#p_d_journal").change(function () {
2349      var id = $(this).val();
2350      //console.log('bbb' + id)
2351      editJournal(id, 0);
2352    });
2353
2354    // Udalost - zobraz detaily
2355    $("#cca-journal-detail").click(function () {
2356      //console.log($(this).next().attr('class'))
2357      if ($(this).children().attr("class") == "fa fa-angle-down") {
2358        $("#cca-journal-detail-hide-show").attr("class", "show");
2359        $(this).children().attr("class", "fa fa-angle-up");
2360      } else {
2361        $("#cca-journal-detail-hide-show").attr("class", "hide");
2362        $(this).children().attr("class", "fa fa-angle-down");
2363      }
2364    });
2365  }
2366
2367  function editJournal(id, edit) {
2368    //console.log(id)
2369    $.ajax({
2370      type: "POST",
2371      dataType: "json",
2372      url: "assets/ajax/ajaxPublication.php",
2373      data: {
2374        p_j_id: id,
2375        case: "editJournal",
2376      },
2377      success: function (data) {
2378        //console.log(data);
2379        $("#cca-modal-title").html(data["title"]);
2380        $("#cca-modal-body").html(data["form"]);
2381        $("#cca-modal-show").html(data["show"]);
2382        if (data["btnType"])
2383          $("#cca-journal").attr("class", "btn btn-warning btn-xs");
2384        else $("#cca-journal").attr("class", "btn btn-primary btn-xs");
2385        $("#cca-journal").attr("value", data["btn"]);
2386
2387        // Udalost - otazka na vymazanie KIB pre casopis
2388        $("#cca-delete-file-journal").click(function () {
2389          $("#cca-delete-file-journal-question").attr("class", "show");
2390        });
2391
2392        // Udalost - odpoved na otazku - nie
2393        $("#cca-delete-file-journal-no").click(function () {
2394          $("#cca-delete-file-journal-question").attr("class", "hide");
2395        });
2396
2397        // Udalost - vymazanie KIB pre casopis
2398        $("#cca-delete-file-journal-yes").click(function () {
2399          var id = $("#p_j_id").val();
2400          //console.log(id);
2401          $.ajax({
2402            type: "POST",
2403            dataType: "json",
2404            url: "assets/ajax/ajaxPublication.php",
2405            data: {
2406              p_j_id: id,
2407              case: "deleteFileJournal",
2408            },
2409            success: function (data) {
2410              //console.log(data);
2411              $("#cca-delete-file-journal-answer").html(data["answer"]);
2412              $("#cca-journal-detail-data").html(data["detail"]);
2413            },
2414          });
2415        });
2416      },
2417    });
2418    if (edit || id < 0) {
2419      $(".cca-modal-form").modal("show");
2420    }
2421  }
2422
2423  ///////////////////////////////////////////////////////////////////////////////////////////////////
2424  function commonBooktitle() {
2425    $("#cca-booktitle").click(function () {
2426      var id = $("#p_d_booktitle").val();
2427      //console.log('aaa ' + id)
2428      editBooktitle(id, 1);
2429    });
2430
2431    $("#p_d_booktitle").change(function () {
2432      var id = $(this).val();
2433      //console.log('bbb' + id)
2434      editBooktitle(id, 0);
2435    });
2436
2437    // Udalost - zobraz detaily
2438    $("#cca-booktitle-detail").click(function () {
2439      //console.log($(this).next().attr('class'))
2440      if ($(this).children().attr("class") == "fa fa-angle-down") {
2441        $("#cca-booktitle-detail-hide-show").attr("class", "show");
2442        $(this).children().attr("class", "fa fa-angle-up");
2443      } else {
2444        $("#cca-booktitle-detail-hide-show").attr("class", "hide");
2445        $(this).children().attr("class", "fa fa-angle-down");
2446      }
2447    });
2448  }
2449  function editBooktitle(id, edit) {
2450    //console.log(id)
2451    $.ajax({
2452      type: "POST",
2453      dataType: "json",
2454      url: "assets/ajax/ajaxPublication.php",
2455      data: {
2456        p_b_id: id,
2457        case: "editBooktitle",
2458      },
2459      success: function (data) {
2460        //console.log(data);
2461        $("#cca-modal-title").html(data["title"]);
2462        $("#cca-modal-body").html(data["form"]);
2463        $("#cca-modal-show").html(data["show"]);
2464        if (data["btnType"])
2465          $("#cca-booktitle").attr("class", "btn btn-warning btn-xs");
2466        else $("#cca-booktitle").attr("class", "btn btn-primary btn-xs");
2467        $("#cca-booktitle").attr("value", data["btn"]);
2468
2469        // Udalost - otazka na vymazanie KIB pre casopis
2470        $("#cca-delete-file-booktitle").click(function () {
2471          $("#cca-delete-file-booktitle-question").attr("class", "show");
2472        });
2473
2474        // Udalost - odpoved na otazku - nie
2475        $("#cca-delete-file-booktitle-no").click(function () {
2476          $("#cca-delete-file-booktitle-question").attr("class", "hide");
2477        });
2478
2479        // Udalost - vymazanie KIB pre casopis
2480        $("#cca-delete-file-booktitle-yes").click(function () {
2481          var id = $("#p_b_id").val();
2482          //console.log(id);
2483          $.ajax({
2484            type: "POST",
2485            dataType: "json",
2486            url: "assets/ajax/ajaxPublication.php",
2487            data: {
2488              p_b_id: id,
2489              case: "deleteFileBooktitle",
2490            },
2491            success: function (data) {
2492              //console.log(data);
2493              $("#cca-delete-file-booktitle-answer").html(data["answer"]);
2494              $("#cca-booktitle-detail-data").html(data["detail"]);
2495            },
2496          });
2497        });
2498      },
2499    });
2500    if (edit || id < 0) {
2501      $(".cca-modal-form").modal("show");
2502    }
2503  }
2504
2505  $("#cca-modal-save").click(function () {
2506    var type_save = $("#cca-modal-type").val();
2507    //console.log(type_save)
2508    if (type_save == "author") {
2509      var order = $("#order").val();
2510      //console.log('xxxxx ' + order)
2511      $.ajax({
2512        type: "POST",
2513        dataType: "json",
2514        url: "assets/ajax/ajaxPublication.php",
2515        data: {
2516          p_p_id: $("#p_p_id").val(),
2517          p_p_name: $("#p_p_name").val(),
2518          p_p_surname: $("#p_p_surname").val(),
2519          p_p_department: $("#p_p_department").val(),
2520          p_p_position: $("#p_p_position").val(),
2521          p_p_osc: $("#p_p_osc").val(),
2522          order: $("#order").val(),
2523          case: "saveAuthor",
2524        },
2525        success: function (data) {
2526          //console.log(data);
2527          $("#p_p_id" + order).html(data["options"]);
2528          $("#cca-modal-show" + order).html(data["show"]);
2529          if (data["btnType"])
2530            $("#cca-author-order" + order).attr(
2531              "class",
2532              "btn btn-warning btn-xs cca-author-edit"
2533            );
2534          else
2535            $("#cca-author-order" + order).attr(
2536              "class",
2537              "btn btn-primary btn-xs cca-author-edit"
2538            );
2539          $("#cca-author-order" + order).attr("value", data["btn"]);
2540        },
2541      });
2542      $(".cca-modal-form").modal("hide");
2543    } else if (type_save == "journal") {
2544      // Je tam aj priloha?
2545      var form_data = new FormData();
2546      form_data.append("p_j_id", $("#p_j_id").val());
2547      form_data.append("p_j_title", $("#p_j_title").val());
2548      form_data.append("p_j_short", $("#p_j_short").val());
2549      form_data.append("p_j_isbn", $("#p_j_isbn").val());
2550      form_data.append("p_j_issn", $("#p_j_issn").val());
2551      form_data.append("p_j_best_quartile", $("#p_j_best_quartile").val());
2552      form_data.append("p_j_quartile", $("#p_j_quartile").val());
2553      form_data.append(
2554        "p_j_quartile_category",
2555        $("#p_j_quartile_category").val()
2556      );
2557      form_data.append("p_j_year", $("#p_j_year").val());
2558      form_data.append("p_j_volume", $("#p_j_volume").val());
2559      form_data.append("p_j_number", $("#p_j_number").val());
2560      form_data.append("p_j_publisher", $("#p_j_publisher").val());
2561      form_data.append("p_j_month", $("#p_j_month").val());
2562      form_data.append("p_j_file_atach", $("#p_j_file_atach").val());
2563      form_data.append("case", "saveJournal");
2564      // Spracovanie subora
2565      //console.log($('#p_j_file_atach').val())
2566      if (
2567        $("#p_j_file_atach").val() !== undefined &&
2568        $("#p_j_file_atach").val() !== null
2569      ) {
2570        var file_data = $("#p_j_file_atach").prop("files")[0];
2571        form_data.append("file", file_data);
2572      }
2573
2574      $.ajax({
2575        type: "POST",
2576        dataType: "json",
2577        url: "assets/ajax/ajaxPublication.php",
2578        cache: false,
2579        contentType: false,
2580        processData: false,
2581        data: form_data,
2582        success: function (data) {
2583          //console.log(data);
2584          $("#p_d_journal").html(data["options"]);
2585          $("#cca-modal-show").html(data["show"]);
2586          if (data["btnType"])
2587            $("#cca-journal").attr("class", "btn btn-warning btn-xs");
2588          else $("#cca-journal").attr("class", "btn btn-primary btn-xs");
2589          $("#cca-journal").attr("value", data["btn"]);
2590          $("#cca-journal-detail-data").html(data["detail"]);
2591        },
2592      });
2593      $(".cca-modal-form").modal("hide");
2594    } else if (type_save == "booktitle") {
2595      // Je tam aj priloha?
2596      var form_data = new FormData();
2597      form_data.append("p_b_id", $("#p_b_id").val());
2598      form_data.append("p_b_title", $("#p_b_title").val());
2599      form_data.append("p_b_chapter", $("#p_b_chapter").val());
2600      form_data.append("p_b_short", $("#p_b_short").val());
2601      form_data.append("p_b_isbn", $("#p_b_isbn").val());
2602      form_data.append("p_b_issn", $("#p_b_issn").val());
2603      form_data.append("p_b_year", $("#p_b_year").val());
2604      form_data.append("p_b_volume", $("#p_b_volume").val());
2605      form_data.append("p_b_number", $("#p_b_number").val());
2606      form_data.append("p_b_editor", $("#p_b_editor").val());
2607      form_data.append("p_b_publisher", $("#p_b_publisher").val());
2608      form_data.append("p_b_series", $("#p_b_series").val());
2609      form_data.append("p_b_address", $("#p_b_address").val());
2610      form_data.append("p_b_edition", $("#p_b_edition").val());
2611      form_data.append("p_b_month", $("#p_b_month").val());
2612      form_data.append("p_b_organization", $("#p_b_organization").val());
2613      form_data.append("p_b_file_atach", $("#p_b_file_atach").val());
2614      form_data.append("case", "saveBooktitle");
2615      // Spracovanie subora
2616      //console.log($('#p_b_file_atach').val())
2617      if (
2618        $("#p_b_file_atach").val() !== undefined &&
2619        $("#p_b_file_atach").val() !== null
2620      ) {
2621        var file_data = $("#p_b_file_atach").prop("files")[0];
2622        form_data.append("file", file_data);
2623      }
2624
2625      $.ajax({
2626        type: "POST",
2627        dataType: "json",
2628        url: "assets/ajax/ajaxPublication.php",
2629        cache: false,
2630        contentType: false,
2631        processData: false,
2632        data: form_data,
2633        success: function (data) {
2634          //console.log(data);
2635          $("#p_d_booktitle").html(data["options"]);
2636          $("#cca-modal-show").html(data["show"]);
2637          if (data["btnType"])
2638            $("#cca-booktitle").attr("class", "btn btn-warning btn-xs");
2639          else $("#cca-booktitle").attr("class", "btn btn-primary btn-xs");
2640          $("#cca-booktitle").attr("value", data["btn"]);
2641          $("#cca-booktitle-detail-data").html(data["detail"]);
2642        },
2643      });
2644      $(".cca-modal-form").modal("hide");
2645    }
2646  });
2647
2648  commonPublication();
2649  commonAuthor();
2650  commonJournal();
2651  commonBooktitle();
2652
2653  //
2654  $("#edit_year").change(function () {
2655    $("#edit_year_select").submit();
2656  });
2657}
2658
2659/*
2660height: 100,	 // set editor height
2661minHeight: null, // set minimum height of editor
2662maxHeight: null, // set maximum height of editor
2663focus: true,	  // set focus to editable area after initializing summernote
2664styleWithSpan: false,
2665toolbar: [
2666	['style', ['style']],
2667	['font', ['bold', 'italic', 'underline', 'clear']],
2668	['fontname', ['fontname']],
2669	['color', ['color']],
2670	['para', ['ul', 'ol', 'paragraph']],
2671	['height', ['height']],
2672	['table', ['table']],
2673	['insert', ['link', 'picture', 'hr']],
2674	['view', ['fullscreen', 'codeview']],
2675	['help', ['help']]
2676],
2677*/
2678
2679// konverzia formatu d.m.Y na Date v JS
2680function DMYToDate(date) {
2681  var parts = date.split(".");
2682  return new Date(parts[2], parts[1] - 1, parts[0]);
2683}
2684// konverzia formatu d.m.Y na Y-m-d pre MySQL
2685function DMYToMySQL(date) {
2686  var parts = date.split(".");
2687  return parts[2] + "-" + parts[1] + "-" + parts[0];
2688}
2689// konverzia formatu Date v JS na d.m.Y
2690function dateToDMY(date) {
2691  return (
2692    date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear()
2693  );
2694}
2695
2696// Funkcia, ktora ziska z DB zoznam dni s volnom
2697function getDataHolidays(callback) {
2698  $.ajax({
2699    type: "POST",
2700    dataType: "json",
2701    url: "assets/ajax/ajaxHoliday.php",
2702    data: {
2703      person_id: $("#person_id").val(),
2704      case: 1,
2705    },
2706    success: function (data) {
2707      callback(data);
2708    },
2709  });
2710}
2711
2712function checkHolidays(date, fromTo) {
2713  // Typy volna (dovolenka: 1, sluzobna cesta: 2, PN: 3, MD: 7, RP: 8, NV: 9, PV: 10, PA: 11, OCR: 12, PVKZ: 13)
2714  if (language == "en")
2715    var holidayType = new Array(
2716      "",
2717      "Vacation",
2718      "Out of office",
2719      "Illness",
2720      "",
2721      "",
2722      "",
2723      "Maternity leave",
2724      "Maternity leave",
2725      "Vacation",
2726      "Vacation",
2727      "Illness",
2728      "Illness",
2729      "Illness"
2730    );
2731  else
2732    var holidayType = new Array(
2733      "",
2734      "Dovolenka",
2735      "Služobná cesta",
2736      "Práceneschopnosť",
2737      "",
2738      "",
2739      "",
2740      "Materská dovolenka",
2741      "Rodičovský príspevok",
2742      "Neplatené voľno",
2743      "Náhradné (platené) voľno",
2744      "Návšteva u lekára (paragraf)",
2745      "OČR",
2746      "Žiadosť o pracovné voľno matkám a osamelým zamestnancom"
2747    );
2748
2749  type = true;
2750  tooltip = "";
2751  if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
2752  else css = "datepicker-0";
2753
2754  for (var key in dataAjax) {
2755    if (key == dateToDMY(date)) {
2756      css = "datepicker-" + dataAjax[key];
2757      tooltip = holidayType[dataAjax[key]];
2758    }
2759  }
2760
2761  if (fromTo == "to") {
2762    // datum do
2763    if ($("#hol_from").val()) {
2764      var border = DMYToDate($("#hol_from").val());
2765      type = border > date ? false : true;
2766    }
2767  } else {
2768    // datum od
2769    if ($("#hol_to").val()) {
2770      var border = DMYToDate($("#hol_to").val());
2771      type = border < date ? false : true;
2772    }
2773  }
2774
2775  return [type, css, tooltip];
2776}
2777
2778// Funkcia sa vola pri zvoleni datumu v kalendari
2779function getHolidayDays(type) {
2780  if (type) {
2781    var from = $("#hol_pvkz").val();
2782    var fromOld = $("#hol_pvkz_old").val();
2783    var to = $("#hol_pvkz").val();
2784    var toOld = $("#hol_pvkz_old").val();
2785  } else {
2786    var from = $("#hol_from").val();
2787    var fromOld = $("#from_old").val();
2788    var to = $("#hol_to").val();
2789    var toOld = $("#to_old").val();
2790  }
2791  if (from && to) {
2792    $.ajax({
2793      type: "POST",
2794      dataType: "json",
2795      url: "assets/ajax/ajaxHoliday.php",
2796      data: {
2797        person_id: $("#person_id").val(),
2798        from: DMYToMySQL(from),
2799        to: DMYToMySQL(to),
2800        fromOld: DMYToMySQL(fromOld),
2801        toOld: DMYToMySQL(toOld),
2802        case: 2,
2803      },
2804      success: function (data) {
2805        if (data.length) {
2806          $("#save").prop("disabled", true);
2807          $("#save").attr("class", "btn-u btn-u-default");
2808          var html = "";
2809          for (key in data) html += "<p>" + data[key] + "</p>";
2810          $("#overlapHolidayBody").html(html);
2811          $("#btnShowPopup").click();
2812        } else {
2813          $("#save").prop("disabled", false);
2814          $("#save").attr("class", "btn-u");
2815          getDiffDays(from, to);
2816        }
2817      },
2818    });
2819  }
2820}
2821
2822function getDiffDays(date1, date2) {
2823  $.ajax({
2824    type: "POST",
2825    dataType: "json",
2826    url: "assets/ajax/ajaxHoliday.php",
2827    data: {
2828      date1: date1,
2829      date2: date2,
2830      case: 3,
2831    },
2832    success: function (data) {
2833      //console.log(data)
2834      $("#hol_days").val(data.totalCount);
2835      $("#hol_days_all").val(data.totalCountDays);
2836    },
2837  });
2838}
2839
2840/*
2841$('#example tbody').on('mouseenter', 'td', function() {
2842	var colIdx = commonTable.cell(this).index().column; 
2843	$(commonTable.cells().nodes()).removeClass('highlight');
2844	$(commonTable.column(colIdx).nodes()).addClass('highlight');
2845});*/
2846
2847/*
2848dom: 'lfrtip',
2849buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
2850*/
2851$(".cca-more-availability-button").click(function () {
2852  //console.log('aaaa')
2853  $("#cca-more-availability").toggle();
2854});
2855
2856// Udalost - zobraz dostupnost
2857$(".cca-more-availability-button").click(function () {
2858  //console.log($(this).next().attr('class'))
2859  if ($(this).children().attr("class") == "fa fa-angle-down") {
2860    $("#cca-more-availability").attr("class", "show");
2861    $(this).children().attr("class", "fa fa-angle-up");
2862  } else {
2863    $("#cca-more-availability").attr("class", "hide");
2864    $(this).children().attr("class", "fa fa-angle-down");
2865  }
2866});
2867
2868// Nastavenie kalendara pre vyhladavanie citacii - FROM
2869$("#citation_from").datepicker({
2870  dateFormat: "d.m.yy",
2871  prevText: '<i class="fa fa-angle-left"></i>',
2872  nextText: '<i class="fa fa-angle-right"></i>',
2873  firstDay: 1,
2874  monthNames: monthNames[language],
2875  dayNamesMin: dayNamesMin[language],
2876  beforeShowDay: function (date) {
2877    if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
2878    else css = "datepicker-0";
2879    return [true, css];
2880  },
2881});
2882
2883// Nastavenie kalendara pre vyhladavanie citacii - TO
2884$("#citation_to").datepicker({
2885  dateFormat: "d.m.yy",
2886  prevText: '<i class="fa fa-angle-left"></i>',
2887  nextText: '<i class="fa fa-angle-right"></i>',
2888  firstDay: 1,
2889  monthNames: monthNames[language],
2890  dayNamesMin: dayNamesMin[language],
2891  beforeShowDay: function (date) {
2892    if (date.getDay() == 0 || date.getDay() == 6) css = "datepicker-weekend";
2893    else css = "datepicker-0";
2894    return [true, css];
2895  },
2896});
2897
2898$("#search-citation-button").click(function () {
2899  $.ajax({
2900    type: "POST",
2901    url: "assets/ajax/ajaxCitation.php",
2902    data: {
2903      from: $("#citation_from").val(),
2904      to: $("#citation_to").val(),
2905      c_type_id1: $("#c_type_id1").prop("checked"),
2906      c_type_id2: $("#c_type_id2").prop("checked"),
2907      person: $("#search-citation-person").val(),
2908      case: "search-citation",
2909    },
2910    success: function (data) {
2911      //console.log(data)
2912      $("#search-citation-show").html(data);
2913    },
2914  });
2915});
2916
2917$("#search-citation-reset").click(function () {
2918  $("#id_c_type1").prop("checked", "checked");
2919  $("#id_c_type2").prop("checked", "checked");
2920  $("#id_c_type3").prop("checked", "checked");
2921  $("#id_c_type4").prop("checked", "checked");
2922  $("#citation_from").val("");
2923  $("#citation_to").val("");
2924  $.ajax({
2925    type: "POST",
2926    url: "assets/ajax/ajaxCitation.php",
2927    data: {
2928      from: "",
2929      to: "",
2930      id_c_type1: "true",
2931      id_c_type2: "true",
2932      id_c_type3: "true",
2933      id_c_type4: "true",
2934      person: $("#search-citation-person").val(),
2935      case: "search-citation",
2936    },
2937    success: function (data) {
2938      //console.log(data)
2939      $("#search-citation-show").html(data);
2940    },
2941  });
2942});
2943
2944$("#list-staff-select").change(function () {
2945  $.ajax({
2946    type: "POST",
2947    url: "assets/ajax/ajax.php",
2948    data: {
2949      select: $(this).val(),
2950      case: "people-filter",
2951    },
2952    success: function (data) {
2953      //console.log(data)
2954      $("#cca-list-staff").html(data);
2955    },
2956  });
2957});
2958
2959// Tato cast musi byt na konci, preto obsahuje udaje zo zaciatku
2960$("#cca-modal-no").click(function (event) {
2961  event.preventDefault();
2962  $("button.close").click();
2963});
2964
2965$("#cca-modal-yes").click(function () {
2966  var deleteID = $("#" + ccaTypeId).val();
2967  //console.log(ccaURL)
2968  //console.log($('#' + ccaTypeId).val())
2969  //console.log(ccaForm)
2970  //console.log(deleteID)
2971  $.ajax({
2972    type: "POST",
2973    url: ccaURL,
2974    data: {
2975      deleteID: deleteID,
2976      case: "delete",
2977    },
2978    success: function (data) {
2979      //console.log(data)
2980      // Pri mazani citacie sa posiela postom aj ID publikacie
2981      if (ccaForm == "form_citation") {
2982        $("#" + ccaForm).submit();
2983      } else {
2984        $(location).attr("href", ccaPage);
2985      }
2986    },
2987  });
2988});
2989
2990$("#cca-show-availability").click(function () {
2991  //console.log('aaa');
2992  $.ajax({
2993    type: "POST",
2994    url: "assets/ajax/ajaxPerson.php",
2995    data: {
2996      id: $("#person_availability").val(),
2997      case: "availability",
2998    },
2999    success: function (data) {
3000      //console.log(data)
3001      $("#ajax_availability").html(data);
3002    },
3003  });
3004});
3005
3006$("#pub-year-export").click(function () {
3007  $.blockUI({
3008    css: {
3009      border: "none",
3010      padding: "15px",
3011      backgroundColor: "#000",
3012      "-webkit-border-radius": "10px",
3013      "-moz-border-radius": "10px",
3014      opacity: 0.5,
3015      color: "#fff",
3016    },
3017  });
3018  var type = $("input[name=pub_year_type]:checked").val();
3019  $.ajax({
3020    type: "POST",
3021    url: "assets/export/export_publication_html.php",
3022    data: $("#form1").serialize(),
3023    success: function (data) {
3024      //console.log(data)
3025      $(".cca-modal-export-body").html(data);
3026      if (type == 1) $(".modal-dialog-large").attr("style", "width: 95%");
3027      else $(".modal-dialog-large").attr("style", "max-width: 768px");
3028      $(".cca-modal-export").modal("show");
3029      $.unblockUI();
3030    },
3031  });
3032});
3033
3034$("#pub-setting-export").click(function () {
3035  $.blockUI({
3036    css: {
3037      border: "none",
3038      padding: "15px",
3039      backgroundColor: "#000",
3040      "-webkit-border-radius": "10px",
3041      "-moz-border-radius": "10px",
3042      opacity: 0.5,
3043      color: "#fff",
3044    },
3045  });
3046  $.ajax({
3047    type: "POST",
3048    url: "assets/export/export_publication_individual_html.php",
3049    data: $("#form11").serialize(),
3050    success: function (data) {
3051      //console.log(data)
3052      $(".cca-modal-export-body").html(data);
3053      $(".modal-dialog").attr("style", "width: 95%");
3054      $(".cca-modal-export").modal("show");
3055      $.unblockUI();
3056    },
3057  });
3058});
3059
3060$("#pub-bibtex-export").click(function () {
3061  $.blockUI({
3062    css: {
3063      border: "none",
3064      padding: "15px",
3065      backgroundColor: "#000",
3066      "-webkit-border-radius": "10px",
3067      "-moz-border-radius": "10px",
3068      opacity: 0.5,
3069      color: "#fff",
3070    },
3071  });
3072  $.ajax({
3073    type: "POST",
3074    url: "assets/export/export_publication_bibtex_html.php",
3075    data: $("#form12").serialize(),
3076    success: function (data) {
3077      //console.log(data)
3078      $(".cca-modal-export-body").html(data);
3079      $(".modal-dialog").attr("style", "width: 95%");
3080      $(".cca-modal-export").modal("show");
3081      $.unblockUI();
3082    },
3083  });
3084});
3085
3086$("#cit-year-export").click(function () {
3087  $.blockUI({
3088    css: {
3089      border: "none",
3090      padding: "15px",
3091      backgroundColor: "#000",
3092      "-webkit-border-radius": "10px",
3093      "-moz-border-radius": "10px",
3094      opacity: 0.5,
3095      color: "#fff",
3096    },
3097  });
3098  $.ajax({
3099    type: "POST",
3100    url: "assets/export/export_citation_html.php",
3101    data: $("#form2").serialize(),
3102    success: function (data) {
3103      //console.log(data)
3104      $(".cca-modal-export-body").html(data);
3105      $(".modal-dialog").attr("style", "width: 95%");
3106      $(".cca-modal-export").modal("show");
3107      $.unblockUI();
3108    },
3109  });
3110});
3111
3112$("#cit-year-export0").click(function () {
3113  $.blockUI({
3114    css: {
3115      border: "none",
3116      padding: "15px",
3117      backgroundColor: "#000",
3118      "-webkit-border-radius": "10px",
3119      "-moz-border-radius": "10px",
3120      opacity: 0.5,
3121      color: "#fff",
3122    },
3123  });
3124  $.ajax({
3125    type: "POST",
3126    url: "assets/export/export_citation_html0.php",
3127    data: $("#form6").serialize(),
3128    success: function (data) {
3129      //console.log(data)
3130      $(".cca-modal-export-body").html(data);
3131      $(".modal-dialog").attr("style", "width: 95%");
3132      $(".cca-modal-export").modal("show");
3133      $.unblockUI();
3134    },
3135  });
3136});
3137
3138$("#pub-cit-export").click(function () {
3139  $.blockUI({
3140    css: {
3141      border: "none",
3142      padding: "15px",
3143      backgroundColor: "#000",
3144      "-webkit-border-radius": "10px",
3145      "-moz-border-radius": "10px",
3146      opacity: 0.5,
3147      color: "#fff",
3148    },
3149  });
3150  $.ajax({
3151    type: "POST",
3152    url: "assets/export/export_publication_citation_html.php",
3153    data: $("#form13").serialize(),
3154    success: function (data) {
3155      //console.log(data)
3156      $(".cca-modal-export-body").html(data);
3157      $(".modal-dialog").attr("style", "width: 95%");
3158      $(".cca-modal-export").modal("show");
3159      $.unblockUI();
3160    },
3161  });
3162});
3163
3164$("#pub-export-years").click(function () {
3165  $.blockUI({
3166    css: {
3167      border: "none",
3168      padding: "15px",
3169      backgroundColor: "#000",
3170      "-webkit-border-radius": "10px",
3171      "-moz-border-radius": "10px",
3172      opacity: 0.5,
3173      color: "#fff",
3174    },
3175  });
3176  $.ajax({
3177    type: "POST",
3178    url: "assets/export/export_publication_years_html.php",
3179    data: $("#form14").serialize(),
3180    success: function (data) {
3181      //console.log(data)
3182      $(".cca-modal-export-body").html(data);
3183      $(".modal-dialog").attr("style", "width: 95%");
3184      $(".cca-modal-export").modal("show");
3185      $.unblockUI();
3186    },
3187  });
3188});
3189
3190$("#cit-year-export-old").click(function () {
3191  var year = $("#c_year").val();
3192  $("#old_year").val(year);
3193  console.log($("#old_year").val());
3194  $("#form2_old").submit();
3195});
3196
3197$("#cit-year-export-old0").click(function () {
3198  var year = $("#c_year0").val();
3199  $("#old_year0").val(year);
3200  console.log($("#old_year0").val());
3201  $("#form6_old").submit();
3202});
3203
3204function ccaTypeCitPart(type, year) {
3205  $.ajax({
3206    type: "POST",
3207    url: "assets/export/export_citation_html.php",
3208    data: {
3209      cit_type_export: 1,
3210      cit_type_export_part: type,
3211      c_year: year,
3212    },
3213    success: function (data) {
3214      //console.log(data)
3215      $(".cca-modal-export-body").html(data);
3216      $(".modal-dialog").attr("style", "width: 95%");
3217      $(".cca-modal-export").modal("show");
3218    },
3219  });
3220}
3221
3222// HTML export citacii pre osoby
3223$("#cit-person-export").click(function () {
3224  $.blockUI({
3225    css: {
3226      border: "none",
3227      padding: "15px",
3228      backgroundColor: "#000",
3229      "-webkit-border-radius": "10px",
3230      "-moz-border-radius": "10px",
3231      opacity: 0.5,
3232      color: "#fff",
3233    },
3234  });
3235  $.ajax({
3236    type: "POST",
3237    url: "assets/export/export_citation_person_html.php",
3238    data: $("#form21").serialize(),
3239    success: function (data) {
3240      //console.log(data)
3241      $(".cca-modal-export-body").html(data);
3242      $(".modal-dialog").attr("style", "width: 95%");
3243      $(".cca-modal-export").modal("show");
3244      $.unblockUI();
3245    },
3246  });
3247});
3248
3249// HTML export citacii pre projekty
3250$("#cit-project-export").click(function () {
3251  $.blockUI({
3252    css: {
3253      border: "none",
3254      padding: "15px",
3255      backgroundColor: "#000",
3256      "-webkit-border-radius": "10px",
3257      "-moz-border-radius": "10px",
3258      opacity: 0.5,
3259      color: "#fff",
3260    },
3261  });
3262  $.ajax({
3263    type: "POST",
3264    url: "assets/export/export_citation_project_html.php",
3265    data: $("#form22").serialize(),
3266    success: function (data) {
3267      //console.log(data)
3268      $(".cca-modal-export-body").html(data);
3269      $(".modal-dialog").attr("style", "width: 95%");
3270      $(".cca-modal-export").modal("show");
3271      $.unblockUI();
3272    },
3273  });
3274});
3275
3276// HTML export citacii pre individualne osoby
3277$("#cit-setting-export").click(function () {
3278  $.blockUI({
3279    css: {
3280      border: "none",
3281      padding: "15px",
3282      backgroundColor: "#000",
3283      "-webkit-border-radius": "10px",
3284      "-moz-border-radius": "10px",
3285      opacity: 0.5,
3286      color: "#fff",
3287    },
3288  });
3289  $.ajax({
3290    type: "POST",
3291    url: "assets/export/export_citation_individual_html.php",
3292    data: $("#form23").serialize(),
3293    success: function (data) {
3294      //console.log(data)
3295      $(".cca-modal-export-body").html(data);
3296      $(".modal-dialog").attr("style", "width: 95%");
3297      $(".cca-modal-export").modal("show");
3298      $.unblockUI();
3299    },
3300  });
3301});
3302
3303$("#annual-export").click(function () {
3304  $.blockUI({
3305    css: {
3306      border: "none",
3307      padding: "15px",
3308      backgroundColor: "#000",
3309      "-webkit-border-radius": "10px",
3310      "-moz-border-radius": "10px",
3311      opacity: 0.5,
3312      color: "#fff",
3313    },
3314  });
3315  var year = $("#annual-year").val();
3316  $.ajax({
3317    type: "POST",
3318    url: "assets/export/annual_report.php",
3319    data: {
3320      year: year,
3321    },
3322    success: function (data) {
3323      //console.log(data)
3324      $(".cca-modal-export-body").html(data);
3325      $(".modal-dialog").attr("style", "width: 95%");
3326      $(".cca-modal-export").modal("show");
3327      $.unblockUI();
3328    },
3329  });
3330});
3331
3332$("#annual-export-om").click(function () {
3333  $.blockUI({
3334    css: {
3335      border: "none",
3336      padding: "15px",
3337      backgroundColor: "#000",
3338      "-webkit-border-radius": "10px",
3339      "-moz-border-radius": "10px",
3340      opacity: 0.5,
3341      color: "#fff",
3342    },
3343  });
3344  var year = $("#annual-year-om").val();
3345  $.ajax({
3346    type: "POST",
3347    url: "assets/export/annual_report_om.php",
3348    data: {
3349      year: year,
3350    },
3351    success: function (data) {
3352      //console.log(data)
3353      $(".cca-modal-export-body").html(data);
3354      $(".modal-dialog").attr("style", "width: 95%");
3355      $(".cca-modal-export").modal("show");
3356      $.unblockUI();
3357    },
3358  });
3359});
3360
3361// Nastavenie kalendara pre datum export od
3362$("#citation_pr_from").datepicker({
3363  dateFormat: "d.m.yy",
3364  prevText: '<i class="fa fa-angle-left"></i>',
3365  nextText: '<i class="fa fa-angle-right"></i>',
3366  firstDay: 1,
3367  monthNames: monthNames[language],
3368  dayNamesMin: dayNamesMin[language],
3369});
3370
3371// Nastavenie kalendara pre datum export do
3372$("#citation_pr_to").datepicker({
3373  dateFormat: "d.m.yy",
3374  prevText: '<i class="fa fa-angle-left"></i>',
3375  nextText: '<i class="fa fa-angle-right"></i>',
3376  firstDay: 1,
3377  monthNames: monthNames[language],
3378  dayNamesMin: dayNamesMin[language],
3379});
3380
3381function editRecord(id) {
3382  $("#" + ccaTypeId).val(id);
3383  $("#" + ccaForm).submit();
3384}
3385
3386function cloneRecord(id) {
3387  $("#" + ccaTypeId).val(id);
3388  $("#" + ccaForm).attr("action", ccaFormClone);
3389  $("#" + ccaForm).submit();
3390}
3391
3392function setDeleteRecordID(id) {
3393  $("#" + ccaTypeId).val(id);
3394  //console.log(ccaTypeId)
3395  //console.log($('#' + ccaTypeId).val(id))
3396}
3397
3398function ccaShowAvailability(id, show) {
3399  //console.log('aaa');
3400  $.ajax({
3401    type: "POST",
3402    url: "assets/ajax/ajaxPerson.php",
3403    data: {
3404      id: id,
3405      show: show,
3406      case: "availability",
3407    },
3408    success: function (data) {
3409      //console.log(data)
3410      $("#ajax_availability").html(data);
3411    },
3412  });
3413}
3414
3415function citationTitle(n) {
3416  var search = $("#search_title" + n).val();
3417  //console.log(search)
3418  if (search.length >= 3) {
3419    $.ajax({
3420      type: "POST",
3421      url: "assets/ajax/ajaxPerson.php",
3422      data: {
3423        search_title: search_title,
3424        case: "search-publication",
3425        n: n,
3426      },
3427      success: function (data) {
3428        //console.log(data)
3429      },
3430    });
3431  }
3432}
3433
3434$("#cancel").click(function () {
3435  $(location).attr("href", ccaPage);
3436});
3437
3438function citInspection1(checkPerson) {
3439  $.blockUI({
3440    css: {
3441      border: "none",
3442      padding: "15px",
3443      backgroundColor: "#000",
3444      "-webkit-border-radius": "10px",
3445      "-moz-border-radius": "10px",
3446      opacity: 0.5,
3447      color: "#fff",
3448    },
3449  });
3450  $.ajax({
3451    url: "assets/export/autocitacie_html.php?checkPerson=" + checkPerson,
3452    success: function (data) {
3453      //console.log(data)
3454      $.unblockUI();
3455      $(".cca-modal-export-body").html(data);
3456      $(".modal-dialog").attr("style", "width: 95%");
3457      $(".cca-modal-export").modal("show");
3458    },
3459  });
3460}
3461
3462function citInspection2(checkPerson) {
3463  $.blockUI({
3464    css: {
3465      border: "none",
3466      padding: "15px",
3467      backgroundColor: "#000",
3468      "-webkit-border-radius": "10px",
3469      "-moz-border-radius": "10px",
3470      opacity: 0.5,
3471      color: "#fff",
3472    },
3473  });
3474  $.ajax({
3475    url: "assets/export/duplicity_html.php?checkPerson=" + checkPerson,
3476    success: function (data) {
3477      //console.log(data)
3478      $.unblockUI();
3479      $(".cca-modal-export-body").html(data);
3480      $(".modal-dialog").attr("style", "width: 95%");
3481      $(".cca-modal-export").modal("show");
3482    },
3483  });
3484}
3485
3486function showCoffeeSession(id) {
3487  $.blockUI({
3488    css: {
3489      border: "none",
3490      padding: "15px",
3491      backgroundColor: "#000",
3492      "-webkit-border-radius": "10px",
3493      "-moz-border-radius": "10px",
3494      opacity: 0.5,
3495      color: "#fff",
3496    },
3497  });
3498  $.ajax({
3499    type: "POST",
3500    url: "assets/ajax/ajaxCoffee.php",
3501    data: {
3502      id: id,
3503    },
3504    success: function (data) {
3505      //console.log(data)
3506      $(".cca-modal-coffee-body").html(data);
3507      //$(".modal-dialog").attr('style', 'width: 95%');
3508      $(".cca-modal-coffee").modal("show");
3509      $.unblockUI();
3510    },
3511  });
3512}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.