$catToEdit['id'] = ''; } } elseif ($displayMode == 'viewDefList') { $catList = claro_user_info_claro_user_info_get_cat_def_list(); } elseif ($displayMode == 'viewMainInfoEdit') { /*>>>>>>>>>>>> CATEGORIES MAIN INFO : EDIT <<<<<<<<<<<<*/ $mainUserInfo = course_user_get_properties($userIdViewed, claro_get_current_course_id()); } elseif ($displayMode == 'viewContentEdit') { $catToEdit = claro_user_info_get_cat_content($userIdViewed, $_REQUEST['editContent']); } elseif ($displayMode == 'viewContentList') { $mainUserInfo = course_user_get_properties($userIdViewed, claro_get_current_course_id()); } if ($displayMode != "viewContentList") { claro_set_display_mode_available(false); } $skypeName = get_user_property($userIdViewed, 'skype'); if ($skypeName) { $skypeStatus = '<a href="skype:' . $skypeName . '?call">' . "\n" . '<img src="http://mystatus.skype.com/smallclassic/' . $skypeName . '" style="border: none;" width="100" height="15" alt="" />' . "\n" . '</a>'; } else { $skypeStatus = '<em>' . get_lang('None') . '</em>'; } ////////////////////////////// // OUTPUT ////////////////////////////// $out = ''; $out .= claro_html_tool_title($nameTools) . '<p>' . "\n" . '<small>' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLUSR'))) . '">' . '<< ' . get_lang('Back to user list') . '</a>' . "\n" . '</small>' . "\n" . '</p>' . "\n" . claro_html_msg_list($messageList); $userData = user_get_properties($userIdViewed); $picturePath = user_get_picture_path($userData); if ($picturePath && file_exists($picturePath)) { $pictureUrl = user_get_picture_url($userData);
/** * Display form to edit or add user to the platform. * * @param $userId int */ function user_html_form($userId = null) { // If the user exists (given user id) if (!empty($userId)) { // Get user's general informations $userData = user_get_properties($userId); // Get user's skype account $userData['skype'] = get_user_property($userId, 'skype'); // Get user's picture $picturePath = user_get_picture_path($userData); if ($picturePath && file_exists($picturePath)) { $pictureUrl = user_get_picture_url($userData); } else { $pictureUrl = ''; } // Get current language $currentLanguage = !empty($userData['language']) ? $userData['language'] : language::current_language(); // A few javascript $htmlHeadXtra[] = '<script type="text/javascript"> function confirmation (name) { if (confirm("' . clean_str_for_javascript(get_lang('Are you sure to delete')) . '"+ name + "?")) {return true;} else {return false;} } $(document).ready(function(){ $("#delete").click(function(){ return confirmation("' . $userData['firstname'] . " " . $userData['lastname'] . '"); }).attr("href","adminuserdeleted.php?uidToEdit=' . $userId . '&cmd=exDelete"); }); </script>'; } else { // Initialize user's data $userData = user_initialise(); // No user's picture $pictureUrl = ''; // Prefered language $currentLanguage = language::current_language(); } // Editable fields if (empty($userId) || claro_is_platform_admin()) { $editableFields = array('name', 'official_code', 'login', 'password', 'email', 'phone', 'language', 'picture', 'skype'); if (claro_is_platform_admin()) { $editableFields[] = 'authSource'; } } else { $editableFields = AuthProfileManager::getUserAuthProfile($userId)->getEditableProfileFields(); // get_conf('profile_editable'); // pushClaroMessage(var_export($editableFields,true), 'debug'); } if (!empty($_SERVER['HTTP_REFERER'])) { $cancelUrl = $_SERVER['HTTP_REFERER']; } else { $cancelUrl = $_SERVER['PHP_SELF']; } // Hack to prevent autocompletion of password fields from browser $htmlHeadXtra[] = '<script type="text/javascript"> $(document).ready( function() { $("#password").val(""); } ); </script>'; $template = new CoreTemplate('user_form.tpl.php'); $template->assign('formAction', $_SERVER['PHP_SELF']); $template->assign('relayContext', claro_form_relay_context()); $template->assign('cancelUrl', claro_htmlspecialchars(Url::Contextualize($cancelUrl))); $template->assign('editableFields', $editableFields); $template->assign('data', $userData); $template->assign('pictureUrl', $pictureUrl); $template->assign('currentLanguage', $currentLanguage); $template->assign('languages', get_language_to_display_list()); return $template->render(); }