Minor - flint fixes

pull/2624/head
Julio Montoya 7 years ago
parent 618c56cd90
commit f2c97adaef
  1. 1
      main/admin/index.php
  2. 10
      main/admin/user_list_consent.php
  3. 9
      main/inc/lib/api.lib.php
  4. 32
      main/inc/lib/message.lib.php
  5. 96
      main/inc/lib/usermanager.lib.php
  6. 12
      main/social/personal_data.php
  7. 2
      src/Chamilo/UserBundle/Repository/UserRepository.php

@ -557,7 +557,6 @@ if (api_is_platform_admin()) {
$blocks['data_privacy']['extra'] = null;
$blocks['data_privacy']['search_form'] = null;
/* Chamilo.org */
$blocks['chamilo']['icon'] = Display::return_icon(
'platform.png',

@ -19,9 +19,6 @@ api_protect_admin_script();
$this_section = SECTION_PLATFORM_ADMIN;
/**
* Prepares the shared SQL query for the user table.
* See get_user_data() and get_number_of_users().
@ -143,10 +140,6 @@ function prepare_user_sql_query($getCount)
$keyword_extra_value
";
if (isset($keywordListValues['keyword_active']) &&
!isset($keywordListValues['keyword_inactive'])
) {
@ -383,7 +376,7 @@ function modify_filter($user_id, $url_params, $row)
'</a>';
if ($user_id != api_get_user_id()) {
$result .= ' <a href="'.api_get_self().'?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$token.'" onclick="javascript:if(!confirm('."'".addslashes(
$result .= ' <a href="'.api_get_self().'?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$token.'" onclick="javascript:if(!confirm('."'".addslashes(
api_htmlentities(get_lang("ConfirmYourChoice"))
)."'".')) return false;">'.
Display::return_icon(
@ -406,7 +399,6 @@ function modify_filter($user_id, $url_params, $row)
).
'</a>&nbsp;';
if ($is_admin) {
$result .= Display::return_icon(
'admin_star.png',

@ -275,7 +275,6 @@ define('LOG_TERM_CONDITION_ACCEPTED', 'term_condition_accepted');
define('LOG_USER_CONFIRMED_EMAIL', 'user_confirmed_email');
define('LOG_USER_REMOVED_LEGAL_ACCEPT', 'user_removed_legal_accept');
define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.]/');
//used when login_is_email setting is true
@ -3877,10 +3876,10 @@ function convert_sql_date($last_post_datetime)
* the only one that is actually from the session, in case there are results from
* session 0 *AND* session n).
*
* @param array $_course Course properties array (result of api_get_course_info())
* @param string $tool Tool (learnpath, document, etc)
* @param int $id The item ID in the given tool
* @param int $session The session ID (optional)
* @param array $_course Course properties array (result of api_get_course_info())
* @param string $tool Tool (learnpath, document, etc)
* @param int $id The item ID in the given tool
* @param int $session The session ID (optional)
* @param int $user_id
* @param string $type
* @param string $group_id

@ -2598,6 +2598,22 @@ class MessageManager
}
}
/**
* @param int $senderId
* @param string $subject
* @param string $message
*/
public static function sendMessageToAllAdminUsers(
$senderId,
$subject,
$message
) {
$admins = UserManager::get_all_administrators();
foreach ($admins as $admin) {
self::send_message_simple($admin['user_id'], $subject, $message, $senderId);
}
}
/**
* Execute the SQL necessary to know the number of messages in the database.
*
@ -2621,20 +2637,4 @@ class MessageManager
return $row['count'];
}
/**
* @param int $senderId
* @param string $subject
* @param string $message
*/
public static function sendMessageToAllAdminUsers(
$senderId,
$subject,
$message
) {
$admins = UserManager::get_all_administrators();
foreach ($admins as $admin) {
self::send_message_simple($admin['user_id'], $subject, $message, $senderId);
}
}
}

@ -6160,8 +6160,9 @@ SQL;
/**
* @param int $userId
*
* @return string
* @throws Exception
*
* @return string
*/
public static function anonymizeUserWithVerification($userId)
{
@ -6201,6 +6202,53 @@ SQL;
return $message;
}
/**
* @param int $userId
*
* @throws Exception
*
* @return string
*/
public static function deleteUserWithVerification($userId)
{
$allowDelete = api_get_configuration_value('allow_delete_user_for_session_admin');
$deleteUserAvailable = api_get_configuration_value('deny_delete_users');
$message = '';
if (api_is_platform_admin() ||
($allowDelete && api_is_session_admin())
) {
$userToUpdateInfo = api_get_user_info($userId);
$currentUserId = api_get_user_id();
if ($userToUpdateInfo && $deleteUserAvailable &&
api_global_admin_can_edit_admin($userId, null, $allowDelete)
) {
if ($userId != $currentUserId &&
UserManager::delete_user($userId)
) {
$message = Display::return_message(
get_lang('UserDeleted').': '.$userToUpdateInfo['complete_name_with_username'],
'confirmation'
);
} else {
$message = Display::return_message(
get_lang('CannotDeleteUserBecauseOwnsCourse'),
'error'
);
}
} else {
$message = Display::return_message(
get_lang('CannotDeleteUser'),
'error'
);
}
}
return $message;
}
/**
* @return EncoderFactory
*/
@ -6298,50 +6346,4 @@ SQL;
return $url;
}
/**
* @param int $userId
*
* @return string
* @throws Exception
*/
public static function deleteUserWithVerification($userId)
{
$allowDelete = api_get_configuration_value('allow_delete_user_for_session_admin');
$deleteUserAvailable = api_get_configuration_value('deny_delete_users');
$message = '';
if (api_is_platform_admin() ||
($allowDelete && api_is_session_admin())
) {
$userToUpdateInfo = api_get_user_info($userId);
$currentUserId = api_get_user_id();
if ($userToUpdateInfo && $deleteUserAvailable &&
api_global_admin_can_edit_admin($userId, null, $allowDelete)
) {
if ($userId != $currentUserId &&
UserManager::delete_user($userId)
) {
$message = Display::return_message(
get_lang('UserDeleted').': '.$userToUpdateInfo['complete_name_with_username'],
'confirmation'
);
} else {
$message = Display::return_message(
get_lang('CannotDeleteUserBecauseOwnsCourse'),
'error'
);
}
} else {
$message = Display::return_message(
get_lang('CannotDeleteUser'),
'error'
);
}
}
return $message;
}
}

@ -154,7 +154,6 @@ switch ($action) {
break;
}
$propertiesToJson = UserManager::getRepository()->getPersonalDataToJson($userId, $substitutionTerms);
if (!empty($_GET['export'])) {
@ -268,11 +267,11 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$permitionBlock .= get_lang('Date').': '.api_get_local_time($legalTime).'<br />';
$permitionBlock .= $formToString;
/*$permitionBlock .= Display::url(
get_lang('DeleteLegal'),
api_get_self().'?action=delete_legal&user_id='.$userId,
['class' => 'btn btn-danger btn-xs']
);*/
/*$permitionBlock .= Display::url(
get_lang('DeleteLegal'),
api_get_self().'?action=delete_legal&user_id='.$userId,
['class' => 'btn btn-danger btn-xs']
);*/
} else {
// @TODO add action handling for button
$permitionBlock .= Display::url(
@ -285,7 +284,6 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$permitionBlock .= get_lang('NoTermsAndConditionsAvailable');
}
//Build the final array to pass to template
$personalData = [];
$personalData['data'] = $personalDataContent;

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\TrackELogin;
use Chamilo\CoreBundle\Entity\Usergroup;
use Chamilo\CoreBundle\Entity\UsergroupRelUser;
use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\EntityRepository;
@ -539,7 +538,6 @@ class UserRepository extends EntityRepository
$items = $extraFieldValues->getAllValuesByItem($userId);
$user->setExtraFields($items);
$lastLogin = $user->getLastLogin();
if (empty($lastLogin)) {
$login = $this->getLastLogin($user);

Loading…
Cancel
Save