announcements.php 23 KB

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