Exemple #1
0
 /**
  * Determines the possible tabs (=sections) that are available.
  * This function is used when creating the tabs in the third header line and
  * all the sections that do not appear there (as determined by the
  * platform admin on the Chamilo configuration settings page)
  * will appear in the right hand menu that appears on several other pages
  * @return array containing all the possible tabs
  * @author Patrick Cool <*****@*****.**>, Ghent University
  */
 public function getTabs()
 {
     $_course = api_get_course_info();
     $navigation = array();
     // Campus Homepage
     $navigation[SECTION_CAMPUS]['url'] = $this->urlGenerator->generate('index');
     $navigation[SECTION_CAMPUS]['title'] = get_lang('CampusHomepage');
     // My Courses
     $navigation['mycourses']['url'] = $this->urlGenerator->generate('userportal');
     $navigation['mycourses']['title'] = get_lang('MyCourses');
     $webCodePath = $this->urlGenerator->generate('root') . '/main/';
     // My Profile
     if (api_is_profile_readable()) {
         $navigation['myprofile']['url'] = $webCodePath . 'auth/profile.php' . (!empty($_course['path']) ? '?coursePath=' . $_course['path'] . '&amp;courseCode=' . $_course['official_code'] : '');
         $navigation['myprofile']['title'] = get_lang('ModifyProfile');
     }
     // Link to my agenda
     $navigation['myagenda']['url'] = $webCodePath . 'calendar/agenda_js.php?type=personal';
     $navigation['myagenda']['title'] = get_lang('MyAgenda');
     // Gradebook
     if (api_get_setting('gradebook_enable') == 'true') {
         $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH) . 'gradebook/gradebook.php' . (!empty($_course['path']) ? '?coursePath=' . $_course['path'] . '&amp;courseCode=' . $_course['official_code'] : '');
         $navigation['mygradebook']['title'] = get_lang('MyGradebook');
     }
     // Reporting
     if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
         // Link to my space
         $navigation['session_my_space']['url'] = $webCodePath . 'mySpace/index.php';
         $navigation['session_my_space']['title'] = get_lang('MySpace');
     } else {
         // Link to my progress
         $navigation['session_my_progress']['url'] = $webCodePath . 'auth/my_progress.php';
         $navigation['session_my_progress']['title'] = get_lang('MyProgress');
     }
     // Social
     if (api_get_setting('social.allow_social_tool') == 'true') {
         $navigation['social']['url'] = $webCodePath . 'social/home.php';
         $navigation['social']['title'] = get_lang('SocialNetwork');
     }
     // Dashboard
     if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) {
         $navigation['dashboard']['url'] = $webCodePath . 'dashboard/index.php';
         $navigation['dashboard']['title'] = get_lang('Dashboard');
     }
     // Custom tabs
     for ($i = 1; $i <= 3; $i++) {
         if (api_get_setting('custom_tab_' . $i . '_name') && api_get_setting('custom_tab_' . $i . '_url')) {
             $navigation['custom_tab_' . $i]['url'] = api_get_setting('custom_tab_' . $i . '_url');
             $navigation['custom_tab_' . $i]['title'] = api_get_setting('custom_tab_' . $i . '_name');
         }
     }
     // Adding block settings for each role
     if (isset($this->app['allow_admin_toolbar'])) {
         $roleTemplate = array();
         foreach ($this->app['allow_admin_toolbar'] as $role) {
             if ($this->security->getToken() && $this->security->isGranted($role)) {
                 // Fixes in order to match the templates
                 if ($role == 'ROLE_ADMIN') {
                     $role = 'administrator';
                 }
                 if ($role == 'ROLE_QUESTION_MANAGER') {
                     $role = 'QUESTION_MANAGER';
                 }
                 $stripRole = strtolower(str_replace('ROLE_', '', $role));
                 $roleTemplate[] = $stripRole;
             }
         }
         if (!empty($roleTemplate)) {
             if (api_get_setting('show_tabs', 'platform_administration') == 'true') {
                 //$navigation['admin']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin';
                 //$navigation['admin']['title'] = get_lang('PlatformAdmin');
             }
         }
         $this->app['admin_toolbar_roles'] = $roleTemplate;
     }
     return $navigation;
 }
Exemple #2
0
/**
 * This file displays the user's profile,
 * optionally it allows users to modify their profile as well.
 *
 * See inc/conf/profile.conf.php to modify settings
 *
 * @package chamilo.auth
 */
/**
 * Code
 */
// Language files that should be included.
$language_file = array('registration', 'messages', 'userInfo');
$cidReset = true;
//require_once '../inc/global.inc.php';
if (api_is_profile_readable() == false) {
    api_not_allowed(true);
}
if (api_get_setting('allow_social_tool') == 'true') {
    $this_section = SECTION_SOCIAL;
} else {
    $this_section = SECTION_MYPROFILE;
}
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
$_SESSION['this_section'] = $this_section;
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {
    api_not_allowed(true);
}
$htmlHeadXtra[] = '<script>
function confirmation(name) {
    if (confirm("' . get_lang('AreYouSureToDelete', '') . ' " + name + " ?")) {