announcements.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Frederik Vermeire <frederik.vermeire@pandora.be>, UGent Internship
  5. * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: code cleaning
  6. * @author Julio Montoya <gugli100@gmail.com>, MORE code cleaning 2011
  7. *
  8. * @abstract The task of the internship was to integrate the 'send messages to specific users' with the
  9. * Announcements tool and also add the resource linker here. The database also needed refactoring
  10. * as there was no title field (the title was merged into the content field)
  11. * @package chamilo.announcements
  12. * multiple functions
  13. */
  14. // use anonymous mode when accessing this course tool
  15. $use_anonymous = true;
  16. // setting the global file that gets the general configuration, the databases, the languages, ...
  17. require_once '../inc/global.inc.php';
  18. /* Sessions */
  19. $ctok = Security::get_existing_token();
  20. $stok = Security::get_token();
  21. $current_course_tool = TOOL_ANNOUNCEMENT;
  22. $this_section = SECTION_COURSES;
  23. $nameTools = get_lang('ToolAnnouncement');
  24. /* ACCESS RIGHTS */
  25. api_protect_course_script(true);
  26. // Configuration settings
  27. $display_announcement_list = true;
  28. $display_form = false;
  29. $display_title_list = true;
  30. // Maximum title messages to display
  31. $maximum = '12';
  32. // Length of the titles
  33. $length = '36';
  34. // Database Table Definitions
  35. $tbl_courses = Database::get_main_table(TABLE_MAIN_COURSE);
  36. $tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION);
  37. $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
  38. $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
  39. $course_id = api_get_course_int_id();
  40. $_course = api_get_course_info_by_id($course_id);
  41. $group_id = api_get_group_id();
  42. $sessionId = api_get_session_id();
  43. api_protect_course_group(GroupManager::GROUP_TOOL_ANNOUNCEMENT);
  44. /* Tracking */
  45. Event::event_access_tool(TOOL_ANNOUNCEMENT);
  46. $announcement_id = isset($_GET['id']) ? intval($_GET['id']) : null;
  47. $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
  48. $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'list';
  49. $announcement_number = AnnouncementManager::getNumberAnnouncements();
  50. $homeUrl = api_get_self().'?action=list&'.api_get_cidreq();
  51. $content = '';
  52. $searchFormToString = '';
  53. switch ($action) {
  54. case 'move':
  55. /* Move announcement up/down */
  56. if (!empty($_GET['down'])) {
  57. $thisAnnouncementId = intval($_GET['down']);
  58. $sortDirection = "DESC";
  59. }
  60. if (!empty($_GET['up'])) {
  61. $thisAnnouncementId = intval($_GET['up']);
  62. $sortDirection = "ASC";
  63. }
  64. if (!empty($sortDirection)) {
  65. if (!in_array(trim(strtoupper($sortDirection)), array('ASC', 'DESC'))) {
  66. $sortDirection = 'ASC';
  67. }
  68. $announcementInfo = AnnouncementManager::get_by_id($course_id, $thisAnnouncementId);
  69. $sql = "SELECT DISTINCT announcement.id, announcement.display_order
  70. FROM $tbl_announcement announcement,
  71. $tbl_item_property itemproperty
  72. WHERE
  73. announcement.c_id = $course_id AND
  74. itemproperty.c_id = $course_id AND
  75. itemproperty.ref = announcement.id AND
  76. itemproperty.tool = '".TOOL_ANNOUNCEMENT."' AND
  77. itemproperty.visibility <> 2
  78. ORDER BY display_order $sortDirection";
  79. $result = Database::query($sql);
  80. $thisAnnouncementOrderFound = false;
  81. $thisAnnouncementOrder = null;
  82. while (list($announcementId, $announcementOrder) = Database::fetch_row($result)) {
  83. if ($thisAnnouncementOrderFound) {
  84. $nextAnnouncementId = $announcementId;
  85. $nextAnnouncementOrder = $announcementOrder;
  86. $sql = "UPDATE $tbl_announcement SET display_order = '$nextAnnouncementOrder'
  87. WHERE c_id = $course_id AND id = $thisAnnouncementId";
  88. Database::query($sql);
  89. $sql = "UPDATE $tbl_announcement SET display_order = '$thisAnnouncementOrder'
  90. WHERE c_id = $course_id AND id = $nextAnnouncementId";
  91. Database::query($sql);
  92. break;
  93. }
  94. // STEP 1 : FIND THE ORDER OF THE ANNOUNCEMENT
  95. if ($announcementId == $thisAnnouncementId) {
  96. $thisAnnouncementOrder = $announcementOrder;
  97. $thisAnnouncementOrderFound = true;
  98. }
  99. }
  100. Display::addFlash(Display::return_message(get_lang('AnnouncementMoved')));
  101. header('Location: '.$homeUrl);
  102. exit;
  103. }
  104. break;
  105. case 'view':
  106. $content = AnnouncementManager::display_announcement($announcement_id);
  107. break;
  108. case 'list':
  109. $htmlHeadXtra[] = api_get_jqgrid_js();
  110. $searchForm = new FormValidator(
  111. 'search_simple',
  112. 'post',
  113. api_get_self().'?'.api_get_cidreq(),
  114. '',
  115. array(),
  116. FormValidator::LAYOUT_INLINE
  117. );
  118. $searchForm->addElement('text', 'keyword', get_lang('Title'));
  119. $users = CourseManager::get_user_list_from_course_code(api_get_course_id(), $sessionId);
  120. $userList = array('' => '');
  121. if (!empty($users)) {
  122. foreach ($users as $user) {
  123. $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
  124. }
  125. }
  126. $users = [];
  127. $searchForm->addElement('select', 'user_id', get_lang('Users'), $userList);
  128. $searchForm->addButtonSearch(get_lang('Search'));
  129. $filterData = array();
  130. $keyword = '';
  131. $userIdToSearch = 0;
  132. if ($searchForm->validate()) {
  133. $filterData = $searchForm->getSubmitValues();
  134. $keyword = $filterData['keyword'];
  135. $userIdToSearch = $filterData['user_id'];
  136. }
  137. // jqgrid will use this URL to do the selects
  138. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_course_announcements&'.api_get_cidreq().'&title_to_search='.$keyword.'&user_id_to_search='.$userIdToSearch;
  139. $deleteUrl = api_get_path(WEB_AJAX_PATH).'announcement.ajax.php?a=delete_item&'.api_get_cidreq();
  140. $columns = array(get_lang('Title'), get_lang('By'), get_lang('LastUpdateDate'), get_lang('Actions'));
  141. // Column config
  142. $columnModel = array(
  143. array(
  144. 'name' => 'title',
  145. 'index' => 'title',
  146. 'width' => '300',
  147. 'align' => 'left',
  148. 'sortable' => 'false',
  149. ),
  150. array(
  151. 'name' => 'username',
  152. 'index' => 'username',
  153. 'width' => '100',
  154. 'align' => 'left',
  155. 'sortable' => 'false',
  156. ),
  157. array(
  158. 'name' => 'insert_date',
  159. 'index' => 'insert_date',
  160. 'width' => '200',
  161. 'align' => 'left',
  162. 'sortable' => 'false',
  163. ),
  164. array(
  165. 'name' => 'actions',
  166. 'index' => 'actions',
  167. 'width' => '150',
  168. 'align' => 'left',
  169. //'formatter' => 'action_formatter',
  170. 'sortable' => 'false',
  171. ),
  172. );
  173. // Autowidth
  174. $extra_params['autowidth'] = 'true';
  175. // height auto
  176. $extra_params['height'] = 'auto';
  177. $editOptions = '';
  178. if (api_is_allowed_to_edit()) {
  179. $extra_params['multiselect'] = true;
  180. $editOptions = '
  181. $("#announcements").jqGrid(
  182. "navGrid",
  183. "#announcements_pager",
  184. { edit: false, add: false, del: true },
  185. { height:280, reloadAfterSubmit:false }, // edit options
  186. { height:280, reloadAfterSubmit:false }, // add options
  187. { reloadAfterSubmit:false, url: "'.$deleteUrl.'" }, // del options
  188. { width:500 } // search options
  189. );
  190. ';
  191. }
  192. $content = '<script>
  193. $(function() {'.
  194. Display::grid_js(
  195. 'announcements',
  196. $url,
  197. $columns,
  198. $columnModel,
  199. $extra_params,
  200. array(),
  201. '',
  202. true
  203. ).$editOptions.'
  204. });
  205. </script>';
  206. $count = AnnouncementManager::getAnnouncements($stok, $announcement_number, true);
  207. if (empty($count)) {
  208. $html = '';
  209. if ((api_is_allowed_to_edit(false, true) ||
  210. (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) &&
  211. (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')
  212. ) {
  213. $html .= '<div id="no-data-view">';
  214. $html .= '<h3>'.get_lang('Announcements').'</h3>';
  215. $html .= Display::return_icon('valves.png', '', array(), 64);
  216. $html .= '<div class="controls">';
  217. $html .= Display::url(
  218. get_lang('AddAnnouncement'),
  219. api_get_self()."?".api_get_cidreq()."&action=add",
  220. array('class' => 'btn btn-primary')
  221. );
  222. $html .= '</div>';
  223. $html .= '</div>';
  224. } else {
  225. $html = Display::return_message(get_lang('NoAnnouncements'), 'warning');
  226. }
  227. $content = $html;
  228. } else {
  229. $content .= Display::grid_html('announcements');
  230. }
  231. break;
  232. case 'delete':
  233. /* Delete announcement */
  234. $id = intval($_GET['id']);
  235. if ($sessionId != 0 && api_is_allowed_to_session_edit(false, true) == false) {
  236. api_not_allowed();
  237. }
  238. if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
  239. AnnouncementManager::delete_announcement($_course, $id);
  240. Display::addFlash(Display::return_message(get_lang('AnnouncementDeleted')));
  241. }
  242. header('Location: '.$homeUrl);
  243. exit;
  244. break;
  245. case 'delete_all':
  246. if (api_is_allowed_to_edit()) {
  247. AnnouncementManager::delete_all_announcements($_course);
  248. Display::addFlash(Display::return_message(get_lang('AnnouncementDeletedAll')));
  249. header('Location: '.$homeUrl);
  250. exit;
  251. }
  252. break;
  253. case 'delete_attachment':
  254. $id = $_GET['id_attach'];
  255. if (api_is_allowed_to_edit()) {
  256. AnnouncementManager::delete_announcement_attachment_file($id);
  257. }
  258. header('Location: '.$homeUrl);
  259. exit;
  260. break;
  261. case 'showhide':
  262. if (!isset($_GET['isStudentView']) || $_GET['isStudentView'] != 'false') {
  263. if (isset($_GET['id']) && $_GET['id']) {
  264. if ($sessionId != 0 &&
  265. api_is_allowed_to_session_edit(false, true) == false
  266. ) {
  267. api_not_allowed();
  268. }
  269. if (!api_is_course_coach() ||
  270. api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $_GET['id'])
  271. ) {
  272. AnnouncementManager::change_visibility_announcement(
  273. $_course,
  274. $_GET['id']
  275. );
  276. Display::addFlash(Display::return_message(get_lang('VisibilityChanged')));
  277. header('Location: '.$homeUrl);
  278. exit;
  279. }
  280. }
  281. }
  282. break;
  283. case 'add':
  284. case 'modify':
  285. if ($sessionId != 0 &&
  286. api_is_allowed_to_session_edit(false, true) == false
  287. ) {
  288. api_not_allowed(true);
  289. }
  290. // DISPLAY ADD ANNOUNCEMENT COMMAND
  291. $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
  292. $url = api_get_self().'?action='.$action.'&id='.$id.'&'.api_get_cidreq();
  293. $form = new FormValidator(
  294. 'f1',
  295. 'post',
  296. $url,
  297. null,
  298. array('enctype' => 'multipart/form-data')
  299. );
  300. if (empty($id)) {
  301. $form_name = get_lang('AddAnnouncement');
  302. } else {
  303. $form_name = get_lang('ModifyAnnouncement');
  304. }
  305. $form->addElement('header', $form_name);
  306. $to = [];
  307. if (empty($group_id)) {
  308. if (isset($_GET['remind_inactive'])) {
  309. $email_ann = '1';
  310. $content_to_modify = sprintf(
  311. get_lang('RemindInactiveLearnersMailContent'),
  312. api_get_setting('siteName'),
  313. 7
  314. );
  315. $title_to_modify = sprintf(
  316. get_lang('RemindInactiveLearnersMailSubject'),
  317. api_get_setting('siteName')
  318. );
  319. } elseif (isset($_GET['remindallinactives']) && $_GET['remindallinactives'] === 'true') {
  320. // we want to remind inactive users. The $_GET['since'] parameter
  321. // determines which users have to be warned (i.e the users who have been inactive for x days or more
  322. $since = isset($_GET['since']) ? intval($_GET['since']) : 6;
  323. // getting the users who have to be reminded
  324. $to = Tracking:: getInactiveStudentsInCourse(
  325. api_get_course_int_id(),
  326. $since,
  327. $sessionId
  328. );
  329. // setting the variables for the form elements: the users who need to receive the message
  330. foreach ($to as &$user) {
  331. $user = 'USER:'.$user;
  332. }
  333. // setting the variables for the form elements: the message has to be sent by email
  334. $email_ann = '1';
  335. // setting the variables for the form elements: the title of the email
  336. $title_to_modify = sprintf(
  337. get_lang('RemindInactiveLearnersMailSubject'),
  338. api_get_setting('siteName')
  339. );
  340. // setting the variables for the form elements: the message of the email
  341. $content_to_modify = sprintf(
  342. get_lang('RemindInactiveLearnersMailContent'),
  343. api_get_setting('siteName'),
  344. $since
  345. );
  346. // when we want to remind the users who have never been active
  347. // then we have a different subject and content for the announcement
  348. if ($_GET['since'] == 'never') {
  349. $title_to_modify = sprintf(
  350. get_lang('RemindInactiveLearnersMailSubject'),
  351. api_get_setting('siteName')
  352. );
  353. $content_to_modify = get_lang(
  354. 'YourAccountIsActiveYouCanLoginAndCheckYourCourses'
  355. );
  356. }
  357. }
  358. $element = CourseManager::addUserGroupMultiSelect($form, array());
  359. $form->setRequired($element);
  360. if (!isset($announcement_to_modify)) {
  361. $announcement_to_modify = '';
  362. }
  363. $form->addElement(
  364. 'checkbox',
  365. 'email_ann',
  366. null,
  367. get_lang('EmailOption')
  368. );
  369. } else {
  370. if (!isset($announcement_to_modify)) {
  371. $announcement_to_modify = '';
  372. }
  373. $element = CourseManager::addGroupMultiSelect($form, $group_id, array());
  374. $form->setRequired($element);
  375. $form->addElement(
  376. 'checkbox',
  377. 'email_ann',
  378. null,
  379. get_lang('EmailOption')
  380. );
  381. }
  382. $announcementInfo = AnnouncementManager::get_by_id($course_id, $id);
  383. if (isset($announcementInfo) && !empty($announcementInfo)) {
  384. $to = AnnouncementManager::load_edit_users("announcement", $id);
  385. $defaults = array(
  386. 'title' => $announcementInfo['title'],
  387. 'content' => $announcementInfo['content'],
  388. 'id' => $announcementInfo['id'],
  389. 'users' => $to,
  390. );
  391. } else {
  392. $defaults = array();
  393. if (!empty($to)) {
  394. $defaults['users'] = $to;
  395. }
  396. }
  397. $form->addElement('text', 'title', get_lang('EmailTitle'));
  398. $form->addElement('hidden', 'id');
  399. $htmlTags = "<b>".get_lang('Tags')."</b><br /><br />";
  400. $tags = AnnouncementManager::get_tags();
  401. foreach ($tags as $tag) {
  402. $htmlTags .= "<b>".$tag."</b><br />";
  403. }
  404. $form->addLabel('', "<div class='alert alert-info'>".$htmlTags."</div>");
  405. $form->addHtmlEditor(
  406. 'content',
  407. get_lang('Description'),
  408. false,
  409. false,
  410. array('ToolbarSet' => 'Announcements')
  411. );
  412. $form->addElement('file', 'user_upload', get_lang('AddAnAttachment'));
  413. $form->addElement('textarea', 'file_comment', get_lang('FileComment'));
  414. $form->addElement('hidden', 'sec_token', $stok);
  415. if (empty($sessionId)) {
  416. $form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions'));
  417. }
  418. $config = api_get_configuration_value('announcements_hide_send_to_hrm_users');
  419. if ($config === false) {
  420. $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));
  421. }
  422. $form->addButtonSave(get_lang('ButtonPublishAnnouncement'));
  423. $form->setDefaults($defaults);
  424. if ($form->validate()) {
  425. $data = $form->getSubmitValues();
  426. $sendToUsersInSession = isset($data['send_to_users_in_session']) ? true : false;
  427. if (isset($id) && $id) {
  428. // there is an Id => the announcement already exists => update mode
  429. if ($ctok == $_POST['sec_token']) {
  430. $file_comment = $_POST['file_comment'];
  431. $file = $_FILES['user_upload'];
  432. AnnouncementManager::edit_announcement(
  433. $id,
  434. $data['title'],
  435. $data['content'],
  436. $data['users'],
  437. $file,
  438. $file_comment,
  439. $sendToUsersInSession
  440. );
  441. /* MAIL FUNCTION */
  442. if (isset($_POST['email_ann']) && empty($_POST['onlyThoseMails'])) {
  443. AnnouncementManager::send_email(
  444. $id,
  445. $sendToUsersInSession,
  446. isset($data['send_to_hrm_users'])
  447. );
  448. }
  449. Display::addFlash(
  450. Display::return_message(
  451. get_lang('AnnouncementModified'),
  452. 'success'
  453. )
  454. );
  455. header('Location: '.$homeUrl);
  456. exit;
  457. }
  458. } else {
  459. // Insert mode
  460. if ($ctok == $_POST['sec_token']) {
  461. $file = $_FILES['user_upload'];
  462. $file_comment = $data['file_comment'];
  463. if (empty($group_id)) {
  464. $insert_id = AnnouncementManager::add_announcement(
  465. $data['title'],
  466. $data['content'],
  467. $data['users'],
  468. $file,
  469. $file_comment,
  470. null,
  471. $sendToUsersInSession
  472. );
  473. } else {
  474. $insert_id = AnnouncementManager::add_group_announcement(
  475. $data['title'],
  476. $data['content'],
  477. array('GROUP:'.$group_id),
  478. $data['users'],
  479. $file,
  480. $file_comment,
  481. $sendToUsersInSession
  482. );
  483. }
  484. Display::addFlash(
  485. Display::return_message(
  486. get_lang('AnnouncementAdded'),
  487. 'success'
  488. )
  489. );
  490. /* MAIL FUNCTION */
  491. if (isset($data['email_ann']) && $data['email_ann']) {
  492. AnnouncementManager::send_email(
  493. $insert_id,
  494. $sendToUsersInSession
  495. );
  496. }
  497. header('Location: '.$homeUrl);
  498. exit;
  499. } // end condition token
  500. }
  501. }
  502. $content = $form->returnForm();
  503. break;
  504. }
  505. if (!empty($_GET['remind_inactive'])) {
  506. $to[] = 'USER:'.intval($_GET['remind_inactive']);
  507. }
  508. if (!empty($group_id)) {
  509. $group_properties = GroupManager:: get_group_properties($group_id);
  510. $interbreadcrumb[] = array(
  511. "url" => api_get_path(WEB_CODE_PATH)."group/group.php?".api_get_cidreq(),
  512. "name" => get_lang('Groups'),
  513. );
  514. $interbreadcrumb[] = array(
  515. "url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(),
  516. "name" => get_lang('GroupSpace').' '.$group_properties['name'],
  517. );
  518. }
  519. if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
  520. //we are not in the learning path
  521. Display::display_header($nameTools, get_lang('Announcements'));
  522. }
  523. // Tool introduction
  524. if (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath') {
  525. Display::display_introduction_section(TOOL_ANNOUNCEMENT);
  526. }
  527. // Actions
  528. $show_actions = false;
  529. $actionsLeft = '';
  530. if ((api_is_allowed_to_edit(false, true) ||
  531. (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) &&
  532. (empty($_GET['origin']) || $_GET['origin'] !== 'learnpath')
  533. ) {
  534. if (in_array($action, array('add', 'modify', 'view'))) {
  535. $actionsLeft .= "<a href='".api_get_self()."?".api_get_cidreq()."&origin=".$origin."'>".
  536. Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM)."</a>";
  537. } else {
  538. $actionsLeft .= "<a href='".api_get_self()."?".api_get_cidreq()."&action=add&origin=".$origin."'>".
  539. Display::return_icon('new_announce.png', get_lang('AddAnnouncement'), '', ICON_SIZE_MEDIUM)."</a>";
  540. }
  541. $show_actions = true;
  542. } else {
  543. if (in_array($action, array('view'))) {
  544. $actionsLeft .= "<a href='".api_get_self()."?".api_get_cidreq()."&origin=".$origin."'>".
  545. Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM)."</a>";
  546. }
  547. }
  548. if (api_is_allowed_to_edit() && $announcement_number > 1) {
  549. if (api_get_group_id() == 0) {
  550. if (!isset($_GET['action'])) {
  551. $actionsLeft .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete_all\" onclick=\"javascript:if(!confirm('".get_lang("ConfirmYourChoice")."')) return false;\">".
  552. Display::return_icon(
  553. 'delete_announce.png',
  554. get_lang('AnnouncementDeleteAll'),
  555. '',
  556. ICON_SIZE_MEDIUM
  557. )."</a>";
  558. }
  559. }
  560. }
  561. if ($show_actions) {
  562. echo Display::toolbarAction('toolbar', array($actionsLeft, $searchFormToString), 2, false);
  563. }
  564. echo $content;
  565. if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
  566. //we are not in learnpath tool
  567. Display::display_footer();
  568. }