listing.php 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Template (view in MVC pattern) used for listing course descriptions
  5. * @author Christian Fasanando <christian1827@gmail.com>
  6. * @package chamilo.course_description
  7. */
  8. // protect a course script
  9. api_protect_course_script(true);
  10. // display actions menu
  11. if (api_is_allowed_to_edit(null,true)) {
  12. $categories = array();
  13. foreach ($default_description_titles as $id => $title) {
  14. $categories[$id] = $title;
  15. }
  16. $categories[ADD_BLOCK] = get_lang('NewBloc');
  17. $i=1;
  18. echo '<div class="actions" style="margin-bottom:30px">';
  19. ksort($categories);
  20. foreach ($categories as $id => $title) {
  21. if ($i==ADD_BLOCK) {
  22. echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
  23. Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
  24. break;
  25. } else {
  26. echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
  27. Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
  28. $i++;
  29. }
  30. }
  31. echo '</div>';
  32. }
  33. $history = isset($history) ? $history : null;
  34. // display course description list
  35. if ($history) {
  36. echo '<div>
  37. <table width="100%">
  38. <tr>
  39. <td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td>
  40. <td align="right"><a href="index.php?action=listing">'.
  41. Display::return_icon('info.png',get_lang('BackToCourseDesriptionList'), array('style'=>'vertical-align:middle;'),ICON_SIZE_SMALL).' '.get_lang('BackToCourseDesriptionList').'</a></td></tr></table></div>';
  42. }
  43. $user_info = api_get_user_info();
  44. if (isset($descriptions) && count($descriptions) > 0) {
  45. foreach ($descriptions as $id => $description) {
  46. if (!empty($description)) {
  47. echo '<div class="panel panel-info">';
  48. echo '<div class="panel-heading">';
  49. if (api_is_allowed_to_edit(null,true) && !$history) {
  50. if (api_get_session_id() == $description['session_id']) {
  51. $description['title'] = $description['title'].' '.api_get_session_image(api_get_session_id(), $user_info['status']);
  52. // delete
  53. echo '<a href="'.api_get_self().'?id='.$description['id'].'&cidReq='.api_get_course_id().'&id_session='.$description['session_id'].'&action=delete&description_type='.$description['description_type'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding())).'\')) return false;">';
  54. echo Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
  55. echo '</a> ';
  56. // edit
  57. echo '<a href="'.api_get_self().'?id='.$description['id'].'&cidReq='.api_get_course_id().'&id_session='.$description['session_id'].'&action=edit&description_type='.$description['description_type'].'">';
  58. echo Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle;float:right; padding-right:4px;'),ICON_SIZE_SMALL);
  59. echo '</a> ';
  60. } else {
  61. echo Display::return_icon('edit_na.png', get_lang('EditionNotAvailableFromSession'), array('style' => 'vertical-align:middle;float:right;'),ICON_SIZE_SMALL);
  62. }
  63. }
  64. echo $description['title'];
  65. echo '</div>';
  66. echo '<div class="panel-body">';
  67. echo $description['content'];
  68. echo '</div></div>';
  69. }
  70. }
  71. } else {
  72. echo '<em>'.get_lang('ThisCourseDescriptionIsEmpty').'</em>';
  73. }