$blocks['sessions']['items'] = $items; $blocks['sessions']['extra'] = null; /* Settings */ if (api_is_platform_admin()) { $blocks['settings']['icon'] = Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_MEDIUM, false); $blocks['settings']['label'] = api_ucfirst(get_lang('System')); $blocks['settings']['class'] = 'block-admin-settings'; $items = array(); $items[] = array('url' => 'special_exports.php', 'label' => get_lang('SpecialExports')); $items[] = array('url' => 'system_status.php', 'label' => get_lang('SystemStatus')); if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) { $items[] = array('url' => 'filler.php', 'label' => get_lang('DataFiller')); } $items[] = array('url' => 'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup')); $items[] = array('url' => 'resource_sequence.php', 'label' => get_lang('ResourcesSequencing')); if (isset($_configuration['db_manager_enabled']) && $_configuration['db_manager_enabled'] == true && api_is_global_platform_admin()) { $host = $_configuration['db_host']; $username = $_configuration['db_user']; $databaseName = $_configuration['main_database']; $items[] = array('url' => "db.php?username={$username}&db={$databaseName}&server={$host}", 'label' => get_lang('Database Manager')); } $blocks['settings']['items'] = $items; $blocks['settings']['extra'] = null; $blocks['settings']['search_form'] = null; // Skills if (api_get_setting('allow_skills_tool') == 'true') { $blocks['skills']['icon'] = Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_MEDIUM, false); $blocks['skills']['label'] = get_lang('Skills'); $blocks['skills']['class'] = 'block-admin-skills'; $items = array(); //$items[] = array('url'=>'skills.php', 'label' => get_lang('SkillsTree'));
/** * Build the modify-column of the table * @param int $user_id The user id * @return string Some HTML-code */ function modify_filter($user_id) { global $origin, $_course, $is_allowed_to_track, $charset, $course_info; $current_user_id = api_get_user_id(); $result = ""; if ($is_allowed_to_track) { $result .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?' . api_get_cidreq() . '&student=' . $user_id . '&details=true&course=' . $_course['id'] . '&origin=user_course&id_session=' . api_get_session_id() . '" title="' . get_lang('Tracking') . '" > ' . Display::return_icon('stats.png', get_lang('Tracking')) . '</a>'; } //if platform admin, show the login_as icon (this drastically shortens // time taken by support to test things out) if (api_is_platform_admin()) { // If not forbidden globally if (empty($_configuration['login_as_forbidden_globally'])) { // If global admin, authorize, otherwise check db setting allows it if (api_is_global_platform_admin() or api_get_setting('login_as_allowed') === 'true') { $result .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'admin/user_list.php?action=login_as&user_id=' . $user_id . '&sec_token=' . $_SESSION['sec_token'] . '">' . Display::return_icon('login_as.gif', get_lang('LoginAs')) . '</a> '; } } } if (api_is_allowed_to_edit(null, true)) { // edit $result .= '<a href="userInfo.php?' . api_get_cidreq() . '&origin=' . $origin . '&editMainUserInfo=' . $user_id . '" title="' . get_lang('Edit') . '" >' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a> '; if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) { // unregister if ($user_id != $current_user_id) { $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a> '; } else { //$result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).'</a> '; } } } else { //Show buttons for unsubscribe if ($course_info['unsubscribe'] == 1) { if ($user_id == $current_user_id) { $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a> '; } } } return $result; }
<?php /* For licensing terms, see /license.txt */ /** * Responses to AJAX calls */ //require_once '../global.inc.php'; \Chamilo\CoreBundle\Framework\Container::$legacyTemplate = 'layout_empty.html.twig'; api_protect_admin_script(); $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null; switch ($action) { case 'update_changeable_setting': $url_id = api_get_current_access_url_id(); if (api_is_global_platform_admin() && $url_id == 1) { if (isset($_GET['id']) && !empty($_GET['id'])) { $params = array('variable = ? ' => array($_GET['id'])); $data = api_get_settings_params($params); if (!empty($data)) { foreach ($data as $item) { $params = array('id' => $item['id'], 'access_url_changeable' => $_GET['changeable']); api_set_setting_simple($params); } } echo '1'; } } break; case 'version': echo version_check(); break; case 'get_extra_content':
/** * Function used to protect a global admin script. * The function blocks access when the user has no global platform admin rights. * See also the api_is_global_platform_admin() function wich defines who's a "global" admin * * @author Julio Montoya */ function api_protect_global_admin_script() { if (!api_is_global_platform_admin()) { api_not_allowed(); return false; } return true; }
$form = generate_settings_form($settings, $settings_by_access_list); $message = array(); if ($form->validate()) { $values = $form->exportValues(); $mark_all = false; $un_mark_all = false; if (api_is_multiple_url_enabled()) { if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['mark_all'])) { $mark_all = true; } if (isset($values['buttons_in_action_right']) && isset($values['buttons_in_action_right']['unmark_all'])) { $un_mark_all = true; } } if ($mark_all || $un_mark_all) { if (api_is_global_platform_admin()) { $locked_settings = api_get_locked_settings(); foreach ($values as $key => $value) { if (!in_array($key, $locked_settings)) { $changeable = 0; if ($mark_all) { $changeable = 1; } $params = array('variable = ?' => array($key)); $data = api_get_settings_params($params); if (!empty($data)) { foreach ($data as $item) { $params = array('id' => $item['id'], 'access_url_changeable' => $changeable); api_set_setting_simple($params); } }
/** * Build the modify-column of the table * @param int The user id * @param string URL params to add to table links * @param array Row of elements to alter * @return string Some HTML-code with modify-buttons */ function modify_filter($user_id, $url_params, $row) { global $_admins_list, $delete_user_available, $app; $is_admin = false; $userId = api_get_user_id(); if (is_array($_admins_list)) { $is_admin = in_array($user_id, $_admins_list); } $statusname = api_get_status_langvars(); $user_is_anonymous = false; $current_user_status_label = $row['7']; if ($current_user_status_label == $statusname[ANONYMOUS]) { $user_is_anonymous = true; } $result = ''; if (!$user_is_anonymous) { $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_' . $user_id . '\')')); $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_' . $user_id . '\',' . $user_id . ')" > ' . $icon . ' <div class="blackboard_hide" id="div_' . $user_id . '"> </div> </a>'; $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_' . $user_id . '\')')); $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_' . $user_id . '\',' . $user_id . ')" > ' . $icon . ' <div class="blackboard_hide" id="div_s_' . $user_id . '"> </div> </a>'; } else { $result .= Display::return_icon('course_na.png', get_lang('Courses')) . ' '; $result .= Display::return_icon('course_na.png', get_lang('Sessions')) . ' '; } if (api_is_platform_admin()) { if (!$user_is_anonymous) { $result .= '<a href="user_information.php?user_id=' . $user_id . '">' . Display::return_icon('synthese_view.gif', get_lang('Info')) . '</a> '; } else { $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')) . ' '; } } //only allow platform admins to login_as, or session admins only for // students (not teachers nor other admins), and only if all options // match to say this user has the permission to do so // $_configuration['login_as_forbidden_globally'], defined in // configuration.php, is the master key to these conditions global $_configuration; if (empty($_configuration['login_as_forbidden_globally']) && (api_is_global_platform_admin() || api_get_setting('login_as_allowed') === 'true' && (api_is_platform_admin() || api_is_session_admin() && $current_user_status_label == $statusname[STUDENT]))) { if (!$user_is_anonymous) { if ($app['security']->isGranted('ROLE_GLOBAL_ADMIN')) { // everything looks good, show "login as" link if ($user_id != $userId) { $result .= '<a href="' . api_get_path(WEB_PUBLIC_PATH) . '?_switch_user='******'">' . Display::return_icon('login_as.gif', get_lang('LoginAs')) . '</a> '; } else { $result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')) . ' '; } } else { // if this user in particular can't be edited, show disabled $result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')) . ' '; } } else { // if anonymous user but other users show the option, show disabled $result .= Display::return_icon('login_as_na.gif', get_lang('LoginAs')) . ' '; } } // Else don't show anything, because the option is not available at all //$result .= Display::url('<i class="icon-key icon-large"></i>', 'roles'); if ($current_user_status_label != $statusname[STUDENT]) { $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')) . ' '; } else { $result .= '<a href="../mySpace/myStudents.php?student=' . $user_id . '">' . Display::return_icon('statistics.gif', get_lang('Reporting')) . '</a> '; } if (api_is_platform_admin(true)) { if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { $result .= '<a href="user_edit.php?user_id=' . $user_id . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a> '; } else { $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a> '; } } if ($is_admin) { $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'), array('width' => ICON_SIZE_SMALL, 'heigth' => ICON_SIZE_SMALL)); } else { $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); } // actions for assigning sessions, courses or users if (api_is_session_admin()) { /*if ($row[0] == api_get_user_id()) { $result .= '<a href="dashboard_add_sessions_to_user.php?user='******'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a> '; }*/ } else { if ($current_user_status_label == $statusname[DRH] || UserManager::is_admin($user_id)) { $result .= '<a href="dashboard_add_users_to_user.php?user='******'">' . Display::return_icon('user_subscribe_course.png', get_lang('AssignUsers'), '', ICON_SIZE_SMALL) . '</a>'; $result .= '<a href="dashboard_add_courses_to_user.php?user='******'">' . Display::return_icon('course_add.gif', get_lang('AssignCourses')) . '</a> '; $result .= '<a href="dashboard_add_sessions_to_user.php?user='******'">' . Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')) . '</a> '; } else { if ($current_user_status_label == $statusname[SESSIONADMIN]) { $result .= '<a href="dashboard_add_sessions_to_user.php?user='******'">' . Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')) . '</a> '; } } } if (api_is_platform_admin()) { $result .= ' <a href="' . api_get_path(WEB_AJAX_PATH) . 'agenda.ajax.php?a=get_user_agenda&user_id=' . $user_id . '" class="agenda_opener">' . Display::return_icon('month.png', get_lang('FreeBusyCalendar'), array(), ICON_SIZE_SMALL) . '</a>'; if ($delete_user_available) { if ($user_id != api_get_user_id() && !$user_is_anonymous && api_global_admin_can_edit_admin($user_id)) { // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. $result .= ' <a href="user_list.php?action=delete_user&user_id=' . $user_id . '&' . $url_params . '&sec_token=' . Security::getCurrentToken() . '" onclick="javascript:if(!confirm(' . "'" . addslashes(get_lang("ConfirmYourChoice")) . "'" . ')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; } else { $result .= Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); } } } return $result; }
function generate_settings_form($settings, $settings_by_access_list) { global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list; $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); $form = new FormValidator('settings', 'post', 'settings.php?category=' . Security::remove_XSS($_GET['category'])); $form->addElement('hidden', 'search_field', !empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null); $url_id = api_get_current_access_url_id(); if (!empty($_configuration['multiple_access_urls']) && api_is_global_platform_admin() && $url_id == 1) { $group = array(); $group[] = $form->createElement('button', 'mark_all', get_lang('MarkAll')); $group[] = $form->createElement('button', 'unmark_all', get_lang('UnmarkAll')); $form->addGroup($group, 'buttons_in_action_right'); } $default_values = array(); $url_info = api_get_access_url($url_id); $i = 0; foreach ($settings as $row) { if (in_array($row['variable'], array_keys($settings_to_avoid))) { continue; } if (!empty($_configuration['multiple_access_urls'])) { if (api_is_global_platform_admin()) { if ($row['access_url_locked'] == 0) { if ($url_id == 1) { if ($row['access_url_changeable'] == '1') { $form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "0" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</a></div>'); } else { $form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</a></div>'); } } else { if ($row['access_url_changeable'] == '1') { $form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</div>'); } else { $form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</div>'); } } } } } $hideme = array(); $hide_element = false; if ($_configuration['access_url'] != 1) { if ($row['access_url_changeable'] == 0) { // We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element. $hide_element = true; $hideme = array('disabled'); } elseif ($url_info['active'] == 1) { // We show the elements. if (empty($row['variable'])) { $row['variable'] = 0; } if (empty($row['subkey'])) { $row['subkey'] = 0; } if (empty($row['category'])) { $row['category'] = 0; } if (is_array($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']])) { // We are sure that the other site have a selected value. if ($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'] != '') { $row['selected_value'] = $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value']; } } // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site. } } switch ($row['type']) { case 'textfield': if (in_array($row['variable'], $convert_byte_to_mega_list)) { $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment']), get_lang('MB')), array('maxlength' => '8')); $form->applyFilter($row['variable'], 'html_filter'); $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1); } elseif ($row['variable'] == 'account_valid_duration') { $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('maxlength' => '5')); $form->applyFilter($row['variable'], 'html_filter'); $default_values[$row['variable']] = $row['selected_value']; // For platform character set selection: Conversion of the textfield to a select box with valid values. } elseif ($row['variable'] == 'platform_charset') { continue; } else { $hideme['class'] = 'col-md-4'; $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $hideme); $form->applyFilter($row['variable'], 'html_filter'); $default_values[$row['variable']] = $row['selected_value']; } break; case 'textarea': if ($row['variable'] == 'header_extra_content') { $file = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt'; $value = ''; if (file_exists($file)) { $value = file_get_contents($file); } $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme); $default_values[$row['variable']] = $value; } elseif ($row['variable'] == 'footer_extra_content') { $file = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt'; $value = ''; if (file_exists($file)) { $value = file_get_contents($file); } $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme); $default_values[$row['variable']] = $value; } else { $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme); $default_values[$row['variable']] = $row['selected_value']; } break; case 'radio': $values = api_get_settings_options($row['variable']); $group = array(); if (is_array($values)) { foreach ($values as $key => $value) { $element =& $form->createElement('radio', $row['variable'], '', get_lang($value['display_text']), $value['value']); if ($hide_element) { $element->freeze(); } $group[] = $element; } } $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), '', false); $default_values[$row['variable']] = $row['selected_value']; break; case 'checkbox': // 1. We collect all the options of this variable. $sql = "SELECT * FROM {$table_settings_current}\n WHERE variable='" . $row['variable'] . "' AND access_url = 1"; $result = Database::query($sql); $group = array(); while ($rowkeys = Database::fetch_array($result)) { // Profile tab option should be hidden when the social tool is enabled. if (api_get_setting('social.allow_social_tool') == 'true') { if ($rowkeys['variable'] == 'show_tabs' && $rowkeys['subkey'] == 'my_profile') { continue; } } // Hiding the gradebook option. if ($rowkeys['variable'] == 'show_tabs' && $rowkeys['subkey'] == 'my_gradebook') { continue; } $element =& $form->createElement('checkbox', $rowkeys['subkey'], '', get_lang($rowkeys['subkeytext'])); if ($row['access_url_changeable'] == 1) { // 2. We look into the DB if there is a setting for a specific access_url. $access_url = $_configuration['access_url']; if (empty($access_url)) { $access_url = 1; } $sql = "SELECT selected_value FROM {$table_settings_current}\n WHERE\n variable='" . $rowkeys['variable'] . "' AND\n subkey='" . $rowkeys['subkey'] . "' AND\n subkeytext='" . $rowkeys['subkeytext'] . "' AND\n access_url = {$access_url}"; $result_access = Database::query($sql); $row_access = Database::fetch_array($result_access); if ($row_access['selected_value'] == 'true' && !$form->isSubmitted()) { $element->setChecked(true); } } else { if ($rowkeys['selected_value'] == 'true' && !$form->isSubmitted()) { $element->setChecked(true); } } if ($hide_element) { $element->freeze(); } $group[] = $element; } $form->addGroup($group, $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), ''); break; case 'link': $form->addElement('static', null, array(get_lang($row['title']), get_lang($row['comment'])), get_lang('CurrentValue') . ' : ' . $row['selected_value'], $hideme); break; case 'select': /* * To populate the list of options, the select type dynamically calls a function that must be called select_ + the name of the variable being displayed. * The functions being called must be added to the file settings.lib.php. */ $form->addElement('select', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), call_user_func('select_' . $row['variable']), $hideme); $default_values[$row['variable']] = $row['selected_value']; break; case 'custom': break; } switch ($row['variable']) { case 'pdf_export_watermark_enable': $url = PDF::get_watermark(null); if ($url != false) { $delete_url = '<a href="?delete_watermark">' . get_lang('DelImage') . ' ' . Display::return_icon('delete.png', get_lang('DelImage')) . '</a>'; $form->addElement('html', '<div style="max-height:100px; max-width:100px; margin-left:162px; margin-bottom:10px; clear:both;"><img src="' . $url . '" style="margin-bottom:10px;" />' . $delete_url . '</div>'); } $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); $form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types); break; case 'timezone_value': $timezone = $row['selected_value']; if (empty($timezone)) { $timezone = _api_get_timezone(); } $form->addElement('html', sprintf(get_lang('LocalTimeUsingPortalTimezoneXIsY'), $timezone, api_get_local_time())); break; } } // end for if (!empty($settings)) { $form->setDefaults($default_values); } $form->addHtml('<div class="bottom_actions">'); $form->addButtonSave(get_lang('SaveSettings')); $form->addHtml('</div>'); return $form; }
if (CourseManager::get_user_in_course_status($_GET['user_id'], $_GET['courseId']) == STUDENT) { CourseManager::unsubscribe_user($_GET['user_id'], $_GET['courseId']); Display::display_normal_message(get_lang('UserUnsubscribed')); } else { Display::display_error_message(get_lang('CannotUnsubscribeUserFromCourse')); } break; } } //only allow platform admins to login_as, or session admins only for students // (not teachers nor other admins), and only if all options confirm it // $_configuration['login_as_forbidden_globally'], defined in configuration.php, // is the master key to these conditions $statusname = api_get_status_langvars(); $login_as_icon = ''; if (empty($_configuration['login_as_forbidden_globally']) && (api_is_global_platform_admin() || api_get_setting('login_as_allowed') === 'true' && (api_is_platform_admin() || api_is_session_admin() && (api_is_session_admin() && $row['6'] == $statusname[STUDENT])))) { $login_as_icon = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/user_list.php?action=login_as&user_id=' . $user['user_id'] . '&sec_token=' . $_SESSION['sec_token'] . '">' . Display::return_icon('login_as.gif', get_lang('LoginAs')) . '</a>'; } echo '<div class="actions"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . intval($_GET['user_id']) . '" title="' . get_lang('Reporting') . '">' . Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM) . '</a>' . $login_as_icon . '</div>'; echo Display::page_header($tool_name); //getting the user image $sysdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'system', false, true); $sysdir = $sysdir_array['dir']; $webdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true); $webdir = $webdir_array['dir']; $fullurl = $webdir . $webdir_array['file']; $system_image_path = $sysdir . $webdir_array['file']; list($width, $height, $type, $attr) = @getimagesize($system_image_path); $resizing = $height > 200 ? 'height="200"' : ''; $height += 30; $width += 30;
/** * Move in template.lib */ private function loadAdminMenu() { $template = $this->get('template'); // Access restrictions. api_protect_admin_script(true); // @todo fix register/check version $message = null; if (!empty($_POST['Register'])) { register_site(); $message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation'); } $blocks = array(); $adminUrl = api_get_path(WEB_CODE_PATH) . 'admin/'; /* Users */ $blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false); $blocks['users']['label'] = api_ucfirst(get_lang('Users')); if (api_is_platform_admin()) { $search_form = $this->getSearchForm($adminUrl . 'user_list.php')->return_form(); $blocks['users']['search_form'] = $search_form; $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV'))); if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { $items[] = array('url' => $adminUrl . 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform')); } $items[] = array('url' => $adminUrl . 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields')); $items[] = array('url' => api_get_path(WEB_PUBLIC_PATH) . 'admin/administrator/roles', 'label' => get_lang('Roles')); } else { $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV'))); } $blocks['users']['items'] = $items; $blocks['users']['extra'] = null; if (api_is_platform_admin()) { /* Courses */ $blocks['courses']['icon'] = \Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false); $blocks['courses']['label'] = api_ucfirst(get_lang('Courses')); $search_form = $this->getSearchForm($adminUrl . 'course_list.php')->return_form(); $blocks['courses']['search_form'] = $search_form; $items = array(); $items[] = array('url' => $adminUrl . 'course_list.php', 'label' => get_lang('CourseList')); if (api_get_setting('course_validation') != 'true') { $items[] = array('url' => $adminUrl . 'course_add.php', 'label' => get_lang('AddCourse')); } else { $items[] = array('url' => $adminUrl . 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests')); $items[] = array('url' => $adminUrl . 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests')); $items[] = array('url' => $adminUrl . 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests')); } $items[] = array('url' => $adminUrl . 'course_export.php', 'label' => get_lang('ExportCourses')); $items[] = array('url' => $adminUrl . 'course_import.php', 'label' => get_lang('ImportCourses')); $items[] = array('url' => $adminUrl . 'course_category.php', 'label' => get_lang('AdminCategories')); $items[] = array('url' => $adminUrl . 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse')); $items[] = array('url' => $adminUrl . 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse')); $items[] = array('url' => $adminUrl . 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields')); $items[] = array('url' => $adminUrl . 'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields')); if (api_get_setting('gradebook_enable_grade_model') == 'true') { $items[] = array('url' => $adminUrl . 'grade_models.php', 'label' => get_lang('GradeModel')); } if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { $items[] = array('url' => $adminUrl . 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse')); } $blocks['courses']['items'] = $items; $blocks['courses']['extra'] = null; /* Platform */ $blocks['platform']['icon'] = \Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false); $blocks['platform']['label'] = api_ucfirst(get_lang('Platform')); $form = $this->getSearchForm($adminUrl . 'settings.php'); $form->addElement('hidden', 'category', 'search_setting'); $search_form = $form->return_form(); $blocks['platform']['search_form'] = $search_form; $items = array(); $items[] = array('url' => $adminUrl . 'settings.php', 'label' => get_lang('PlatformConfigSettings')); $items[] = array('url' => $adminUrl . 'settings.php?category=Plugins', 'label' => get_lang('Plugins')); $items[] = array('url' => $adminUrl . 'settings.php?category=Regions', 'label' => get_lang('Regions')); $items[] = array('url' => $adminUrl . 'system_announcements.php', 'label' => get_lang('SystemAnnouncements')); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda')); $items[] = array('url' => $adminUrl . 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage')); $items[] = array('url' => $adminUrl . 'configure_inscription.php', 'label' => get_lang('ConfigureInscription')); $items[] = array('url' => $adminUrl . 'statistics/index.php', 'label' => get_lang('Statistics')); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'mySpace/company_reports.php', 'label' => get_lang('Reports')); /* Event settings */ if (api_get_setting('activate_email_template') == 'true') { $items[] = array('url' => $adminUrl . 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement')); } if (api_get_multiple_access_url()) { if (api_is_global_platform_admin()) { $items[] = array('url' => $adminUrl . 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs')); } } if (api_get_setting('allow_reservation') == 'true') { //$items[] = array('url' => $adminUrl.'../reservation/m_category.php', 'label' => get_lang('BookingSystem')); } if (api_get_setting('allow_terms_conditions') == 'true') { $items[] = array('url' => $adminUrl . 'legal_add.php', 'label' => get_lang('TermsAndConditions')); } $blocks['platform']['items'] = $items; $blocks['platform']['extra'] = null; } /* Sessions */ $blocks['sessions']['icon'] = \Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false); $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions')); $search_form = $this->getSearchForm(api_get_path(WEB_CODE_PATH) . 'session/session_list.php')->return_form(); $blocks['sessions']['search_form'] = $search_form; $items = array(); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_list.php', 'label' => get_lang('ListSession')); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_add.php', 'label' => get_lang('AddSession')); $items[] = array('url' => 'session_category_list.php', 'label' => get_lang('ListSessionCategory')); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_import.php', 'label' => get_lang('ImportSessionListXMLCSV')); if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) { $items[] = array('url' => $adminUrl . 'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession')); } $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_export.php', 'label' => get_lang('ExportSessionListXMLCSV')); $items[] = array('url' => $adminUrl . '../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession')); if (api_is_platform_admin()) { if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) { // option only visible in development mode. Enable through code if required $items[] = array('url' => $adminUrl . 'user_move_stats.php', 'label' => get_lang('MoveUserStats')); } $items[] = array('url' => $adminUrl . 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions')); } $items[] = array('url' => $adminUrl . 'usergroups.php', 'label' => get_lang('Classes')); $items[] = array('url' => $adminUrl . 'exercise_report.php', 'label' => get_lang('ExerciseReport')); $items[] = array('url' => $adminUrl . 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields')); $blocks['sessions']['items'] = $items; $blocks['sessions']['extra'] = null; /* Settings */ if (api_is_platform_admin()) { $blocks['settings']['icon'] = \Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false); $blocks['settings']['label'] = api_ucfirst(get_lang('System')); $items = array(); $items[] = array('url' => $adminUrl . 'special_exports.php', 'label' => get_lang('SpecialExports')); if (!empty($_configuration['db_admin_path'])) { $items[] = array('url' => $_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases') . ' (' . get_lang('DBManagementOnlyForServerAdmin') . ') '); } $items[] = array('url' => $adminUrl . 'system_status.php', 'label' => get_lang('SystemStatus')); if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) { $items[] = array('url' => $adminUrl . 'filler.php', 'label' => get_lang('DataFiller')); } $items[] = array('url' => $adminUrl . 'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup')); $items[] = array('url' => $adminUrl . 'system_management.php', 'label' => get_lang('SystemManagement')); $blocks['settings']['items'] = $items; $blocks['settings']['extra'] = null; $blocks['settings']['search_form'] = null; //Skills if (api_get_setting('allow_skills_tool') == 'true') { $blocks['skills']['icon'] = \Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false); $blocks['skills']['label'] = get_lang('Skills'); $items = array(); //$items[] = array('url' => $adminUrl.'skills.php', 'label' => get_lang('SkillsTree')); $items[] = array('url' => $adminUrl . 'skills_wheel.php', 'label' => get_lang('SkillsWheel')); $items[] = array('url' => $adminUrl . 'skills_import.php', 'label' => get_lang('SkillsImport')); //$items[] = array('url' => $adminUrl.'skills_profile.php', 'label' => get_lang('SkillsProfile')); $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php', 'label' => get_lang('SkillsRanking')); $items[] = array('url' => $adminUrl . 'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks')); $blocks['skills']['items'] = $items; $blocks['skills']['extra'] = null; $blocks['skills']['search_form'] = null; } /** Chamilo.org */ $blocks['chamilo']['icon'] = \Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false); $blocks['chamilo']['label'] = 'Chamilo.org'; $items = array(); $items[] = array('url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage')); $items[] = array('url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum')); $items[] = array('url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide')); $items[] = array('url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion')); $items[] = array('url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList')); $items[] = array('url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide')); $items[] = array('url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide')); $items[] = array('url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions')); $items[] = array('url' => 'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders')); $blocks['chamilo']['items'] = $items; $blocks['chamilo']['extra'] = null; $blocks['chamilo']['search_form'] = null; } $admin_ajax_url = api_get_path(WEB_AJAX_PATH) . 'admin.ajax.php'; $template->assign('web_admin_ajax_url', $admin_ajax_url); $template->assign('blocks', $blocks); }
if ($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true' || $key != CAS_AUTH_SOURCE) { $auth_sources[$key] = $key; $nb_ext_auth_source_added++; } } if ($nb_ext_auth_source_added > 0) { // @todo check the radio button for external authentification and select the external authentification in the menu $group[] = $form->createElement('radio', 'reset_password', null, get_lang('ExternalAuthentication') . ' ', 3); $group[] = $form->createElement('select', 'auth_source', null, $auth_sources); $group[] = $form->createElement('static', '', '', '<br />'); $form->addGroup($group, 'password', null, '', false); } } $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1); // before giving the form to reset the password, check the corresponding param if (api_is_global_platform_admin() or api_get_setting('admins_can_set_users_pass') === 'true') { $group = array(); $group[] = $form->createElement('radio', 'reset_password', null, null, 2); $group[] = $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button();')); $form->addGroup($group, 'password', null, '', false); } // Status. $status = api_get_user_roles(); unset($status[ANONYMOUS]); $form->addElement('select', 'status', get_lang('Profile'), $status, array('id' => 'status_select', 'onchange' => 'javascript: display_drh_list();', 'class' => 'chzn-select')); $display = isset($user_data['status']) && ($user_data['status'] == STUDENT || isset($_POST['status']) && $_POST['status'] == STUDENT) ? 'block' : 'none'; /* $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">'); $drh_select = $form->addElement('select', 'hr_dept_id', get_lang('Drh'), array(), 'id="drh_select"'); $drh_list = UserManager :: get_user_list(array('status' => DRH), api_sort_by_first_name() ? array('firstname', 'lastname') : array('lastname', 'firstname'));