Moving admin/index into admin/administrator managed by a controller.

skala
Julio Montoya 13 years ago
parent 9d51d51056
commit 2e03cddcaa
  1. 376
      main/admin/index.php
  2. 7
      main/inc/lib/api.lib.php
  3. 5
      main/inc/lib/template.lib.php
  4. 80
      main/template/default/admin/administrator/index.tpl
  5. 56
      main/template/default/admin/settings_index.tpl
  6. 252
      src/ChamiloLMS/Controller/Admin/AdministratorController.php

@ -1,374 +1,4 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Index page of the admin tools
* @package chamilo.admin
*/
/**
* Code
*/
// Language files that need to be included.
$language_file = array('admin', 'tracking','coursebackup');
// Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions.
api_protect_admin_script(true);
$nameTools = get_lang('PlatformAdmin');
// Displaying the header
$message = '';
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SYS_CODE_PATH).'install/index.php')) {
$message = Display::return_message(get_lang('InstallDirAccessibleSecurityThreat'), 'warning');
}
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning');
}
/* ACTION HANDLING */
if (!empty($_POST['Register'])) {
register_site();
$message = Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
}
$keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
}
if (isset($_GET['msg']) && isset($_GET['type'])) {
if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) {
switch($_GET['type']) {
case 'error':
$message = Display::return_message(get_lang($_GET['msg']), 'error');
break;
case 'confirmation':
$message = Display::return_message(get_lang($_GET['msg']), 'confirm');
}
}
}
$blocks = array();
/* 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 = ' <form method="get" class="form-search" action="user_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['users']['search_form'] = $search_form;
$items = array(
array('url'=>'user_list.php', 'label' => get_lang('UserList')),
array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
array('url'=>'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
array('url'=>'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
);
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
}
$items[] = array('url'=>'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'=>'user_list.php', 'label' => get_lang('UserList')),
array('url'=>'user_add.php', 'label' => get_lang('AddUsers')),
array('url'=>'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 = ' <form method="get" class="form-search" action="course_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['courses']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'course_list.php', 'label' => get_lang('CourseList'));
if (api_get_setting('course_validation') != 'true') {
$items[] = array('url'=>'course_add.php', 'label' => get_lang('AddCourse'));
} else {
$items[] = array('url'=>'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
$items[] = array('url'=>'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
$items[] = array('url'=>'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
}
$items[] = array('url'=>'course_export.php', 'label' => get_lang('ExportCourses'));
$items[] = array('url'=>'course_import.php', 'label' => get_lang('ImportCourses'));
$items[] = array('url'=>'course_category.php', 'label' => get_lang('AdminCategories'));
$items[] = array('url'=>'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
$items[] = array('url'=>'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
$items[] = array('url'=>'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
$items[] = array('url'=>'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
if (api_get_setting('gradebook_enable_grade_model') == 'true') {
$items[] = array('url'=>'grade_models.php', 'label' => get_lang('GradeModel'));
}
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
$items[] = array('url'=>'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'));
$search_form = ' <form method="get" action="settings.php" class="form-search">
<input class="span3" type="text" name="search_field" value="" >
<input type="hidden" value="search_setting" name="category">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</form>';
$blocks['platform']['search_form'] = $search_form;
$items = array();
$items[] = array('url'=>'settings.php', 'label' => get_lang('PlatformConfigSettings'));
$items[] = array('url'=>'settings.php?category=Plugins','label' => get_lang('Plugins'));
$items[] = array('url'=>'settings.php?category=Regions','label' => get_lang('Regions'));
$items[] = array('url'=>'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'=>'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
$items[] = array('url'=>'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
$items[] = array('url'=>'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'=>'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
}
if (api_get_multiple_access_url()) {
if (api_is_global_platform_admin()) {
$items[] = array('url'=>'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
}
}
if (api_get_setting('allow_reservation') == 'true') {
$items[] = array('url'=>'../reservation/m_category.php', 'label' => get_lang('BookingSystem'));
}
if (api_get_setting('allow_terms_conditions') == 'true') {
$items[] = array('url'=>'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 = ' <form method="GET" class="form-search" action="'.api_get_path(WEB_CODE_PATH).'session/session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</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'=>'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'=>'../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'=>'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
}
$items[] = array('url'=>'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
}
$items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
$items[] = array('url'=> 'exercise_report.php', 'label' => get_lang('ExerciseReport'));
$items[] = array('url'=>'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'=>'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'=>'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'=>'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'=>'skills.php', 'label' => get_lang('SkillsTree'));
$items[] = array('url'=>'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
$items[] = array('url'=>'skills_import.php', 'label' => get_lang('SkillsImport'));
//$items[] = array('url'=>'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'=>'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;
// Try to display a maximum before we check the chamilo version and all that.
//session_write_close(); //close session to avoid blocking concurrent access
//flush(); //send data to client as much as allowed by the web server
//ob_flush();
//Version check
$blocks['version_check']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['version_check']['label'] = get_lang('VersionCheck');
$blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
$blocks['version_check']['search_form'] = null;
$blocks['version_check']['items'] = null;
//$blocks['version_check']['class'] = '';
}
$admin_ajax_url = api_get_path(WEB_AJAX_PATH).'admin.ajax.php';
$app['template']->assign('web_admin_ajax_url', $admin_ajax_url);
$app['template']->assign('blocks', $blocks);
$app['template']->display('default/admin/settings_index.tpl');
/**
* Displays either the text for the registration or the message that the installation is (not) up to date
*
* @return string html code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version august 2006
* @todo have a 6monthly re-registration
*/
function version_check()
{
$tbl_settings = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$sql = 'SELECT selected_value FROM '.$tbl_settings.' WHERE variable="registered" ';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
// The site has not been registered yet.
$return = '';
if ($row['selected_value'] == 'false') {
$return .= get_lang('VersionCheckExplanation');
$return .= '<form class="well" action="'.api_get_self().'" id="VersionCheck" name="VersionCheck" method="post">';
$return .= '<label class="checkbox"><input type="checkbox" name="donotlistcampus" value="1" id="checkbox" />'.get_lang('HideCampusFromPublicPlatformsList');
$return .= '</label><button type="submit" class="btn btn-primary" name="Register" value="'.get_lang('EnableVersionCheck').'" id="register" >'.get_lang('EnableVersionCheck').'</button>';
$return .= '</form>';
check_system_version();
} else {
// Site registered. Call anyway
$return .= check_system_version();
}
return $return;
}
/**
* Check if the current installation is up to date
* The code is borrowed from phpBB and slighlty modified
* @author The phpBB Group <support@phpbb.com> (the code)
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (the modifications)
* @author Yannick Warnier <ywarnier@beeznest.org> for the move to HTTP request
* @copyright (C) 2001 The phpBB Group
* @return language string with some layout (color)
*/
function check_system_version()
{
global $_configuration;
$system_version = trim($_configuration['system_version']); // the chamilo version of your installation
if (ini_get('allow_url_fopen') == 1) {
// The number of courses
$number_of_courses = Statistics::count_courses();
// The number of users
$number_of_users = Statistics::count_users();
$number_of_active_users = Statistics::count_users(null, null, null,true);
$data = array(
'url' => api_get_path(WEB_PATH),
'campus' => api_get_setting('siteName'),
'contact' => api_get_setting('emailAdministrator'),
'version' => $system_version,
'numberofcourses' => $number_of_courses,
'numberofusers' => $number_of_users,
'numberofactiveusers' => $number_of_active_users,
//The donotlistcampus setting recovery should be improved to make
// it true by default - this does not affect numbers counting
'donotlistcampus' => api_get_setting('donotlistcampus'),
'organisation' => api_get_setting('Institution'),
'language' => api_get_setting('platformLanguage'),
'adminname' => api_get_setting('administratorName').' '.api_get_setting('administratorSurname'),
);
$res = api_http_request('version.chamilo.org', 80, '/version.php', $data);
if ($res != 0) {
$version_info = $res;
if ($system_version != $version_info) {
$output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>';
} else {
$output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>';
}
} else {
$output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>';
}
} else {
$output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
}
return $output;
}
$url = api_get_path(WEB_PUBLIC_PATH).'admin/administrator';
header('Location: '.$url);
exit;

@ -2059,7 +2059,8 @@ function api_get_session_date_validation($session_info, $course_code, $ignore_vi
* @param int session id
* @return int 0 = session still available, SESSION_VISIBLE_READ_ONLY = 1, SESSION_VISIBLE = 2, SESSION_INVISIBLE = 3
*/
function api_get_session_visibility($session_id, $course_code = null, $ignore_visibility_for_admins = true) {
function api_get_session_visibility($session_id, $course_code = null, $ignore_visibility_for_admins = true)
{
if (api_is_platform_admin()) {
if ($ignore_visibility_for_admins) {
@ -2074,7 +2075,7 @@ function api_get_session_visibility($session_id, $course_code = null, $ignore_vi
if (!empty($session_info)) {
$visibility = $session_info['visibility'];
//1. Checking session date validation
// 1. Checking session date validation
$date_validation = api_get_session_date_validation($session_info, $course_code, $ignore_visibility_for_admins);
if ($date_validation) {
@ -6988,8 +6989,6 @@ function api_is_profile_readable()
return isset($profileIsReadable) ? $profileIsReadable : true;
}
/**
* Function to make an HTTP request through fsockopen (specialised for GET)
* Derived from Jeremy Saintot: http://www.php.net/manual/en/function.fsockopen.php#101872

@ -1010,14 +1010,15 @@ class Template
// Platform administration
if (api_is_platform_admin(true)) {
$navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/index.php';
$navigation['platform_admin']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin/administrator';
$navigation['platform_admin']['title'] = get_lang('PlatformAdmin');
} else {
if (api_is_question_manager()) {
$navigation['question_manager']['url'] = api_get_path(WEB_PUBLIC_PATH).'admin/questionmanager';
$navigation['question_manager']['title'] = get_lang('PlatformAdmin');
}
/*$token = $this->app['security']->getToken();
$user = $token->getUser();*/
}
return $navigation;

@ -1,22 +1,66 @@
{% extends app.template_style ~ "/layout/layout_1_col.tpl" %}
{% block content %}
<ul>
<li>
<a href="{{ url('question_score.controller:indexAction') }}">{{ 'Question score name' |trans }}</a>
</li>
<li>
<a href="{{ url('question_score_name.controller:indexAction') }}">{{ 'Question names' |trans }}</a>
</li>
<li>
<a href="{{ url('role.controller:indexAction') }}">{{ 'Roles' |trans }}</a>
</li>
<li>
<a href="{{ url('branch.controller:indexAction') }}">{{ 'Branches' |trans }}</a>
</li>
<li>
<a href="{{ url('jury.controller:indexAction') }}">{{ 'Juries' |trans }}</a>
</li>
</ul>
<script>
$(function() {
//$("#settings").tabs();
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div id="settings">
<div class="row">
{% for block_item in blocks %}
<div id="tabs-{{ loop.index }}" class="span6">
<div class="well_border {{ block_item.class }}">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div style="list-style-type:none">
{{ block_item.search_form }}
</div>
{% if block_item.items is not null %}
<ul>
{% for url in block_item.items %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
<div class="row">
<div class="span6">
<div class="well_border">
<ul>
<li>
<a href="{{ url('question_score.controller:indexAction') }}">{{ 'Question score name' |trans }}</a>
</li>
<li>
<a href="{{ url('question_score_name.controller:indexAction') }}">{{ 'Question names' |trans }}</a>
</li>
<li>
<a href="{{ url('role.controller:indexAction') }}">{{ 'Roles' |trans }}</a>
</li>
</ul>
</div>
</div>
</div>
</div>
{% endblock %}

@ -1,56 +0,0 @@
{% extends app.template_style ~ "/layout/layout_1_col.tpl" %}
{% block content %}
<script>
$(function() {
//$("#settings").tabs();
$.ajax({
url:'{{ web_admin_ajax_url }}?a=version',
success:function(version){
$(".admin-block-version").html(version);
}
});
});
</script>
<div id="settings">
{% for block_item in blocks %}
{% if loop.index % 2 == 1 %}
{% if app.full_width == 1 %}
<div class="row-fluid">
{% else %}
<div class="row">
{% endif %}
{% endif %}
<div id="tabs-{{ loop.index }}" class="span6">
<div class="well_border {{ block_item.class }}">
<h4>{{ block_item.icon }} {{ block_item.label }}</h4>
<div style="list-style-type:none">
{{ block_item.search_form }}
</div>
{% if block_item.items is not null %}
<ul>
{% for url in block_item.items %}
<li>
<a href="{{ url.url }}">
{{ url.label }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if block_item.extra is not null %}
<div>
{{ block_item.extra }}
</div>
{% endif %}
</div>
</div>
{% if loop.index % 2 == 0 %}
</div>
{% endif %}
{% endfor %}
</div>
{% endblock %}

@ -29,23 +29,247 @@ class AdministratorController extends CommonController
public function indexAction()
{
$template = $this->get('template');
$response = $template->render_template('admin/administrator/index.tpl');
return new Response($response, 200, array());
}
function getRepository()
{
// 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');
}
/**
* This method should return a new entity instance to be used for the "create" action.
*
* @abstract
* @return Object
*/
function getNewEntity()
{
$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 = ' <form method="get" class="form-search" action="user_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</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 = ' <form method="get" class="form-search" action="course_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</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'));
$search_form = ' <form method="get" action="settings.php" class="form-search">
<input class="span3" type="text" name="search_field" value="" >
<input type="hidden" value="search_setting" name="category">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</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 = ' <form method="GET" class="form-search" action="'.api_get_path(WEB_CODE_PATH).'session/session_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
</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;
// Version check
$blocks['version_check']['icon'] = \Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['version_check']['label'] = get_lang('VersionCheck');
$blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';
$blocks['version_check']['search_form'] = null;
$blocks['version_check']['items'] = null;
//$blocks['version_check']['class'] = '';
}
$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);
$response = $template->render_template('admin/administrator/index.tpl');
return new Response($response, 200, array());
}
}

Loading…
Cancel
Save