sepe.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /* For licensing terms, see /license.txt */
  2. /**
  3. * JS library for the Chamilo sepe plugin
  4. * @package chamilo.plugin.sepe
  5. */
  6. $(document).ready(function () {
  7. $("#delete-center-data").click(function (e) {
  8. e.preventDefault();
  9. e.stopPropagation();
  10. if (confirm($('#confirmDeleteCenterData').val())) {
  11. $.post("function.php", {tab: "delete_center_data"},
  12. function (data) {
  13. if (data.status == 'false') {
  14. alert(data.content);
  15. } else {
  16. alert(data.content);
  17. location.reload();
  18. }
  19. }, "json");
  20. }
  21. });
  22. $("#delete-action").click(function (e) {
  23. e.preventDefault();
  24. e.stopPropagation();
  25. var actionId = $("#action_id").val();
  26. if (confirm($('#confirmDeleteAction').val())) {
  27. $.post("function.php", {tab: "delete_action", id:actionId},
  28. function (data) {
  29. if (data.status == 'false') {
  30. alert(data.content);
  31. } else {
  32. window.location.replace("formative-actions-list.php");
  33. }
  34. }, "json");
  35. }
  36. });
  37. $(".delete-specialty").click(function(e){
  38. e.preventDefault();
  39. e.stopPropagation();
  40. iid = $(this).prop("id");
  41. if (confirm($('#confirmDeleteSpecialty').val())) {
  42. $.post("function.php", {tab: "delete_specialty", id:iid},
  43. function (data) {
  44. if (data.status == 'false') {
  45. alert(data.content);
  46. } else {
  47. alert(data.content);
  48. location.reload();
  49. }
  50. }, "json");
  51. }
  52. });
  53. $(".delete-classroom").click(function(e){
  54. e.preventDefault();
  55. e.stopPropagation();
  56. iid = $(this).prop("id");
  57. if (confirm($('#confirmDeleteClassroom').val())) {
  58. $.post("function.php", {tab: "delete_classroom", id:iid},
  59. function (data) {
  60. if (data.status == 'false') {
  61. alert(data.content);
  62. } else {
  63. alert(data.content);
  64. location.reload();
  65. }
  66. }, "json");
  67. }
  68. });
  69. $(".delete-tutor").click(function(e){
  70. e.preventDefault();
  71. e.stopPropagation();
  72. iid = $(this).prop("id");
  73. if (confirm($('#confirmDeleteTutor').val())) {
  74. $.post("function.php", {tab: "delete_tutor", id:iid},
  75. function (data) {
  76. if (data.status == 'false') {
  77. alert(data.content);
  78. } else {
  79. alert(data.content);
  80. location.reload();
  81. }
  82. }, "json");
  83. }
  84. });
  85. $(".delete-participant").click(function(e){
  86. e.preventDefault();
  87. e.stopPropagation();
  88. iid = $(this).prop("id");
  89. if (confirm($('#confirmDeleteParticipant').val())) {
  90. $.post("function.php", {tab: "delete_participant", id:iid},
  91. function (data) {
  92. if (data.status == 'false') {
  93. alert(data.content);
  94. } else {
  95. alert(data.content);
  96. location.reload();
  97. }
  98. }, "json");
  99. }
  100. });
  101. $(".delete-specialty-participant").click(function(e){
  102. e.preventDefault();
  103. e.stopPropagation();
  104. iid = $(this).prop("id");
  105. if (confirm($("#confirmDeleteParticipantSpecialty").val())) {
  106. $.post("function.php", {tab: "delete_specialty_participant", id:iid},
  107. function (data) {
  108. if (data.status == 'false') {
  109. alert(data.content);
  110. } else {
  111. alert(data.content);
  112. location.reload();
  113. }
  114. }, "json");
  115. }
  116. });
  117. $(".assign_action").click(function(e){
  118. e.preventDefault();
  119. e.stopPropagation();
  120. vcourse = $(this).prop("id");
  121. vaction = $(this).parent().prev().children().val();
  122. if (vaction != '') {
  123. $.post("function.php", {tab:"assign_action", course_id:vcourse, action_id:vaction},
  124. function (data) {
  125. if (data.status == 'false') {
  126. alert(data.content);
  127. } else {
  128. location.reload();
  129. }
  130. }, "json");
  131. } else {
  132. alert($("#alertAssignAction").val());
  133. }
  134. });
  135. $(".unlink-action").click(function(e){
  136. e.preventDefault();
  137. e.stopPropagation();
  138. iid = $(this).prop("id");
  139. $.post("function.php", {tab: "unlink_action", id:iid},
  140. function (data) {
  141. if (data.status == 'false') {
  142. alert(data.content);
  143. } else {
  144. location.reload();
  145. }
  146. }, "json");
  147. });
  148. $(".delete-action").click(function(e){
  149. e.preventDefault();
  150. e.stopPropagation();
  151. iid = $(this).prop("id").substr(16);
  152. if (confirm($('#confirmDeleteUnlinkAction').val())) {
  153. $.post("function.php", {tab: "delete_action", id:iid},
  154. function (data) {
  155. if (data.status == 'false') {
  156. alert(data.content);
  157. } else {
  158. location.reload();
  159. }
  160. }, "json");
  161. }
  162. });
  163. $("#slt_user_exists").change(function(){
  164. if ($(this).val() == "0") {
  165. $("#tutor-data-layer").show();
  166. $("#tutors-list-layer").hide();
  167. } else {
  168. $("#tutors-list-layer").show();
  169. $("#tutor-data-layer").hide();
  170. }
  171. });
  172. $(".info_tutor").click(function(e){
  173. e.preventDefault();
  174. e.stopPropagation();
  175. $(this).parent().parent().next().toggle("slow");
  176. });
  177. $("#slt_centers_exists").change(function(){
  178. if ($(this).val() == "0") {
  179. $("#center-data-layer").show();
  180. $("#centers-list-layer").hide();
  181. } else {
  182. $("#centers-list-layer").show();
  183. $("#center-data-layer").hide();
  184. }
  185. });
  186. $('form[name="form_participant_action"] input[type="submit"]').click(function(e){
  187. e.preventDefault();
  188. e.stopPropagation();
  189. if ($('#platform_user_id').val() == '') {
  190. alert($("#alertSelectUser").val());
  191. } else {
  192. $('form[name="form_participant_action"]').submit();
  193. }
  194. });
  195. $("#key-sepe-generator").click(function(e){
  196. e.preventDefault();
  197. e.stopPropagation();
  198. $.post("function.php", {tab: "key_sepe_generator"},
  199. function (data) {
  200. if (data.status == 'false') {
  201. alert(data.content);
  202. } else {
  203. $("#input_key").val(data.content);
  204. }
  205. }, "json");
  206. });
  207. });