userInfo.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../inc/global.inc.php';
  4. require_once 'userInfoLib.php';
  5. $allow = api_get_configuration_value('extra');
  6. if (empty($allow)) {
  7. exit;
  8. }
  9. $TABLECALHORAIRE = Database :: get_course_table(cal_horaire);
  10. $htmlHeadXtra[] = '<script>
  11. function show_image(image,width,height) {
  12. width = parseInt(width) + 20;
  13. height = parseInt(height) + 20;
  14. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
  15. }
  16. </script>';
  17. $editMainUserInfo = Security::remove_XSS($_REQUEST['editMainUserInfo']);
  18. $uInfo = $editMainUserInfo;
  19. $this_section = SECTION_COURSES;
  20. $nameTools = get_lang('Users');
  21. api_protect_course_script(true);
  22. $tool_info = api_get_tool_information_by_name(TOOL_USER);
  23. if (api_is_anonymous()) {
  24. api_not_allowed(true);
  25. }
  26. //prepare variables used in userInfoLib.php functions
  27. $TBL_USERINFO_DEF = Database:: get_course_table(TABLE_USER_INFO_DEF);
  28. $TBL_USERINFO_CONTENT = Database:: get_course_table(TABLE_USER_INFO_CONTENT);
  29. if ($tool_info['visibility'] == 1) {
  30. $interbreadcrumb[] = ['url' => 'user.php', 'name' => get_lang('Users')];
  31. }
  32. if ($origin != 'learnpath') { //so we are not in learnpath tool
  33. Display :: display_header($nameTools, "User");
  34. $origin = Security::remove_XSS($_GET['origin']);
  35. } else {
  36. ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH); ?>css/default.css" /> <?php
  37. }
  38. $currentCourse = api_get_course_id();
  39. $current_session_id = api_get_session_id();
  40. /*
  41. * data found in settings are :
  42. * $uid
  43. * $isAdmin
  44. * $isAdminOfCourse
  45. * $_configuration['main_database']
  46. * $currentCourseID
  47. */
  48. $userIdViewed = Security::remove_XSS($_REQUEST['uInfo']);
  49. /**
  50. * Connection layer between Chamilo and the current script.
  51. */
  52. $courseCode = api_get_course_id();
  53. $tbl_coursUser = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  54. $userIdViewer = api_get_user_id(); // id fo the user currently online
  55. $allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
  56. $allowedToEditDef = api_is_allowed_to_edit(null, true);
  57. $is_allowedToTrack = api_is_allowed_to_edit(null, true);
  58. $displayMode = "viewContentList";
  59. $removeDef = Security::remove_XSS($_GET['removeDef']);
  60. $editDef = Security::remove_XSS($_GET['editDef']);
  61. $moveUpDef = Security::remove_XSS($_GET['moveUpDef']);
  62. $moveDownDef = Security::remove_XSS($_GET['moveDownDef']);
  63. if ($allowedToEditDef) {
  64. if (!empty($_POST['submitDef'])) {
  65. if (!empty($_POST['id'])) {
  66. edit_cat_def($_POST['id'], $_POST['title'], $_POST['comment'], $_POST['nbline']);
  67. } else {
  68. create_cat_def($_POST['title'], $_POST['comment'], $_POST['nbline']);
  69. }
  70. $displayMode = "viewDefList";
  71. } elseif (!empty($_GET['removeDef'])) {
  72. remove_cat_def($_GET['removeDef'], true);
  73. $displayMode = "viewDefList";
  74. } elseif (!empty($_GET['editDef'])) {
  75. $displayMode = "viewDefEdit";
  76. } elseif (!empty($_POST['addDef'])) {
  77. $displayMode = "viewDefEdit";
  78. } elseif (!empty($_GET['moveUpDef'])) {
  79. move_cat_rank($_GET['moveUpDef'], "up");
  80. $displayMode = "viewDefList";
  81. } elseif (!empty($_GET['moveDownDef'])) {
  82. move_cat_rank($_GET['moveDownDef'], "down");
  83. $displayMode = "viewDefList";
  84. } elseif (!empty($_POST['viewDefList'])) {
  85. $displayMode = "viewDefList";
  86. } elseif (!empty($_GET['editMainUserInfo'])) {
  87. $userIdViewed = strval(intval($_GET['editMainUserInfo']));
  88. $displayMode = "viewMainInfoEdit";
  89. } elseif (!empty($_REQUEST['submitMainUserInfo'])) {
  90. $userIdViewed = strval(intval($_REQUEST['submitMainUserInfo']));
  91. if ($current_session_id) {
  92. } else {
  93. if (!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']) {
  94. $userProperties['status'] = 1;
  95. } else {
  96. $userProperties['status'] = 5;
  97. }
  98. if (!empty($_POST['promoteTutor']) && $_POST['promoteTutor']) {
  99. $userProperties['tutor'] = 1;
  100. } else {
  101. $userProperties['tutor'] = 0;
  102. }
  103. $userhoraire_name = $_POST['hor_name'];
  104. $course_id = $_course['real_id'];
  105. update_user_course_properties($userIdViewed, $courseCode, $userProperties, $userhoraire_name, $course_id);
  106. }
  107. $displayMode = "viewContentList";
  108. }
  109. }
  110. if ($allowedToEditContent) {
  111. if (isset($_POST['submitContent'])) {
  112. if ($_POST['cntId']) {
  113. // submit a content change
  114. edit_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
  115. } else {
  116. // submit a totally new content
  117. fill_new_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
  118. }
  119. $displayMode = "viewContentList";
  120. } elseif (!empty($_GET['editContent'])) {
  121. $displayMode = "viewContentEdit";
  122. $userIdViewed = $userIdViewed;
  123. }
  124. }
  125. if (api_is_allowed_to_edit(null, true)) {
  126. echo '<div class="actions">';
  127. if ($origin == 'users') {
  128. echo '<a href="user.php?'.api_get_cidreq().'&origin='.$origin.'">'.
  129. Display::return_icon('back.png', get_lang('BackUser'), '', ICON_SIZE_MEDIUM).'</a>';
  130. } else {
  131. echo '<a href="javascript:history.back(1)">'.
  132. Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
  133. }
  134. if (!is_numeric($_GET['editMainUserInfo'])) {
  135. if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
  136. echo '<a href="userInfo.php?'.api_get_cidreq(
  137. ).'&origin='.$origin.'&editMainUserInfo='.$userIdViewed.'">'.
  138. Display::return_icon('edit.png', get_lang('EditUser'), '', ICON_SIZE_MEDIUM).get_lang(
  139. 'EditUser'
  140. ).'</a>';
  141. }
  142. } else {
  143. if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
  144. echo '<a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&uInfo='.$userIdViewed.'">'.
  145. Display::return_icon(
  146. 'user.png',
  147. get_lang('ViewUser'),
  148. '',
  149. ICON_SIZE_MEDIUM
  150. ).get_lang('ViewUser').'</a>';
  151. }
  152. }
  153. echo '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&origin=user_course&student='.$userIdViewed.'&details=true&course='.$_course['id'].'">'.Display::return_icon('statistics.png', get_lang('UserStatistics'), '', ICON_SIZE_MEDIUM).get_lang('UserStatistics').'</a>';
  154. echo '</div>';
  155. } else {
  156. if ($tool_info['visibility'] == 1) {
  157. echo '<div class="actions">';
  158. if ($origin == 'users') {
  159. echo '<a href="user.php?'.api_get_cidreq().'&origin='.$origin.'">'.
  160. Display::return_icon(
  161. 'back.png',
  162. get_lang('BackUser'),
  163. '',
  164. ICON_SIZE_MEDIUM
  165. ).'</a>';
  166. } else {
  167. echo '<a href="javascript:history.back(1)">'.Display::return_icon(
  168. 'back.png',
  169. get_lang('Back'),
  170. '',
  171. ICON_SIZE_MEDIUM
  172. ).'</a>';
  173. }
  174. echo '</div>';
  175. }
  176. }
  177. // get information about user id viewed
  178. $user_info_viewed = api_get_user_info($userIdViewed);
  179. $is_session_course_coach = UserManager::is_session_course_coach(
  180. $userIdViewed,
  181. $_course['sysCode'],
  182. $current_session_id
  183. );
  184. if ($displayMode == "viewDefEdit") {
  185. /* CATEGORIES DEFINITIONS : EDIT */
  186. $catToEdit = get_cat_def($_GET['editDef']);
  187. $edit_heading_form = new FormValidator('edit_heading_form');
  188. $edit_heading_form->addElement('hidden', 'id');
  189. $edit_heading_form->add_textfield('title', get_lang('Title'));
  190. $edit_heading_form->addElement('textarea', 'comment', get_lang('Comment'), ['cols' => 60, 'rows' => 4]);
  191. $possible_line_nrs[1] = '1 '.get_lang('Line');
  192. $possible_line_nrs[3] = '3 '.get_lang('Lines');
  193. $possible_line_nrs[5] = '5 '.get_lang('Lines');
  194. $possible_line_nrs[10] = '10 '.get_lang('Lines');
  195. $possible_line_nrs[15] = '15 '.get_lang('Lines');
  196. $edit_heading_form->addElement('select', 'nbline', get_lang('LineNumber'), $possible_line_nrs);
  197. $edit_heading_form->addElement('submit', 'submitDef', get_lang('Ok'));
  198. $edit_heading_form->setDefaults($catToEdit);
  199. $edit_heading_form->display();
  200. } elseif ($displayMode == "viewDefList") {
  201. $catList = get_cat_def_list();
  202. if ($catList) {
  203. foreach ($catList as $thisCat) {
  204. // displays Title and comments
  205. echo "<p>", "<b>".htmlize($thisCat['title'])."</b><br>\n", "<i>".htmlize($thisCat['comment'])."</i>\n", "</p>";
  206. // displays lines
  207. echo "<blockquote>\n", "<font color=\"gray\">\n";
  208. for ($i = 1; $i <= $thisCat['nbline']; $i++) {
  209. echo "<br>__________________________________________\n";
  210. }
  211. echo "</font>\n", "</blockquote>\n";
  212. // displays commands
  213. echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&removeDef=", $thisCat['catId'], "\">", "<img src=\"../img/delete.gif\" border=\"0\" alt=\"".get_lang('Remove')."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset))."')) return false;\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&editDef=", $thisCat['catId'], "\">", "<img src=\"../img/edit.gif\" border=\"0\" alt=\"".get_lang('Edit')."\" />", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveUpDef=", $thisCat['catId'], "\">", "<img src=\"../img/up.gif\" border=\"0\" alt=\"".get_lang('MoveUp')."\">", "</a>", "<a href=\"".api_get_self()."?".api_get_cidreq()."&moveDownDef=", $thisCat['catId'], "\">", "<img src=\"../img/down.gif\" border=\"0\" alt=\"".get_lang('MoveDown')."\">", "</a>\n";
  214. } // end for each
  215. } // end if ($catList)
  216. echo "<center>\n",
  217. "<form method=\"post\" action=\"".api_get_self()."\">",
  218. "<input type=\"submit\" name=\"addDef\" class=\"plus\" value=\"".get_lang('AddNewHeading')."\" />",
  219. "</form>\n",
  220. "<center>\n";
  221. } elseif ($displayMode == 'viewContentEdit') {
  222. /* CATEGORIES CONTENTS : EDIT */
  223. $catToEdit = get_cat_content($userIdViewed, $_GET['editContent']);
  224. $content_heading_form = new FormValidator('content_heading_form');
  225. $content_heading_form->addElement('hidden', 'cntId');
  226. $content_heading_form->addElement('hidden', 'catId');
  227. $content_heading_form->addElement('hidden', 'uInfo');
  228. $content_heading_form->addElement('static', null, $catToEdit['title'], htmlize($catToEdit['comment']));
  229. if ($catToEdit['nbline'] == 1) {
  230. $content_heading_form->addElement('text', 'content', null, ['size' => 80]);
  231. } else {
  232. $content_heading_form->addElement(
  233. 'textarea',
  234. 'content',
  235. null,
  236. ['cols' => 60, 'rows' => $catToEdit['nbline']]
  237. );
  238. }
  239. $content_heading_form->addElement('submit', 'submitContent', get_lang('Ok'));
  240. $defaults = $catToEdit;
  241. $defaults['cntId'] = $catToEdit['contentId'];
  242. $defaults['uInfo'] = $userIdViewed;
  243. $content_heading_form->setDefaults($defaults);
  244. $content_heading_form->display();
  245. } elseif ($displayMode == "viewMainInfoEdit") {
  246. $mainUserInfo = api_get_user_info($userIdViewed);
  247. if ($mainUserInfo) {
  248. ($mainUserInfo['status'] == COURSEMANAGER) ? $courseAdminChecked = "checked" : $courseAdminChecked = "";
  249. $image_array = UserManager::get_user_picture_path_by_id($userIdViewed, 'web', false, true);
  250. // get the path,width and height from original picture
  251. $big_image = $image_array['dir'].'big_'.$image_array['file'];
  252. $big_image_size = api_getimagesize($big_image);
  253. $big_image_width = $big_image_size['width'];
  254. $big_image_height = $big_image_size['height'];
  255. $url_big_image = $big_image.'?rnd='.time();
  256. if ($image_array['file'] == 'unknown.jpg') {
  257. echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
  258. } else {
  259. echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
  260. }
  261. echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
  262. "<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
  263. "<table width=\"80%\" border=\"0\">",
  264. "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
  265. "<td align=\"left\">", get_lang('Name'), "</td>\n",
  266. "<td width=\"100px\" align=\"left\">", get_lang('Schedule'), "</td>\n";
  267. echo "</tr>\n",
  268. "<tr align=\"center\">",
  269. "<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
  270. "<td align=\"left\"><b>", $mainUserInfo['official_code'], "</td>";
  271. //récupérer horaire de l'élève
  272. $course_id = $_course['real_id']; ?>
  273. <SELECT NAME='hor_name'>
  274. <OPTION VALUE='<?php echo $mainUserInfo['official_code']; ?>'><?php echo get_lang('select_calendar_student'); ?></OPTION>
  275. <?php
  276. $sql = "SELECT distinct name FROM $TABLECALHORAIRE
  277. where c_id = $course_id ";
  278. $result2 = Database::query($sql);
  279. while ($row = Database::fetch_array($result2)) {
  280. $horaire_name = $row["name"]; ?>
  281. <OPTION VALUE='<?php echo $horaire_name; ?>'><?php echo "$horaire_name "; ?></OPTION>
  282. <?php
  283. } ?>
  284. </SELECT>
  285. <?php
  286. echo'<p></p> ';
  287. if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed)) {
  288. } else {
  289. echo "<td>", get_lang('CourseManager'), "</td>\n";
  290. }
  291. echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
  292. if (api_get_setting('show_email_addresses') == 'true') {
  293. echo "<p>".Display:: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
  294. }
  295. if (api_get_setting('extended_profile') == 'true') {
  296. if (!empty($mainUserInfo['competences'])) {
  297. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
  298. }
  299. if (!empty($mainUserInfo['diplomas'])) {
  300. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
  301. }
  302. if (!empty($mainUserInfo['teach'])) {
  303. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
  304. }
  305. if (!empty($mainUserInfo['openarea'])) {
  306. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
  307. }
  308. if (!empty($mainUserInfo['competences'])) {
  309. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
  310. }
  311. }
  312. } else {
  313. Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
  314. }
  315. } elseif ($displayMode == "viewContentList") {
  316. // default display
  317. $virtual_course_code = $_GET["virtual_course"];
  318. if (isset($virtual_course_code)) {
  319. $courseCode = $virtual_course_code;
  320. $allowedToEditDef = false;
  321. }
  322. $mainUserInfo = api_get_user_info($userIdViewed);
  323. if ($mainUserInfo) {
  324. $image_array = UserManager::get_user_picture_path_by_id($userIdViewed, 'web', false, true);
  325. // get the path,width and height from original picture
  326. $big_image = $image_array['dir'].'big_'.$image_array['file'];
  327. $big_image_size = api_getimagesize($big_image);
  328. $big_image_width = $big_image_size['width'];
  329. $big_image_height = $big_image_size['height'];
  330. $url_big_image = $big_image.'?rnd='.time();
  331. if ($image_array['file'] == 'unknown.jpg') {
  332. echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
  333. } else {
  334. echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
  335. }
  336. // is the user online?
  337. $online = '';
  338. if (user_is_online($userIdViewed)) {
  339. $online = Display::return_icon('online.gif', get_lang('OnLine'), ['style' => 'with="8"; height="8"']);
  340. }
  341. // DISPLAY TABLE HEADING
  342. if ($origin == 'learnpath') {
  343. $allowedToEditDef = false;
  344. $is_allowedToTrack = false;
  345. }
  346. echo "<table width=\"80%\" border=\"0\">",
  347. "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
  348. "<td align=\"left\">".get_lang('Name')."</td>\n",
  349. "<td width=\"20%\" align=\"left\">".get_lang('Description')."</td>\n",
  350. "<td width=\"100px\" align=\"left\">", get_lang('OfficialCode'), "</td>\n";
  351. echo "</tr>\n",
  352. "<tr align=\"center\">\n",
  353. "<td align=\"left\"><b>".$online.' '.htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName']))."</b></td>\n",
  354. "<td align=\"left\"><b>", $mainUserInfo['official_code'], "</td>";
  355. // DISPLAY TABLE CONTENT
  356. if ($current_session_id) {
  357. if ($user_info_viewed['status'] == COURSEMANAGER) {
  358. echo "<td> - </td>\n";
  359. }
  360. } else {
  361. if ($user_info_viewed['status'] == STUDENT) {
  362. echo "<td> - </td>\n";
  363. } else {
  364. echo "<td> - </td>\n";
  365. }
  366. }
  367. echo "</tr></table>";
  368. if (api_get_setting("show_email_addresses") == "true") {
  369. echo "<p>".Display::encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
  370. }
  371. if (api_get_setting('extended_profile') == 'true') {
  372. if (!empty($mainUserInfo['competences'])) {
  373. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
  374. }
  375. if (!empty($mainUserInfo['diplomas'])) {
  376. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
  377. }
  378. if (!empty($mainUserInfo['teach'])) {
  379. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
  380. }
  381. if (!empty($mainUserInfo['openarea'])) {
  382. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
  383. }
  384. if (!empty($mainUserInfo['competences'])) {
  385. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
  386. }
  387. }
  388. } else {
  389. Display::return_message(get_lang('ThisStudentIsSubscribeThroughASession'), 'normal');
  390. }
  391. if (api_get_setting('allow_user_headings') == 'true' && $allowedToEditDef) {
  392. // only course administrators see this line
  393. echo "<div align=right>",
  394. "<form method=\"post\" action=\"".api_get_self()."\">",
  395. get_lang('CourseAdministratorOnly')," : ",
  396. "<input type=\"submit\" class=\"save\" name=\"viewDefList\" value=\"".get_lang('DefineHeadings')."\" />",
  397. "</form>",
  398. "<hr noshade size=\"1\" style=\"color:#99CCFF\">",
  399. "</div>\n";
  400. }
  401. $catList = get_course_user_info($userIdViewed);
  402. if ($catList) {
  403. foreach ($catList as $thisCat) {
  404. // Category title
  405. echo "<p><b>", $thisCat['title'], "</b></p>\n";
  406. // Category content
  407. echo "<blockquote>\n";
  408. if ($thisCat['content']) {
  409. echo htmlize($thisCat['content'])."\n";
  410. } else {
  411. echo "....";
  412. }
  413. // Edit command
  414. if ($allowedToEditContent) {
  415. echo "<br /><br />\n",
  416. "<a href=\"".api_get_self()."?".api_get_cidreq(
  417. )."&editContent=", $thisCat['catId'], "&uInfo=", $userIdViewed, "\">",
  418. "<img src=\"../img/edit.gif\" border=\"0\" alt=\"edit\">",
  419. "</a>\n";
  420. }
  421. echo "</blockquote>\n";
  422. }
  423. }
  424. }
  425. Display::display_footer();