userInfo.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <?php // $Id: userInfo.php 20951 2009-05-23 19:07:59Z ivantcholakov $
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays info about one specific user, specified through
  5. * a GET parameter, e.g. uInfo=2
  6. *
  7. * @todo clean up script in clean sections:
  8. * (1) gather information
  9. * (2) tool logic
  10. * (3) display
  11. * @author original author (unknown, probably thomas,hugues,moosh)
  12. * @author Roan Embrechts, minor modification: virtual courses support
  13. * @author Julio Montoya Armas Several fixes
  14. * @package chamilo.user
  15. */
  16. /* INIT SECTION */
  17. // name of the language file that needs to be included
  18. $language_file = array ('registration', 'userInfo');
  19. require_once '../inc/global.inc.php';
  20. require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
  21. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  22. require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
  23. $htmlHeadXtra[] = '<script type="text/javascript">
  24. function show_image(image,width,height) {
  25. width = parseInt(width) + 20;
  26. height = parseInt(height) + 20;
  27. window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
  28. }
  29. </script>';
  30. $editMainUserInfo = Security::remove_XSS($_REQUEST['editMainUserInfo']);
  31. $uInfo = $editMainUserInfo;
  32. $this_section = SECTION_COURSES;
  33. $nameTools = get_lang('Users');
  34. api_protect_course_script(true);
  35. $tool_info = api_get_tool_information_by_name(TOOL_USER);
  36. if(api_is_anonymous()) {
  37. api_not_allowed(true);
  38. }
  39. //prepare variables used in userInfoLib.php functions
  40. $TBL_USERINFO_DEF = Database :: get_course_table(TABLE_USER_INFO);
  41. $TBL_USERINFO_CONTENT = Database :: get_course_table(TABLE_USER_INFO_CONTENT);
  42. if ($tool_info['visibility'] == 1 ) {
  43. $interbreadcrumb[] = array ('url' => 'user.php', 'name' => get_lang('Users'));
  44. }
  45. if ($origin != 'learnpath')
  46. { //so we are not in learnpath tool
  47. Display :: display_header($nameTools, "User");
  48. }
  49. else
  50. {
  51. ?> <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CODE_PATH);?>css/default.css" /> <?php
  52. }
  53. $currentCourse = $currentCourseID;
  54. // api_display_tool_title(get_lang("Users"));
  55. /*
  56. * data found in settings are :
  57. * $uid
  58. * $isAdmin
  59. * $isAdminOfCourse
  60. * $_configuration['main_database']
  61. * $currentCourseID
  62. */
  63. //$userIdViewed = $uInfo; // Id of the user we want to view coming from the user.php
  64. //get information about one user
  65. $userIdViewed = Security::remove_XSS($_REQUEST['uInfo']);
  66. /*
  67. -----------------------------------------------------------
  68. Connection layer between Dokeos and the current script
  69. -----------------------------------------------------------
  70. */
  71. $mainDB = $_configuration['main_database'];
  72. $courseCode = $currentCourseID = $_course['sysCode'];
  73. $tbl_coursUser = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
  74. $userIdViewer = $_user['user_id']; // id fo the user currently online
  75. //$userIdViewed = $_GET['userIdViewed']; // Id of the user we want to view
  76. $allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
  77. $allowedToEditDef = api_is_allowed_to_edit();
  78. $is_allowedToTrack = api_is_allowed_to_edit() && $_configuration['tracking_enabled'];
  79. // Library connection
  80. require_once ("userInfoLib.php");
  81. /*
  82. ==============================================================================
  83. FUNCTIONS
  84. ==============================================================================
  85. */
  86. /*
  87. ==============================================================================
  88. COMMANDS SECTION
  89. ==============================================================================
  90. */
  91. $displayMode = "viewContentList";
  92. $removeDef = Security::remove_XSS($_GET['removeDef']);
  93. $editDef = Security::remove_XSS($_GET['editDef']);
  94. $moveUpDef = Security::remove_XSS($_GET['moveUpDef']);
  95. $moveDownDef = Security::remove_XSS($_GET['moveDownDef']);
  96. if ($allowedToEditDef)
  97. {
  98. if (!empty($_POST['submitDef']))
  99. {
  100. if (!empty($_POST['id']))
  101. {
  102. edit_cat_def($_POST['id'], $_POST['title'], $_POST['comment'], $_POST['nbline']);
  103. }
  104. else
  105. {
  106. create_cat_def($_POST['title'], $_POST['comment'], $_POST['nbline']);
  107. }
  108. $displayMode = "viewDefList";
  109. }
  110. elseif (!empty($_GET['removeDef']))
  111. {
  112. remove_cat_def($_GET['removeDef'], true);
  113. $displayMode = "viewDefList";
  114. }
  115. elseif (!empty($_GET['editDef']))
  116. {
  117. $displayMode = "viewDefEdit";
  118. }
  119. elseif (!empty ($_POST['addDef']))
  120. {
  121. $displayMode = "viewDefEdit";
  122. }
  123. elseif (!empty($_GET['moveUpDef']))
  124. {
  125. move_cat_rank($_GET['moveUpDef'], "up");
  126. $displayMode = "viewDefList";
  127. }
  128. elseif (!empty($_GET['moveDownDef']))
  129. {
  130. move_cat_rank($_GET['moveDownDef'], "down");
  131. $displayMode = "viewDefList";
  132. }
  133. elseif (!empty($_POST['viewDefList']))
  134. {
  135. $displayMode = "viewDefList";
  136. }
  137. elseif (!empty($_GET['editMainUserInfo']))
  138. {
  139. $userIdViewed = strval(intval($_GET['editMainUserInfo']));
  140. $displayMode = "viewMainInfoEdit";
  141. }
  142. elseif (!empty($_REQUEST['submitMainUserInfo']))
  143. {
  144. /*
  145. if (isset ($_REQUEST['submitMainUserInfo']))
  146. {
  147. */
  148. $userIdViewed = strval(intval($_REQUEST['submitMainUserInfo']));
  149. /*
  150. //is teacher
  151. $promoteCourseAdmin=$_REQUEST['promoteCourseAdmin'];
  152. $userProperties['status'] = 5;
  153. if ($promoteCourseAdmin)
  154. {
  155. $userProperties['status'] = 1;
  156. }
  157. // deprecated feature
  158. // is coach
  159. if (isset ($_REQUEST['promoteTutor']))
  160. {
  161. $promoteTutor=$_REQUEST['promoteTutor'];
  162. $userProperties['tutor'] = 0;
  163. if ($promoteTutor)
  164. {
  165. $userProperties['tutor'] = 1;
  166. }
  167. }
  168. // role is a string
  169. if (isset ($_REQUEST['role']))
  170. {
  171. $role=$_REQUEST['role'];
  172. $userProperties['role'] = $role;
  173. }
  174. */
  175. //get information about one user - task #3009
  176. if(!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']){
  177. $userProperties['status'] = 1;
  178. }else{
  179. $userProperties['status'] = 5;
  180. }
  181. if(!empty($_POST['promoteTutor']) && $_POST['promoteTutor']){
  182. $userProperties['tutor'] = 1;
  183. }else{
  184. $userProperties['tutor'] = 0;
  185. }
  186. $userProperties['role'] = $_POST['role'];
  187. update_user_course_properties($userIdViewed, $courseCode, $userProperties);
  188. $displayMode = "viewContentList";
  189. }
  190. }
  191. // COMMON COMMANDS
  192. if ($allowedToEditContent)
  193. {
  194. if (isset($_POST['submitContent']))
  195. {
  196. if ($_POST['cntId']) // submit a content change
  197. {
  198. edit_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
  199. }
  200. else // submit a totally new content
  201. {
  202. fill_new_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
  203. }
  204. $displayMode = "viewContentList";
  205. }
  206. elseif (!empty($_GET['editContent']))
  207. {
  208. $displayMode = "viewContentEdit";
  209. $userIdViewed = $userIdViewed;
  210. }
  211. }
  212. /* DISPLAY MODES */
  213. // Back button for each display mode (Top)
  214. if (api_is_allowed_to_edit()) {
  215. echo '<div class="actions">';
  216. echo '<a href="user.php?'.api_get_cidreq().'&amp;origin='.$origin.'">'.Display::return_icon('back.png',get_lang('BackUser')).get_lang('BackUser').'</a>';
  217. if (!is_numeric($_GET['editMainUserInfo'])) {
  218. echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;editMainUserInfo='.$userIdViewed.'">'.Display::return_icon('edit.gif',get_lang('EditUser')).get_lang('EditUser').'</a>';
  219. } else {
  220. echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;uInfo='.$userIdViewed.'">'.Display::return_icon('members.gif',get_lang('ViewUser')).get_lang('ViewUser').'</a>';
  221. }
  222. echo '<a href="../mySpace/myStudents.php?'.api_get_cidreq().'&amp;origin=user_course&amp;student='.$userIdViewed.'&amp;details=true&amp;course='.$_course['id'].'">'.Display::return_icon('statistics.gif',get_lang('UserStatistics')).get_lang('UserStatistics').'</a>';
  223. echo '</div>';
  224. } else {
  225. if ($tool_info['visibility'] == 1 ) {
  226. echo '<div class="actions">';
  227. echo '<a href="user.php?'.api_get_cidreq().'&amp;origin='.$origin.'">'.Display::return_icon('back.png',get_lang('BackUser')).get_lang('BackUser').'</a>';
  228. echo '</div>';
  229. }
  230. }
  231. if ($displayMode == "viewDefEdit")
  232. {
  233. /*>>>>>>>>>>>> CATEGORIES DEFINITIONS : EDIT <<<<<<<<<<<<*/
  234. $catToEdit = get_cat_def($_GET['editDef']);
  235. $edit_heading_form = new FormValidator('edit_heading_form');
  236. $edit_heading_form->addElement('hidden', 'id');
  237. $edit_heading_form->add_textfield('title', get_lang('Title'));
  238. $edit_heading_form->addElement('textarea', 'comment', get_lang('Comment'), array ('cols' => 60, 'rows' => 4));
  239. $possible_line_nrs[1] = '1 '.get_lang('Line');
  240. $possible_line_nrs[3] = '3 '.get_lang('Lines');
  241. $possible_line_nrs[5] = '5 '.get_lang('Lines');
  242. $possible_line_nrs[10] = '10 '.get_lang('Lines');
  243. $possible_line_nrs[15] = '15 '.get_lang('Lines');
  244. $edit_heading_form->addElement('select', 'nbline', get_lang('LineNumber'), $possible_line_nrs);
  245. $edit_heading_form->addElement('submit', 'submitDef', get_lang('Ok'));
  246. $edit_heading_form->setDefaults($catToEdit);
  247. $edit_heading_form->display();
  248. }
  249. elseif ($displayMode == "viewDefList")
  250. {
  251. /*>>>>>>>>>>>> CATEGORIES DEFINITIONS : LIST <<<<<<<<<<<<*/
  252. $catList = get_cat_def_list();
  253. if ($catList)
  254. {
  255. foreach ($catList as $thisCat)
  256. {
  257. // displays Title and comments
  258. echo "<p>", "<b>".htmlize($thisCat['title'])."</b><br>\n", "<i>".htmlize($thisCat['comment'])."</i>\n", "</p>";
  259. // displays lines
  260. echo "<blockquote>\n", "<font color=\"gray\">\n";
  261. for ($i = 1; $i <= $thisCat['nbline']; $i ++)
  262. {
  263. echo "<br>__________________________________________\n";
  264. }
  265. echo "</font>\n", "</blockquote>\n";
  266. // displays commands
  267. 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";
  268. } // end for each
  269. } // end if ($catList)
  270. echo "<center>\n",
  271. "<form method=\"post\" action=\"".api_get_self()."\">",
  272. "<input type=\"submit\" name=\"addDef\" class=\"plus\" value=\"".get_lang('AddNewHeading')."\" />",
  273. "</form>\n",
  274. "<center>\n";
  275. }
  276. elseif ($displayMode == "viewContentEdit")
  277. {
  278. /*>>>>>>>>>>>> CATEGORIES CONTENTS : EDIT <<<<<<<<<<<<*/
  279. $catToEdit = get_cat_content($userIdViewed, $_GET['editContent']);
  280. $content_heading_form = new FormValidator('content_heading_form');
  281. $content_heading_form->addElement('hidden', 'cntId');
  282. $content_heading_form->addElement('hidden', 'catId');
  283. $content_heading_form->addElement('hidden', 'uInfo');
  284. $content_heading_form->addElement('static', null, $catToEdit['title'], htmlize($catToEdit['comment']));
  285. if ($catToEdit['nbline'] == 1)
  286. {
  287. $content_heading_form->addElement('text', 'content', null, array ('size' => 80));
  288. }
  289. else
  290. {
  291. $content_heading_form->addElement('textarea', 'content', null, array ('cols' => 60, 'rows' => $catToEdit['nbline']));
  292. }
  293. $content_heading_form->addElement('submit', 'submitContent', get_lang('Ok'));
  294. $defaults = $catToEdit;
  295. $defaults['cntId'] = $catToEdit['contentId'];
  296. $defaults['uInfo'] = $userIdViewed;
  297. $content_heading_form->setDefaults($defaults);
  298. $content_heading_form->display();
  299. }
  300. elseif ($displayMode == "viewMainInfoEdit")
  301. {
  302. /*>>>>>>>>>>>> CATEGORIES MAIN INFO : EDIT <<<<<<<<<<<<*/
  303. $mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
  304. if ($mainUserInfo)
  305. {
  306. ($mainUserInfo['status'] == 1) ? $courseAdminChecked = "checked" : $courseAdminChecked = "";
  307. ($mainUserInfo['tutor_id'] == 1) ? $tutorChecked = "checked" : $tutorChecked = "";
  308. $image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
  309. // get the path,width and height from original picture
  310. $big_image = $image_array['dir'].'big_'.$image_array['file'];
  311. $big_image_size = api_getimagesize($big_image);
  312. $big_image_width= $big_image_size[0];
  313. $big_image_height= $big_image_size[1];
  314. $url_big_image = $big_image.'?rnd='.time();
  315. if ($image_array['file']=='unknown.jpg') {
  316. echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
  317. } else {
  318. echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
  319. }
  320. //"<td>", get_lang('Tutor'), "</td>\n",
  321. echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
  322. "<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
  323. "<table width=\"80%\" border=\"0\">",
  324. "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
  325. "<td align=\"left\">", get_lang('Name'), "</td>\n",
  326. "<td width=\"100px\" align=\"left\">", get_lang('Description'), "</td>\n",
  327. //"<td>", get_lang('Tutor'), "</td>\n",
  328. "<td>", get_lang('CourseManager'), "</td>\n",
  329. "</tr>\n",
  330. "<tr align=\"center\">",
  331. "<td align=\"left\"><b>", htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName'])), "</b></td>\n",
  332. "<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\" /></td>";
  333. //"<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, " /></td>";
  334. if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed))
  335. {
  336. echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteCourseAdmin\" value=\"1\"", $courseAdminChecked, " /></td>\n";
  337. }
  338. else
  339. {
  340. echo "<td>", get_lang('CourseManager'), "</td>\n";
  341. }
  342. echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
  343. echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
  344. if (api_get_setting('extended_profile') == 'true')
  345. {
  346. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
  347. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
  348. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
  349. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
  350. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
  351. }
  352. }
  353. else
  354. {
  355. Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
  356. }
  357. }
  358. elseif ($displayMode == "viewContentList") // default display
  359. {
  360. /*>>>>>>>>>>>> CATEGORIES CONTENTS : LIST <<<<<<<<<<<<*/
  361. $virtual_course_code = $_GET["virtual_course"];
  362. if (isset ($virtual_course_code))
  363. {
  364. $courseCode = $virtual_course_code;
  365. //not supported yet: editing users of virtual courses
  366. $allowedToEditDef = false;
  367. }
  368. $mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
  369. if ($mainUserInfo)
  370. {
  371. $image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
  372. // get the path,width and height from original picture
  373. $big_image = $image_array['dir'].'big_'.$image_array['file'];
  374. $big_image_size = api_getimagesize($big_image);
  375. $big_image_width= $big_image_size[0];
  376. $big_image_height= $big_image_size[1];
  377. $url_big_image = $big_image.'?rnd='.time();
  378. if ($image_array['file']=='unknown.jpg') {
  379. echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
  380. } else {
  381. echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
  382. }
  383. // is the user online ?
  384. $users_online = WhoIsOnline(30);
  385. foreach ($users_online as $online) {
  386. if (in_array($userIdViewed, $online)) {
  387. $online = Display::return_icon('online.gif', get_lang('OnLine'),array('style'=>'with="8"; height="8"'));
  388. break;
  389. }
  390. else
  391. {
  392. $online ='';
  393. }
  394. }
  395. //DISPLAY TABLE HEADING
  396. if ($origin == 'learnpath') { $allowedToEditDef=false; $is_allowedToTrack=false; }
  397. //"<td>",get_lang('Tutor'),"</td>\n",
  398. echo "<table width=\"80%\" border=\"0\">",
  399. "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
  400. "<td align=\"left\">",get_lang('Name'),"</td>\n",
  401. "<td width=\"20%\" align=\"left\">",get_lang('Description'),"</td>\n",
  402. //"<td>",get_lang('Tutor'),"</td>\n",
  403. "<td>",get_lang('CourseManager'),"</td>\n",
  404. ($allowedToEditDef?"<td>".get_lang('Edit')."</td>\n":""),
  405. ($is_allowedToTrack?"<td>".get_lang('Tracking')."</td>\n":""),
  406. "</tr>\n",
  407. "<tr align=\"center\">\n",
  408. "<td align=\"left\"><b>".$online.' '.htmlize(api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName']))."</b></td>\n",
  409. "<td align=\"left\">".htmlize($mainUserInfo['role'])."</td>";
  410. //DISPLAY TABLE CONTENT
  411. // deprecated feature
  412. if ($mainUserInfo['tutor_id'] == 1)
  413. {
  414. //echo "<td>",get_lang('Tutor'),"</td>\n";
  415. }
  416. else
  417. {
  418. //echo "<td> - </td>\n";
  419. }
  420. if ($mainUserInfo['status'] == 1)
  421. {
  422. echo "<td>",get_lang('CourseManager'),"</td>";
  423. }
  424. else
  425. {
  426. echo "<td> - </td>\n";
  427. }
  428. if ($allowedToEditDef)
  429. {
  430. echo "<td>",
  431. "<a href=\"".api_get_self()."?".api_get_cidreq()."&editMainUserInfo=$userIdViewed\">",
  432. "<img border=\"0\" alt=\"\" src=\"../img/edit.gif\" />",
  433. "</a>",
  434. "</td>";
  435. }
  436. if ($is_allowedToTrack)
  437. {
  438. echo "<td>",
  439. "<a href=\"../mySpace/myStudents.php?".api_get_cidreq()."&origin=user_course&student=$userIdViewed&details=true&course=".$_course['id']."\">",
  440. "<img border=\"0\" alt=\"".get_lang('Tracking')." : $userIdViewed\" src=\"../img/statistics.gif\" />",
  441. "</a>",
  442. "</td>";
  443. }
  444. echo "</tr>",
  445. "</table>";
  446. //"<p><a href=\"mailto:",$mainUserInfo['email'],"\">",$mainUserInfo['email'],"</a>",
  447. if (api_get_setting("show_email_addresses") == "true")
  448. {
  449. echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
  450. }
  451. else
  452. {
  453. if (api_is_allowed_to_edit())
  454. {
  455. echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
  456. }
  457. }
  458. if (api_get_setting('extended_profile') == 'true')
  459. {
  460. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
  461. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
  462. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
  463. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
  464. echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
  465. }
  466. }
  467. else{
  468. Display :: display_normal_message(get_lang('ThisStudentIsSubscribeThroughASession'));
  469. }
  470. if (api_get_setting('allow_user_headings') == 'true' && $allowedToEditDef) // only course administrators see this line
  471. {
  472. echo "<div align=right>",
  473. "<form method=\"post\" action=\"".api_get_self()."\">",
  474. get_lang('CourseAdministratorOnly')," : ",
  475. "<input type=\"submit\" class=\"save\" name=\"viewDefList\" value=\"".get_lang('DefineHeadings')."\" />",
  476. "</form>",
  477. "<hr noshade size=\"1\" style=\"color:#99CCFF\">",
  478. "</div>\n";
  479. }
  480. $catList = get_course_user_info($userIdViewed);
  481. if ($catList)
  482. {
  483. foreach ($catList as $thisCat)
  484. {
  485. // Category title
  486. echo "<p><b>",$thisCat['title'],"</b></p>\n";
  487. // Category content
  488. echo "<blockquote>\n";
  489. if ($thisCat['content'])
  490. {
  491. echo htmlize($thisCat['content'])."\n";
  492. }
  493. else
  494. {
  495. echo "....";
  496. }
  497. // Edit command
  498. if ($allowedToEditContent)
  499. {
  500. echo "<br><br>\n",
  501. "<a href=\"".api_get_self()."?".api_get_cidreq()."&editContent=",$thisCat['catId'],"&uInfo=",$userIdViewed,"\">",
  502. "<img src=\"../img/edit.gif\" border=\"0\" alt=\"edit\">",
  503. "</a>\n";
  504. }
  505. echo "</blockquote>\n";
  506. }
  507. }
  508. }
  509. // Back button for each display mode (bottom)
  510. //echo "<div class=\"actions\"><a href=\"user.php?".api_get_cidreq()."&amp;origin=".$origin."\">".get_lang('BackUser')."</a></div>\n";
  511. /* FOOTER */
  512. Display :: display_footer();
  513. ?>