Remove unused code, replace api_display_tool_title

With Display::page_subheader2
pull/3924/head
Julio Montoya 4 years ago
parent af9f4dfdbe
commit 93550fd703
  1. 2
      public/main/admin/access_url_add_courses_to_url.php
  2. 2
      public/main/admin/access_url_add_usergroup_to_url.php
  3. 2
      public/main/admin/access_url_add_users_to_url.php
  4. 2
      public/main/admin/access_url_edit_course_category_to_url.php
  5. 2
      public/main/admin/access_url_edit_courses_to_url.php
  6. 2
      public/main/admin/access_url_edit_usergroup_to_url.php
  7. 2
      public/main/admin/access_url_edit_users_to_url.php
  8. 2
      public/main/admin/configure_inscription.php
  9. 2
      public/main/admin/course_list.php
  10. 2
      public/main/admin/ldap_users_list.php
  11. 2
      public/main/admin/ldap_users_synchro.php
  12. 2
      public/main/admin/user_list.php
  13. 2
      public/main/admin/user_list_consent.php
  14. 2
      public/main/extra/myStudents.php
  15. 2
      public/main/extra/my_progress_ind.php
  16. 2
      public/main/forum/forumqualify.php
  17. 2
      public/main/gradebook/gradebook_showlog_link.php
  18. 6
      public/main/inc/ajax/social.ajax.php
  19. 356
      public/main/inc/lib/api.lib.php
  20. 30
      public/main/inc/lib/internationalization.lib.php
  21. 2
      public/main/mySpace/admin.php
  22. 2
      public/main/mySpace/coaches.php
  23. 2
      public/main/session/session_course_edit.php
  24. 1
      public/main/survey/surveyUtil.class.php
  25. 2
      public/plugin/before_login/plugin.php

@ -42,7 +42,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];

@ -39,7 +39,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];

@ -40,7 +40,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
if ($_POST['form_sent']) {
$form_sent = $_POST['form_sent'];

@ -96,7 +96,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
}
Display::display_header($tool_name);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
$noUserGroupList = $userGroupList = [];
$ajax_search = 'unique' == $add_type ? true : false;

@ -102,7 +102,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
$no_course_list = $course_list = [];
$ajax_search = 'unique' == $add_type ? true : false;

@ -103,7 +103,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
$noUserGroupList = $userGroupList = [];
$ajax_search = 'unique' === $add_type ? true : false;

@ -141,7 +141,7 @@ echo Display::toolbarAction(
]
);
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
$nosessionUsersList = $sessionUsersList = [];
$ajax_search = 'unique' === $add_type ? true : false;

@ -337,7 +337,7 @@ $content = Display::page_header($tool_name);
// api_not_allowed();
//}
//api_display_tool_title($tool_name);
//Display::page_subheader2($tool_name);
if ('approval' == api_get_setting('allow_registration')) {
$content .= Display::return_message(get_lang('Your account has to be approved'), 'normal');
}

@ -139,7 +139,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc
$res = Database::query($sql);
$courses = [];
$languages = api_get_languages_to_array();
$languages = api_get_languages();
$path = api_get_path(WEB_CODE_PATH);

@ -28,7 +28,7 @@ if (($_GET['action']=="add_user") && ($_GET['id_session'] == strval(intval($_GET
$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('Administration')];
$tool_name = get_lang('Search for LDAP users');
//Display::display_header($tool_name); //cannot display now as we need to redirect
//api_display_tool_title($tool_name);
//Display::page_subheader2($tool_name);
if (isset($_GET['action'])) {
$check = Security::check_token('get');

@ -44,7 +44,7 @@ $action = $_REQUEST['action'];
$tool_name = get_lang('Synchro LDAP : Import Etudiants/Etapes dans session');
Display::display_header($tool_name);
//api_display_tool_title($tool_name);
//Display::page_subheader2($tool_name);
?>
<form method="get" action="<?php echo api_get_self(); ?>" onsubmit="javascript:if(!confirm('<?php echo get_lang('Please confirm your choice'); ?>')) return false;">

@ -495,7 +495,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
if (1 == $user[7] && !empty($user['exp'])) {
// check expiration date
$expiration_time = convert_sql_date($user['exp']);
$expiration_time = api_strtotime($user['exp']);
// if expiration date is passed, store a special value for active field
if ($expiration_time < $t) {
$user[7] = '-1';

@ -227,7 +227,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
if (1 == $user[7] && !empty($user[10])) {
// check expiration date
$expiration_time = convert_sql_date($user[10]);
$expiration_time = api_strtotime($user[10]);
// if expiration date is passed, store a special value for active field
if ($expiration_time < $t) {
$user[7] = '-1';

@ -1485,7 +1485,7 @@ while ($a_courses = Database::fetch_array($result2)) {
}
}
api_display_tool_title($nameTools);
Display::page_subheader2($nameTools);
$tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA);
$now = date('Y-m-d');
//on compte le nombre de m% dans l'agenda pour chaque module

@ -123,7 +123,7 @@ while ($a_courses = Database::fetch_array($result2)) {
}
}
api_display_tool_title($nameTools);
Display::page_subheader2($nameTools);
$now = date('Y-m-d');
$tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA);

@ -190,7 +190,7 @@ if ('learnpath' === $origin) {
// the last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string
Display::display_header('');
api_display_tool_title($nameTools);
Display::page_subheader2($nameTools);
} else {
$interbreadcrumb[] = [
'url' => 'index.php?'.api_get_cidreq().'&search='.$search,

@ -23,7 +23,7 @@ $interbreadcrumb[] = [
];
$this_section = SECTION_COURSES;
Display::display_header('');
echo Display::toolbarAction('toolbar', [api_display_tool_title(get_lang('Assessment history'))]);
Display::page_subheader2(get_lang('Assessment history'));
$t_user = Database::get_main_table(TABLE_MAIN_USER);
$t_link_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);

@ -159,7 +159,7 @@ switch ($action) {
$result = Blog::getBlogPostFromUser($courseId, $user_id, $courseCode);
if (!empty($result)) {
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog')));
Display::page_subheader2(api_xml_http_response_encode(get_lang('Blog')));
echo '<div style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode($result);
echo '</div>';
@ -171,7 +171,7 @@ switch ($action) {
$result = Blog::getBlogCommentsFromUser($courseId, $user_id, $course_code);
if (!empty($result)) {
echo '<div style="background:#FAF9F6; padding-left:10px;">';
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog comments')));
Display::page_subheader2(api_xml_http_response_encode(get_lang('Blog comments')));
echo api_xml_http_response_encode($result);
echo '</div>';
echo '<br />';
@ -182,7 +182,7 @@ switch ($action) {
}
} else {
echo '<div class="clear"></div><br />';
api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));
Display::page_subheader2(api_xml_http_response_encode(get_lang('Details')));
echo '<div style="background:#FAF9F6; padding:0px;">';
echo api_xml_http_response_encode(get_lang('User not registered in course'));
echo '<div class="clear"></div><br />';

@ -175,9 +175,6 @@ define('PLATFORM_AUTH_SOURCE', 'platform');
define('CAS_AUTH_SOURCE', 'cas');
define('LDAP_AUTH_SOURCE', 'extldap');
// CONSTANT defining the default HotPotatoes files directory
define('DIR_HOTPOTATOES', '/HotPotatoes_files');
// event logs types
define('LOG_COURSE_DELETE', 'course_deleted');
define('LOG_COURSE_CREATE', 'course_created');
@ -304,10 +301,6 @@ define('USERNAME_PURIFIER_SHALLOW', '/\s/');
// true whether the server runs on Windows OS, false otherwise.
define('IS_WINDOWS_OS', api_is_windows_os());
// iconv extension, for PHP5 on Windows it is installed by default.
define('ICONV_INSTALLED', function_exists('iconv'));
define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension.
// Patterns for processing paths. Examples.
define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path);
define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path);
@ -323,8 +316,6 @@ define('REL_HOME_PATH', 'REL_HOME_PATH');
define('WEB_PATH', 'WEB_PATH');
define('SYS_PATH', 'SYS_PATH');
define('SYMFONY_SYS_PATH', 'SYMFONY_SYS_PATH');
//define('SYS_UPLOAD_PATH', 'SYS_UPLOAD_PATH');
//define('WEB_UPLOAD_PATH', 'WEB_UPLOAD_PATH');
define('REL_PATH', 'REL_PATH');
define('WEB_COURSE_PATH', 'WEB_COURSE_PATH');
@ -434,11 +425,6 @@ define('HOOK_EVENT_TYPE_PRE', 0);
define('HOOK_EVENT_TYPE_POST', 1);
define('HOOK_EVENT_TYPE_ALL', 10);
define('CAREER_STATUS_ACTIVE', 1);
define('CAREER_STATUS_INACTIVE', 0);
define('PROMOTION_STATUS_ACTIVE', 1);
define('PROMOTION_STATUS_INACTIVE', 0);
// Group permissions
define('GROUP_PERMISSION_OPEN', '1');
define('GROUP_PERMISSION_CLOSED', '2');
@ -627,9 +613,6 @@ define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0);
define('SHORTCUTS_HORIZONTAL', 0);
define('SHORTCUTS_VERTICAL', 1);
// Image class
define('IMAGE_PROCESSOR', 'gd'); // 'imagick' or 'gd' strings
// Course copy
define('FILE_SKIP', 1);
define('FILE_RENAME', 2);
@ -683,11 +666,6 @@ if (!defined('CHAMILO_LOAD_WYSIWYG')) {
define('CHAMILO_LOAD_WYSIWYG', true);
}
/* Constants for course home */
define('TOOL_PUBLIC', 'Public');
define('TOOL_PUBLIC_BUT_HIDDEN', 'PublicButHide');
define('TOOL_COURSE_ADMIN', 'courseAdmin');
define('TOOL_PLATFORM_ADMIN', 'platformAdmin');
define('TOOL_AUTHORING', 'toolauthoring');
define('TOOL_INTERACTION', 'toolinteraction');
define('TOOL_COURSE_PLUGIN', 'toolcourseplugin'); //all plugins that can be enabled in courses
@ -754,42 +732,7 @@ function api_get_path($path = '', $configuration = [])
}
$root_sys = Container::getProjectDir();
$root_web = '';
// If no $root_web has been set so far *and* no custom config has been passed to the function
// then re-use the previously-calculated (run-specific) $root_web and skip this complex calculation
/*
if (empty($root_web) || $emptyConfigurationParam === false || empty($configuration)) {
// Resolve master hostname.
if (!empty($configuration) && array_key_exists('root_web', $configuration)) {
$root_web = $configuration['root_web'];
} else {
$root_web = '';
// Try guess it from server.
if (defined('SYSTEM_INSTALLATION') && SYSTEM_INSTALLATION) {
if (($pos = strpos(($requested_page_rel = api_get_self()), 'main/install')) !== false) {
$root_rel = substr($requested_page_rel, 0, $pos);
// See http://www.mediawiki.org/wiki/Manual:$wgServer
$server_protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$server_name =
isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME']
: (isset($_SERVER['HOSTNAME']) ? $_SERVER['HOSTNAME']
: (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST']
: (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR']
: 'localhost')));
if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':')
&& (($server_protocol == 'http'
&& $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))
) {
$server_name .= ":".$_SERVER['SERVER_PORT'];
}
$root_web = $server_protocol.'://'.$server_name.$root_rel;
$root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/';
}
// Here we give up, so we don't touch anything.
}
}
}*/
if (isset(Container::$container)) {
$root_web = Container::$container->get('router')->generate(
'index',
@ -828,7 +771,6 @@ function api_get_path($path = '', $configuration = [])
SYS_CSS_PATH => $root_sys.'public/build/css/',
SYS_PLUGIN_PATH => $root_sys.'public/plugin/',
SYS_ARCHIVE_PATH => $root_sys.'var/cache/',
// SYS_UPLOAD_PATH => 'var/upload/',
SYS_TEST_PATH => $root_sys.'tests/',
SYS_TEMPLATE_PATH => $root_sys.'public/main/template/',
SYS_PUBLIC_PATH => $root_sys.'public/',
@ -843,18 +785,11 @@ function api_get_path($path = '', $configuration = [])
WEB_LIBRARY_PATH => $root_web.'main/inc/lib/',
WEB_LIBRARY_JS_PATH => $root_web.'main/inc/lib/javascript/',
WEB_PLUGIN_PATH => $root_web.'plugin/',
// WEB_ARCHIVE_PATH => 'var/cache/',
//WEB_UPLOAD_PATH => 'var/upload/',
WEB_PUBLIC_PATH => $root_web,
];
$root_rel = '';
// Dealing with trailing slashes.
$rootWebWithSlash = api_add_trailing_slash($root_web);
$root_sys = api_add_trailing_slash($root_sys);
$root_rel = api_add_trailing_slash($root_rel);
global $virtualChamilo;
if (!empty($virtualChamilo)) {
$paths[SYS_ARCHIVE_PATH] = api_add_trailing_slash($virtualChamilo[SYS_ARCHIVE_PATH]);
@ -1245,16 +1180,6 @@ function api_block_anonymous_users($printHeaders = true)
api_block_inactive_user();
return true;
/*$user = api_get_user_info();
if (!(isset($user['user_id']) && $user['user_id']) || api_is_anonymous($user['user_id'], true)) {
api_not_allowed($printHeaders);
return false;
}
api_block_inactive_user();
return true;*/
}
/**
@ -1351,46 +1276,6 @@ function api_get_user_id()
return 0;
}
/**
* Gets the list of courses a specific user is subscribed to.
*
* @param int User ID
* @param bool $fetch_session Whether to get session courses or not - NOT YET IMPLEMENTED
*
* @return array Array of courses in the form [0]=>('code'=>xxx,'db'=>xxx,'dir'=>xxx,'status'=>d)
*
* @deprecated use CourseManager::get_courses_list_by_user_id()
*/
function api_get_user_courses($userId, $fetch_session = true)
{
// Get out if not integer
if ($userId != strval(intval($userId))) {
return [];
}
$t_course = Database::get_main_table(TABLE_MAIN_COURSE);
$t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT cc.id as real_id, cc.code code, cc.directory dir, cu.status status
FROM $t_course cc, $t_course_user cu
WHERE
cc.id = cu.c_id AND
cu.user_id = $userId AND
cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH;
$result = Database::query($sql);
if (false === $result) {
return [];
}
$courses = [];
while ($row = Database::fetch_array($result)) {
// we only need the database name of the course
$courses[] = $row;
}
return $courses;
}
/**
* Formats user information into a standard array
* This function should be only used inside api_get_user_info().
@ -1502,47 +1387,6 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
$result['avatar_no_query'] = '';
$result['avatar_small'] = '';
$result['avatar_medium'] = '';
/*if (!isset($user['avatar'])) {
$originalFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_ORIGINAL,
null,
$result
);
$result['avatar'] = $originalFile;
$avatarString = explode('?', $result['avatar']);
$result['avatar_no_query'] = reset($avatarString);
} else {
$result['avatar'] = $user['avatar'];
$avatarString = explode('?', $user['avatar']);
$result['avatar_no_query'] = reset($avatarString);
}
if (!isset($user['avatar_small'])) {
$smallFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_SMALL,
null,
$result
);
$result['avatar_small'] = $smallFile;
} else {
$result['avatar_small'] = $user['avatar_small'];
}
if (!isset($user['avatar_medium'])) {
$mediumFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_MEDIUM,
null,
$result
);
$result['avatar_medium'] = $mediumFile;
} else {
$result['avatar_medium'] = $user['avatar_medium'];
}*/
$urlImg = api_get_path(WEB_IMG_PATH);
$iconStatus = '';
$iconStatusMedium = '';
@ -1830,48 +1674,6 @@ function api_get_user_info_from_entity(
$result['avatar_no_query'] = '';
$result['avatar_small'] = '';
$result['avatar_medium'] = '';
/*if (!isset($user['avatar'])) {
$originalFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_ORIGINAL,
null,
$result
);
$result['avatar'] = $originalFile;
$avatarString = explode('?', $result['avatar']);
$result['avatar_no_query'] = reset($avatarString);
} else {
$result['avatar'] = $user['avatar'];
$avatarString = explode('?', $user['avatar']);
$result['avatar_no_query'] = reset($avatarString);
}
if (!isset($user['avatar_small'])) {
$smallFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_SMALL,
null,
$result
);
$result['avatar_small'] = $smallFile;
} else {
$result['avatar_small'] = $user['avatar_small'];
}
if (!isset($user['avatar_medium'])) {
$mediumFile = UserManager::getUserPicture(
$user_id,
USER_IMAGE_SIZE_MEDIUM,
null,
$result
);
$result['avatar_medium'] = $mediumFile;
} else {
$result['avatar_medium'] = $user['avatar_medium'];
}*/
//$urlImg = api_get_path(WEB_IMG_PATH);
$urlImg = '/';
$iconStatus = '';
$iconStatusMedium = '';
@ -1953,12 +1755,12 @@ function api_get_user_entity(int $userId = 0): ?User
function api_get_current_user(): ?User
{
$isLoggedIn = Container::$container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED');
$isLoggedIn = Container::getAuthorizationChecker()->isGranted('IS_AUTHENTICATED_REMEMBERED');
if (false === $isLoggedIn) {
return null;
}
$token = Container::$container->get('security.token_storage')->getToken();
$token = Container::getTokenStorage()->getToken();
if (null !== $token) {
return $token->getUser();
@ -2457,24 +2259,6 @@ function api_format_course_array(Course $course = null)
}
$courseData['course_image'] = $image.'?filter=course_picture_small';
// Course large image
/*$courseData['course_image_large_source'] = '';
if (file_exists($courseSys.'/course-pic.png')) {
$url_image = $webCourseHome.'/course-pic.png';
$courseData['course_image_large_source'] = $courseSys.'/course-pic.png';
} else {
$url_image = Display::return_icon(
'session_default.png',
null,
null,
null,
null,
true,
true
);
}*/
$courseData['course_image_large'] = $image.'?filter=course_picture_medium';
return $courseData;
@ -2912,26 +2696,6 @@ function api_get_setting($variable)
$variable = trim($variable);
switch ($variable) {
/*case 'header_extra_content':
$filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt';
if (file_exists($filename)) {
$value = file_get_contents($filename);
return $value;
} else {
return '';
}
break;
case 'footer_extra_content':
$filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt';
if (file_exists($filename)) {
$value = file_get_contents($filename);
return $value;
} else {
return '';
}
break;*/
case 'server_type':
$test = ['dev', 'test'];
$environment = Container::getEnvironment();
@ -3038,9 +2802,8 @@ function api_get_plugin_setting($plugin, $variable)
function api_get_settings_params($params)
{
$table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$result = Database::select('*', $table, ['where' => $params]);
return $result;
return Database::select('*', $table, ['where' => $params]);
}
/**
@ -3051,9 +2814,8 @@ function api_get_settings_params($params)
function api_get_settings_params_simple($params)
{
$table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$result = Database::select('*', $table, ['where' => $params], 'one');
return $result;
return Database::select('*', $table, ['where' => $params], 'one');
}
/**
@ -3062,9 +2824,8 @@ function api_get_settings_params_simple($params)
function api_delete_settings_params($params)
{
$table = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
$result = Database::delete($table, $params);
return $result;
return Database::delete($table, $params);
}
/**
@ -3077,8 +2838,6 @@ function api_get_self()
return htmlentities($_SERVER['PHP_SELF']);
}
/* USER PERMISSIONS */
/**
* Checks whether current user is a platform administrator.
*
@ -3139,9 +2898,8 @@ function api_is_platform_admin_by_id($user_id = null, $url = null)
$sql = "SELECT * FROM $url_user_table
WHERE access_url_id = $url AND user_id = $user_id";
$res = Database::query($sql);
$result = 1 === Database::num_rows($res);
return $result;
return 1 === Database::num_rows($res);
}
/**
@ -3215,7 +2973,6 @@ function api_is_course_admin()
}
return false;
//return Session::read('is_courseAdmin');
}
/**
@ -3424,52 +3181,9 @@ function api_is_session_in_category($session_id, $category_name)
if (Database::num_rows($rs) > 0) {
return true;
} else {
return false;
}
}
/**
* Displays the title of a tool.
* Normal use: parameter is a string:
* api_display_tool_title("My Tool").
*
* Optionally, there can be a subtitle below
* the normal title, and / or a supra title above the normal title.
*
* e.g. supra title:
* group
* GROUP PROPERTIES
*
* e.g. subtitle:
* AGENDA
* calender & events tool
*
* @author Hugues Peeters <hugues.peeters@claroline.net>
*
* @param mixed $title_element - it could either be a string or an array
* containing 'supraTitle', 'mainTitle',
* 'subTitle'
*/
function api_display_tool_title($title_element)
{
if (is_string($title_element)) {
$tit = $title_element;
unset($title_element);
$title_element = [];
$title_element['mainTitle'] = $tit;
}
echo '<h3>';
if (!empty($title_element['supraTitle'])) {
echo '<small>'.$title_element['supraTitle'].'</small><br />';
}
if (!empty($title_element['mainTitle'])) {
echo $title_element['mainTitle'];
}
if (!empty($title_element['subTitle'])) {
echo '<br /><small>'.$title_element['subTitle'].'</small>';
}
echo '</h3>';
return false;
}
/**
@ -3796,7 +3510,6 @@ function api_is_allowed_to_session_edit($tutor = false, $coach = false)
*/
function api_is_allowed($tool, $action, $task_id = 0)
{
$_user = api_get_user_info();
$_course = api_get_course_info();
if (api_is_course_admin()) {
@ -3844,15 +3557,11 @@ function api_is_allowed($tool, $action, $task_id = 0)
}
/**
* Tells whether this user is an anonymous user.
*
* @param int $user_id User ID (optional, will take session ID if not provided)
* @param bool $db_check Whether to check in the database (true) or simply in
* the session (false) to see if the current user is the anonymous user
* Current user is anon?
*
* @return bool true if this user is anonymous, false otherwise
*/
function api_is_anonymous($user_id = null, $db_check = false)
function api_is_anonymous()
{
return !Container::getAuthorizationChecker()->isGranted('IS_AUTHENTICATED_FULLY');
}
@ -3872,27 +3581,6 @@ function api_not_allowed(
throw new Exception('You are not allowed');
}
/**
* Gets a UNIX timestamp from a database (MySQL) datetime format string.
*
* @param $last_post_datetime standard output date in a sql query
*
* @return int timestamp
*
* @author Toon Van Hoecke <Toon.VanHoecke@UGent.be>
*
* @version October 2003
* @desc convert sql date to unix timestamp
*/
function convert_sql_date($last_post_datetime)
{
[$last_post_date, $last_post_time] = explode(' ', $last_post_datetime);
[$year, $month, $day] = explode('-', $last_post_date);
[$hour, $min, $sec] = explode(':', $last_post_time);
return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year);
}
/**
* Displays a combo box so the user can select his/her preferred language.
*
@ -4109,24 +3797,6 @@ function api_get_languages()
return $languages;
}
/**
* Returns a list of all the languages that are made available by the admin.
*
* @return array
*/
function api_get_languages_to_array()
{
$tbl_language = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$sql = "SELECT * FROM $tbl_language WHERE available='1' ORDER BY original_name ASC";
$result = Database::query($sql);
$languages = [];
while ($row = Database::fetch_array($result)) {
$languages[$row['english_name']] = $row['original_name'];
}
return $languages;
}
/**
* Returns the id (the database id) of a language.
*
@ -4412,8 +4082,6 @@ function api_time_to_hms($seconds, $space = ':', $showSeconds = true, $roundMinu
return $hours.$space.$min.$seconds;
}
/* FILE SYSTEM RELATED FUNCTIONS */
/**
* Returns the permissions to be assigned to every newly created directory by the web-server.
* The return value is based on the platform administrator's setting
@ -5918,8 +5586,6 @@ function api_is_global_platform_admin($user_id = null)
// The admin is registered in the first "main" site with access_url_id = 1
if (in_array(1, $urlList)) {
return true;
} else {
return false;
}
}
@ -5962,10 +5628,10 @@ function api_global_admin_can_edit_admin(
} else {
return true;
}
} else {
return false;
}
}
return false;
}
/**

@ -1960,36 +1960,6 @@ function _api_mb_internal_encoding($encoding = 'UTF-8')
return mb_internal_encoding($encoding);
}
/**
* Checks whether the specified encoding is supported by the PHP iconv extension.
*
* @param string $encoding the specified encoding
*
* @return bool returns TRUE when the specified encoding is supported, FALSE othewise
*/
function _api_iconv_supports($encoding)
{
static $supported = [];
if (!isset($supported[$encoding])) {
if (ICONV_INSTALLED) {
$enc = api_refine_encoding_id($encoding);
if ('HTML-ENTITIES' != $enc) {
$test_string = '';
for ($i = 32; $i < 128; $i++) {
$test_string .= chr($i);
}
$supported[$encoding] = (@iconv_strlen($test_string, $enc)) ? true : false;
} else {
$supported[$encoding] = false;
}
} else {
$supported[$encoding] = false;
}
}
return $supported[$encoding];
}
/**
* Given a date object, return a human or ISO format, with or without h:m:s.
*

@ -17,7 +17,7 @@ api_block_anonymous_users();
$interbreadcrumb[] = ["url" => "index.php", "name" => get_lang('Reporting')];
Display::display_header($nameTools);
$data = [];
api_display_tool_title($nameTools);
Display::page_subheader2($nameTools);
// Database Table Definitions
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);

@ -20,7 +20,7 @@ if (isset($_GET["id_student"])) {
Display::display_header($nameTools);
api_display_tool_title($nameTools);
Display::page_subheader2($nameTools);
$data = [];
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);

@ -142,7 +142,7 @@ if (!api_is_platform_admin() && api_is_teacher()) {
Display::display_header($tool_name);
$tool_name = get_lang('Edit session course');
api_display_tool_title($tool_name);
Display::page_subheader2($tool_name);
$form = new FormValidator(
'form',

@ -2486,7 +2486,6 @@ class SurveyUtil
SessionEntity $session = null,
CGroup $group = null
): ?CSurveyInvitation {
$invitation = new CSurveyInvitation();
$invitation
->setUser($user)

@ -20,7 +20,7 @@ $plugin_info['author'] = 'Julio Montoya';
// The plugin configuration.
$form = new FormValidator('form');
$form->addSelect('language', get_lang('Language'), api_get_languages_to_array());
$form->addSelectLanguage('language', get_lang('Language'));
$form->addElement('header', 'Option 1');
$form->addElement('textarea', 'option1', get_lang('Description'), ['rows' => 10, 'class' => 'span6']);

Loading…
Cancel
Save