userInfo.php 22 KB

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