|
22 | 22 | exit();
|
23 | 23 | }
|
24 | 24 |
|
| 25 | +printf("<header><h2>%s</h2></header>", $PMF_LANG['msgOpenQuestions']); |
| 26 | + |
25 | 27 | if ($permission['delquestion']) {
|
26 | 28 |
|
27 | 29 | $category = new PMF_Category($faqConfig, false);
|
28 | 30 | $category->setUser($current_admin_user);
|
29 | 31 | $category->setGroups($current_admin_groups);
|
30 | 32 | $date = new PMF_Date($faqConfig);
|
31 | 33 | $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
|
32 |
| - $delete = PMF_Filter::filterInput(INPUT_GET, 'delete', FILTER_SANITIZE_STRING, 'no'); |
33 | 34 |
|
34 | 35 | $toggle = PMF_Filter::filterInput(INPUT_GET, 'is_visible', FILTER_SANITIZE_STRING);
|
35 | 36 | if ($toggle == 'toggle') {
|
|
39 | 40 | }
|
40 | 41 | }
|
41 | 42 |
|
42 |
| - printf("<header><h2>%s</h2></header>", $PMF_LANG['msgOpenQuestions']); |
43 |
| - |
44 |
| - if ($delete == 'yes') { |
45 |
| - $faq->deleteQuestion($questionId); |
46 |
| - printf('<p class="alert alert-success">%s</p>', $PMF_LANG['ad_entry_delsuc']); |
47 |
| - } |
| 43 | + print '<div id="returnMessage"></div>'; |
48 | 44 |
|
49 | 45 | $openquestions = $faq->getAllOpenQuestions();
|
50 | 46 |
|
51 | 47 | if (count($openquestions) > 0) {
|
52 | 48 | ?>
|
53 |
| - <table class="table table-striped"> |
54 |
| - <thead> |
55 |
| - <tr> |
56 |
| - <th><?php print $PMF_LANG['ad_entry_author']; ?></th> |
57 |
| - <th><?php print $PMF_LANG['ad_entry_theme']; ?></th> |
58 |
| - <th><?php print $PMF_LANG['ad_entry_visibility']; ?>?</th> |
59 |
| - <th><?php print $PMF_LANG['ad_gen_delete']; ?>?</th> |
60 |
| - </tr> |
61 |
| - </thead> |
62 |
| - <tbody> |
| 49 | + <form id="questionSelection" name="questionSelection" method="post"> |
| 50 | + <table class="table table-striped"> |
| 51 | + <thead> |
| 52 | + <tr> |
| 53 | + <th></th> |
| 54 | + <th><?php print $PMF_LANG['ad_entry_author']; ?></th> |
| 55 | + <th><?php print $PMF_LANG['ad_entry_theme']; ?></th> |
| 56 | + <th colspan="2"><?php print $PMF_LANG['ad_entry_visibility']; ?>?</th> |
| 57 | + </tr> |
| 58 | + </thead> |
| 59 | + <tbody> |
63 | 60 | <?php
|
64 | 61 | foreach ($openquestions as $question) {
|
65 | 62 | ?>
|
66 | 63 | <tr>
|
| 64 | + <td> |
| 65 | + <input id="questions[]" |
| 66 | + name="questions[]" |
| 67 | + value="<?php print $question['id']; ?>" type="checkbox" /> |
| 68 | + </td> |
67 | 69 | <td>
|
68 | 70 | <?php print $date->format(PMF_Date::createIsoDate($question['created'])); ?>
|
69 | 71 | <br />
|
|
72 | 74 | </a>
|
73 | 75 | </td>
|
74 | 76 | <td>
|
75 |
| - <div id="PMF_openQuestionsCategory"><?php print $category->categoryName[$question['category_id']]['name'] ?></div> |
| 77 | + <strong><?php print $category->categoryName[$question['category_id']]['name'] ?></strong> |
76 | 78 | <br />
|
77 | 79 | <?php print $question['question'] ?>
|
78 | 80 | </td>
|
79 | 81 | <td>
|
80 | 82 | <a href="?action=question&id=<?php print $question['id']; ?>&is_visible=toggle">
|
81 |
| - <?php print (('Y' == $question['is_visible']) ? $PMF_LANG['ad_gen_no'] : $PMF_LANG['ad_gen_yes']); ?> |
| 83 | + <?php print ('Y' == $question['is_visible']) ? $PMF_LANG['ad_gen_no'] : $PMF_LANG['ad_gen_yes']; ?> |
82 | 84 | </a>
|
83 | 85 | </td>
|
84 | 86 | <td>
|
85 |
| - <a onclick="return confirm('<?php print $PMF_LANG['ad_user_del_3'] ?>'); return false;" href="?action=question&id=<?php print $question['id']; ?>&delete=yes"> |
86 |
| - <?php print $PMF_LANG['ad_gen_delete']; ?> |
87 |
| - </a> |
88 |
| - <br /> |
89 | 87 | <?php if ($faqConfig->get('records.enableCloseQuestion') && $question['answer_id']) { ?>
|
90 | 88 | <a href="?action=editentry&id=<?php print $question['answer_id']; ?>&lang=<?php print $LANGCODE; ?>">
|
91 | 89 | <?php print $PMF_LANG['msg2answerFAQ']; ?>
|
|
101 | 99 | <?php
|
102 | 100 | }
|
103 | 101 | ?>
|
104 |
| - </tbody> |
105 |
| - </table> |
| 102 | + </tbody> |
| 103 | + </table> |
| 104 | + </form> |
| 105 | + |
| 106 | + <p> |
| 107 | + <input class="btn-danger" id="submitDeleteQuestions" type="submit" name="submit" |
| 108 | + value="<?php print $PMF_LANG["ad_entry_delete"]; ?>" /> |
| 109 | + </p> |
| 110 | + |
| 111 | + <script type="text/javascript"> |
| 112 | + /* <![CDATA[ */ |
| 113 | + $('#submitDeleteQuestions').click(function() { deleteQuestions(); return false; }); |
| 114 | + |
| 115 | + function deleteQuestions() |
| 116 | + { |
| 117 | + var questions = $('#questionSelection').serialize(); |
| 118 | + |
| 119 | + $('#returnMessage').empty(); |
| 120 | + $.ajax({ |
| 121 | + type: 'POST', |
| 122 | + url: 'index.php?action=ajax&ajax=records&ajaxaction=delete_question', |
| 123 | + data: questions, |
| 124 | + success: function(msg) { |
| 125 | + $('#saving_data_indicator').html('<img src="images/indicator.gif" /> deleting ...'); |
| 126 | + $('tr td input:checked').parent().parent().fadeOut('slow'); |
| 127 | + $('#saving_data_indicator').fadeOut('slow'); |
| 128 | + $('#returnMessage'). |
| 129 | + html('<p class="alert alert-success">' + msg + '</p>'); |
| 130 | + } |
| 131 | + }); |
| 132 | + return false; |
| 133 | + } |
| 134 | + |
| 135 | + /* ]]> */ |
| 136 | + </script> |
106 | 137 | <?php
|
107 | 138 | } else {
|
108 | 139 | print $PMF_LANG['msgNoQuestionsAvailable'];
|
|
0 commit comments